session_destroy();


Posted on 16th Feb 2014 07:03 pm by admin

new to php
I have a simple login and am trying to write a logout.
I set a $_SESSION var to 1 if they are logged in:

if(isset($_POST['logname']))
{
$UserArr = chk_lgn($_POST['logname'],$_POST['passwd']);
$_SESSION['iden'] = $UserArr['UserId'];
$_SESSION['logname'] = $UserArr['logname'];
}

if($_SESSION['iden'] !=0)
{
$_SESSION['auth'] = 1;
header('location:../UserPage/index.php');
}

elseif($_SESSION['iden'] == 0)
{
$_SESSION['auth'] = 0;
if($_POST){echo "Try Again.";}
}

In a include file I have this function:

function log_out()
{
if($_GET[auth==0])
{
session_unset();
session_destroy();
}
}

At the top(of index) I call the function, fallowed this in the html:

<p><a href="../index.php?auth=0">LogOut</a></p>

When I click logout I am still able to navigate to member pages.
Shouldn't auth=0 in the url be stored in $_GET and be available for logout?
Thanks

No comments posted yet

Your Answer:

Login to answer
319 Like 48 Dislike
Previous forums Next forums
Other forums

Save cookie to DB
I'm working on a pixel tracking script for an incentive website and I need to use an ASP script to s

Help with captcha script needed
Hello,

I am working on a script where reCAPTCHA or a similar form of CAPTCHA will be used, f

Parse Error Help
Hello, I got the parse error "Parse error: syntax error, unexpected ',' in register.php on line

gmmktime or mktime
I live in the UK, i am within the GMT (with daylight saving time ie 1 hour difrence between summer a

Using Windows message as a Handle
Hi,

I am writing one of my first multithreaded programs.

In one of the thread,

Help With editting and deleting form
Hallo !!

So look at this image :

http://img194.imageshack.us/img194/8272/snapshot5f.pn

Display certain image depending on time of year
Hi, I am new to these forums and would really appreciate some advice on a piece of coding I have don

Track downloads' status
Hello,

I need to make somehow, some system, to track whether downloads are completed or faile

need help about
i store the value of my select statement result to an array and stored it to a variable named $fname

curl javascript problem
Hi Experts.
I'm new curl and wanna to get some info from this http://www.amadeus.net/

when

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash