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

319 Like 48 Dislike
Previous php-forum Next php-forum
Other php-forum

Weird MySQL error, why am I recieving this?
PHP Code:


<?php require "global_settings.php"; ?>
<titl

passing data from one page to another
hey guys
i have the follwoing code to get information from one page and place on another:

Code working in IE but not FireFox
I created a dynamic navigation list for my website based off of a table in my database. The code is

New to PHP and just trying to understand a little code.
I hope I'm not annoying anyone or breaking the rules but I was wondering about this bit of code righ

url- go to webpage
i have an input text field and submit button.

how do i make the url entered into the textfiel

VAT
how should I deal with VAT?

if I have a product that costs £5.00 and VAT @ 17.5% (£0.87

do while...woes
I'm sure this is childsplay but it is stumping me, everytime i try what I think would make this work

Script not running properly
Hello Everyone
This is a basic script for posting to a database. I'm not sure why it doesn't work

check if value exists
I have googled this for a while and I am getting lots of different results. Is there a standard meth

help with email script...
hey

I need help with my mail script

when the form on http://www.mcgdesignstudio.com/c

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