Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session ID appears in code on pages first view

Status
Not open for further replies.

Streetdaddy

Programmer
Jun 10, 1999
161
AU
Further to a problem I was having where everytime I go to this page for the first browser session e.g. Internet Explorer opened, a javascript "object expected' error occurs. It's generated from js code used on the page for a dynamic menu. Finally I have realised that php is outputting the php session id in the js string and it seems to be causing a problem (i think), because when I refresh the page, the php session id is no longer in the js string and there is no js error generated.

This is the code in the javascript file that is included:

content[1] = content[1] + &quot;<tr><td><img src=\&quot;images/nav_sub_spacer.gif\&quot; width=\&quot;22\&quot; height=\&quot;12\&quot; border=\&quot;0\&quot;><a href=\&quot;?pgWeatherBOM\&quot; class=\&quot;dhtml\&quot;><strong>BOM Info</strong></a></td></tr>&quot;;

Then here is the code that is output on the first page view:

content[1] = content[1] + &quot;<tr><td><img src=\&quot;images/nav_sub_spacer.gif\&quot; width=\&quot;22\&quot; height=\&quot;12\&quot; border=\&quot;0\&quot;><a href=&quot;\?PHPSESSID=851760968a90d8844ce0dda7d6980d6d&quot;&quot;?pgWeatherBOM\&quot; class=\&quot;dhtml\&quot;><strong>BOM Info</strong></a></td></tr>&quot;;

Notice the part in red? Where did that come from?

Then after page has been refreshed:

content[1] = content[1] + &quot;<tr><td><img src=\&quot;images/nav_sub_spacer.gif\&quot; width=\&quot;22\&quot; height=\&quot;12\&quot; border=\&quot;0\&quot;><a href=\&quot;?pgWeatherBOM\&quot; class=\&quot;dhtml\&quot;><strong>BOM Info</strong></a></td></tr>&quot;;

So after the refresh, the php session id is gone, and there is no javascript error? Can anyone tell me why
?PHPSESSID=851760968a90d8844ce0dda7d6980d6d&quot;&quot;
is being output?

ps. the js functions are included like this:

'index.php' includes 'includes/navigation_js.php'
'index.php' includes 'includes/header.php' which contains a function that outputs the <body> tag with an onLoad call to a function in 'navigation_js.php'. The js error points to the line with the body tag.
Miles

Those Micros~1 guys sure know what they doing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top