kgp43
09-25-2004, 10:43 AM
Hey,
My forums are located in a directory and not a subdomain: http://www.domain/forums
I need to use the username and password from the cookie, in other areas of my website, so I changed the name of the cookie to: .domain.com
Searched the forums and found some code (used for extracting data from the cookie). I modified it a little, so it fit my needs:
//Select the forum database
mysql_select_db ("perfume_forums");
$userid = intval($_COOKIE[bbuserid]);
$password = addslashes($_COOKIE[bbpassword]);
$result = mysql_query("SELECT username, userid FROM user WHERE userid=$userid AND MD5(CONCAT(password, 'LicenseNo')) = '$password'");
$user = mysql_fetch_array($result);
if ($user[userid]) {
//echo "<input name='user_name' type='hidden' value='$user[userid]'>";
echo "User: ".$user[username];
} else {
echo "<input name='user_name' type='text' class='rating-form' maxlength='20'>";
}
- why doent this work?
My forums are located in a directory and not a subdomain: http://www.domain/forums
I need to use the username and password from the cookie, in other areas of my website, so I changed the name of the cookie to: .domain.com
Searched the forums and found some code (used for extracting data from the cookie). I modified it a little, so it fit my needs:
//Select the forum database
mysql_select_db ("perfume_forums");
$userid = intval($_COOKIE[bbuserid]);
$password = addslashes($_COOKIE[bbpassword]);
$result = mysql_query("SELECT username, userid FROM user WHERE userid=$userid AND MD5(CONCAT(password, 'LicenseNo')) = '$password'");
$user = mysql_fetch_array($result);
if ($user[userid]) {
//echo "<input name='user_name' type='hidden' value='$user[userid]'>";
echo "User: ".$user[username];
} else {
echo "<input name='user_name' type='text' class='rating-form' maxlength='20'>";
}
- why doent this work?