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

New to Arrays
Hi I am new to PHP (a week and a half now) and I am just beginning to read about arrays. I understan

mysql timestamp manipulation
How could I use a timestamp (e.g 2009-10-30 13:20:35 ), and with php find out if it is:

from

Help with Password Encoding/Decoding?
Trying to design a "change password" tool. On my signup code I'm using base64_encode, now

Trouble with a select list
Hello All!
I was wondering if any of you guys could help me with a small problem I'm having!

natcasesort works on one server but not on another
Hi

I have a problem that I was hoping that someone can help me with.

I'm trying to use

Keeping track of php uploads
Hello all.

I was looking at the way PHP handles file uploads.
It seems that PHP uses a tem

Using Curl_multi for processing multiple URLs
Hi,

I am at a loss as to how to implement this. I would like to be able to automatically assi

need to add "sizes" to shopping cart
Hey guys, I am trying to figure out a way to add a "size" selector on to this bit of code.

Problem writing URL into database
How would I write this into the database?

<?php echo "http://".$_SERVER['SER

delete comma
HI,

How to delete "," at the end of the string.
Code: $match = 2009/02/03/a2corr

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