Re: A Question About Using A Php User Class And Session Variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 14-08-21 12:39 PM, dealTek wrote:
Hi all,

Newbie learning about php Classes…

I have a question about using a php user class and  session variables.  Let's say that I have managed to create a user class that finds a particular person from the database query.

As I move about the site from page to page it would  be nice to be able to use the current user inside the user class without needing to re – look them up in the database multiple times

Q:  so is there a way to combine the current active user in the class with session variables so that they can be used multiple times?  If so, how would this work?

--
Thanks,
Dave - DealTek
dealtek@xxxxxxxxx
[db-14]


This really is not a class issue. When you call the class to determine the record ID of the user, you will save it in a variable. Probably created by calling the class to instantiate the variable.

What is important is understanding sessions, to track repeated page accesses. This is a good start:

http://www.tizag.com/phpT/phpsessions.php

Now for security reasons, DO NOT USE the record ID as the session variable. Save the session ID and record ID pair in either the database or the host file system.


--
Stephen

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux