Appending PHPSESSID

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
HaVoC
Forum Commoner
Posts: 83
Joined: Sat Feb 07, 2004 7:20 am
Location: Smiths Falls, CA

Appending PHPSESSID

Post by HaVoC »

IS there a command to add the PHPSESSID to every link clicked?

I've seen a command before that appends the session id, I don't remember it anymore...does anyone know what command i'm looking for?
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

User avatar
HaVoC
Forum Commoner
Posts: 83
Joined: Sat Feb 07, 2004 7:20 am
Location: Smiths Falls, CA

Post by HaVoC »

So then I can keep a user logged in
User avatar
HaVoC
Forum Commoner
Posts: 83
Joined: Sat Feb 07, 2004 7:20 am
Location: Smiths Falls, CA

Post by HaVoC »

THanks
Last edited by HaVoC on Sun May 16, 2004 3:32 pm, edited 1 time in total.
User avatar
delorian
Forum Contributor
Posts: 223
Joined: Sun May 04, 2003 5:20 pm
Location: Olsztyn, Poland

Post by delorian »

If you're using sessions for user loggin it's better not to parse session id through link, but if really want to - read about session.use_trans_sid http://us2.php.net/manual/en/ref.session.php or try the following function:

Code: Select all

function add_sessid($url)
{
     if(!preg_match("|".session_name()."=".session_id()."|i", $url)) {
          return $url."&".session_name()."=".session_id();
     } else {
          return $url;
    }
}
I did not test it.
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post by Steveo31 »

What delorian said... trans_sid is much easier to handle and you don't need to append it to every link.
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

Also, the user will be kept in no matter what, as long as you set the sessions properly.

No need to fiddle with session_id
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

I would disbable trans_id for security issues.

Just inform your customers that they are required to enable cookies.
User avatar
HaVoC
Forum Commoner
Posts: 83
Joined: Sat Feb 07, 2004 7:20 am
Location: Smiths Falls, CA

Post by HaVoC »

Thanks for the help guys! I am also wondering, is there a command that counts how many sessions that have been started on my site?
Post Reply