Connecting Tech Pros Worldwide Forums | Help | Site Map

logout script not functioning

Newbie
 
Join Date: Feb 2007
Posts: 20
#1: Feb 15 '07
I have created a log in system and logging in is functioning but logging out is not working its showing error warnings.

logout.php
[PHP]
<?
//include function files for this application
require_once("system_fns.php");
session_start();
$old_user = $valid_user; //store to test if *were* logged in
$result_unreg = session_unregister("valid_user");
$result_dest = session_destroy();
//start output html
do_html_header("Logging Out");

if(!empty ($old user))
{
if($result_unreg && result_dest)
{
//if they were logged in and are now logged out
echo "Logged Out.<br>";
do_html_url("login.php", "Login");
}
else
{
//they were logged in and could not be logged out
echo "Could not log you out.<br>";
}
}
else
{
//if they were logged in but came to this page somehow
echo "You were not logged in, and so you have been logged out.<br>";
do_html_url("login.php", "Login");
}
?>
[/PHP]

This is the error I'm getting.
Parse error: parse error, unexpected T_STRING, expecting ')' in C:\project\test\logout.php on line 11
Here is code at line 11
[PHP]
if(!empty ($old user))
[/PHP]
Any is greatly appreciated.

Newbie
 
Join Date: Jul 2006
Posts: 14
#2: Feb 16 '07

re: logout script not functioning


Quote:

Originally Posted by muchexie

I have created a log in system and logging in is functioning but logging out is not working its showing error warnings.

logout.php
[PHP]
<?
//include function files for this application
require_once("system_fns.php");
session_start();
$old_user = $valid_user; //store to test if *were* logged in
$result_unreg = session_unregister("valid_user");
$result_dest = session_destroy();
//start output html
do_html_header("Logging Out");

if(!empty ($old user))
{
if($result_unreg && result_dest)
{
//if they were logged in and are now logged out
echo "Logged Out.<br>";
do_html_url("login.php", "Login");
}
else
{
//they were logged in and could not be logged out
echo "Could not log you out.<br>";
}
}
else
{
//if they were logged in but came to this page somehow
echo "You were not logged in, and so you have been logged out.<br>";
do_html_url("login.php", "Login");
}
?>
[/PHP]

This is the error I'm getting.
Parse error: parse error, unexpected T_STRING, expecting ')' in C:\project\test\logout.php on line 11
Here is code at line 11
[PHP]
if(!empty ($old user))
[/PHP]
Any is greatly appreciated.

check this page
[PHP] do_html_header("Logging Out");[/PHP]
i am not able to see any extensions here
Newbie
 
Join Date: Feb 2007
Posts: 20
#3: Feb 16 '07

re: logout script not functioning


Quote:

Originally Posted by aniltc

check this page
[PHP] do_html_header("Logging Out");[/PHP]
i am not able to see any extensions here

Maybe I did not get your question right but the way I understand this code.
[PHP]
do_html_header("Logging Out");
[/PHP]
It only outputs the statement Logging Out.I don't think it should have the extensions you are talking about.
Reply