for years i have been useing a phpbb2 cookies to log into part of my website but since phpbb3 has come out it has stoped working and i didnt know if anyone could help me sort it out
PHP Code:
<?php
include ('inc/config.php');
include ('inc/openforumdb.php');
$AUTH = 0;
if (isset($_COOKIE['phpbb3_data'])) {
$session_id = isset($_COOKIE['phpbb3_sid']) ? $_COOKIE['phpbb3_sid'] : '';
$sessiondata = isset($_COOKIE['phpbb3_data']) ? unserialize(stripslashes($_COOKIE['phpbb3_data'])) : array();
$session_key = $sessiondata['autologinid'];
echo stripslashes($_COOKIE['phpbb3_data']) . "<br>";
echo "Session ID: " . $session_id . "<br>";
//echo "Session Key: " . $session_key . "<br>";
echo "Session Key Hashed: " . md5($session_key) . "<br>";
echo "User ID: " . $sessiondata['userid'] . "<br>";
$UID = $sessiondata['userid'];
}
if($UID == -1)
{
$AUTH = 0;
echo "User Anonymous / Not logged in<br>";
}
else
{
if($sessiondata['autologinid'] == null)
{
echo "USING SESSION<br>";
$query = "SELECT * FROM b50__sessions WHERE session_id = '" . $session_id . "' AND session_user_id = '" . $UID . "'";
}
else
{
echo "USING KEY<br>";
$query = "SELECT * FROM b50__sessions_keys WHERE key_id = '" . md5($session_key) . "' AND user_id = '" . $UID . "'";
}
$result = mysql_query($query);
if (mysql_num_rows($result) > 0)
{
echo "cookie verified (COOKIE OKOK)" . "<br>";
$query = "SELECT * FROM b50__user_group WHERE group_id = '" . mysql_real_escape_string($MagGroup) . "' AND user_pending = '0' AND user_id = '" . mysql_real_escape_string($UID) . "'";
$result = mysql_query($query);
if (mysql_num_rows($result) > 0)
{
$query = "SELECT * FROM b50__user_group WHERE group_id = '" . mysql_real_escape_string($SiteOps) . "' AND user_pending = '0' AND user_id = '" . mysql_real_escape_string($UID) . "'";
$result = mysql_query($query);
if (mysql_num_rows($result) > 0)
{
$AUTH = 3;
echo "SySop (GROUP OKOK)<br>";
}
else
{
$AUTH = 2;
echo "Maglinker (GROUP OKOK)<br>";
}
}
else
{
echo "Not authorized (GROUP ERROR)";
$AUTH = 1;
}
}
else
{
echo "cookie not verified (COOKIE ERROR)";
$AUTH = 0;
}
mysql_close($con);
}
?>
that is the part of the script i use to check the cookies but then that works the rest of the site will can anyone help me plz