Hey folks
I have recently launched a new interactive website at http://www.stargate-alpha.com and am having problems with my login system, it appears to work for 90 percent of our members, yet for the others it just will not work.
Here is the snippet of code that controls the cookies in the header:
// cookie variables
$cookiename = "uid";
$cookieexpire = time();
$cookiepath = "/";
$cookiedomain = "";
$cookiesecure = "0";
$uid = $HTTP_COOKIE_VARS["uid"];
// check if a cookie is set, if the value returns empty then set the uid value to "Null"
if (empty($uid) || ($uid == "")) {
Header("Location: index.php");
$cookievar = "Null";
$uid = "Null";
setcookie($cookiename, $cookievar, $cookieexpire + 31536000, $cookiepath, $cookiedomain, $cookiesecure);
}
// check the login variable to see if the index page has called the login procedure
if ($login == "yes") {
Header("Location: index.php");
mysql_connect("$dbhostname", "$dbusername", "$dbpassword");
mysql_select_db("$databasename") or die ("Unable to connect to SQL Server");
$sql_query = "SELECT * FROM users WHERE email = '$email' and password = md5('$password')";
$result = mysql_query($sql_query);
$numrows = mysql_numrows($result);
if ($numrows != "0") {
$user_data = mysql_fetch_array($result);
$uid = $user_data["uid"];
$cookievar = $uid;
setcookie($cookiename, $cookievar, $cookieexpire + 31536000, $cookiepath, $cookiedomain, $cookiesecure);
$login = "";
}
}
// check the logout variable to see if the user has logged out
if ($logout == "yes") {
Header("Location: index.php");
$cookievar = "Null";
$uid = "Null";
setcookie($cookiename, $cookievar, $cookieexpire + 31536000, $cookiepath, $cookiedomain, $cookiesecure);
$logout = "";
}
I'm at the end of my teather on this one, btw I've tried setting $cookiedomain variable as: www.stargate-alpha.com, stargate-alpha.com, .stargate-alpha.com, stargate-alpha.com/command (the site resides in a sub folder entitled command)
I ANYONE can help me fix this I will give them full credit on the site, PLEASE HELP.
On the verge of a mental illness LOL
nick jones