Re: [HAB] How to build a member area with PHP Sessions

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

 



OOzy Pal wrote:
Dears
Can anyone direct me to a good tutorial on how to build a member area using php sessions?
Thank you
OOzy



Regards, OOzy

What is the purpose of life?
		
---------------------------------
Do you Yahoo!?
 Yahoo! Search presents - Jib Jab's 'Second Term'

I'm not aware of a tutorial but I do have member areas on my website. I also will display certain items on a web page depending on whether a member is actually logged in.


The process is something like this:

1. Members logs into website using USERID and PASSWORD
2. Prior to every new page a session is started
3. If member is in-session then set VALIDLOGON = 'YES'
4. At that point I can display links or images or anything
   that are dependent on VALIDLOGON = 'YES'

For example I have PHP code that looks something like:

if (validlogon == 'YES') {
		          Display stuff that only members see
                         }

I've also taken it a further step by creating a variable called
'Privileges' which gives gives certain members greater access to information.


For example I might have PHP code that looks something like:

if (validlogon == 'YES' and privilege = 'C') {
                   Display stuff for members who have C privilege
                                              }

The last example is the case where I don't want non-members to see a particular page. I do the check for validlogon at the beginning of the script .... if the user is not validated then user gets bounced back to the site HOME page. This PHP code looks like:

if ($validlogon == "NO") {
   header("Location: home.php?msg=INVALID USERID OR PASSWORD");
   exit; }

Anyways, that's the general idea. It works for me. Others may have more complex schemes but this serves my purpose well. I'm not a professional programmer so I generally look for stuff that I can easily understand.

Hope this helps.


-- Jerry Kita

http://www.salkehatchiehuntersville.com

email: jskita@xxxxxxxxxxxxx

--
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