note 8067 deleted from ref.session by sander
| From: | sander@php.net | Date: | Sun, 07 Apr 2002 11:29:28 +0000 |
| Subject: | note 8067 deleted from ref.session by sander | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-28848@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>