Jump to content

Recognizing 4 different cookies


Cory94bailly

Recommended Posts

My code:

 

<?php
require('config.php');
if(isset($_COOKIE['ID_fcs_member']))
{

//Look for the cookies
$username1 = $_COOKIE['ID_fcs_member'];
$pass1 = $_COOKIE['Key_fcs_member'];
$username2 = $_COOKIE['ID_fcs_team'];
$pass2 = $_COOKIE['Key_fcs_team'];

// Fetch data
$check1 = mysql_query("SELECT * FROM members WHERE username = '$username1'")or die(mysql_error());
$check2 = mysql_query("SELECT * FROM team WHERE username = '$username2'")or die(mysql_error());

if (mysql_num_rows($check1) > 0) 
{ 
	//They have a member's cookie!
	$login_logout = "<a href='logout.php'>Logout</a>";
} 
elseif (mysql_num_rows($check2) > 0) 
{ 
	//The have a team cookie!
	$login_logout = "<a href='logout.php'>Logout</a>";
}
}
else
{
$login_logout = "<a href='login.php'>Login</a>
<img src='images/splitter.gif' class='splitter' alt='' />
<a href='register.php'>Register</a>";
}

print $login_logout;
?>

 

 

 

Obviously, that isn't working...

 

How can I make it so if they are logged in as a member OR team, it shows logout but if they are not logged in, shot Login and Register?

 

I have all that BUT when I log in as a member, it's fine.. If I log in as team.. the cookie gets set but it still shows Login and Register...

 

 

All help appreciated.

Link to comment
https://forums.phpfreaks.com/topic/110235-recognizing-4-different-cookies/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.