3v4l.org

run code in 300+ PHP versions simultaneously
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Martin Su - Allio Parser (Upload)</title> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/font-awesome.min.css" rel="stylesheet"> <link href="css/styles.css" rel="stylesheet"> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <br> <h1>http://admin-test.pmm/saves/index</h1> <form method="post" enctype="multipart/form-data"> Select image to upload: <input type="file" name="fileToUpload" id="fileToUpload"> <input type="submit" value="Upload Image" name="submit"> </form> <?php $target_dir = "files/retailers/id/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1; $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION); // Check if image file is a actual image or fake image if(isset($_POST["submit"])) { $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]); if($check !== false) { echo "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { echo "File is not an image."; $uploadOk = 0; } } // Check if file already exists if (file_exists($target_file)) { echo "Sorry, file already exists."; $uploadOk = 0; } // Check file size if ($_FILES["fileToUpload"]["size"] > 1000000) { echo "Sorry, your file is too large."; $uploadOk = 0; } // Allow certain file formats if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" ) { echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed."; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo "Sorry, your file was not uploaded."; // if everything is ok, try to upload file } else { if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded."; } else { echo "Sorry, there was an error uploading your file."; } } ?> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="js/bootstrap.min.js"></script> </body> </html>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 36
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 34
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 42
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 49
Branch analysis from position: 47
2 jumps found. (Code = 46) Position 1 = 51, Position 2 = 53
Branch analysis from position: 51
2 jumps found. (Code = 46) Position 1 = 54, Position 2 = 56
Branch analysis from position: 54
2 jumps found. (Code = 46) Position 1 = 57, Position 2 = 59
Branch analysis from position: 57
2 jumps found. (Code = 43) Position 1 = 60, Position 2 = 62
Branch analysis from position: 60
2 jumps found. (Code = 43) Position 1 = 64, Position 2 = 66
Branch analysis from position: 64
1 jumps found. (Code = 42) Position 1 = 85
Branch analysis from position: 85
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 66
2 jumps found. (Code = 43) Position 1 = 74, Position 2 = 84
Branch analysis from position: 74
1 jumps found. (Code = 42) Position 1 = 85
Branch analysis from position: 85
Branch analysis from position: 84
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 62
Branch analysis from position: 59
Branch analysis from position: 56
Branch analysis from position: 53
Branch analysis from position: 49
Branch analysis from position: 42
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 42
Branch analysis from position: 40
Branch analysis from position: 42
Branch analysis from position: 36
filename:       /in/44kF9
function name:  (null)
number of ops:  87
compiled vars:  !0 = $target_dir, !1 = $target_file, !2 = $uploadOk, !3 = $imageFileType, !4 = $check
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     '%3C%21DOCTYPE+html%3E%0A%3Chtml+lang%3D%22en%22%3E%0A%3Chead%3E%0A%09%3Cmeta+charset%3D%22utf-8%22%3E%0A%09%3Cmeta+http-equiv%3D%22X-UA-Compatible%22+content%3D%22IE%3Dedge%22%3E%0A%09%3Cmeta+name%3D%22viewport%22+content%3D%22width%3Ddevice-width%2C+initial-scale%3D1%22%3E%0A%09%3Ctitle%3EMartin+Su+-+Allio+Parser+%28Upload%29%3C%2Ftitle%3E%0A%09%3Clink+href%3D%22css%2Fbootstrap.min.css%22+rel%3D%22stylesheet%22%3E%0A%09%3Clink+href%3D%22css%2Ffont-awesome.min.css%22+rel%3D%22stylesheet%22%3E%0A%09%3Clink+href%3D%22css%2Fstyles.css%22+rel%3D%22stylesheet%22%3E%0A%09%3C%21--%5Bif+lt+IE+9%5D%3E%0A%09++%3Cscript+src%3D%22https%3A%2F%2Foss.maxcdn.com%2Fhtml5shiv%2F3.7.2%2Fhtml5shiv.min.js%22%3E%3C%2Fscript%3E%0A%09++%3Cscript+src%3D%22https%3A%2F%2Foss.maxcdn.com%2Frespond%2F1.4.2%2Frespond.min.js%22%3E%3C%2Fscript%3E%0A%09%3C%21%5Bendif%5D--%3E%0A%3C%2Fhead%3E%0A%3Cbody%3E%0A%09%3Cbr%3E%0A%09%3Ch1%3Ehttp%3A%2F%2Fadmin-test.pmm%2Fsaves%2Findex%3C%2Fh1%3E%0A%09%3Cform+method%3D%22post%22+enctype%3D%22multipart%2Fform-data%22%3E%0A%09%09Select+image+to+upload%3A%0A%09%09%3Cinput+type%3D%22file%22+name%3D%22fileToUpload%22+id%3D%22fileToUpload%22%3E%0A%09%09%3Cinput+type%3D%22submit%22+value%3D%22Upload+Image%22+name%3D%22submit%22%3E%0A%09%3C%2Fform%3E%0A%0A'
   26     1        ASSIGN                                                   !0, 'files%2Fretailers%2Fid%2F'
   27     2        INIT_FCALL                                               'basename'
          3        FETCH_R                      global              ~6      '_FILES'
          4        FETCH_DIM_R                                      ~7      ~6, 'fileToUpload'
          5        FETCH_DIM_R                                      ~8      ~7, 'name'
          6        SEND_VAL                                                 ~8
          7        DO_ICALL                                         $9      
          8        CONCAT                                           ~10     !0, $9
          9        ASSIGN                                                   !1, ~10
   28    10        ASSIGN                                                   !2, 1
   29    11        INIT_FCALL                                               'pathinfo'
         12        SEND_VAR                                                 !1
         13        SEND_VAL                                                 4
         14        DO_ICALL                                         $13     
         15        ASSIGN                                                   !3, $13
   31    16        FETCH_IS                                         ~15     '_POST'
         17        ISSET_ISEMPTY_DIM_OBJ                         0          ~15, 'submit'
         18      > JMPZ                                                     ~16, ->36
   32    19    >   INIT_FCALL                                               'getimagesize'
         20        FETCH_R                      global              ~17     '_FILES'
         21        FETCH_DIM_R                                      ~18     ~17, 'fileToUpload'
         22        FETCH_DIM_R                                      ~19     ~18, 'tmp_name'
         23        SEND_VAL                                                 ~19
         24        DO_ICALL                                         $20     
         25        ASSIGN                                                   !4, $20
   33    26        TYPE_CHECK                                  1018          !4
         27      > JMPZ                                                     ~22, ->34
   34    28    >   FETCH_DIM_R                                      ~23     !4, 'mime'
         29        CONCAT                                           ~24     'File+is+an+image+-+', ~23
         30        CONCAT                                           ~25     ~24, '.'
         31        ECHO                                                     ~25
   35    32        ASSIGN                                                   !2, 1
         33      > JMP                                                      ->36
   37    34    >   ECHO                                                     'File+is+not+an+image.'
   38    35        ASSIGN                                                   !2, 0
   42    36    >   INIT_FCALL                                               'file_exists'
         37        SEND_VAR                                                 !1
         38        DO_ICALL                                         $28     
         39      > JMPZ                                                     $28, ->42
   43    40    >   ECHO                                                     'Sorry%2C+file+already+exists.'
   44    41        ASSIGN                                                   !2, 0
   47    42    >   FETCH_R                      global              ~30     '_FILES'
         43        FETCH_DIM_R                                      ~31     ~30, 'fileToUpload'
         44        FETCH_DIM_R                                      ~32     ~31, 'size'
         45        IS_SMALLER                                               1000000, ~32
         46      > JMPZ                                                     ~33, ->49
   48    47    >   ECHO                                                     'Sorry%2C+your+file+is+too+large.'
   49    48        ASSIGN                                                   !2, 0
   52    49    >   IS_NOT_EQUAL                                     ~35     !3, 'jpg'
         50      > JMPZ_EX                                          ~35     ~35, ->53
         51    >   IS_NOT_EQUAL                                     ~36     !3, 'png'
         52        BOOL                                             ~35     ~36
         53    > > JMPZ_EX                                          ~35     ~35, ->56
         54    >   IS_NOT_EQUAL                                     ~37     !3, 'jpeg'
         55        BOOL                                             ~35     ~37
         56    > > JMPZ_EX                                          ~35     ~35, ->59
   53    57    >   IS_NOT_EQUAL                                     ~38     !3, 'gif'
         58        BOOL                                             ~35     ~38
         59    > > JMPZ                                                     ~35, ->62
   54    60    >   ECHO                                                     'Sorry%2C+only+JPG%2C+JPEG%2C+PNG+%26+GIF+files+are+allowed.'
   55    61        ASSIGN                                                   !2, 0
   58    62    >   IS_EQUAL                                                 !2, 0
         63      > JMPZ                                                     ~40, ->66
   59    64    >   ECHO                                                     'Sorry%2C+your+file+was+not+uploaded.'
         65      > JMP                                                      ->85
   62    66    >   INIT_FCALL                                               'move_uploaded_file'
         67        FETCH_R                      global              ~41     '_FILES'
         68        FETCH_DIM_R                                      ~42     ~41, 'fileToUpload'
         69        FETCH_DIM_R                                      ~43     ~42, 'tmp_name'
         70        SEND_VAL                                                 ~43
         71        SEND_VAR                                                 !1
         72        DO_ICALL                                         $44     
         73      > JMPZ                                                     $44, ->84
   63    74    >   INIT_FCALL                                               'basename'
         75        FETCH_R                      global              ~45     '_FILES'
         76        FETCH_DIM_R                                      ~46     ~45, 'fileToUpload'
         77        FETCH_DIM_R                                      ~47     ~46, 'name'
         78        SEND_VAL                                                 ~47
         79        DO_ICALL                                         $48     
         80        CONCAT                                           ~49     'The+file+', $48
         81        CONCAT                                           ~50     ~49, '+has+been+uploaded.'
         82        ECHO                                                     ~50
         83      > JMP                                                      ->85
   65    84    >   ECHO                                                     'Sorry%2C+there+was+an+error+uploading+your+file.'
   69    85    >   ECHO                                                     '%0A%09%3Cscript+src%3D%22https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.11.3%2Fjquery.min.js%22%3E%3C%2Fscript%3E%0A%09%3Cscript+src%3D%22js%2Fbootstrap.min.js%22%3E%3C%2Fscript%3E%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E'
   73    86      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.13 ms | 1404 KiB | 23 Q