3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php require "config.php"; list($hash,$id) = explode("~",$_COOKIE['permlogin']); $con = mysqli_connect($mysql_host,$mysql_user,$mysql_password,$mysql_database); $sql = "SELECT * FROM auto_login WHERE userId='$id' AND loginHash='$hash'"; $query = mysqli_query($con,$sql); $count = mysqli_num_rows($query); function keygen($length) { $key = ''; list($usec, $sec) = explode(' ', microtime()); mt_srand((float) $sec + ((float) $usec * 100000)); $inputs = array_merge(range('z','a'),range(0,9),range('A','Z')); for($i=0; $i<$length; $i++) { $key .= $inputs{mt_rand(0,61)}; } return $key; } if ($count == 1) { setcookie("permlogin","",time()-47336401,"/",".gjs19.tk"); $dataSql = "SELECT * FROM members WHERE id='$id'"; $dataQuery = mysqli_query($con,$dataSql); $row = mysqli_fetch_array($dataQuery); $hash = keygen(128); $updateSql = "UPDATE auto_login SET loginHash='" . $hash . "' WHERE userId='" . $id . "'"; $updateQuery = mysqli_query($con,$updateSql); session_start(); $_SESSION['userid'] = $row['id']; $_SESSION['passname'] = $row['username']; $_SESSION['usertype'] = $row['type']; /*$_SESSION['avatar'] = "image/avatar/".$row['avatar'];*/ switch ($row['type']) { case "0": $_SESSION['username'] = "<font color='lightblue'>" . $row['username'] . "</font>"; break; case "1": $_SESSION['username'] = "<font color='orange'>" . $row['username'] . "</font>"; break; case "2": $_SESSION['username'] = "<font color='red'>" . $row['username'] . "</font>"; break; } setcookie("permlogin",$hash . "~" . $id,time()+31557600,"/",".gjs19.tk"); header("Location: ../index.php"); }
Output for 5.1.0 - 7.1.0
Warning: require(config.php): failed to open stream: No such file or directory in /in/ZalXl on line 2 Fatal error: require(): Failed opening required 'config.php' (include_path='.:') in /in/ZalXl on line 2
Process exited with code 255.
Output for 4.3.2 - 5.0.5
Warning: main(config.php): failed to open stream: No such file or directory in /in/ZalXl on line 2 Fatal error: main(): Failed opening required 'config.php' (include_path='.:') in /in/ZalXl on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: main(config.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/ZalXl on line 2 Fatal error: main() [http://www.php.net/function.main]: Failed opening required 'config.php' (include_path='.:') in /in/ZalXl on line 2