Some functions not working on php upgrade


#1

I have a website running compwebchess, a now defunct open source chess playing software. My host is upgrading to php 5, and I have been testing the site on php 5 and mysql 5 on localhost. Some functions do not work. I would be grateful for any help offered.

The next page function does not work when listing games or players. On older versions of php you could go to a page listing players, and click through page 2, page 3 etc and the list would change correspondingly:

For example pagina3 would show a different list of players to pagina2:
http://localhost/gweinydd/dyffrynaeron.org/gwyddbwyll/inviteplayer.php?order=rating&order2=DESC&ponline=&pagina=3

This is the code for the relevant part of the page:

[php]

<?=$MSG_LANG['page']?>:

<? if ($slevel =="1"){ $level = getPlayerLevel($_SESSION['playerID']); echo $MSG_LANG["mylevel"].": $level (".getXPmin($level)."-".getXPmax($level).")
"; } $order = $_GET['order']; $computer = $_GET['computer']; $ponline = $_GET['ponline']; $letra = $_GET['letra']; if ($letra == "") $letra = "A"; if (!isset($order)) $order="rating"; if (!isset($order2)) $order2 = "DESC"; if ($order2 == "ASC") $order2inv = "DESC"; else $order2inv = "ASC"; if ($order=="firstName") $order="substring(firstName,0,5)"; if ($computer == "1") $tmpQuery="SELECT * FROM players WHERE engine='1' AND ativo='1' and rating>0 ORDER BY rating,substring(firstName,0,5)"; else if ($slevel == "1") $tmpQuery="SELECT * FROM players WHERE engine='0' AND firstName like '$letra%' and rating<=".getXPmax($level)." AND rating >= ".getXPmin($level)." AND playerID <>".$_SESSION['playerID']." AND ativo='1' and rating>0 ORDER BY rating"; else if ($ponline == "1"){ $tempo = time()-300; $tmpQuery = "SELECT * FROM players WHERE lastUpdate>='$tempo' AND engine='0' and playerID <> ".$_SESSION['playerID']." AND ativo='1' and rating>0 ORDER BY $order"; }else if ($order == "rating" || $order == "pais") $tmpQuery="SELECT * FROM players WHERE engine='0' AND playerID <> ".$_SESSION['playerID']." AND ativo='1' and rating>0 ORDER BY $order $order2"; else if (isset($_GET['cod'])) $tmpQuery="SELECT * FROM players WHERE playerID=".$_GET['cod']; else $tmpQuery="SELECT * FROM players WHERE engine='0' AND firstName like '$letra%' and playerID <> ".$_SESSION['playerID']." AND ativo='1' and rating>0 ORDER BY $order"; if ($order == "substring(firstName,0,5)" && $ponline != "1") for ($l=65; $l<=90; $l++) echo "[".chr($l)."] "; else{ $perpage = $CFG_PERPAGE_LIST; if ($pagina=="") $pagina=1; $inicio = $perpage * $pagina - $perpage; $fim = $perpage * $pagina; $rs = mysql_query($tmpQuery); $rows = mysql_num_rows($rs); $ultima = ceil($rows/$perpage); if ($rows <= $fim)$proxima=FALSE; else $proxima=TRUE; $tmpQuery .= " LIMIT $inicio,$perpage"; if ($pagina-1 >0) echo "[«]"; else echo "[«]"; $b=1; for ($pg=1 ; $pg<=$ultima ; $pg++){ if ($pg != $pagina)echo " [$pg]"; else echo " [$pg] "; if (floor($pg/23) == $b){ echo "
"; $b++; } } if ($proxima) echo "[»]"; else echo "[»]"; } ?>

[/php]


#2

Well, a quick review of the code and nothing jumps out at me as incorrect.
Which line is giving you problems? Not sure where your “next page function” in the code…
Usually, when upgrading versions of PHP, you would just look thru the change-list and see
if anything jumps out at you. Here is the log for ver5.4:
http://php.net/ChangeLog-5.php
Only the first part is important because it lists items no longer used. (Ones dropped and not available)
Make sure you are not using anything from the first part of the list.

Let us know where your code is failing and we can look deeper into it for you. good luck…