<!-- WARPZONE status --> <style type="text/css" media="screen"> #site-nav h3{ display: none; } #site-nav{ border: 0px; } .zonenstatus { padding: 15px 10px; display: block; color: #050000; font: 700 11px Sans-Serif; } </style> <script type="text/javascript"> function queryWankerStatus() { jQuery.getJSON("/api/status",function(result) { if (result != null && result.tuerOffen != null) { if (result.tuerOffen == 1) { jQuery("#wankerTuerOffen").html("<font color=\"00cc00\">Offen</font>"); } else { jQuery("#wankerTuerOffen").html("<font color=\"cc0000\">Geschlossen</font>"); } } if (result != null && result.tempLounge != null && result.tempLounge.length > 1) { var tempLounge = result.tempLounge.substring(0,2); if (result.tempLounge.length > 2) { tempLounge = tempLounge + ',' + result.tempLounge.substring(2,1); } jQuery("#wankerTempLounge").html(tempLounge); } if (result != null && result.tempWerkstatt != null && result.tempWerkstatt.length > 1) { var tempWerkstatt = result.tempWerkstatt.substring(0,2); if (result.tempWerkstatt.length > 2) { tempWerkstatt = tempWerkstatt + ',' + result.tempWerkstatt.substring(2,1); } jQuery("#wankerTempWerkstatt").html(tempWerkstatt); } }); setTimeout(queryWankerStatus, 30000); } jQuery(document).ready(function() { queryWankerStatus(); }); </script> <?php $wankerlink = mysql_pconnect('localhost', 'wanker', 'b2SGyye48tJjtjyY', false) or print(mysql_error()); mysql_select_db('warpzone_wanker', $wankerlink) or print("FehlerS:" . mysql_error()); $wankerQuery = "SELECT tempLounge, tempWerkstatt, tuerOffen FROM zonenstatus WHERE UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(time) < 600 ORDER BY time DESC LIMIT 1"; $wankerResult = mysql_query($wankerQuery, $wankerlink) or print("FehlerQ:" . mysql_error($wankerLink)); if(mysql_num_rows($wankerResult) > 0) { $wankerZonenArray = mysql_fetch_array($wankerResult) or print(mysql_error()); $wankerTempWerkstatt = ($wankerZonenArray['tempWerkstatt'] / 10); $wankerTempLounge = ($wankerZonenArray['tempLounge'] / 10); $wankerTuerOffen = $wankerZonenArray['tuerOffen'] == 0 ? "<font color=\"cccccc\">Geschlossen</font>" : "<font color=\"cccccc\">Offen</font>"; }else{ $wankerTempWerkstatt = $wankerTempLounge = $wankerTuerOffen = "<font color=\"cccccc\">Unbekannt</font>"; } mysql_close($wankerlink); ?> <ul> <li><span class="zonenstatus">Status: <span id="wankerTuerOffen" class="wankerClosed"><?php print($wankerTuerOffen); ?></span></span></li> <li><span class="zonenstatus">Lounge: <span id="wankerTempLounge"><?php print($wankerTempLounge); ?></span>°C</span></li> <li><span class="zonenstatus">Werkstatt: <span id="wankerTempWerkstatt"><?php print($wankerTempWerkstatt); ?></span>°C</span></li> </ul> <!-- /WARPZONE status -->