Foser Posted May 19, 2007 Share Posted May 19, 2007 For some reason my own password script does not work. Process.php <?php $pw = $_POST['pw']; if ($pw == "1234"){ echo "You are Successfully Logged in!"; } else { echo "You are not an authorized user."; } ?> index.html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Basic Single Password</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <form name="pw" method="post" action="process.php"> <input name="textfield" type="password" size="6" maxlength="4"> <input type="submit" name="Submit" value="Submit"> </form> </body> </html> thanks Quote Link to comment https://forums.phpfreaks.com/topic/52090-solved-simple-php-password-issue/ Share on other sites More sharing options...
jitesh Posted May 19, 2007 Share Posted May 19, 2007 $pw = $_POST['textfield']; <input name="textfield" type="password" size="6" maxlength="4"> Quote Link to comment https://forums.phpfreaks.com/topic/52090-solved-simple-php-password-issue/#findComment-256821 Share on other sites More sharing options...
MadTechie Posted May 19, 2007 Share Posted May 19, 2007 change <input name="textfield" type="password" size="6" maxlength="4"> to <input name="pw" type="password" size="6" maxlength="4"> or $pw = $_POST['textfield']; <input name="textfield" type="password" size="6" maxlength="4"> then please click solved! Quote Link to comment https://forums.phpfreaks.com/topic/52090-solved-simple-php-password-issue/#findComment-256873 Share on other sites More sharing options...
Foser Posted May 19, 2007 Author Share Posted May 19, 2007 How would I make this script safer? So we wouldn't see the file process.php and most of how it works in the source from the browser? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/52090-solved-simple-php-password-issue/#findComment-256906 Share on other sites More sharing options...
taith Posted May 19, 2007 Share Posted May 19, 2007 instead of if ($pw == "1234"){ echo "You are Successfully Logged in!"; } else { echo "You are not an authorized user."; } change them echo's to a $_SESSION variable, and redirect right away... that way nobody ever see's that page :-) Quote Link to comment https://forums.phpfreaks.com/topic/52090-solved-simple-php-password-issue/#findComment-256908 Share on other sites More sharing options...
MadTechie Posted May 19, 2007 Share Posted May 19, 2007 The source isn't displayed.. the server process the script and displays the results.. so in your script the source will NOT show the password Quote Link to comment https://forums.phpfreaks.com/topic/52090-solved-simple-php-password-issue/#findComment-256910 Share on other sites More sharing options...
Foser Posted May 19, 2007 Author Share Posted May 19, 2007 Thanks Quote Link to comment https://forums.phpfreaks.com/topic/52090-solved-simple-php-password-issue/#findComment-256985 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.