Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

about session..

General discussions related to php

Moderators: macek, egami, gesf

about session..

Postby youpi » Wed Feb 26, 2003 9:59 am

Hi,

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 :?
thanks
youpi
New php-forum User
New php-forum User
 
Posts: 9
Joined: Tue Jan 28, 2003 10:20 am

Postby Redcircle » 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'
and
HDGSYUEJDH77674543 values usertype = 'Customer'

Does that shed any light?
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Postby youpi » Thu Feb 27, 2003 6:19 am

hi,

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?

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


Return to PHP General

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.