For those who have asked how to get rid of the '?' after your url when
cookies are enabled and the sid is passed through cookies instead of through
the url.. Well here is a very very simplistic script that I wrote and have
not had any problems with it at all... I hope it helps! :)

Ok this might be a little too simplistic, but it works great for me :)  I
have a page that is called by all my other pages so this is right after my
session start command:

  if (sid) {  // if there is a current sid
    $sida = "?".sid;        // if sid is only variable passed through URL
    $sidb = "?".sid."&";    // if other variables are passed through URL
  } else $sidb = '?';

Now with a link that does not have any other variables I just create the
link like this:

<a href="mypage.php<?=$sida?>">My Page</a>

Now if this link had several other variables I would write the link like
this:

<a href="mypage.php<?=$sidb?>var1=heya&var2=myname">My Page</a>

Cookies ON:  <a href="mypage.php">My Page</a>
Cookies OFF: <a href="mypage.php?PHPSID=1234">My Page</a>

Cookies ON:  <a href="mypage.php?var1=heya&var2=myname">My Page</a>
Cookies OFF: <a href="mypage.php?PHPSID=1234&var1=heya&var2=myname">My
Page</a>

It's real simple and easy *hehe*  I havent ran into any problems with it
yet... But if you can see some problems that might develop please by all
means tell me!

Rick

"Every person you meet - and everything you do in life - is an opportunity
to learn something." - Tom Clancy


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to