havox Posted November 21, 2010 Share Posted November 21, 2010 Well this isn't all about cookies or maybe it is, I'm not to sure. On top of this my script has suddenly broke and stops at check.php I'm also not sure how I should go about checking the cookie to identify the user and how to keep other from viewing the output page(s). <html> <head> <title>Deadnode.com</title> <style type="text/css"> img { position:absolute; left:300px; top:130px; z-index:-1; } form { position:absolute; left:365px; top:248px; z-index:0; } </style> </head> <body> <img src="iL0bw.png" /> <form method="post" action="check.php"> <center><table> <tr><td><font face="verdana,arial" size=-1>Username:</td><td><input type="text" size="25" name="user"></td> <tr><td><font face="verdana,arial" size=-1>Password:</td><td><input type="password" size="25" name="pwd"></td> <tr><td><font face="verdana,arial" size=-1> </td><td><font face="verdana,arial" size=-1><input type="submit" value="Login"></td></tr> </table></center> </form> </body> </html> <?php function check() { $admin="test"; $pass="test"; if (isset($_POST["user"]) && $_POST["user"] == $admin && isset($_POST["pwd"]) && $_POST["pwd"] == $pass) { header('Location: output.php'); setcookie("usr", "test", time()+3600); else { header('Location: index.html'); } } ?> <?php require('function.php'); check(); ?> <?php require('check.php'); ?> <html> <body> <p>Congrats!</p> </body> </html> Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted November 21, 2010 Share Posted November 21, 2010 you'd probably be better off using sessions and let PHP deal with cookies, etc. http://www.google.com/search?client=safari&rls=en&q=php+sessions&ie=UTF-8&oe=UTF-8 Quote Link to comment Share on other sites More sharing options...
revraz Posted November 21, 2010 Share Posted November 21, 2010 Are you familiar with what happens when you use Header? Quote Link to comment Share on other sites More sharing options...
havox Posted November 21, 2010 Author Share Posted November 21, 2010 No I am not. I googled on how to redirect to pages and thats what came up. 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.