3v4l.org

run code in 300+ PHP versions simultaneously
// viewprofiles.php <?php include_once("header.php"); echo $user.' is currently logged in<br><br>'; echo <<<_END <form method="post" action="viewprofiles.php"><pre> <input type="submit" name ="choice" value="LIKE" /> <input type="submit" name ="choice" value="NEXT PROFILE" /> </pre></form> _END; $allusers = array(); //Create the $allusers array, comprised of all users except me $result = queryMysql("SELECT * FROM members"); $num = mysql_num_rows($result); for ($j = 0 ; $j < $num ; ++$j) { $row = mysql_fetch_row($result); if ($row[0] == $user) continue; $allusers[$j] = $row[0]; } //Create the $i_like_these_users array, comprised of all users i liked $result = queryMysql("SELECT * FROM likeprofile WHERE user='$user'"); $num = mysql_num_rows($result); for ($j = 0 ; $j < $num ; ++$j) { $row = mysql_fetch_row($result); $i_like_these_users[$j] = $row[1]; } //Create the $i_dislike_these_users array, comprised of all users i disliked $result = queryMysql("SELECT * FROM dislikeprofile WHERE user='$user'"); $num = mysql_num_rows($result); for ($j = 0 ; $j < $num ; ++$j) { $row = mysql_fetch_row($result); $i_dislike_these_users[$j] = $row[1]; } //Create the $usersiviewed array, comprised of all users i have either liked or disliked if (is_array($i_like_these_users) && is_array($i_dislike_these_users)) { $usersiviewed = array_merge($i_like_these_users,$i_dislike_these_users); } elseif(is_array($i_like_these_users)) { $usersiviewed = $i_like_these_users; } else { $usersiviewed = $i_dislike_these_users; } // this removes from the array $allusers (i.e., profiles i can view) all $usersviewed (i.e., all the profiles i have already either liked/disliked) if (is_array($usersiviewed)) { $peopleicanview = array_diff($allusers, $usersiviewed); $peopleicanview = array_values($peopleicanview); // this re-indexes the array } else { $peopleicanview = $allusers; $peopleicanview = array_values($peopleicanview); // this re-indexes the array } $current_user_profile = $peopleicanview[0]; echo 'check out '.$current_user_profile.'s picture <br />'; if (file_exists("$current_user_profile.jpg")) {echo "<img src='$current_user_profile.jpg' align='left' />";} // if i like or dislike this person, the likeprofile or dislikeprofile table is updated with my name and the name of the person who liked or disliked if (isset($_POST['choice']) && $_POST['choice'] == 'LIKE') { $ilike = $current_user_profile; $query = "INSERT INTO likeprofile VALUES" . "('$user', '$ilike')"; if (!queryMysql($query)) echo "INSERT failed: $query<br />" . mysql_error() . "<br /><br />"; } if (isset($_POST['choice']) && $_POST['choice'] == 'NEXT PROFILE') { $idontlike = $current_user_profile; $query = "INSERT INTO dislikeprofile VALUES" . "('$user', '$idontlike')"; if (!queryMysql($query)) echo "INSERT failed: $query<br />" . mysql_error() . "<br /><br />"; } ?>
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
// viewprofiles.php Warning: include_once(): open_basedir restriction in effect. File(header.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/o8jYP on line 3 Warning: include_once(header.php): Failed to open stream: Operation not permitted in /in/o8jYP on line 3 Warning: include_once(): Failed opening 'header.php' for inclusion (include_path='.:') in /in/o8jYP on line 3 Warning: Undefined variable $user in /in/o8jYP on line 5 is currently logged in<br><br><form method="post" action="viewprofiles.php"><pre> <input type="submit" name ="choice" value="LIKE" /> <input type="submit" name ="choice" value="NEXT PROFILE" /> </pre></form> Fatal error: Uncaught Error: Call to undefined function queryMysql() in /in/o8jYP:18 Stack trace: #0 {main} thrown in /in/o8jYP on line 18
Process exited with code 255.
Output for 8.0.13
// viewprofiles.php Warning: include_once(header.php): Failed to open stream: No such file or directory in /in/o8jYP on line 3 Warning: include_once(): Failed opening 'header.php' for inclusion (include_path='.:') in /in/o8jYP on line 3 Warning: Undefined variable $user in /in/o8jYP on line 5 is currently logged in<br><br><form method="post" action="viewprofiles.php"><pre> <input type="submit" name ="choice" value="LIKE" /> <input type="submit" name ="choice" value="NEXT PROFILE" /> </pre></form> Fatal error: Uncaught Error: Call to undefined function queryMysql() in /in/o8jYP:18 Stack trace: #0 {main} thrown in /in/o8jYP on line 18
Process exited with code 255.
Output for 7.4.33
// viewprofiles.php Warning: include_once(header.php): failed to open stream: No such file or directory in /in/o8jYP on line 3 Warning: include_once(): Failed opening 'header.php' for inclusion (include_path='.:') in /in/o8jYP on line 3 Notice: Undefined variable: user in /in/o8jYP on line 5 is currently logged in<br><br><form method="post" action="viewprofiles.php"><pre> <input type="submit" name ="choice" value="LIKE" /> <input type="submit" name ="choice" value="NEXT PROFILE" /> </pre></form> Fatal error: Uncaught Error: Call to undefined function queryMysql() in /in/o8jYP:18 Stack trace: #0 {main} thrown in /in/o8jYP on line 18
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.32
// viewprofiles.php Warning: include_once(): open_basedir restriction in effect. File(header.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/o8jYP on line 3 Warning: include_once(header.php): failed to open stream: Operation not permitted in /in/o8jYP on line 3 Warning: include_once(): Failed opening 'header.php' for inclusion (include_path='.:') in /in/o8jYP on line 3 Notice: Undefined variable: user in /in/o8jYP on line 5 is currently logged in<br><br><form method="post" action="viewprofiles.php"><pre> <input type="submit" name ="choice" value="LIKE" /> <input type="submit" name ="choice" value="NEXT PROFILE" /> </pre></form> Fatal error: Uncaught Error: Call to undefined function queryMysql() in /in/o8jYP:18 Stack trace: #0 {main} thrown in /in/o8jYP on line 18
Process exited with code 255.
Output for 7.3.32 - 7.3.33
// viewprofiles.php Warning: include_once(header.php): failed to open stream: No such file or directory in /in/o8jYP on line 3 Warning: include_once(): Failed opening 'header.php' for inclusion (include_path='.:') in /in/o8jYP on line 3 is currently logged in<br><br><form method="post" action="viewprofiles.php"><pre> <input type="submit" name ="choice" value="LIKE" /> <input type="submit" name ="choice" value="NEXT PROFILE" /> </pre></form> Fatal error: Uncaught Error: Call to undefined function queryMysql() in /in/o8jYP:18 Stack trace: #0 {main} thrown in /in/o8jYP on line 18
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
// viewprofiles.php Warning: include_once(): open_basedir restriction in effect. File(header.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/o8jYP on line 3 Warning: include_once(header.php): failed to open stream: Operation not permitted in /in/o8jYP on line 3 Warning: include_once(): Failed opening 'header.php' for inclusion (include_path='.:') in /in/o8jYP on line 3 Notice: Undefined variable: user in /in/o8jYP on line 5 is currently logged in<br><br><form method="post" action="viewprofiles.php"><pre> <input type="submit" name ="choice" value="LIKE" /> <input type="submit" name ="choice" value="NEXT PROFILE" /> </pre></form> Fatal error: Call to undefined function queryMysql() in /in/o8jYP on line 18
Process exited with code 255.
Output for 5.1.0 - 5.1.1, 5.1.3 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45
// viewprofiles.php Warning: include_once(header.php): failed to open stream: No such file or directory in /in/o8jYP on line 3 Warning: include_once(): Failed opening 'header.php' for inclusion (include_path='.:') in /in/o8jYP on line 3 Notice: Undefined variable: user in /in/o8jYP on line 5 is currently logged in<br><br><form method="post" action="viewprofiles.php"><pre> <input type="submit" name ="choice" value="LIKE" /> <input type="submit" name ="choice" value="NEXT PROFILE" /> </pre></form> Fatal error: Call to undefined function queryMysql() in /in/o8jYP on line 18
Process exited with code 255.
Output for 5.1.2
// viewprofiles.php Warning: include_once(header.php): failed to open stream: No such file or directory in /in/o8jYP on line 3 Warning: include_once(): Failed opening 'header.php' for inclusion (include_path='.:') in /in/o8jYP on line 3 Notice: Undefined variable: user in /in/o8jYP on line 5 is currently logged in<br><br><form method="post" action="viewprofiles.php"><pre> <input type="submit" name ="choice" value="LIKE" /> <input type="submit" name ="choice" value="NEXT PROFILE" /> </pre></form> Fatal error: Call to undefined function queryMysql() in /in/o8jYP on line 19
Process exited with code 255.
Output for 5.0.4 - 5.0.5
// viewprofiles.php Warning: main(header.php): failed to open stream: No such file or directory in /in/o8jYP on line 3 Warning: main(): Failed opening 'header.php' for inclusion (include_path='.:') in /in/o8jYP on line 3 Notice: Undefined variable: user in /in/o8jYP on line 5 is currently logged in<br><br><form method="post" action="viewprofiles.php"><pre> <input type="submit" name ="choice" value="LIKE" /> <input type="submit" name ="choice" value="NEXT PROFILE" /> </pre></form> Fatal error: Call to undefined function queryMysql() in /in/o8jYP on line 18
Process exited with code 255.
Output for 5.0.0 - 5.0.3
// viewprofiles.php Warning: main(header.php): failed to open stream: No such file or directory in /in/o8jYP on line 3 Warning: main(): Failed opening 'header.php' for inclusion (include_path='.:') in /in/o8jYP on line 3 Notice: Undefined variable: user in /in/o8jYP on line 5 is currently logged in<br><br><form method="post" action="viewprofiles.php"><pre> <input type="submit" name ="choice" value="LIKE" /> <input type="submit" name ="choice" value="NEXT PROFILE" /> </pre></form> Fatal error: Call to undefined function queryMysql() in /in/o8jYP on line 18
Process exited with code 255.
Output for 4.4.5 - 4.4.9
// viewprofiles.php Warning: main(header.php): failed to open stream: No such file or directory in /in/o8jYP on line 3 Warning: main(): Failed opening 'header.php' for inclusion (include_path='.:') in /in/o8jYP on line 3 Notice: Undefined variable: user in /in/o8jYP on line 5 is currently logged in<br><br><form method="post" action="viewprofiles.php"><pre> <input type="submit" name ="choice" value="LIKE" /> <input type="submit" name ="choice" value="NEXT PROFILE" /> </pre></form> Fatal error: Call to undefined function: querymysql() in /in/o8jYP on line 18
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.1, 4.4.3 - 4.4.4
// viewprofiles.php Warning: main(header.php): failed to open stream: No such file or directory in /in/o8jYP on line 3 Warning: main(): Failed opening 'header.php' for inclusion (include_path='.:') in /in/o8jYP on line 3 Notice: Undefined variable: user in /in/o8jYP on line 5 is currently logged in<br><br><form method="post" action="viewprofiles.php"><pre> <input type="submit" name ="choice" value="LIKE" /> <input type="submit" name ="choice" value="NEXT PROFILE" /> </pre></form> Fatal error: Call to undefined function: querymysql() in /in/o8jYP on line 18
Process exited with code 255.
Output for 4.4.2
// viewprofiles.php Warning: main(header.php): failed to open stream: No such file or directory in /in/o8jYP on line 3 Warning: main(): Failed opening 'header.php' for inclusion (include_path='.:') in /in/o8jYP on line 3 Notice: Undefined variable: user in /in/o8jYP on line 5 is currently logged in<br><br><form method="post" action="viewprofiles.php"><pre> <input type="submit" name ="choice" value="LIKE" /> <input type="submit" name ="choice" value="NEXT PROFILE" /> </pre></form> Fatal error: Call to undefined function: querymysql() in /in/o8jYP on line 19
Process exited with code 255.
Output for 4.3.0 - 4.3.1
// viewprofiles.php Warning: main(header.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/o8jYP on line 3 Warning: main() [http://www.php.net/function.main]: Failed opening 'header.php' for inclusion (include_path='.:') in /in/o8jYP on line 3 Notice: Undefined variable: user in /in/o8jYP on line 5 is currently logged in<br><br><form method="post" action="viewprofiles.php"><pre> <input type="submit" name ="choice" value="LIKE" /> <input type="submit" name ="choice" value="NEXT PROFILE" /> </pre></form> Fatal error: Call to undefined function: querymysql() in /in/o8jYP on line 18

preferences:
324.83 ms | 403 KiB | 460 Q