Forum Moderators: coopster

Message Too Old, No Replies

session tracking

         

armin_neu

8:08 pm on Apr 14, 2003 (gmt 0)



hi there
i`m a newbie to PHP. I tried to realize a kind of user tracking and therefore provide each user with a different menu while starting up a side.

On the first page I call sessin_start() - shown below- and register the variable "rights".

session_start();
session_register("rights");

...and I .....

if($user_right == "ADMIN"){ $rights ="ADMIN";}
if($user_right == "INSERT"){ $rights ="INSERT";}
if($user_right == "PICK"){ $rights ="PICK";}
print "$rights";
if(session_is_registered("rights")) print "help me";

...set the session variable according to a profile gotten from a Mysql database (INSERT-rights, ADMIN-rights, or PICK-rights).
So far everythings works and I get the message"help me" on the screen. The attribute for the varialbe "rights" is a s well stored - as seen below - in the seesion file:

data in session file:
rights¦s:6:"INSERT";

Now the problem:

As soon as I call the variable on a different php-side(file) and want to track the information according to a session I can`t read from the "rights" varialbe . Even the session_is_registered doesn`t work with the follwowing code on the other php-side.

// $user_right = "ADMIN";
if(session_is_registered("rights")) print "help me again";
if($rights == "ADMIN"){ $user_right = "ADMIN";}
if($rights == "INSERT"){ $user_right = "INSERT";}
if($rights == "PICK"){ $user_right = "PICK";}
print "$user_right";

Here my php.ini settings:

[Session]

session.save_handler = files
session.save_path = C:/temp
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_maxlifetime = 1440
session.referer_check =
session.entropy_length = 0
session.entropy_file =
aspects.
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 1

url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"

...thanks for help

DrDoc

8:12 pm on Apr 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You need to call session_start() on every subsequent page where you want to use the session information.

DrDoc

8:16 pm on Apr 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Forgive me, I almost missed...

Welcome [webmasterworld.com] to Webmaster World! ;)

armin_neu

8:26 pm on Apr 14, 2003 (gmt 0)



yeaaaaaphi..

...it works..:-)

.thanks for your quick and fantastic help...