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 ? Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
redarrow Posted February 27, 2008 Share Posted February 27, 2008 !! or not && Quote Link to comment 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!"; } } ?> Quote Link to comment 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.