+ Reply to Thread
Results 1 to 4 of 4

Thread: Session

  1. #1
    zenon80983 is offline x10Hosting Member zenon80983 is an unknown quantity at this point
    Join Date
    Dec 2010
    Posts
    43

    Session

    Hi i have been searching google for a few days now and have been trying to get help from a website that i know of that helps under the website design catagory in the forums and seems no one is able to help so im going to try here.

    I have a members only website area and the login works and all of that but i need a script that allows registered and logged in users to view the content of that page and when a user who is not logged in trys to access the page they get redirected back to the index page.

    can anyone tell me a script to do this or make one???

    please help i cannot continue with my member system until this problem is solved.

    and please dont suggest Cookies because they dont work i have already tried it.

  2. #2
    khopcraft77 is offline x10Hosting Member khopcraft77 is an unknown quantity at this point
    Join Date
    May 2011
    Location
    Sooke, B.C.
    Posts
    80

    Re: Session

    If cookies don't work for you, then either a) you are doing it wrong, or b) you have it disabled. Its probably a. I recommend looking up a tutorial on cookies because there a great way to do member stuff.
    Play games at my website: Games of Greatness

  3. #3
    cybrax's Avatar
    cybrax is offline x10 Elder cybrax is on a distinguished road
    Join Date
    Aug 2009
    Location
    UK
    Posts
    699

    Re: Session

    This tutorial should help with the basics...

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


    Cookies of course would be the simpler way to do it, but some folk are overly paranoid about them and as a result block them as a matter of course. So using session to pass this tempory information is one of the few alternatives.
    Last edited by cybrax; 07-07-2011 at 10:12 PM.
    The code must flow.
    Project 157: Latest UK Jobs direct to your mobile phone
    New Domain under construction: Lovelogic.net
    home for some new projects that we can't keep here ;)


  4. #4
    arradia is offline x10Hosting Member arradia is an unknown quantity at this point
    Join Date
    Dec 2007
    Posts
    5

    Re: Session

    you'd need to set a session variable - for example -

    $_SESSION['valid_login'] = true

    then test for it each page:

    if(!$_SESSION['valid_login'])
    {
    header('Location:index.htm')
    }

    you need to put session_start() at the top of each page you want to use session variables on.

+ Reply to Thread

Similar Threads

  1. IE PHP session help
    By as4s1n in forum Programming Help
    Replies: 0
    Last Post: 03-09-2010, 06:46 PM
  2. PHP session var
    By Gauze in forum Free Hosting
    Replies: 1
    Last Post: 08-26-2008, 08:49 PM
  3. PHP session ID
    By callumacrae in forum Programming Help
    Replies: 6
    Last Post: 07-10-2008, 02:57 PM
  4. session problems
    By galaxyAbstractor in forum Free Hosting
    Replies: 0
    Last Post: 12-16-2007, 10:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers