Professional Web Applications Themes

PHP sessions and cookies - PHP Development

Hello, Script login.php starts session with session_start(). Than I register some variables and navigate to second script- checkiflogged.php. The "check..." shows all my variables correctly nad has 2 links: <a href='phpcookiewon.php'>PHP WON</a> <a href='logout.php'>PHP logout</a> Logout.php is: <? session_destroy(); ?> <? setcookie ("PHPSESSID", "", time() - 3600); include 'checkiflogged.php'; ?> If I press link 1 notting happens and I see the same PHPSESSID as before. When I press link to logout I got "Trying to destroy uninitialized session in /logout.php on line 2". How can I delete the session cookie? Reagards, Talthen...

  1. #1

    Default PHP sessions and cookies

    Hello,
    Script login.php starts session with session_start(). Than I register some
    variables and navigate to second script- checkiflogged.php. The "check..."
    shows all my variables correctly nad has 2 links:
    <a href='phpcookiewon.php'>PHP WON</a>
    <a href='logout.php'>PHP logout</a>

    Logout.php is:
    <? session_destroy(); ?>

    <?
    setcookie ("PHPSESSID", "", time() - 3600);
    include 'checkiflogged.php';
    ?>

    If I press link 1 notting happens and I see the same PHPSESSID as before.
    When I press link to logout I got "Trying to destroy uninitialized session
    in /logout.php on line 2".

    How can I delete the session cookie?

    Reagards,
    Talthen


    Guest

  2. #2

    Default Re: PHP sessions and cookies

    > <? 


    The above is 'phpcookiewon.php'


    Guest

  3. #3

    Default Re: PHP sessions and cookies

    pl wrote: 
    Don't you have to start a next script operating in/on the same session
    with another session_start() on the first line ??? Not sure, but I
    thought so.
    In which case the logout script is incomplete and logically is trying to
    close a session it has nothing to do with...

    GL
    Schraalhans
    Schraalhans Guest

  4. #4

    Default Re: PHP sessions and cookies

    "Schraalhans Keukenmeester" ; 

    I did. The problem was that "session_destroy(); " wasn't destroying ;/

    Regards,
    Talthen


    Guest

Similar Threads

  1. Cookieless Sessions (Sessions Without Cookies) and Security
    By scottymo in forum ASP.NET Security
    Replies: 3
    Last Post: September 29th, 11:00 PM
  2. Cookies and Sessions
    By in forum PHP Development
    Replies: 2
    Last Post: September 21st, 02:52 PM
  3. Replies: 5
    Last Post: September 14th, 05:46 AM
  4. [PHP] Sessions GET vs. Cookies
    By Chris Shiflett in forum PHP Development
    Replies: 2
    Last Post: July 28th, 09:55 AM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139