dannyd Posted February 27, 2008 Share Posted February 27, 2008 <?PHP if (isset($_POST['submit']) && isset($_POST['username']) && $_POST['username']=="admin" && isset($_POST['password']) && $_POST['password']=="admin") { echo 'success'; } ?> <html><body> <table width="980" height="500"><tr valign="middle"><td align="center"> <form method="post" action="http://zenit.senecac.on.ca/~php701_081sa20/assn1/login.php"><b>User Name:</b> <input type="text" name="username" size="20"> <b>Password:</b> <input type="text" name="password" size="20"></form> <input type="submit" value="submit" name="submit"></td></tr></table> </body></html> This doesnt seem to work. Its just a script that if the user enters their login and pass as admin it says success. Just trying to practice some PHP .. any help ? Link to comment https://forums.phpfreaks.com/topic/93388-login-sample-script/ Share on other sites More sharing options...
amites Posted February 27, 2008 Share Posted February 27, 2008 try putting a var_dump($_POST) in there, it will tell you what is there so you can check against what you think should be there Link to comment https://forums.phpfreaks.com/topic/93388-login-sample-script/#findComment-478542 Share on other sites More sharing options...
redarrow Posted February 27, 2008 Share Posted February 27, 2008 !! or not && Link to comment https://forums.phpfreaks.com/topic/93388-login-sample-script/#findComment-478615 Share on other sites More sharing options...
cyrixware Posted February 28, 2008 Share Posted February 28, 2008 <?php $submit = $_REQUEST['Submit']; if($submit == "Login") { if ((!$_POST[username]) || (!$_POST[password])) { echo "Please fill-up all the required fields!"; } elseif (($_REQUEST['username'] == "admin") && ($_REQUEST['password'] == "password")) { echo"Success! You may proceed!"; } else { echo"Invalid username / password!"; } } ?> Link to comment https://forums.phpfreaks.com/topic/93388-login-sample-script/#findComment-478644 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.