Hi
My web hosting company has updated their PHP and as a consequence my login script has stopped working. From what I have found out the session register() is no longer used and that $_SESSION should be used instead.
Can anyone give me some ideas on how to change the script so I can get this working again as I can’t log in to my website otherwise.
Thank you in advance.
Phil
[php]<?php require_once('../Connections/phcleani_forms.php'); ?>
<?php
mysql_select_db($database_phcleani_forms, $phcleani_forms);
$query_Recordset1 = "SELECT * FROM applicants";
$Recordset1 = mysql_query($query_Recordset1, $phcleani_forms) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php
// *** Validate request to login to this site.
session_start();
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($accesscheck)) {
$GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}
if (isset($_POST['name'])) {
$loginUsername=$_POST['name'];
$password=$_POST['email'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "success.php";
$MM_redirectLoginFailed = "index.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_phcleani_forms, $phcleani_forms);
$LoginRS__query=sprintf("SELECT username, password FROM applicants WHERE username='%s' AND password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $phcleani_forms) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$GLOBALS['MM_Username'] = $loginUsername;
$GLOBALS['MM_UserGroup'] = $loginStrGroup;
//register the session variables
session_register("MM_Username");
session_register("MM_UserGroup");
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
Untitled Document
<?php
mysql_free_result($Recordset1);
?>
[/php]