Cory94bailly Posted May 14, 2008 Share Posted May 14, 2008 <? if(isset($_COOKIE['ID_fcs_member'])) { //Connect to Members DB mysql_connect("***", "***", "***") or die(mysql_error()); mysql_select_db("***") or die(mysql_error()); //Look for the member cookies $username = $_COOKIE['ID_fcs_member']; $pass = $_COOKIE['Key_fcs_member']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { //If the cookie exists, show the "Logout" button. { ?> <a href="logout.php">Logout</a> <? } } } else //If the cookie does not exist, show the "Login" button. { ?> <a href="login.php">Login</a> <img src="images/splitter.gif" class="splitter" alt="" /> <? } ?> <? if(isset($_COOKIE['ID_fcs_team'])) { //Connect to Team DB mysql_connect("***", "***", "***") or die(mysql_error()); mysql_select_db("***") or die(mysql_error()); //Look for the team cookies $username = $_COOKIE['ID_fcs_team']; $pass = $_COOKIE['Key_fcs_team']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { //If the cookie exists, show the "Logout" button. { ?> <a href="logout.php">Logout</a> <? } } } else //If the cookie does not exist, show the "Login" button. { ?> <a href="login.php">Login</a> <img src="images/splitter.gif" class="splitter" alt="" /> <? } ?> Well that's my whole "Loggedin.php"... I obviously know I'm already doing it wrong.. Any help? I tried grouping them together so it wouldn't show one "logout" and one "login" button but it didn't work when I tried.. Link to comment https://forums.phpfreaks.com/topic/105518-solved-help-with-recognizing-if-we-are-logged-in-or-not/ Share on other sites More sharing options...
Loldongs Posted May 14, 2008 Share Posted May 14, 2008 Use Sessions for starters cookies are gay Link to comment https://forums.phpfreaks.com/topic/105518-solved-help-with-recognizing-if-we-are-logged-in-or-not/#findComment-540533 Share on other sites More sharing options...
Cory94bailly Posted May 14, 2008 Author Share Posted May 14, 2008 Use Sessions for starters cookies are gay Ummm...... That's messed up imo but... I heard sessions are domain specific, this is a subdomain/a folder... Link to comment https://forums.phpfreaks.com/topic/105518-solved-help-with-recognizing-if-we-are-logged-in-or-not/#findComment-540535 Share on other sites More sharing options...
DeanWhitehouse Posted May 14, 2008 Share Posted May 14, 2008 you haven't made an IF statement //If the cookie exists, show the "Logout" button. { ?> <a href="logout.php">Logout</a> <? } should be //If the cookie exists, show the "Logout" button. if(cookie_name) { ?> <a href="logout.php">Logout</a> <? } Link to comment https://forums.phpfreaks.com/topic/105518-solved-help-with-recognizing-if-we-are-logged-in-or-not/#findComment-540537 Share on other sites More sharing options...
Cory94bailly Posted May 14, 2008 Author Share Posted May 14, 2008 you haven't made an IF statement //If the cookie exists, show the "Logout" button. { ?> <a href="logout.php">Logout</a> <? } should be //If the cookie exists, show the "Logout" button. if(cookie_name) { ?> <a href="logout.php">Logout</a> <? } That's not the exact point I am looking for... I am technically looking for 4 different cookies and I don't know how to look for them all at the same time since 2 use one DB and 2 use another DB... Link to comment https://forums.phpfreaks.com/topic/105518-solved-help-with-recognizing-if-we-are-logged-in-or-not/#findComment-540540 Share on other sites More sharing options...
Daniel0 Posted May 14, 2008 Share Posted May 14, 2008 Use Sessions for starters cookies are gay So basically you love those ?PHPSESSID= following by a long alphanumeric string on the end of all your URLs? Otherwise you might want to check up on how sessions work before making such bold statements... Link to comment https://forums.phpfreaks.com/topic/105518-solved-help-with-recognizing-if-we-are-logged-in-or-not/#findComment-540924 Share on other sites More sharing options...
Cory94bailly Posted May 14, 2008 Author Share Posted May 14, 2008 BUMP Link to comment https://forums.phpfreaks.com/topic/105518-solved-help-with-recognizing-if-we-are-logged-in-or-not/#findComment-541165 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.