Re: DIRECTLY GO TO LOGIN PAGE AFTER CLICKING ?LOGOUT? LINK

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The following code works fine. 

<?php
        //Start session
        session_start();

        //Unset the variables stored in session
        unset($_SESSION['SESS_MEMBER_ID']);
        unset($_SESSION['SESS_FIRST_NAME']);
        unset($_SESSION['SESS_LAST_NAME']);

header("Location:index.php");

?>

Thanks for the excellent hint.

- Shan -


--- In php-objects@xxxxxxxxxxxxxxx, vijaya lakshmi <vijayalakshmi6jun@...> wrote:
>
> <?php
> //Start session
> session_start();
> 
> //Unset the variables stored in session
> unset($_SESSION['SESS_MEMBER_ID']);
> unset($_SESSION['SESS_FIRST_NAME']);
> unset($_SESSION['SESS_LAST_NAME']);
> 
>  header("Location:login.php");
> 
> 
> ?>
> 
> 
> 
> On Wed, Sep 29, 2010 at 8:56 PM, shanro_im <shanro_im@...> wrote:
> 
> >
> >
> > Hi all,
> > My sample project opens "index.php" page for user login. On successful
> > login it opens "member-index.php". When "Logout" link on "member-index.php"
> > is clicked, it opens "logout.php" which has a link for login again.
> >
> > Please advise how can I avoid displaying "logout.php" and directly go to
> > "index.php" when clicking "Logout" link on "member-index.php".
> >
> > "member-index.php" - Code
> > =========================
> > <?php
> > require_once('auth.php');
> > ?>
> > <head>
> > <title>Member Index</title>
> > <link href="loginmodule.css" rel="stylesheet" type="text/css" />
> > </head>
> > <body>
> > <h1>Welcome <?php echo $_SESSION['SESS_FIRST_NAME'];?></h1>
> > <a href="member-profile.php">My Profile</a> | <a
> > href="logout.php">Logout</a>
> > <p>This is a password protected area only accessible to members. </p>
> > </body>
> > </html>
> >
> > "logout.php" - Code
> > ===================
> > <?php
> > //Start session
> > session_start();
> >
> > //Unset the variables stored in session
> > unset($_SESSION['SESS_MEMBER_ID']);
> > unset($_SESSION['SESS_FIRST_NAME']);
> > unset($_SESSION['SESS_LAST_NAME']);
> > ?>
> > <head>
> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
> > <title>Logged Out</title>
> > <link href="loginmodule.css" rel="stylesheet" type="text/css" />
> > </head>
> > <body>
> > <h1>Logout </h1>
> > <p align="center">&nbsp;</p>
> > <h4 align="center" class="err">You have been logged out.</h4>
> > <p align="center">Click here to <a href="index.php">Login</a></p>
> > </body>
> > </html>
> >
> > Thanks
> >
> > Shan
> >
> > 
> >
> 
> 
> 
> -- 
> Thanks & Regards
> Vijayalakshmi
> 
> 
> [Non-text portions of this message have been removed]
>



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux