|
|
#1 (permalink) | ||
|
MR. SECURITY
Excelling Contributor
Joined in Jun 2004
Lives in Orlando, USA
Hosted on SH129
722 posts
Gave thanks: 4
Thanked 1 Time in 1 Post
|
PHP/MySQL Sessions
I had this code
Code:
if( $kernel->session->vars['session_group_id'] <> 1 )
{
$kernel->ld['lang_f_control_panel'] = "";
}
else
{
$kernel->tp->call( "admin_copyright_notice" );
$kernel->tp->call( "admin_footer" );
}
Code:
if(($kernel->session->vars['session_group_id'] != 1 )|| ($kernel->session->vars['session_group_id'] != 23))
{
$kernel->ld['lang_f_control_panel'] = "";
}
else
{
$kernel->tp->call( "admin_copyright_notice" );
$kernel->tp->call( "admin_footer" );
}
Quote:
Quote:
__________________
2005 Surpassies: Winner of Most Skilled Wordsmith SH129 - Power SH81 - OC5 |
||
|
|
|
|
|
#2 (permalink) |
|
Race Surpass
Super #1
Joined in Jul 2006
Lives in Oklahoma City, OK
Hosted on sh102
1,218 posts
Gave thanks: 18
Thanked 86 times
|
Darned if I can find anything wrong with that code. Right number of parenthesis and curly braces and no misplaced semi-colons. Might make sure the file was transferred back to the server in ASCII and not binary or possible copy that section of code to Notepad, delete in the original and paste it back in case there's some weird hidden whitespace character.
That or something was mistakenly modified or changed somewhere else. Or, I'm an idiot and don't see the problem... ![]()
__________________
|
|
|
|
| This user thanks MarkRH for this great post! | Tracer Round (November 12th, 2007) |
|
|
#3 (permalink) | |
|
MR. SECURITY
Excelling Contributor
Joined in Jun 2004
Lives in Orlando, USA
Hosted on SH129
722 posts
Gave thanks: 4
Thanked 1 Time in 1 Post
|
Quote:
Bad thing is it didnt do what I want. Neither session_group_id's can see the footer info now. Before group id 1 could. ![]()
__________________
2005 Surpassies: Winner of Most Skilled Wordsmith SH129 - Power SH81 - OC5 |
|
|
|
|
|
|
#4 (permalink) |
|
Registered User
Super #1
Joined in Mar 2005
Lives in Washougal, WA
1,302 posts
Gave thanks: 23
Thanked 39 times
|
Seems out of place, and I am no expert.
Code:
if(($kernel->session->vars['session_group_id'] != 1 )|| ($kernel->session->vars['session_group_id'] != 23)) Code:
if(($kernel->session->vars['session_group_id'] != 1) || ($kernel->session->vars['session_group_id'] != 23)) Code:
if(( $kernel->session->vars['session_group_id'] != 1 ) || ( $kernel->session->vars['session_group_id'] != 23 )) |
|
|
|
|
|
#5 (permalink) |
|
Race Surpass
Super #1
Joined in Jul 2006
Lives in Oklahoma City, OK
Hosted on sh102
1,218 posts
Gave thanks: 18
Thanked 86 times
|
Yeah, I was looking at the logic of that and didn't think it would work how you wanted, change it to:
PHP Code:
__________________
|
|
|
|
| This user thanks MarkRH for this great post! | Tracer Round (November 13th, 2007) |
|
|
#6 (permalink) |
|
Skittles
Super #1
Joined in Aug 2004
Lives in a space ship
Hosted on dedi
6,665 posts
Gave thanks: 96
Thanked 190 times
|
but he wants it if it's either 1 or 23... since it can't be both 1 and 23.
I couldn't find anything wrong, but I am sure there has to be something!
__________________
Mountain Dew Knight
People should not be afraid of their governments. Governments should be afraid of their people. |
|
|
|
| This user thanks DewKnight for this great post! | Tracer Round (November 13th, 2007) |
|
|
#8 (permalink) |
|
Race Surpass
Super #1
Joined in Jul 2006
Lives in Oklahoma City, OK
Hosted on sh102
1,218 posts
Gave thanks: 18
Thanked 86 times
|
Correct, so if it's 1, the first variation will result in true and not show the footer.
if true or true = true (id = 5) if true or false = true (id = 23) if false or true = true (id = 1) if false or false = false (an impossible case since the value can't be 1 and 23 at the same time) Using and: if true and true = true (id = 5) if true and false = false (id = 23) if false and true = false (id = 1) if false and false = false (impossible case, id can't be both 1 and 23)
__________________
|
|
|
|
|
|
#9 (permalink) | |
|
MR. SECURITY
Excelling Contributor
Joined in Jun 2004
Lives in Orlando, USA
Hosted on SH129
722 posts
Gave thanks: 4
Thanked 1 Time in 1 Post
|
Quote:
![]() But I havent the slightest clue why AND works and OR doesnt.
__________________
2005 Surpassies: Winner of Most Skilled Wordsmith SH129 - Power SH81 - OC5 |
|
|
|
|