vegnadragon Posted January 23, 2008 Share Posted January 23, 2008 I often used cookies in the past because they where easier to use but i think i need to use session for my new page. What i do know is that session is store in the server. So my problem is, in my site i want to store a single number value, a unique name or id to identify and a expire time so how do i create those and how do i get those values in a session. i hope the message is clear. Thanks for your time. Quote Link to comment https://forums.phpfreaks.com/topic/87449-session-problems/ Share on other sites More sharing options...
pocobueno1388 Posted January 23, 2008 Share Posted January 23, 2008 You set a session like this $_SESSION['session_name'] = value; you also need to remember to call session_start() at the top of each page you want the session to carry on to. Sessions tutorial Quote Link to comment https://forums.phpfreaks.com/topic/87449-session-problems/#findComment-447250 Share on other sites More sharing options...
vegnadragon Posted January 23, 2008 Author Share Posted January 23, 2008 I know how to do that, my session contain info for userA, i don't want userB to get userA. I want to create a unique session only for userA. Quote Link to comment https://forums.phpfreaks.com/topic/87449-session-problems/#findComment-447269 Share on other sites More sharing options...
pocobueno1388 Posted January 24, 2008 Share Posted January 24, 2008 Do you have an auto-incremented field in your users table? If you do I'm assuming it is their user ID. Just register that ID as the session and it's unique. If you don't want to do that, maybe you can use the function uniqid() Quote Link to comment https://forums.phpfreaks.com/topic/87449-session-problems/#findComment-447473 Share on other sites More sharing options...
ziv Posted January 24, 2008 Share Posted January 24, 2008 I know how to do that, my session contain info for userA, i don't want userB to get userA. I want to create a unique session only for userA. Session is unique per user! this code: <?php session_start(); $_SESSION['x'] = /* any data you want to store */; ?> will create a session file for each user-request (one per user). the user A will not see the value x of user B! Quote Link to comment https://forums.phpfreaks.com/topic/87449-session-problems/#findComment-447589 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.