I have just made a log on script. It has several errors. I am not great with php. Heres my script: I know of this error: There might be other errors too. Thanks in advance.
You missed the } on the syntax, also you need the session_start(); before the script, since your using sessions <html> <head> <title> Logging In </title><script type="text/javascript"> <!-- function delayer(){ window.location = "../javascriptredirect.php" } //--> </script> </head> <body onLoad="setTimeout('delayer()', 5000)" bgcolor="blue"><center><font size="36"><b><br> Logging in, please wait. If your browser does not auto matically redirect you, <a href="main.php">click here</a>. </font></center> </body> </html> <?php session_start(); ///////////You also need to start the session using session_start(); //get input data $user=$_POST["username"]; $pass=$_POST["password"]; //encrypt username and pass $cuser=md5($user); $cpass=md5($pass); //make variables $ip = $_SERVER['REMOTE_ADDR']; $userplusip = $user . $ip; //include login file include($user . ".php"); //make sure info matches and starts session if ($cuser==$realuser && $cpass==$realpass) { $_SESSION["auth_username"] = $user; $_SESSION["userplusip"] = $userplusip; } ////////////// Missed out this! ?> PHP:
<?php session_start(); ///////////You also need to start the session using session_start(); ?> <html> <head> <title> Logging In </title><script type="text/javascript"> <!-- function delayer(){ window.location = "../javascriptredirect.php" } //--> </script> </head> <body onLoad="setTimeout('delayer()', 5000)" bgcolor="blue"><center><font size="36"><b><br> Logging in, please wait. If your browser does not auto matically redirect you, <a href="main.php">click here</a>. </font></center> </body> </html> <?php //get input data $user=$_POST["username"]; $pass=$_POST["password"]; //encrypt username and pass $cuser=md5($user); $cpass=md5($pass); //make variables $ip = $_SERVER['REMOTE_ADDR']; $userplusip = $user . $ip; //include login file include($user . ".php"); //make sure info matches and starts session if ($cuser==$realuser && $cpass==$realpass) { $_SESSION["auth_username"] = $user; $_SESSION["userplusip"] = $userplusip; } ////////////// Missed out this! ?> PHP: and check your form. It looks like your $_POST['username'] is empty.