Ok, this is the first try to make LotGD 0.9.7 compatible with PHP 5. The following list contains changes worked out by Zarzal and me. Those are the necessary changes only! There are still a lot of lines that are not clean to PHP 5 but it runs smooth anyway. With those changes LotGD works with all available PHP versions above 4.3.4. It even works if the PHP developers decide to make "now" a real "now" again.
We don't give any guaranties.

("->" stands for "replace the above with".)
about.php:
$time = (strtotime(date("1971-m-d H:i:s",strtotime("now -".getsetting("gameoffsetseconds",0)." seconds"))))*getsetting("daysperday",4) % strtotime("1971-01-01 00:00:00");
->
$time = (strtotime(date("1971-m-d H:i:s",strtotime(date("r")."-".getsetting("gameoffsetseconds",0)." seconds"))))*getsetting("daysperday",4) % strtotime("1971-01-01 00:00:00");
--
"Next new gameday: ".date("h:i:s a",strtotime("+$realsecstotomorrow seconds"))." (".date("H\\h i\\m s\\s",strtotime("1970-01-01 00:00:00 + $realsecstotomorrow seconds"))."),viewonly",
->
"Next new gameday: ".date("h:i:s a",strtotime(date("r")."+$realsecstotomorrow seconds"))." (".date("H\\h i\\m s\\s",strtotime("1970-01-01 00:00:00 + $realsecstotomorrow seconds"))."),viewonly",
common.php:
$sql="SELECT name,alive,location,sex,level,laston,loggedin,lastip,uniqueid FROM accounts WHERE locked=0 AND loggedin=1 AND laston>'".date("Y-m-d H:i:s",strtotime("-".getsetting("LOGINTIMEOUT",900)." seconds"))."' ORDER BY level DESC";
->
$sql="SELECT name,alive,location,sex,level,laston,loggedin,lastip,uniqueid FROM accounts WHERE locked=0 AND loggedin=1 AND laston>'".date("Y-m-d H:i:s",strtotime(date("r")."-".getsetting("LOGINTIMEOUT",900)." seconds"))."' ORDER BY level DESC";
--
$time = convertgametime(strtotime("now"));
->
$time = convertgametime(strtotime(date("r")));
--
function convertgametime($intime){
$time = (strtotime(date("1971-m-d H:i:s",strtotime("-".getsetting("gameoffsetseconds",0)." seconds",$intime))))*getsetting("daysperday",4) % strtotime("1971-01-01 00:00:00");
return $time;
}
->
function convertgametime($intime){
$multi = getsetting("daysperday",4);
$offset = getsetting("gameoffsetseconds",0);
$fixtime = mktime(0,0,0-$offset,date("m")-$multi,date("d"),date("Y"));
$time=$multi*(strtotime(date("Y-m-d H:i:s",$intime))-$fixtime);
$time=strtotime(date("Y-m-d H:i:s",$time)."+".($multi*date("I",$intime))." hour");
$time=strtotime(date("Y-m-d H:i:s",$time)."-".date("I",$time). " hour");
$time=strtotime(date("Y-m-d H:i:s",$time)."+".(23-$multi)." hour");
return $time;
}
--
$sql = "DELETE from debuglog WHERE date <'".date("Y-m-d H:i:s",strtotime("-".(getsetting("expirecontent",180)/10)." days"))."'";
->
$sql = "DELETE from debuglog WHERE date <'".date("Y-m-d H:i:s",strtotime(date("r")."-".(getsetting("expirecontent",180)/10)." days"))."'";
--
if (strtotime("-".getsetting("LOGINTIMEOUT",900)." seconds") > $session['lasthit'] && $session['lasthit']>0 && $session[loggedin]){
->
if (strtotime(date("r")."-".getsetting("LOGINTIMEOUT",900)." seconds") > $session['lasthit'] && $session['lasthit']>0 && $session[loggedin]){
--
$session[lasthit]=strtotime("now");
->
$session[lasthit]=strtotime(date("r"));
configuration.php:
$time = (strtotime(date("1971-m-d H:i:s",strtotime("now -".getsetting("gameoffsetseconds",0)." seconds"))))*getsetting("daysperday",4) % strtotime("1971-01-01 00:00:00");
->
$time = (strtotime(date("1971-m-d H:i:s",strtotime(date("r")."-".getsetting("gameoffsetseconds",0)." seconds"))))*getsetting("daysperday",4) % strtotime("1971-01-01 00:00:00");
--
"Last new day: ".date("h:i:s a",strtotime("-$realsecssofartoday seconds")).",viewonly",
"Next new day: ".date("h:i:s a",strtotime("+$realsecstotomorrow seconds")).",viewonly",
->
"Last new day: ".date("h:i:s a",strtotime(date("r")."-$realsecssofartoday seconds")).",viewonly",
"Next new day: ".date("h:i:s a",strtotime(date("r")."+$realsecstotomorrow seconds")).",viewonly",
dag.php:
$laston=round((strtotime("0 days")-strtotime($row[laston])) / 86400,0)." days";
->
$laston=round((strtotime(date("r"))-strtotime($row[laston])) / 86400,0)." days";
inn.php:
$pvptimeout = date("Y-m-d H:i:s",strtotime("-$pvptime seconds"));
->
$pvptimeout = date("Y-m-d H:i:s",strtotime(date("r")."-$pvptime seconds"));
--
(laston < '".date("Y-m-d H:i:s",strtotime("-".getsetting("LOGINTIMEOUT",900)." sec"))."' OR loggedin=0) AND
->
(laston < '".date("Y-m-d H:i:s",strtotime(date("r")."-".getsetting("LOGINTIMEOUT",900)." sec"))."' OR loggedin=0) AND
list.php:
$sql = "SELECT acctid,name,login,alive,location,sex,level,laston,loggedin,race FROM accounts WHERE locked=0 AND loggedin=1 AND laston>'".date("Y-m-d H:i:s",strtotime("-".getsetting("LOGINTIMEOUT",900)." seconds"))."' ORDER BY level DESC, dragonkills DESC, login ASC";
->
$sql = "SELECT acctid,name,login,alive,location,sex,level,laston,loggedin,race FROM accounts WHERE locked=0 AND loggedin=1 AND laston>'".date("Y-m-d H:i:s",strtotime(date("r")."-".getsetting("LOGINTIMEOUT",900)." seconds"))."' ORDER BY level DESC, dragonkills DESC, login ASC";
--
$laston=round((strtotime("0 days")-strtotime($row[laston])) / 86400,0)." days";
->
$laston=round((strtotime(date("r"))-strtotime($row[laston])) / 86400,0)." days";
logdnet.php:
if (strtotime($row[lastupdate])<strtotime("-1 minutes")){
->
if (strtotime($row[lastupdate])<strtotime(date("r")."-1 minutes")){
login.php:
$sql="SELECT laston,loggedin FROM accounts WHERE locked=0 AND loggedin=1 AND laston>'".date("Y-m-d H:i:s",strtotime("-".getsetting("LOGINTIMEOUT",900)." seconds"))."' ORDER BY level DESC";
->
$sql="SELECT laston,loggedin FROM accounts WHERE locked=0 AND loggedin=1 AND laston>'".date("Y-m-d H:i:s",strtotime(date("r")."-".getsetting("LOGINTIMEOUT",900)." seconds"))."' ORDER BY level DESC";
--
$sql = "INSERT INTO bans VALUES ('{$_SERVER['REMOTE_ADDR']}','','".date("Y-m-d H:i:s",strtotime("+".($c*3)." hours"))."','Automatic System Ban: Too many failed login attempts.')";
->
$sql = "INSERT INTO bans VALUES ('{$_SERVER['REMOTE_ADDR']}','','".date("Y-m-d H:i:s",strtotime(date("r")."+".($c*3)." hours"))."','Automatic System Ban: Too many failed login attempts.')";
pvp.php:
$pvptimeout = date("Y-m-d H:i:s",strtotime("-$pvptime seconds"));
->
$pvptimeout = date("Y-m-d H:i:s",strtotime(date("r")."-$pvptime seconds"));
--
(laston < '".date("Y-m-d H:i:s",strtotime("-".getsetting("LOGINTIMEOUT",900)." sec"))."' OR loggedin=0) AND
->
(laston < '".date("Y-m-d H:i:s",strtotime(date("r")."-".getsetting("LOGINTIMEOUT",900)." sec"))."' OR loggedin=0) AND
--
if (strtotime($row[laston]) > strtotime("-".getsetting("LOGINTIMEOUT",900)." sec") && $row[loggedin]){
->
if (strtotime($row[laston]) > strtotime(date("r")."-".getsetting("LOGINTIMEOUT",900)." sec") && $row[loggedin]){
referers.php
$sql = "DELETE FROM referers WHERE last<'".date("Y-m-d H:i:s",strtotime("-".getsetting("expirecontent",180)." days"))."'";
->
$sql = "DELETE FROM referers WHERE last<'".date("Y-m-d H:i:s",strtotime(date ("r")."-".getsetting("expirecontent",180)." days"))."'";
--
$diffsecs = strtotime("now")-strtotime($row['last']);
->
$diffsecs = strtotime(date("r"))-strtotime($row['last']);
superuser.php:
$laston=round((strtotime("0 days")-strtotime($row[laston])) / 86400,0)." Tage";
->
$laston=round((strtotime(date("r"))-strtotime($row[laston])) / 86400,0)." Tage";
user.php:
$sql = "UPDATE accounts SET lasthit='".date("Y-m-d H:i:s",strtotime("-".(86500/getsetting("daysperday",4))." seconds"))."' WHERE acctid='$_GET[userid]'";
->
$sql = "UPDATE accounts SET lasthit='".date("Y-m-d H:i:s",strtotime(date("r")."-".(86500/getsetting("daysperday",4))." seconds"))."' WHERE acctid='$_GET[userid]'";
--
$sql.=",\"".((int)$_POST[duration]==0?"0000-00-00":date("Y-m-d",strtotime("+$_POST[duration] days")))."\",";
->
$sql.=",\"".((int)$_POST[duration]==0?"0000-00-00":date("Y-m-d",strtotime(date("r")."+$_POST[duration] days")))."\",";
--
$expire=round((strtotime($row[banexpire])-strtotime("now")) / 86400,0)." days";
->
$expire=round((strtotime($row[banexpire])-strtotime(date("r"))) / 86400,0)." days";
--
$laston=round((strtotime("0 days")-strtotime($row[laston])) / 86400,0)." days";
->
$laston=round((strtotime(date("r"))-strtotime($row[laston])) / 86400,0)." days";
special/darkhorse.php
(3x):
$HTTP_GET_VARS[try]
-> (3x):
$HTTP_GET_VARS['try']
special/oldmanbet.php
(2x):
$HTTP_GET_VARS[try]
-> (2x):
$HTTP_GET_VARS['try']
You can use the same (or similar) changes in 0.9.8 prerelease to make it PHP 5 compatible.
If you find something we missed please let us know.