about session..

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 9
Joined: Tue Jan 28, 2003 10:20 am

Wed Feb 26, 2003 9:59 am


i am using session for the login and password.

I have 3 types of users : Customer,Visitor,Administrator

How does the session recognise the user? it depends on which of the 3 user profile was used?

If i several people connect with profile VIsitor, there will be several session created?

hope these questions are not too stupid :?

User avatar
Posts: 826
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Wed Feb 26, 2003 11:55 am

when a user goes to your site it will create a session id. which is a randomly generated string. this string is stored in a cookie. you can then register variables to that unique string and store them from page to page.

example make a session_start() call at the very top of the page.

this will create a unique id if it is a new session. something like D87878787GGF6

if you then register a variable it will be associated with that string. using $_SESSION['usertype'] = 'Visitor'

so the session D87878787GGF6 has usertype - 'Visitor'

if another person goes to the website it will create an additional session id HDGSYUEJDH77674543, then set the usertype an associate it with the session.

$_SESSION['usertype'] = 'Customer';

with that we have two sessions

D87878787GGF6 values usertype = 'Visitor'
HDGSYUEJDH77674543 values usertype = 'Customer'

Does that shed any light?

New php-forum User
New php-forum User
Posts: 9
Joined: Tue Jan 28, 2003 10:20 am

Thu Feb 27, 2003 6:19 am


thanks a lot, i think i understood. :wink:

I've just got a few more question :

* Is it better to store the profile of the user in the session?
or create different type of login to mysql server?

* Regarding the security how can i prevent that people can access my source code?


Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests