SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: sessions

  1. #1
    SitePoint Evangelist AlexC's Avatar
    Join Date
    Oct 2000
    Location
    Sheffield, UK
    Posts
    437
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok...i know nothing about sessions, and have just learned how to create them

    i have created a session in a php script called registerme.php which also checks if the user is a valid user

    i need to check for this session on every page that is protected by my password gateway. how do i do this?

    Alex

  2. #2
    Non-Member
    Join Date
    Apr 2000
    Location
    Waco, Texas.
    Posts
    188
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You will have to get a hold of the session ID on each of those pages. Whenever I use sessions, I tend to always pass them by the URL rather than rely on cookies. This is what I would do to make sure that on every page the person has valid session variables for $username and $password:
    Code:
    if($HTTP_GET_VARS["id"])
    {
    	session_id($HTTP_GET_VARS["id"]);
    	session_start();
    	if(session_is_registered("username")==FALSE OR session_is_registered("password")==FALSE)
    	{
    		//Some type of error message here
    	}
    
    }
    Of course the above will only work if you have registered 'username' and 'password' as session variables.

    Hope that helps


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •