By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,664 Members | 1,612 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,664 IT Pros & Developers. It's quick & easy.

logout script not functioning

P: 20
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.
Feb 15 '07 #1
Share this Question
Share on Google+
2 Replies


P: 17
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
Feb 16 '07 #2

P: 20
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.
Feb 16 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.