SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    BoOm-Rocka! Smarky's Avatar
    Join Date
    Jun 2000
    Location
    England
    Posts
    1,319
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey how would you do one of these I simply can't get one to work here is the code i am using.

    <?php
    session_start();
    $user="";
    session_unregister('user');
    session_destroy();
    header("Location:../index.php");
    ?>

    here i have blanked the var and destroyed the session yet and page with session_start(); seems to put the old data back in. rendering the logout scirpt useless
    Garlic bread, I've tasted it, it's the future

  2. #2
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Remove the calls to session_destroy() and session_unregister() and see if that helps. The applications in which I've used sessions have never needed session_destroy(). My logout page, for example is as follows:

    PHP Code:
    <? include('useraccess.php'); ?>
    <?
        
    unset($userid);
        unset(
    $userpassword);
    ?>
    <p><strong>Logout Complete</strong></p>
    <p>You are no longer logged into the <STRONG>Project Web
    Site</STRONG>. If you wish to log in again, <a
    href="index.php">click here</a> to return to the login 
    page.</p>
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  3. #3
    BoOm-Rocka! Smarky's Avatar
    Join Date
    Jun 2000
    Location
    England
    Posts
    1,319
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    changed code to

    session_start();
    unset($user);
    unset($password);
    header("Location:../index.php");
    ?>


    seems to work now thanks alot (Again)
    Garlic bread, I've tasted it, it's the future

  4. #4
    Non-Member
    Join Date
    Apr 2000
    Location
    Waco, Texas.
    Posts
    188
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I always use:
    PHP Code:
    <?
    session_unset
    ();
    session_destroy();
    It seems to do the job.


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
  •