Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.