The weird thing is, it works for my friend and it works when I use the form on my forum's pages (its on the same hosting etc.)
$check = mysql_query("SELECT * FROM user_info WHERE user='$user'");
while ($row = mysql_fetch_array($check))
{
$username = $row['user'];
}
$checkpass = mysql_query("SELECT * FROM user_info WHERE pass='$encpass'");
while ($row = mysql_fetch_array($checkpass))
{
$password = $row['pass'];
}
if (isset ($usercook) && isset($enccook))
{
include ('sidebar.php');
}
else
{
if (!isset ($user))
{
writeForm();
}
else
{
if ($user == $username)
{
if ($encpass == $password)
{
if (empty($user) || empty($pass))
{
writeForm();
die('');
}
include ('sidebar.php');
print "";
setcookie("pass", "$pass"); //gives user cookie with submitted password
setcookie("user", $user, time()+3600); /* expire in 1 hour */
}
else
{
print ("");
writeForm();
}
}
else
{
print ("");
writeForm();
}
}
}\
print ("");
print ("");
print ("[url="http:///index.php"]Home[/url]
");
print ("");
print ("[url="http:///about.php"]About[/url]
");
print ("");
print ("[url="http:///portfolio.php"]Portfolio[/url]
");
print ("");
print ("[url="http://forum.php"]Forum[/url]
");
print ("");
print ("[url="http:///contact.php"]Contact[/url]
");
print ("");
print ("[url="http:///affiliates.php"]Affiliates[/url]
");
print ("");
include ('con_log.php');
$usercook = $_COOKIE["user"];
$passcook = $_COOKIE["user"];
$enccook = md5($passcook);
$user = $_POST["user"];
$pass = $_POST["pass"]; //cookie is gathered
$encpass = md5($pass);
function writeForm ()
{
print ("");
print ("Username:
Password:
[url="http://register.php"]Register[/url]
Please enter your username and password.
");
print ("ERROR: Incorrect password.
");
print ("");
print ("");
print ("ERROR: Incorrect username.
");
print ("");
print ("");
?>
The 'user' cookie never gets set. I have done a number of tests, and the $user variable does get set, but the cookie doesn't
Any ideas as to what the problem could be?
If you need/want any more information, i'll do my best to provide it.
Edited by outofexile, 21 March 2008 - 06:37 AM.
