3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php include(__DIR__ . '/config.php'); global $_CONFIG; if(!array_key_exists('code', $_GET) || $_GET['code'] != $_CONFIG['code']) exit; define("MONO_ON", 1); require(__DIR__ . '/class/class_db_'.$_CONFIG['driver'].'.php'); $db = new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c = $db->connection_id; include(__DIR__ . '/global_funcs.php'); $db->query("UPDATE `fedjail` SET `fed_days` = `fed_days` - 1"); $q = $db->query("SELECT * FROM `fedjail` WHERE `fed_days` = 0"); $ids = array(); while($r = $db->fetch_row($q)) array_push($ids, $r['fed_userid']); if(count($ids) > 0) $db->query("UPDATE users SET fedjail=0 WHERE userid IN(".implode(",", $ids).")"); $db->query("DELETE FROM `fedjail` WHERE `fed_days` = 0"); $db->query("UPDATE `users` SET " . "`daysingang` = IF(`gang` > 0, `daysingang` + 1, 0), " . "`daysold` = `daysold` + 1, " . "`boxes_opened` = 0, " . "`mailban` = IF(`mailban` > 0, `mailban` - 1, 0), " . "`donatordays` = IF(`donatordays` > 0, `donatordays` - 1, 0), " . "`cdays` = IF(`course` > 0, `cdays` - 1, 0), " . "`bankmoney` = IF(`bankmoney` > 0, `bankmoney` + (`bankmoney` * .2), 0) " . "`cybermoney` + IF(`cybermoney` > 0, (`cybermoney` * 0.7), 0)" ); $q = $db->query("SELECT `userid`, `course` FROM `users` WHERE `cdays` = 0 AND `course` > 0"); while($r = $db->fetch_row($q)) { $db->query("INSERT INTO `coursesdone` VALUES(".$r['userid'].", ".$r['course'].")"); $cd = $db->query("SELECT * FROM `courses` WHERE `crID` = ".$r['course']); if($db->num_rows($cd)) { $coud = $db->fetch_row($cd); $upd = ""; $ev = ""; if($coud['crSTR']) { $upd .= ", `strength` = `strength` + ".$coud['crSTR']; $ev .= ", ".number_format($coud['crSTR'])." strength"; } if($coud['crGUARD']) { $upd .= ", `guard` = `guard` + ".$coud['crGUARD']; $ev .= ", ".number_format($coud['crGUARD'])." guard"; } if($coud['crLABOUR']) { $upd .= ", `labour` = `labour` + ".$coud['crLABOUR']; $ev .= ", ".number_format($coud['crLABOUR'])." labour"; } if($coud['crAGIL']) { $upd .= ", `agility` = `agility` + ".$coud['crAGIL']; $ev .= ", ".number_format($coud['crAGIL'])." agility"; } if($coud['crIQ']) { $upd .= ", `IQ` = `IQ` + ".$coud['crIQ']; $ev .= ", ".number_format($coud['crIQ'])." IQ"; } $ev = substr($ev, 1); if($upd) $db->query("UPDATE userstats SET `userid` = `userid` ".$upd." WHERE `userid` = ".$r['userid']); event_add($r['userid'], "Congratulations, you completed the ".$coud['crNAME']." and gained ".$ev."!"); } else event_add($r['userid'], "Unfortunately, the course you were taking was removed from the School's curriculum. Your course has been ended at no extra cost to you"); } $db->query("UPDATE `users` SET `course` = 0 WHERE `cdays` = 0"); $db->query("TRUNCATE TABLE `votes`"); ?>
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: include(/in/config.php): failed to open stream: No such file or directory in /in/CH8Tl on line 2 Warning: include(): Failed opening '/in/config.php' for inclusion (include_path='.:') in /in/CH8Tl on line 2
Output for hhvm-3.10.0 - 3.12.0
Warning: File not found: /in/config.php in /in/CH8Tl on line 2
Output for 5.1.0 - 5.2.17
Notice: Use of undefined constant __DIR__ - assumed '__DIR__' in /in/CH8Tl on line 2 Warning: include(__DIR__/config.php): failed to open stream: No such file or directory in /in/CH8Tl on line 2 Warning: include(): Failed opening '__DIR__/config.php' for inclusion (include_path='.:') in /in/CH8Tl on line 2
Output for 4.3.2 - 5.0.5
Notice: Use of undefined constant __DIR__ - assumed '__DIR__' in /in/CH8Tl on line 2 Warning: main(__DIR__/config.php): failed to open stream: No such file or directory in /in/CH8Tl on line 2 Warning: main(): Failed opening '__DIR__/config.php' for inclusion (include_path='.:') in /in/CH8Tl on line 2
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant __DIR__ - assumed '__DIR__' in /in/CH8Tl on line 2 Warning: main(__DIR__/config.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/CH8Tl on line 2 Warning: main() [http://www.php.net/function.main]: Failed opening '__DIR__/config.php' for inclusion (include_path='.:') in /in/CH8Tl on line 2