3v4l.org

run code in 300+ PHP versions simultaneously
<?php include ('dbconnection.php'); (include("header.html")) or die("ERROR")?> <?php //Custom Error Handling Setup (I think...)if ($_SERVER['REQUEST_METHOD'] == 'POST'){define('LIVE', FALSE);function my_error_handler ($e_number, $e_message, $e_file, $e_line, $e_vars) { $message = "An error occurred in script '$e_file' on line $e_line: $e_message\n"; $message .= print_r ($e_vars, 1); if (!LIVE) { echo '<pre>' . $message . "\n"; debug_print_backtrace(); echo '</pre><br />'; } else { echo '<div class="error">A system error occurred. We apologize for the inconvenience.</div><br />'; } }set_error_handler ('my_error_handler');$isbn = $_POST['ISBN'];$title = trim($_REQUEST['title']);$description = trim($_REQUEST['description']);$price = trim($_REQUEST['price']);$publisher = trim($_REQUEST['publisher']);$pubdate = trim($_REQUEST['pubdate']);$edition = trim($_REQUEST['edition']);$pages = trim($_REQUEST['pages']);$catname = trim($_REQUEST['CategoryName']);$firstname = trim($_REQUEST['strFName']);$lastname =trim( $_REQUEST['strLName']);////////////////////////////////////////////////////////////////$errors = array(); if (!preg_match ('/^[0-9]+{13}&/', $isbn)) {$errors[] = 'ISBN must be numeric and 13 characters long';} if (empty($_POST["title"])) {$errors[] = 'Title cannot be empty';} if (empty($_POST["description"])) {$errors[] = 'Description cannot be empty';} if (!preg_match ('/^$[0-9\.]&/', $price)) {$errors[] = 'Price must be in $USD';} if (empty($_POST["publisher"])) {$errors[] = 'Publisher cannot be empty';} if (!preg_match ('!^(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d!', $pubdate)) {$errors[] = 'Date must be in dd-mm-yyyy';} if (!preg_match ('/^[0-9]{2}$/', $edition)) {$errors[] = 'Edition must be numeric and 2 digits long';} if (!preg_match ('/^[0-9]$/', $pages)) {$errors[] = 'Pages must be numeric';} if (empty($_POST["catname"])) {$errors[] = 'Category cannot be empty';} if (empty($_POST["firstname"])) {$errors[] = 'First Name cannot be empty';} if (empty($_POST["lastname"])) {$errors[] = 'Last Name cannot be empty';} if (empty($errors)) { $sql_ba = "INSERT INTO bookauthors (strFName, strLName) values('$firstname', '$lastname');"; $sql_bd = "INSERT INTO bookdescriptions (ISBN, title, description, price, publisher, pubdate, edition, pages) values('$isbn', '$title', '$description', '$price', '$publisher', '$pubdate', '$edition', '$pages');"; $sql_bab = "INSERT INTO bookauthorsbooks (ISBN, AuthorID) values('$isbn', LAST_INSERT_ID());"; $sql_bc = "INSERT INTO bookcategories (CategoryName) values('$catname');"; $sql_bcb = "INSERT INTO bookcategoriesbooks (CategoryID, ISBN) VALUES(LAST_INSERT_ID(), '$isbn');"; $sql = $sql_ba . $sql_bd . $sql_bab . $sql_bc . $sql_bc; echo $sql; $success = ''; if(mysqli_multi_query($conn, $sql)) { do { $success+=mysqli_affected_rows($conn); } while (mysqli_more_results($conn) && mysqli_next_result($conn)); } if ($success == 5) { echo "All records have been successfully inserted"; } } else { echo '<h1>Error!</h1> <p style="color:red;">The following error(s) occurred:<br />'; foreach ($errors as $msg) { echo " - $msg<br />\n"; } echo '</p><p>Please try again.</p>'; }/////////////////////////////////////////////////////////////////} mysqli_close($conn);?><form action="insertbook.php" method="post"> <fieldset><legend>Enter your information in the form below:</legend> <div id="field"> <label for="ISBN">ISBN: </label> <input type="text" name="ISBN" value="<?php if (isset($isbn)) echo htmlentities($isbn);?>"/> </div> <div id="field"> <label for="title">Title: </label> <input type="text" name="title" value="<?php if (isset($title)) echo htmlentities($title);?>"/> </div> <div id="field"> <label for="description">Description: </label> <input type="text" name="description" value="<?php if (isset($description)) echo htmlentities($description);?>"/> </div> <div id="field"> <label for="price">Price: </label> <input type="text" name="price" value="<?php if (isset($price)) echo htmlentities($price);?>"/> </div> <div id="field"> <label for="publisher">Publisher: </label> <input type="text" name="publisher" value="<?php if (isset($publisher)) echo htmlentities($publisher);?>"/> </div> <div id="field"> <label for="pubdate">Publish Date: </label> <input type="text" name="pubdate" value="<?php if (isset($pubdate)) echo htmlentities($pubdate);?>"/> </div> <div id="field"> <label for="edition">Edition: </label> <input type="text" name="edition" value="<?php if (isset($edition)) echo htmlentities($edition);?>"/> </div> <div id="field"> <label for="pages">Pages: </label> <input type="text" name="pages" value="<?php if (isset($pages)) echo htmlentities($pages); ?>"/> </div> <div id="field"> <label for="CategoryName">Category Name: </label> <input type="text" name="CategoryName" value="<?php if (isset($CategoryName)) echo htmlentities($CategoryName);?>"/> </div> <div id="field"> <label for="strFName">Author First Name: </label> <input type="text" name="strFName" value="<?php if (isset($strFName)) echo htmlentities($strFName);?>"/> </div> <div id="field"> <label for="strLName">Author Last Name</label> <input type="text" name="strLName" value="<?php if (isset($strLName)) echo htmlentities($strLName);?>"/> </div> <br> <input id="submit" type="submit" value="Submit" name="submit"> </fieldset></form><?php (include("footer.html")) or die("ERROR");?>
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
Warning: include(): open_basedir restriction in effect. File(dbconnection.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/e3hn7 on line 1 Warning: include(dbconnection.php): Failed to open stream: Operation not permitted in /in/e3hn7 on line 1 Warning: include(): Failed opening 'dbconnection.php' for inclusion (include_path='.:') in /in/e3hn7 on line 1 Warning: include(): open_basedir restriction in effect. File(header.html) is not within the allowed path(s): (/tmp:/in:/etc) in /in/e3hn7 on line 1 Warning: include(header.html): Failed to open stream: Operation not permitted in /in/e3hn7 on line 1 Warning: include(): Failed opening 'header.html' for inclusion (include_path='.:') in /in/e3hn7 on line 1 ERROR
Output for 8.0.13
Warning: include(dbconnection.php): Failed to open stream: No such file or directory in /in/e3hn7 on line 1 Warning: include(): Failed opening 'dbconnection.php' for inclusion (include_path='.:') in /in/e3hn7 on line 1 Warning: include(header.html): Failed to open stream: No such file or directory in /in/e3hn7 on line 1 Warning: include(): Failed opening 'header.html' for inclusion (include_path='.:') in /in/e3hn7 on line 1 ERROR
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.21, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0, 7.3.32 - 7.3.33, 7.4.33
Warning: include(dbconnection.php): failed to open stream: No such file or directory in /in/e3hn7 on line 1 Warning: include(): Failed opening 'dbconnection.php' for inclusion (include_path='.:') in /in/e3hn7 on line 1 Warning: include(header.html): failed to open stream: No such file or directory in /in/e3hn7 on line 1 Warning: include(): Failed opening 'header.html' for inclusion (include_path='.:') in /in/e3hn7 on line 1 ERROR
Output for 7.2.29 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.32
Warning: include(): open_basedir restriction in effect. File(dbconnection.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/e3hn7 on line 1 Warning: include(dbconnection.php): failed to open stream: Operation not permitted in /in/e3hn7 on line 1 Warning: include(): Failed opening 'dbconnection.php' for inclusion (include_path='.:') in /in/e3hn7 on line 1 Warning: include(): open_basedir restriction in effect. File(header.html) is not within the allowed path(s): (/tmp:/in:/etc) in /in/e3hn7 on line 1 Warning: include(header.html): failed to open stream: Operation not permitted in /in/e3hn7 on line 1 Warning: include(): Failed opening 'header.html' for inclusion (include_path='.:') in /in/e3hn7 on line 1 ERROR
Output for 7.1.20
Warning: include(): open_basedir restriction in effect. File(dbconnection.php) is not within the allowed path(s): (/tmp:/in) in /in/e3hn7 on line 1 Warning: include(dbconnection.php): failed to open stream: Operation not permitted in /in/e3hn7 on line 1 Warning: include(): Failed opening 'dbconnection.php' for inclusion (include_path='.:') in /in/e3hn7 on line 1 Warning: include(): open_basedir restriction in effect. File(header.html) is not within the allowed path(s): (/tmp:/in) in /in/e3hn7 on line 1 Warning: include(header.html): failed to open stream: Operation not permitted in /in/e3hn7 on line 1 Warning: include(): Failed opening 'header.html' for inclusion (include_path='.:') in /in/e3hn7 on line 1 ERROR
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5
Warning: main(dbconnection.php): failed to open stream: No such file or directory in /in/e3hn7 on line 1 Warning: main(): Failed opening 'dbconnection.php' for inclusion (include_path='.:') in /in/e3hn7 on line 1 Warning: main(header.html): failed to open stream: No such file or directory in /in/e3hn7 on line 1 Warning: main(): Failed opening 'header.html' for inclusion (include_path='.:') in /in/e3hn7 on line 1 ERROR
Output for 4.3.0 - 4.3.1
Warning: main(dbconnection.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/e3hn7 on line 1 Warning: main() [http://www.php.net/function.main]: Failed opening 'dbconnection.php' for inclusion (include_path='.:') in /in/e3hn7 on line 1 Warning: main(header.html) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/e3hn7 on line 1 Warning: main() [http://www.php.net/function.main]: Failed opening 'header.html' for inclusion (include_path='.:') in /in/e3hn7 on line 1 ERROR

preferences:
227.12 ms | 402 KiB | 311 Q