Logout session

General discussion on PHP
Post Reply
will5247
Posts: 18
Joined: Sun Jun 01, 2014 4:38 am

Logout session

Post by will5247 » Sun Apr 03, 2016 3:27 am

I am working in the latest version of Zend Studio.. but nothing works i have a structure as follows

logout.php which contains

session_destroy();

redirect("index.php");

then i have my index.php page which is my home page

what i am trying to do is when they click logout link it goes to home page and says "Logout successful!!" I have tried this

logout.php

session_destroy();

set_message('<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
Logged Out Successfully!</div>');

redirect("index.php");


then on my index.php

<?php display_message();?>




in my functions.php i have


function set_message($message)
{
if (! empty($message)) {

$_SESSION['message'] = $message;
} else {

$message = "";
}
}

function display_message()
{
if (isset($_SESSION['message'])) {
echo $_SESSION['message'];
unset($_SESSION['message']);
}
}

scottgcampbell
Posts: 187
Joined: Wed Apr 22, 2009 2:29 pm
Location: Edmonton, AB, Canada

Re: Logout session

Post by scottgcampbell » Tue Apr 12, 2016 5:52 pm


raph1810
Posts: 1
Joined: Wed Jun 01, 2016 3:10 am

Re: Logout session

Post by raph1810 » Wed Jun 01, 2016 3:11 am

nice

Post Reply