maddog39 0 Report post Posted February 14, 2005 (edited) Hello all, I found this script actually on another website. But I modded it and added some things. Heres the code and stuff. Open a new file in your text editor and paste in this code. <?php{echo '<form name='pp' method='post' action='check.php'>Username:<input type='text' name='user' value=''><br>Password:<input type='password' name='pass' value=''><br><input type='submit' value='Login'></form>';}?>Name this file login.php Now open another new file in your text editor and paste in this code. <?php// Change 'YourUsername' to whatever you want.if ($_POST['user'] == "YourUsername") {// Change 'YourURL' to the directory to forward to.echo "<meta http-equiv='refresh' content='0;URL=YourURL'>";}else {header("Location: error.php");}// Change 'YourPassword' to whatever you want.if ($_POST['pass'] == "YourPassword") {// Change 'YourURL' to the directory to forward to.echo "<meta http-equiv='refresh' content='0;URL=YourURL'>";}else {header("Location: error.php");}?>Name this file check.php For the last file, open up another new file in your text editor and paste in this code. <?phpecho "I am sorry, you have entered the username or password inccorectly. You are now being redirected.";echo "<meta http-equiv='refresh' content='2;URL=login.php'>";?>Name this file error.php. Then upload these to your server and try them out. Its an easy way to password protect directories on a webserver. Demo: CLICK HERE Deno User: test Demo Pass: test Edited February 19, 2005 by maddog39 (see edit history) Share this post Link to post Share on other sites
ill 0 Report post Posted February 14, 2005 Interesting. I like it, I might put this to use for my "Slave" team. Share this post Link to post Share on other sites
bigboss 0 Report post Posted February 14, 2005 thats interesting thanks for the tip Share this post Link to post Share on other sites
maddog39 0 Report post Posted February 14, 2005 Your all welcome. Share this post Link to post Share on other sites
Taupe 0 Report post Posted February 15, 2005 Don't forget to add <fieldset>s and <label>s in your forms... Share this post Link to post Share on other sites
maddog39 0 Report post Posted February 15, 2005 What the heck do those do. The script works fine ive tried it and I use it. Share this post Link to post Share on other sites
Taupe 0 Report post Posted February 16, 2005 Read this article, this one, this explaination., this checklist, this tutorial, this one and thiat one if you still don't know those basic tags... (And no : the script doesn't work fine : try to validate your page and you'll see...) Share this post Link to post Share on other sites
maddog39 0 Report post Posted February 19, 2005 Looky here. I setup a demo for you guys, the user is test and the pass is test. Try it it works. Plus I dont know what you mean by vailidate it. Anyway I am going to clean up the code a little bit. Share this post Link to post Share on other sites
EricDrinkard 0 Report post Posted February 19, 2005 Hey this might be what I am loking for......Thank fo a while I have ben lookig for a logi system tha wa simple but not stupid.ThanksEric Drinkad Share this post Link to post Share on other sites
maddog39 0 Report post Posted February 19, 2005 Your welcome, I think I have fixed all of the bugs in it. Just tell if there are anymore. I have been testing and changing it like all night. Share this post Link to post Share on other sites
Taupe 0 Report post Posted February 21, 2005 Looky here. I setup a demo for you guys, the user is test and the pass is test. Try it it works.No : it doesn't Share this post Link to post Share on other sites
Xedos 0 Report post Posted February 21, 2005 I don't get you people and your exact code. Surely you've forgot a doctype once. Besides, it does work. Just because that stoopid W3 says it doesn't, doesn't mean the php won't work.God I hate W3 Share this post Link to post Share on other sites
rejected 0 Report post Posted February 21, 2005 Could you set this up to where you can register, too? Like have it edit login.php so it adds the name into there? Share this post Link to post Share on other sites
maddog39 0 Report post Posted February 21, 2005 No if you want registered members than a MySQL database IS required. There is not possible way to do without it as far as I know. Share this post Link to post Share on other sites