Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 6 of 6

Thread: Secure Cookies?

  1. #1
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default Secure Cookies?

    Hm, would doing a sort of cms feature be better with cookies then sessions?

    And are there secure cookies, I've seen many unsecure ways...

    Can somebody post info on how to make, delete and see if a cookie is present. Like, there's a page 'members only'. The members will have the cookie, if they have it they can view the page, if they don't they will receive an error message. How are they secure aswell...?

    +REP to decent answers.

  2. #2
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    Set cookie
    PHP Code:
    ob_start();
    setcookie("CookieName","Value (Username or something)",time()+3600); 
    Display Cookie
    PHP Code:
    ob_start();
    echo(
    $_COOKIE["CookieName"]); 
    Members Only page
    PHP Code:
    ob_start();
    if(!isset(
    $_COOKIE["CookieName"]))
    die(
    "Members Only access!"); 
    Unset Cookie
    PHP Code:
    ob_start();
    setcookie("CookieName","",time()-3600); 
    Coming and going...
    Highers are getting the better of me

  3. #3
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default

    I've got sessions working now, less code and much better IMO!

  4. #4
    Join Date
    Sep 2006
    Location
    Hobart, Australia
    Posts
    593
    Tokens
    0

    Default

    Yeah, use sessions. Much more secure than cookies.

  5. #5
    Join Date
    Jul 2007
    Location
    Scotland
    Posts
    529
    Tokens
    0

    Default

    Encode the cookies using base_64?

  6. #6
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by RichardKnox View Post
    Encode the cookies using base_64?
    It's easier to use sessions I'd say, they're clear and are secure.

Posting Permissions

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