note 8067 added to Session handling functions
| From: | chernyshevsky at hotmail dot com | Date: | Fri, 25 Aug 2000 20:26:14 +0000 |
| Subject: | note 8067 added to Session handling functions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-3250@lists.php.net to get a copy of this message | ||
Use Javscript to automatically append the SID to the ends of the URLs in your page. Put this snippet
at the end of your file:
<pre>
<script>
function addvar(href, variable, value)
{
if(href.indexOf('?') != -1)
{
return href + '&' + variable + '=' + value;
}
else
{
return href + '?' + variable + '=' + value;
}
}
for(i = 0; i < document.anchors.length; i++)
{
with(document.anchors[i])
{
href = addvar(href, 'SID', '<?php echo $SID ?>');
}
}
for(i = 0; i < document.forms.length; i++)
{
with(document.forms[i])
{
action = addvar(action, 'SID', '<?php echo $SID ?>');
}
}
</script>
</pre>
http://www.php.net/manual/ref.session.php