SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cookie checking and loggin out

    Would this be an effective way to delete a cookie, then refresh the page so it displays the correct message? (displays logged in if cookie exists, not logged in if it doesn't)
    PHP Code:
    $is_set $HTTP_COOKIE_VARS['cookie_name'];

    if(
    $is_set != ""// $is_set has a value, so cookie exists/
    {
        
    setcookie("3dartisan_username"""time() - 100);
        
    setcookie("3dartisan_password"""time() - 100);
        
    header("Location: $PHP_SELF"); // refresh the page to display correct message

    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  2. #2
    SitePoint Guru Marc's Avatar
    Join Date
    Nov 2000
    Location
    New York
    Posts
    765
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm thinking yea, but you could also do this..
    PHP Code:


    if(isset($HTTP_COOKIE_VARS['cookie_name'])) // $is_set has a value, so cookie exists/
    {
        
    setcookie("3dartisan_username"""time() - 100);
        
    setcookie("3dartisan_password"""time() - 100);
        
    header("Location: $PHP_SELF"); // refresh the page to display correct message

    Marc Gugliuzza
    marc.gugliuzza.com




Bookmarks

Posting Permissions

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