d-fraz Posted June 14, 2008 Share Posted June 14, 2008 Hey. I'm having troubles with this admin session. <?php if ($_SESSION['admin'] == "$admin" ) { echo "IP Address"; }else echo "none"; ?> But even when I'm logged out it will show "Ip Address" when it should show "none" Anyone know the problem? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/110172-solved-session/ Share on other sites More sharing options...
DarkWater Posted June 14, 2008 Share Posted June 14, 2008 You're comparing it to $admin, which seems to be not set, so that if statement is basically seeing if $_SESSION['admin'] is null. Try it without the $ in front of admin. =P Quote Link to comment https://forums.phpfreaks.com/topic/110172-solved-session/#findComment-565391 Share on other sites More sharing options...
d-fraz Posted June 14, 2008 Author Share Posted June 14, 2008 Still don't work. Quote Link to comment https://forums.phpfreaks.com/topic/110172-solved-session/#findComment-565392 Share on other sites More sharing options...
DarkWater Posted June 14, 2008 Share Posted June 14, 2008 <?php if ($_SESSION['admin'] == "admin" ) { echo "IP Address"; }else echo "none"; ?> That doesn't work? Quote Link to comment https://forums.phpfreaks.com/topic/110172-solved-session/#findComment-565394 Share on other sites More sharing options...
d-fraz Posted June 14, 2008 Author Share Posted June 14, 2008 Nope. Always shows "none" if you put the variable on admin ($admin) it will always show IP Address. I want it where if you're an admin it will show Ip Address, Else if you're a user,guest,moderator it will show none. Quote Link to comment https://forums.phpfreaks.com/topic/110172-solved-session/#findComment-565396 Share on other sites More sharing options...
DarkWater Posted June 14, 2008 Share Posted June 14, 2008 What should $_SESSION['admin'] be equal to? 1? "yes"? "admin"? Just tell me and I'll fix it for you, lol. Quote Link to comment https://forums.phpfreaks.com/topic/110172-solved-session/#findComment-565397 Share on other sites More sharing options...
d-fraz Posted June 14, 2008 Author Share Posted June 14, 2008 equal to admin. Quote Link to comment https://forums.phpfreaks.com/topic/110172-solved-session/#findComment-565398 Share on other sites More sharing options...
DarkWater Posted June 14, 2008 Share Posted June 14, 2008 <?php if ($_SESSION['admin'] == "admin" ) { echo "IP Address"; }else echo "none"; ?> And you're sure that doesn't work? O_O Quote Link to comment https://forums.phpfreaks.com/topic/110172-solved-session/#findComment-565399 Share on other sites More sharing options...
d-fraz Posted June 14, 2008 Author Share Posted June 14, 2008 Nope don't work. Quote Link to comment https://forums.phpfreaks.com/topic/110172-solved-session/#findComment-565400 Share on other sites More sharing options...
d-fraz Posted June 14, 2008 Author Share Posted June 14, 2008 Here is something else but it always shows "IP"; even when I'm logged out. <?php if ($groupname == "$admin" ) { echo "IP"; }else { echo "None"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/110172-solved-session/#findComment-565401 Share on other sites More sharing options...
DarkWater Posted June 14, 2008 Share Posted June 14, 2008 Because $admin is empty. I think you just want "admin", not "$admin". Quote Link to comment https://forums.phpfreaks.com/topic/110172-solved-session/#findComment-565405 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.