Results 1 to 2 of 2

Thread: Session-ing

  1. #1

    Thread Starter
    Addicted Member TheGoldenShogun's Avatar
    Join Date
    Mar 2001
    Location
    VA/MD... anywhere around the beltway
    Posts
    236

    Unhappy Session-ing

    I am trying to figure out sessions fully and why I should use them.

    Currently, when a user logs in I drop them a cookie and then, throughout the member section, write a little if at the top of the page to make sure that cookie is what it should be. If it's not, they get the boot.

    Now why should I not use that or why is that not as secure as sessions? Also, with a session, if I am understanding it correct, I can set the sessions on one page but everytime a page that needs a session is called I need to call session_start()? then what, the same type of validation as my cookie if statement at the top of the page?

    this is similar to what my little if statement looks like on the pages currently..

    if ($cookie == '$x')
    echo("You're on the list, come in");
    else
    echo("Who you, get out of here!");

    how would I write that with sessions?

  2. #2
    scoutt
    Guest
    you are rigth. also session are more secure because they live on the server. and it all depends onm what version of php you are working with.if you have phph v. 4.2 or 4.1.2 you check like this.

    if ($_SESSION[sessionVariable])
    echo("You're on the list, come in");
    else
    echo("Who you, get out of here!");

    if you are on 4.0.2 or smaller it would be

    if ($sessionVariable)
    echo("You're on the list, come in");
    else
    echo("Who you, get out of here!");

Posting Permissions

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



Click Here to Expand Forum to Full Width