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");?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 27
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 34
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 41
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 48
Branch analysis from position: 44
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 55
Branch analysis from position: 51
2 jumps found. (Code = 43) Position 1 = 58, Position 2 = 62
Branch analysis from position: 58
2 jumps found. (Code = 43) Position 1 = 65, Position 2 = 69
Branch analysis from position: 65
2 jumps found. (Code = 43) Position 1 = 72, Position 2 = 76
Branch analysis from position: 72
2 jumps found. (Code = 43) Position 1 = 79, Position 2 = 83
Branch analysis from position: 79
2 jumps found. (Code = 47) Position 1 = 86, Position 2 = 88
Branch analysis from position: 86
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 88
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 83
Branch analysis from position: 76
Branch analysis from position: 69
Branch analysis from position: 62
Branch analysis from position: 55
Branch analysis from position: 48
Branch analysis from position: 41
Branch analysis from position: 34
Branch analysis from position: 27
Branch analysis from position: 20
Branch analysis from position: 13
filename:       /in/e3hn7
function name:  (null)
number of ops:  89
compiled vars:  !0 = $isbn, !1 = $title, !2 = $description, !3 = $price, !4 = $publisher, !5 = $pubdate, !6 = $edition, !7 = $pages, !8 = $CategoryName, !9 = $strFName, !10 = $strLName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   INCLUDE_OR_EVAL                                          'dbconnection.php', INCLUDE
          1        INCLUDE_OR_EVAL                                  $12     'header.html', INCLUDE
          2      > JMPNZ_EX                                         ~13     $12, ->5
          3    > > EXIT                                                     'ERROR'
          4*       BOOL                                             ~13     <true>
          5    >   ECHO                                                     '%09'
          6        ECHO                                                     '%3Cform+action%3D%22insertbook.php%22+method%3D%22post%22%3E%09%3Cfieldset%3E%3Clegend%3EEnter+your+information+in+the+form+below%3A%3C%2Flegend%3E%09%09%3Cdiv+id%3D%22field%22%3E%09%09%09%3Clabel+for%3D%22ISBN%22%3EISBN%3A+%3C%2Flabel%3E%09%09%09%3Cinput+type%3D%22text%22+name%3D%22ISBN%22+value%3D%22'
          7        ISSET_ISEMPTY_CV                                         !0
          8      > JMPZ                                                     ~14, ->13
          9    >   INIT_FCALL                                               'htmlentities'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $15     
         12        ECHO                                                     $15
         13    >   ECHO                                                     '%22%2F%3E+%09%09%3C%2Fdiv%3E%09%09%3Cdiv+id%3D%22field%22%3E%09%09%09%3Clabel+for%3D%22title%22%3ETitle%3A+%3C%2Flabel%3E%09%09%09%3Cinput+type%3D%22text%22+name%3D%22title%22+value%3D%22'
         14        ISSET_ISEMPTY_CV                                         !1
         15      > JMPZ                                                     ~16, ->20
         16    >   INIT_FCALL                                               'htmlentities'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $17     
         19        ECHO                                                     $17
         20    >   ECHO                                                     '%22%2F%3E%09%09%3C%2Fdiv%3E%09%09%3Cdiv+id%3D%22field%22%3E%09%09%09%3Clabel+for%3D%22description%22%3EDescription%3A+%3C%2Flabel%3E%09%09%09%3Cinput+type%3D%22text%22+name%3D%22description%22+value%3D%22'
         21        ISSET_ISEMPTY_CV                                         !2
         22      > JMPZ                                                     ~18, ->27
         23    >   INIT_FCALL                                               'htmlentities'
         24        SEND_VAR                                                 !2
         25        DO_ICALL                                         $19     
         26        ECHO                                                     $19
         27    >   ECHO                                                     '%22%2F%3E%09%09%3C%2Fdiv%3E%09%09%3Cdiv+id%3D%22field%22%3E%09%09%09%3Clabel+for%3D%22price%22%3EPrice%3A+%3C%2Flabel%3E%09%09%09%3Cinput+type%3D%22text%22+name%3D%22price%22+value%3D%22'
         28        ISSET_ISEMPTY_CV                                         !3
         29      > JMPZ                                                     ~20, ->34
         30    >   INIT_FCALL                                               'htmlentities'
         31        SEND_VAR                                                 !3
         32        DO_ICALL                                         $21     
         33        ECHO                                                     $21
         34    >   ECHO                                                     '%22%2F%3E%09%09%3C%2Fdiv%3E%09%09%09%3Cdiv+id%3D%22field%22%3E%09%09%09%3Clabel+for%3D%22publisher%22%3EPublisher%3A+%3C%2Flabel%3E%09%09%09%3Cinput+type%3D%22text%22+name%3D%22publisher%22+value%3D%22'
         35        ISSET_ISEMPTY_CV                                         !4
         36      > JMPZ                                                     ~22, ->41
         37    >   INIT_FCALL                                               'htmlentities'
         38        SEND_VAR                                                 !4
         39        DO_ICALL                                         $23     
         40        ECHO                                                     $23
         41    >   ECHO                                                     '%22%2F%3E%09%09%3C%2Fdiv%3E%09%09%3Cdiv+id%3D%22field%22%3E%09%09%09%3Clabel+for%3D%22pubdate%22%3EPublish+Date%3A+%3C%2Flabel%3E%09%09%09%3Cinput+type%3D%22text%22+name%3D%22pubdate%22+value%3D%22'
         42        ISSET_ISEMPTY_CV                                         !5
         43      > JMPZ                                                     ~24, ->48
         44    >   INIT_FCALL                                               'htmlentities'
         45        SEND_VAR                                                 !5
         46        DO_ICALL                                         $25     
         47        ECHO                                                     $25
         48    >   ECHO                                                     '%22%2F%3E%09%09%3C%2Fdiv%3E%09%09%3Cdiv+id%3D%22field%22%3E%09%09%09%3Clabel+for%3D%22edition%22%3EEdition%3A+%3C%2Flabel%3E%09%09%09%3Cinput+type%3D%22text%22+name%3D%22edition%22+value%3D%22'
         49        ISSET_ISEMPTY_CV                                         !6
         50      > JMPZ                                                     ~26, ->55
         51    >   INIT_FCALL                                               'htmlentities'
         52        SEND_VAR                                                 !6
         53        DO_ICALL                                         $27     
         54        ECHO                                                     $27
         55    >   ECHO                                                     '%22%2F%3E%09%09%3C%2Fdiv%3E%09%09%3Cdiv+id%3D%22field%22%3E%09%09%09%3Clabel+for%3D%22pages%22%3EPages%3A+%3C%2Flabel%3E%09%09%09%3Cinput+type%3D%22text%22+name%3D%22pages%22+value%3D%22'
         56        ISSET_ISEMPTY_CV                                         !7
         57      > JMPZ                                                     ~28, ->62
         58    >   INIT_FCALL                                               'htmlentities'
         59        SEND_VAR                                                 !7
         60        DO_ICALL                                         $29     
         61        ECHO                                                     $29
         62    >   ECHO                                                     '%22%2F%3E%09%09%3C%2Fdiv%3E%09%09%3Cdiv+id%3D%22field%22%3E%09%09%09%3Clabel+for%3D%22CategoryName%22%3ECategory+Name%3A+%3C%2Flabel%3E%09%09%09%3Cinput+type%3D%22text%22+name%3D%22CategoryName%22+value%3D%22'
         63        ISSET_ISEMPTY_CV                                         !8
         64      > JMPZ                                                     ~30, ->69
         65    >   INIT_FCALL                                               'htmlentities'
         66        SEND_VAR                                                 !8
         67        DO_ICALL                                         $31     
         68        ECHO                                                     $31
         69    >   ECHO                                                     '%22%2F%3E%09%09%3C%2Fdiv%3E%09%09%3Cdiv+id%3D%22field%22%3E%09%09%09%3Clabel+for%3D%22strFName%22%3EAuthor+First+Name%3A+%3C%2Flabel%3E%09%09%09%3Cinput+type%3D%22text%22+name%3D%22strFName%22+value%3D%22'
         70        ISSET_ISEMPTY_CV                                         !9
         71      > JMPZ                                                     ~32, ->76
         72    >   INIT_FCALL                                               'htmlentities'
         73        SEND_VAR                                                 !9
         74        DO_ICALL                                         $33     
         75        ECHO                                                     $33
         76    >   ECHO                                                     '%22%2F%3E%09%09%3C%2Fdiv%3E%09%09%3Cdiv+id%3D%22field%22%3E%09%09%09%3Clabel+for%3D%22strLName%22%3EAuthor+Last+Name%3C%2Flabel%3E%09%09%09%3Cinput+type%3D%22text%22+name%3D%22strLName%22+value%3D%22'
         77        ISSET_ISEMPTY_CV                                         !10
         78      > JMPZ                                                     ~34, ->83
         79    >   INIT_FCALL                                               'htmlentities'
         80        SEND_VAR                                                 !10
         81        DO_ICALL                                         $35     
         82        ECHO                                                     $35
         83    >   ECHO                                                     '%22%2F%3E%09%09%3C%2Fdiv%3E%09%09%09%3Cbr%3E%09%09%09%3Cinput+id%3D%22submit%22+type%3D%22submit%22+value%3D%22Submit%22+name%3D%22submit%22%3E%09%3C%2Ffieldset%3E%3C%2Fform%3E'
         84        INCLUDE_OR_EVAL                                  $36     'footer.html', INCLUDE
         85      > JMPNZ_EX                                         ~37     $36, ->88
         86    > > EXIT                                                     'ERROR'
         87*       BOOL                                             ~37     <true>
         88    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.29 ms | 1404 KiB | 15 Q