When the user types in the wrong username or password, the page notifies them and then the second time the enter in information in the html form, the php variables do not read the POST variables unless I wait 20 seconds before trying again. I've tried a few things and nothing changes the fact that the second time the php script runs, the $user and $password variables are blank, unless I wait 20 seconds. Here is the php script that runs after the html form is filled out.
Code: Select all
<?php
$user = $_POST['username'];
$pass = $_POST['password'];
include("dbinfo.inc.php");
mysql_connect('$myhostname',$myusername,$mypassword);
mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM userinfo WHERE username='$user'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
if ($num == 0){
echo "$user, $pass"; //Troubleshooting, first time correct output, after the result is " , "
include("signininc.html"); //goes to form with error message
}
else{
$passwordcheck=mysql_result($result,0,"password");
if ($pass != $passwordcheck){
include("signininc.html"); //goes to form with error message
}
else{
$folder=mysql_result($result,0,"folderid");
include("$folder/$folder.html");
}
}
?>Chris