Jump to content

Another SESSION question


weemikey

Recommended Posts

Hi all. I read quite a bit before posting because I just didn't find the info I was looking for. I'm a fairly new PHP guy, and an intermediate coder overall, so I'm usually in over my head. Right now I'm trying to connect a pre-made piece of PHP software (document management) to my own contact manager. So the user logs into the system we paid for and a cookie gets set with a SESSION ID in it. There's a table in the database of the software that logs user id's with the SESSION ID.

 

I THINK I need to do a getcookie() on the PHPSESSID cookie that I see in my cookie list. I can take the SESSION ID that I find there and look up the user id, and from that the username in the database. I only need a username so I can do a "last_user" field in the contact manager I wrote to integrate into the existing system.

 

Is that a reasonable solution? Could there be any confusion if I specify the "PHPSESSID" cookie, or is there really only the ONE that was created when the user first logs in?

 

I'd appreciate any advice.....

 

Thanks!

Mike

Link to comment
https://forums.phpfreaks.com/topic/70997-another-session-question/
Share on other sites

you wouldn't getcookie, you would start your session and then:

 

$var = $_SESSION['user_id']; //to get the user id, assuming user_id is in the $_SESSION array.

$var2 = $_SESSION['user_name']; //to get the user name, assuming user_name is in the $_SESSION array.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.