Re: DIRECTLY GO TO LOGIN PAGE AFTER CLICKING ?LOGOUT? LINK
Please add the code
// add this vode
header('Location: index.php');
next to the below code
//Unset the variables stored in session
unset($_SESSION['SESS_MEMBER_ID']);
unset($_SESSION['SESS_FIRST_NAME']);
unset($_SESSION['SESS_LAST_NAME']);
you have written in your "logout.php" file, and you are done.
Regards,
Anil
--- In php-objects@xxxxxxxxxxxxxxx, "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"> </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
>
[PHP Home]
[PHP Users]
[PHP Soap]
[Kernel Newbies]
[Yosemite]
[Yosemite Campsites]