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

Ball movement
I want to move a ball from one point to another and it should hit a group of balls at the other end

MySQL Primary key gap
Alright, so I have a table with 26 entries in it (id, filename, caption) for my image randomiser (ht

how can we add data from dynamic fields to mysql db in php
i have a script which i found on the internet. i modify that script according to my needs. what is i

Multi-image upload problems
Lets see if I can get some help on this one. Can anyone show me what I am doing wrong here. I'm just

What am I missing here? Help!
Hello all!. I can't seem to get this working right. Well - it renders right, but something is goin

registration form
first time posting. did some searches but didnt find exactly what i am looking for. dont flame cause

Count on multidimensional array
Hi, i got an array as below:

Array
(
=> Array
(

News script
Hi ...

I am not sure if this is the rite place to post this but if its not sorry

i am

Mail Script Problems
I have created a PHP mail script. I am having a problem though. In $body i am trying to put two va

While Problem
i am having a problem with a while statement here is the code
Code: [Select]<?php
sess

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