Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logging off problem (Change of PHP Version.) 1

Status
Not open for further replies.

BadChough

Programmer
Dec 20, 2007
137
0
0
GB
I have just been advised by 1&1 hosting to update from 5.2 to 5.5 version of PHP for use on my sites. I have started the process and immediately run into a problem. Everything in the site functions OK (I think) but when I go to logout of the Members part of the site I get the following error message:
"Fatal error: Call to undefined function session_unregister() in /homepages/35/d406485504/htdocs/hopeless/writers2/edit/logout.php on line 14"
This is something new!
Line 14 reads:
Code:
session_unregister('MM_Username');
The whole section of code reads;
Code:
<?php require_once('../../../Connections/tormented3.php'); ?>
<?php
//initialize the session
session_start();

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  session_unregister('MM_Username');
  session_unregister('MM_UserGroup');
	
  $logoutGoTo = "../index.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>

Is that enough information for anyone to help me sort this out? I am using DW2004 to provide the coding, which I then fiddle about with until I get it to do what I want!
Thanks for looking.
 
The session_unregister() function was deprecated in PHP 5.3, and has been removed as of PHP 5.4. That means it no longer exists within PHP's core code.

You can use standard unset() method to remove a session variable.

Code:
unset($_SESSION['VARIABLE_NAME']);

I would strongly advise against trusting Dreamweaver's code generator. More so one as old as DW 2004.








----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
You're welcome.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Wow! this brings bag bad memories DW2004, I strongly suggest taking the time to bring this code to more recent technology because of security issue and also because that code isn't supported any longer by neither PHP nor Adobe.


AL Almeida
CIO
May all those that come behind us, find us faithful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top