PDA

View Full Version : Log in script tutorial


lux
12-04-2006, 09:39 PM
Hey dj,

Excellent tutorials, very clear and easy to follow!

In the 3rd tutorial you use session_destroy(); to destroy all sessions. I want to build an application that multiple users will be accessing at once. What would you suggest as a method for removing a single session on logoff as apposed to all sessions?

Also would you be able to expand the tutorials to include the use of user profiles that may determine which pages a particular user may access based on their profile.

Cheers dj

davidj
12-04-2006, 09:54 PM
session_destroy(); will only kill sessions that belong to a single user

its just a way to clear every session thats been set

as a applcations developer i could be using 30+ sessions and dont want to kill sessions 1 at a time. Just nuke em all at once using my BFG called session_destroy();

plus its a cool named function

davidj
12-04-2006, 09:56 PM
Also would you be able to expand the tutorials to include the use of user profiles that may determine which pages a particular user may access based on their profile.


yes thats a good one

will have something up before the weekend

lux
12-04-2006, 10:03 PM
ok dj, my mistake.

so one session is for one page but if a user accesses more than one page a session is created for each page where session_start() is defined?

davidj
12-04-2006, 10:16 PM
in page 1 you have...

$_SESSON['user_name'] = "dj";

that session is accessable in every page below session_start(); and is available thoughout at anytime (you dont have to set this again!)

in page 3 you have...

$_SESSON['car'] = "Z4";

so at this stage you have 2 sessions set and can be used at any time no matter what page you are on