How to work with disabled cookies?

Discussion in 'PHP' started by markzero, Nov 10, 2009.

  1. #1
    Question is simple.
    I do not want to use session id because I heard that crawlers test your pages without cookies and then we get an ugly link (is this true?)

    So, my decision is just not letting users use site if cookies are disabled (gmail does this)
    My idea is to redirect with header at the beginning of index.php to another php, there set cookie, return to index.php and check there for cookie. But this will create eternal loop

    Any ideas?
     
    markzero, Nov 10, 2009 IP
  2. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #2
    Why not just something like this

    Set a cookie and check it on same page itself ??

    setcookie("user", "Test Cookie", time()+3600);
    if (isset($_COOKIE["user"]))
    Proceed
    else
    exit and do whatever u want it too
     
    Bohra, Nov 11, 2009 IP
  3. markzero

    markzero Peon

    Messages:
    133
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    when you use setcookie, you can't just proceed, you need to refresh a page
    didn't have time to think a lot, but it could be done with more than 2 pages involed since a page has to be reloaded or redirected to check for a cookie
    i've just put warning with some onclick javascript window, like "you must enable cookies" near login area
     
    markzero, Nov 11, 2009 IP