Hi everyone.
I did PHP back at Uni almost 5 years ago.. got 98% overall with my coding assignments.. but have not touched it since... I know the basics I guess of the programming language but I am now pretty much unfamiliar with even the basics...
My problem is now I have decided to get back into it.. and my first problem is trying to modify some PHP code that was created to run on a PHP 4 server (or earlier not really sure). And I am updating it to be compatible with a newer PHP 5 server.
Here is the code in its original form:
Code:
<?php require_once('../Connections/confirm.php'); ?>
<?php
session_start();
$loginFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($accesscheck)) {
$GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}
if (isset($HTTP_POST_VARS['username'])) {
$loginUsername=$HTTP_POST_VARS['username'];
$password=$HTTP_POST_VARS['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "adminentry.php";
$MM_redirectLoginFailed = "index.php?badlogin=true";
$MM_redirecttoReferrer = false;
mysql_select_db($database_name, $name);
$LoginRS__query=sprintf("SELECT name, pass FROM admin WHERE name='%s' AND pass='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $name) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($HTTP_SESSION_VARS['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $HTTP_SESSION_VARS['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
I am aware that the HTTP_SERVER_VARS is no longer cool to use.. but how to modify the code to be acceptable is messing with my head.. I replaced HTTP_SERVER_VARS with $GET, and the page did nothing.. no errors.. it displayed okay.. just didnt actually do anything...
Any help would be greatly appreciated.