Need help with a login script which stopped working after my IP-host upgraded the server to PHP 5.3
The script is really old! It was once developed in php3 about 6-7 (?) years ago. It has gradually stopped working on some platforms (browser) since a few months back, but now noone can access the site anymore ! The guy who developed it for me is no longer around, and I’m not proficient in PHP…Really thankful for all help I can get!
[php]<?php
include("…/losen.php");
$logindb = “brf_L”;
$logintable = “Login”;
$username = $HTTP_COOKIE_VARS[“usernamecookie”];
$andelnr = getandel();
function getandel() {
global $username, $logindb;
initdb($logindb);
$svar = mysql_query(“SELECT Andel FROM Login WHERE user=’$username’”) or die (“Invalid query”);
$nummer = mysql_result($svar, Andel);
if ($nummer < 10) {
$andel = “Andel0$nummer”;
} else {
$andel = “Andel$nummer”;
}
return $andel;
}
function initdb($db) {
global $hostname, $mysqluser, $mysqlpassword;
mysql_pconnect($hostname,$mysqluser,$mysqlpassword) or die(“Unable to connect to SQL server”);
mysql_select_db($db) or die(“Unable to select database”);
}
function nytid() { //writes new time in the table
$time = time();
// initdb($logindb);
mysql_query(“UPDATE Login SET time=’$time’ WHERE user=’$username’”) or die(“Unable to perform insert”);
}
function inloggad() { //tests if you are logged in
//user name from cookie
//checks if time is OK and if IP is the same
$mintime = time() - 54000; //time in db should be at least 15 m from now
global $username, $REMOTE_ADDR, $logindb;
initdb($logindb);
$inlogdat = mysql_query(“SELECT * FROM Login WHERE user=’$username’ AND ip=’$REMOTE_ADDR’ AND time>’$mintime’”) or die (“Invalid query 1”);
$rows = mysql_num_rows($inlogdat);
return $rows;
}
function htmlpage() { // This is where the HTML page starts
?>