Help with keeping a user logged in

PythonPython Forum LeaderThe Royal RAM
Hi,

Im currently working on my own forum system script (see my post in the General Forum for more info). Basically I want to keep people logged in once they have logged in so that when they close their browser and visit again they are still logged in.

What is the best way? Either to use cookies or some sort of other method? Also how is this done?

Thanks

The Royal Ram

Comments

  • CannonBallGuyCannonBallGuy Moderator Shared Hoster
    Cookies is the usual way, I believe...
  • martian2k4martian2k4 Llama Hunter Moderator
    Yes its pretty simple, you put

    setcookie ("authenticated", "yes"); for example

    on the page after checking if there info id right then on a pgae you want to check if they are logged in you would put

    if($_COOKIE["authenticated"] == 'yes'){
    echo "you are logged in";
    }else{
    echo "You are ont logged in";

    They aint too hard to use, a lot like sessions :D
    Free MySpace Layouts- Coming soon
    Photoshop Tutorials- Coming soon
    Premium PHP Scripts- Coming soon

    Haha i should really do some work so i can remove all the coming soon's
  • martian2k4martian2k4 Llama Hunter Moderator
    Ohh i aint no expert with cookies cz i aint eva had a use for them but i had a look at a few sites and tought this might b helpfull

    setcookie(name, value, expire, path, domain);

    Just for extra security :p
    Free MySpace Layouts- Coming soon
    Photoshop Tutorials- Coming soon
    Premium PHP Scripts- Coming soon

    Haha i should really do some work so i can remove all the coming soon's
  • PythonPython Forum Leader The Royal RAM
    now ya see. I knew about everything you just posted.. the problem was that its wasnt working for me... I just thought that perhaps I was doing ot wrong but no my method was right

    I will try again now.

    Thanks

    The Royal Ram

  • PythonPython Forum Leader The Royal RAM
    Ok I noticed that I was doing something wrong... a stupid mistake really..

    Thanks

    The Royal Ram

  • martian2k4martian2k4 Llama Hunter Moderator
    Lmao good luck with it :D
    Free MySpace Layouts- Coming soon
    Photoshop Tutorials- Coming soon
    Premium PHP Scripts- Coming soon

    Haha i should really do some work so i can remove all the coming soon's
  • kinkkink serious member VPS - Virtual Prince of the Server
    use a timout function either they do something once an hour or they auto log off
  • PythonPython Forum Leader The Royal RAM
    will do :)

    The Royal Ram

Sign In or Register to comment.