3v4l.org

run code in 300+ PHP versions simultaneously
<?php $uploads_folder = "/home/yourUnixUsername/public_html/uploads/"; $web_folder = "/uploads/"; $image_requested = $_GET['pic']; // filename from url $images = array(); if(file_exists($uploads_folder.$image_requested)) // if that image exists, get every image from that folder { if ($dh = opendir($uploads_folder)) { $inc = 0; while (($file = readdir($dh)) !== false) { if (!is_dir($uploads_folder.$file)) { $images[$inc]=$web_folder.$file; // construct a web path to image $inc++; } } closedir($dh); } } foreach($images as $an_image) { echo '<img src="'.$an_image.'">'; } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 37
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 37
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 18
Branch analysis from position: 34
2 jumps found. (Code = 77) Position 1 = 38, Position 2 = 43
Branch analysis from position: 38
2 jumps found. (Code = 78) Position 1 = 39, Position 2 = 43
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 28
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 18
Branch analysis from position: 34
Branch analysis from position: 18
Branch analysis from position: 28
Branch analysis from position: 37
Branch analysis from position: 37
filename:       /in/MmAfD
function name:  (null)
number of ops:  45
compiled vars:  !0 = $uploads_folder, !1 = $web_folder, !2 = $image_requested, !3 = $images, !4 = $dh, !5 = $inc, !6 = $file, !7 = $an_image
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2Fhome%2FyourUnixUsername%2Fpublic_html%2Fuploads%2F'
    4     1        ASSIGN                                                   !1, '%2Fuploads%2F'
    6     2        FETCH_R                      global              ~10     '_GET'
          3        FETCH_DIM_R                                      ~11     ~10, 'pic'
          4        ASSIGN                                                   !2, ~11
    8     5        ASSIGN                                                   !3, <array>
   10     6        INIT_FCALL                                               'file_exists'
          7        CONCAT                                           ~14     !0, !2
          8        SEND_VAL                                                 ~14
          9        DO_ICALL                                         $15     
         10      > JMPZ                                                     $15, ->37
   13    11    >   INIT_FCALL                                               'opendir'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $16     
         14        ASSIGN                                           ~17     !4, $16
         15      > JMPZ                                                     ~17, ->37
   15    16    >   ASSIGN                                                   !5, 0
   17    17      > JMP                                                      ->28
   19    18    >   INIT_FCALL                                               'is_dir'
         19        CONCAT                                           ~19     !0, !6
         20        SEND_VAL                                                 ~19
         21        DO_ICALL                                         $20     
         22        BOOL_NOT                                         ~21     $20
         23      > JMPZ                                                     ~21, ->28
   21    24    >   CONCAT                                           ~23     !1, !6
         25        ASSIGN_DIM                                               !3, !5
         26        OP_DATA                                                  ~23
   22    27        PRE_INC                                                  !5
   17    28    >   INIT_FCALL                                               'readdir'
         29        SEND_VAR                                                 !4
         30        DO_ICALL                                         $25     
         31        ASSIGN                                           ~26     !6, $25
         32        TYPE_CHECK                                  1018          ~26
         33      > JMPNZ                                                    ~27, ->18
   26    34    >   INIT_FCALL                                               'closedir'
         35        SEND_VAR                                                 !4
         36        DO_ICALL                                                 
   31    37    > > FE_RESET_R                                       $29     !3, ->43
         38    > > FE_FETCH_R                                               $29, !7, ->43
   33    39    >   CONCAT                                           ~30     '%3Cimg+src%3D%22', !7
         40        CONCAT                                           ~31     ~30, '%22%3E'
         41        ECHO                                                     ~31
   31    42      > JMP                                                      ->38
         43    >   FE_FREE                                                  $29
   35    44      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.86 ms | 1400 KiB | 23 Q