icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.
Old November 12th, 2007, 8:13 PM   #1 (permalink)
MR. SECURITY
Excelling Contributor
 
Tracer Round's Avatar
 
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" );
			}
I want to include session_group_id 23 so with the help of DewKnight I now have

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" );
			}
Now I get

Quote:
Parse error: syntax error, unexpected ';', expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /<path>/include/function_class_page.php on line 1029
Line 1029 is

Quote:
?>
Any suggestions?
__________________
2005 Surpassies: Winner of Most Skilled Wordsmith

SH129 - Power
SH81 - OC5
Tracer Round is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old November 12th, 2007, 8:41 PM   #2 (permalink)
Race Surpass
Super #1
 
MarkRH's Avatar
 
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...
MarkRH is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
This user thanks MarkRH for this great post!
Tracer Round (November 12th, 2007)
Old November 12th, 2007, 8:57 PM   #3 (permalink)
MR. SECURITY
Excelling Contributor
 
Tracer Round's Avatar
 
Joined in Jun 2004
Lives in Orlando, USA
Hosted on SH129
722 posts
Gave thanks: 4
Thanked 1 Time in 1 Post
Quote:
Originally Posted by MarkRH View Post
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...
Ok, I took your advice and reverted back to the original code and entered the changes without using copy/paste. I am not getting an error anymore.

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
Tracer Round is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old November 12th, 2007, 9:23 PM   #4 (permalink)
wgm
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))
Possibly
Code:
if(($kernel->session->vars['session_group_id'] != 1) || ($kernel->session->vars['session_group_id'] != 23))
or
Code:
if(( $kernel->session->vars['session_group_id'] != 1 ) || ( $kernel->session->vars['session_group_id'] != 23 ))
wgm is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old November 13th, 2007, 12:19 AM   #5 (permalink)
Race Surpass
Super #1
 
MarkRH's Avatar
 
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:
    if (($kernel->session->vars['session_group_id'] != ) && ($kernel->session->vars['session_group_id'] != 23)) 
MarkRH is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
This user thanks MarkRH for this great post!
Tracer Round (November 13th, 2007)
Old November 13th, 2007, 12:38 AM   #6 (permalink)
Skittles
Super #1
 
DewKnight's Avatar
 
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.
DewKnight is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
This user thanks DewKnight for this great post!
Tracer Round (November 13th, 2007)
Old November 13th, 2007, 12:55 AM   #7 (permalink)
wgm
Registered User
Super #1
 
Joined in Mar 2005
Lives in Washougal, WA
1,302 posts
Gave thanks: 23
Thanked 39 times
I'll just leave this to the experts (or gurus) to solve, mine was a guess only.
wgm is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old November 13th, 2007, 12:57 AM   #8 (permalink)
Race Surpass
Super #1
 
MarkRH's Avatar
 
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)
MarkRH is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old November 13th, 2007, 9:56 PM   #9 (permalink)
MR. SECURITY
Excelling Contributor
 
Tracer Round's Avatar
 
Joined in Jun 2004
Lives in Orlando, USA
Hosted on SH129
722 posts
Gave thanks: 4
Thanked 1 Time in 1 Post
Quote:
Originally Posted by MarkRH View Post
Yeah, I was looking at the logic of that and didn't think it would work how you wanted, change it to:
PHP Code:
    if (($kernel->session->vars['session_group_id'] != ) && ($kernel->session->vars['session_group_id'] != 23)) 
That worked Mark! Thanks

But I havent the slightest clue why AND works and OR doesnt.
__________________
2005 Surpassies: Winner of Most Skilled Wordsmith

SH129 - Power
SH81 - OC5
Tracer Round is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On