SimplePortal

Customization => Custom Coding => Topic started by: mons00n on November 05, 2010, 05:57:03 PM

Title: PHP block broken after update
Post by: mons00n on November 05, 2010, 05:57:03 PM
We're running SMF 2.0 RC4 and up until today was running SP 2.3.2, which is now updated to 2.3.3

We had a small PHP script to check if a server was online or not that worked fine in a custom php block:

Code: [Select]
<?
function servstat($name, $host, $port) {
?>
<tr>
<td> <?echo($name); ?> </td>
<td>  -  </td>
<?
@$socket = fsockopen($host, $port,$errno,$errstr,5);
 if(!$socket) {
  ?> <td> <b> <font color = "red"> Offline! </font> </b> </td><?
 } else {
  fclose($socket);
  ?> <td> <b> <font color = "green"> Online! </font> </b> </td><?
 }
?> </tr> <?
}
?> <table border = "0" align="center">
 <?
servstat("MC Server", "IPADDRESS",PORT);
servstat("Vent Server", "IPADDRESS",PORT);
?> </table>

which worked fine, but after the update it only shows a blank box.  Does anyone have any ideas why this stopped working after the update of SP?  Thanks for your time!
Title: Re: PHP block broken after update
Post by: Nathaniel on November 05, 2010, 06:32:25 PM
Use "<?php" not "<?".
Title: Re: PHP block broken after update
Post by: mons00n on November 05, 2010, 11:19:13 PM
thanks for dealing with my php ignorance =)

worked like a charm!
SimplePortal 2.3.8 © 2008-2024, SimplePortal