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 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 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. 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? 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. 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. 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. 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 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. 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"; } ?> 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". Link to comment https://forums.phpfreaks.com/topic/110172-solved-session/#findComment-565405 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.