CSSbeginner123
05-29-2003, 12:09 PM
help! does anyone have a really good code for password protected pages? one that can protect pages really well...? and no downloading?
|
View Full Version : password protection!!! HELPPPPPP!!!!!!! CSSbeginner123 05-29-2003, 12:09 PM help! does anyone have a really good code for password protected pages? one that can protect pages really well...? and no downloading? MelodyUkOk 05-29-2003, 12:48 PM I think there's one at http://www.bravenet.com designhazard 05-31-2003, 03:23 PM does your host supports php? toosweet4u 05-31-2003, 04:38 PM Here are 3 different methods. I did them just now so its not perfect. :) JavaScript <script language="javascript"> function checkpass() { var the_pass = "hokeypokey" var pass = document.login.pass.value if (pass = the_pass) { window.alert = "Thanks for logging in!" window.location = "secret.html" } else { window.alert = "Your password is incorrect." } } </script> <form name="login"> <input type="text" name="pass" value="" /> <input type="button" value="submit" onclick="checkpass()" /> </form> PHP <?php function checkpass($pass) { $the_pass = 'hokeypokey'; if ($pass == $the_pass) { echo 'Thanks for logging in.'; header('Location: secret.php'); } else { echo 'Your password is incorrect.'; } } $pass = $_REQUEST['pass']; if (isset($pass)) { checkpass($pass); } ?> <form action="login.php"> <input type="text" name="pass" value="" /> <input type="submit" name="submit" value="submit" /> </form> Perl #!usr/bin/perl print "Content-type: text/html\n\n"; $the_pass = 'hokeypokey'; if ($pass == $the_pass) { echo 'Thanks for logging in.'; echo '<script language="javascript">window.location = "secret.php"</script>'; } else { echo 'Your password is incorrect.'; } <form action="login.pl"> <input type="text" name="pass" value="" /> <input type="submit" name="submit" value="submit" /> </form> erictheman 05-31-2003, 05:42 PM the php and perl are safe. the javascript is too easy to crack. designhazard 06-01-2003, 01:11 AM you can also try this: http://www.codephobia.com/tutorials/view.php3?idnum=5 |