Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: cme1st2302 on September 21, 2009, 01:41:33 AM

Title: 8: Undefined index: session_var??
Post by: cme1st2302 on September 21, 2009, 01:41:33 AM
Dear fellow SMFer's,
   I was doing a check of the Error Log and I have the following error in my log (17 pages worth):

8: Undefined index: session_var
File: /home/content/b/u/c/buc240/html/eastcoastastro/forums/Themes/default/languages/Post.english.php (eval?)
Line: 111

This is the code from line 111 of the Post.english.php file:

$txt['maxAttachPerPost'] = 'per post';

Any ideas how to fix this error? 

Thanks in advance,
Chris

PS - I attached the file as well just in case you need it.
Title: Re: 8: Undefined index: session_var??
Post by: tyty1234 on September 21, 2009, 01:52:03 AM
The error is not coming from that file. What you want to do is install this mod (http://custom.simplemachines.org/mods/index.php?mod=2054), disable template eval, and then replicate the error, and then tell us what the new error is.
Title: Re: 8: Undefined index: session_var??
Post by: SlammedDime on September 21, 2009, 02:02:56 AM
Since it's the post language file, the error is either occuring in index.template.php on line 111 or post.template.php on line 111.
Title: Re: 8: Undefined index: session_var??
Post by: cme1st2302 on September 21, 2009, 02:49:16 AM
Thanks for the replies fellas!!!

@tyty1234 - I will try what you suggested and report back.

But in the mean time.....
@SlammedDime - Here is the code from line 111 from both the files you suggested:

index.template.php (from the overall forum default theme)
<title>', $context['page_title'], '</title>';

Post.template.php
var numErrors = errors.getElementsByTagName("error").length, errorList = new Array();

Thanks,
Chris
Title: Re: 8: Undefined index: session_var??
Post by: cme1st2302 on September 21, 2009, 03:10:50 AM
@tyty1234 - I did what you said and here is the error I got after:

8: Undefined index: session_var
File: /home/content/b/u/c/buc240/html/eastcoastastro/forums/Themes/default/PortalShoutbox.template.php
Line: 111

I've attached the PortalShoutbox.template.php

Thanks,
Chris
Title: Re: 8: Undefined index: session_var??
Post by: SlammedDime on September 21, 2009, 03:42:27 AM
SMF 1.1.x doesn't use session_var, that's a SMF 2.0 thing... so I'd bring it up to the SP people....

However you should be able to fix it by doing the following

Code (Find) Select
' . $context['session_var'] . '

Code (Replace) Select
sesc
Title: Re: 8: Undefined index: session_var??
Post by: tyty1234 on September 21, 2009, 04:41:34 AM
Quote from: SlammedDime on September 21, 2009, 03:42:27 AM
SMF 1.1.x doesn't use session_var, that's a SMF 2.0 thing... so I'd bring it up to the SP people....

However you should be able to fix it by doing the following

Code (Find) Select
' . $context['session_var'] . '

Code (Replace) Select
sesc
Um...do you mean...

Code (Replace With) Select

' . $sesc . '


;)
Title: Re: 8: Undefined index: session_var??
Post by: SlammedDime on September 21, 2009, 04:42:46 AM
No, it's not a PHP variable it needs to be replaced with, it's a normal text string, hense just sesc

;)
Title: Re: 8: Undefined index: session_var??
Post by: tyty1234 on September 21, 2009, 04:46:41 AM
Huh, really?

Learned something new today. :)
Title: Re: 8: Undefined index: session_var??
Post by: [SiNaN] on September 21, 2009, 04:55:18 AM
This was reported sometime ago, here: ;)

http://simpleportal.net/index.php?topic=3201.0
Title: Re: 8: Undefined index: session_var??
Post by: SlammedDime on September 21, 2009, 04:59:09 AM
Thx SiNaN...

Looks like it's 'sc', not 'sesc'... I need to go back and review 1.1.x code... :)
Title: Re: 8: Undefined index: session_var??
Post by: [SiNaN] on September 21, 2009, 05:03:50 AM
No problems. ;)

'sc' is used for POST and 'sesc' for GET. That variable is passed to a Js function for AJAX stuff. So it uses POST.
Title: Re: 8: Undefined index: session_var??
Post by: tyty1234 on September 21, 2009, 05:22:50 AM
Learned and remembered two things today. $_POST['sc'] and $_GET['sesc'].

I have to remember those, thanks SiNAN. :)
Title: Re: 8: Undefined index: session_var??
Post by: cme1st2302 on September 21, 2009, 12:38:52 PM
Ok so i am using the sc then?  I will try this out later when I get home and report back.  Thanks to all of you for helping me out.  I appreciate it!!!

Chris
Title: Re: 8: Undefined index: session_var??
Post by: cme1st2302 on September 24, 2009, 08:55:55 PM
[SiNaN]  I can not find the following code anywhere in the PortalShoutbox.php file

' . $context['session_var'] . '

What should I do?

Chris
Title: Re: 8: Undefined index: session_var??
Post by: SlammedDime on September 24, 2009, 09:06:36 PM
It's in PortalShoutbox.template.php, the same file that you posted above.
Title: Re: 8: Undefined index: session_var??
Post by: cme1st2302 on September 24, 2009, 09:34:00 PM
Ok I found it was looking in the wrong file duh.  I changed the code and now I will give it a day to see if it shows up in the log again.  Should I re-enable the template eval?

Thanks again for your help!!!
Chris
Title: Re: 8: Undefined index: session_var??
Post by: Arantor on September 24, 2009, 09:41:15 PM
You can if you want but it doesn't hurt to leave it off.
Title: Re: 8: Undefined index: session_var??
Post by: cme1st2302 on September 24, 2009, 09:53:07 PM
So far no errors in the log.  I will mark this as solved for now but if it comes up again I will re-open it.  Thanks all for your help!!!

Chris
Title: Re: 8: Undefined index: session_var??
Post by: cme1st2302 on September 25, 2009, 01:11:27 AM
Ok fellas that fixed it.  I had a number of users on and there are no erros in the log after 4 hours.  Thanks again for everyone's help!!!

Chris