3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('display_errors',1); error_reporting(E_ALL); $db_host='localhost'; $db_user='root'; $database='tpetd'; $table='etud'; if (!mysql_connect($db_host, $db_user)) die("can't connec"); if (!mysql_select_db($database)) die("can't selec database"); if (isset($_POST['submit'])) { $fname= $_FILES['sel_file']['name']; echo 'uplaod file name :'.$fname.' '; $chk_exr = explode(".",$fname); if(strtolower(end($chk_ext)) == "csv") { $filename = $_FILES['sel_file']['tmp_name']; $handle = fopen($filename, "r"); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $sql = "insert into etud(prenom,nom,date) values ('$data[0]','$data[1]','$data[2]')"; mysql_query($sql) or die(mysql_error()); } fclose($handle); echo"Success"; } else { echo"invalide"; } } ?> <h1>IMPORT CSV FILE</h1> <form action="<?php echo $_SERVER["PHP_SELF"]?>" method ="post" enctype="multipart/form-data"> imprort file : <input type='file' name='sel_file' size='20'> <input type='submit' name='submit' value='submit'> </form> end(explode('Polymorph\Component\Content\Model\Post'));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 18
Branch analysis from position: 17
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 24
Branch analysis from position: 23
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 90
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 89
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 76
Branch analysis from position: 76
2 jumps found. (Code = 44) Position 1 = 84, Position 2 = 57
Branch analysis from position: 84
1 jumps found. (Code = 42) Position 1 = 90
Branch analysis from position: 90
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 57
2 jumps found. (Code = 47) Position 1 = 72, Position 2 = 76
Branch analysis from position: 72
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 76
Branch analysis from position: 89
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 90
filename:       /in/eJgf5
function name:  (null)
number of ops:  96
compiled vars:  !0 = $db_host, !1 = $db_user, !2 = $database, !3 = $table, !4 = $fname, !5 = $chk_exr, !6 = $chk_ext, !7 = $filename, !8 = $handle, !9 = $sql, !10 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'ini_set'
          1        SEND_VAL                                                 'display_errors'
          2        SEND_VAL                                                 1
          3        DO_ICALL                                                 
    3     4        INIT_FCALL                                               'error_reporting'
          5        SEND_VAL                                                 32767
          6        DO_ICALL                                                 
    4     7        ASSIGN                                                   !0, 'localhost'
    5     8        ASSIGN                                                   !1, 'root'
    6     9        ASSIGN                                                   !2, 'tpetd'
    7    10        ASSIGN                                                   !3, 'etud'
    8    11        INIT_FCALL_BY_NAME                                       'mysql_connect'
         12        SEND_VAR_EX                                              !0
         13        SEND_VAR_EX                                              !1
         14        DO_FCALL                                      0  $17     
         15        BOOL_NOT                                         ~18     $17
         16      > JMPZ                                                     ~18, ->18
    9    17    > > EXIT                                                     'can%27t+connec'
   10    18    >   INIT_FCALL_BY_NAME                                       'mysql_select_db'
         19        SEND_VAR_EX                                              !2
         20        DO_FCALL                                      0  $19     
         21        BOOL_NOT                                         ~20     $19
         22      > JMPZ                                                     ~20, ->24
   11    23    > > EXIT                                                     'can%27t+selec+database'
   14    24    >   FETCH_IS                                         ~21     '_POST'
         25        ISSET_ISEMPTY_DIM_OBJ                         0          ~21, 'submit'
         26      > JMPZ                                                     ~22, ->90
   16    27    >   FETCH_R                      global              ~23     '_FILES'
         28        FETCH_DIM_R                                      ~24     ~23, 'sel_file'
         29        FETCH_DIM_R                                      ~25     ~24, 'name'
         30        ASSIGN                                                   !4, ~25
   17    31        CONCAT                                           ~27     'uplaod+file+name+%3A', !4
         32        CONCAT                                           ~28     ~27, '+'
         33        ECHO                                                     ~28
   18    34        INIT_FCALL                                               'explode'
         35        SEND_VAL                                                 '.'
         36        SEND_VAR                                                 !4
         37        DO_ICALL                                         $29     
         38        ASSIGN                                                   !5, $29
   20    39        INIT_FCALL                                               'strtolower'
         40        INIT_FCALL                                               'end'
         41        SEND_REF                                                 !6
         42        DO_ICALL                                         $31     
         43        SEND_VAR                                                 $31
         44        DO_ICALL                                         $32     
         45        IS_EQUAL                                                 $32, 'csv'
         46      > JMPZ                                                     ~33, ->89
   22    47    >   FETCH_R                      global              ~34     '_FILES'
         48        FETCH_DIM_R                                      ~35     ~34, 'sel_file'
         49        FETCH_DIM_R                                      ~36     ~35, 'tmp_name'
         50        ASSIGN                                                   !7, ~36
   23    51        INIT_FCALL                                               'fopen'
         52        SEND_VAR                                                 !7
         53        SEND_VAL                                                 'r'
         54        DO_ICALL                                         $38     
         55        ASSIGN                                                   !8, $38
   25    56      > JMP                                                      ->76
   27    57    >   ROPE_INIT                                     7  ~44     'insert+into+etud%28prenom%2Cnom%2Cdate%29+values+%28%27'
         58        FETCH_DIM_R                                      ~40     !10, 0
         59        ROPE_ADD                                      1  ~44     ~44, ~40
         60        ROPE_ADD                                      2  ~44     ~44, '%27%2C%27'
         61        FETCH_DIM_R                                      ~41     !10, 1
         62        ROPE_ADD                                      3  ~44     ~44, ~41
         63        ROPE_ADD                                      4  ~44     ~44, '%27%2C%27'
         64        FETCH_DIM_R                                      ~42     !10, 2
         65        ROPE_ADD                                      5  ~44     ~44, ~42
         66        ROPE_END                                      6  ~43     ~44, '%27%29'
         67        ASSIGN                                                   !9, ~43
   28    68        INIT_FCALL_BY_NAME                                       'mysql_query'
         69        SEND_VAR_EX                                              !9
         70        DO_FCALL                                      0  $49     
         71      > JMPNZ_EX                                         ~50     $49, ->76
         72    >   INIT_FCALL_BY_NAME                                       'mysql_error'
         73        DO_FCALL                                      0  $51     
         74      > EXIT                                                     $51
         75*       BOOL                                             ~50     <true>
   25    76    >   INIT_FCALL                                               'fgetcsv'
         77        SEND_VAR                                                 !8
         78        SEND_VAL                                                 1000
         79        SEND_VAL                                                 '%2C'
         80        DO_ICALL                                         $52     
         81        ASSIGN                                           ~53     !10, $52
         82        TYPE_CHECK                                  1018          ~53
         83      > JMPNZ                                                    ~54, ->57
   30    84    >   INIT_FCALL                                               'fclose'
         85        SEND_VAR                                                 !8
         86        DO_ICALL                                                 
   31    87        ECHO                                                     'Success'
         88      > JMP                                                      ->90
   35    89    >   ECHO                                                     'invalide'
   39    90    >   ECHO                                                     '%3Ch1%3EIMPORT+CSV+FILE%3C%2Fh1%3E%0A%3Cform+action%3D%22'
   40    91        FETCH_R                      global              ~56     '_SERVER'
         92        FETCH_DIM_R                                      ~57     ~56, 'PHP_SELF'
         93        ECHO                                                     ~57
         94        ECHO                                                     '%22+method+%3D%22post%22+enctype%3D%22multipart%2Fform-data%22%3E%0Aimprort+file+%3A+%3Cinput+type%3D%27file%27+name%3D%27sel_file%27+size%3D%2720%27%3E%0A%3Cinput+type%3D%27submit%27+name%3D%27submit%27+value%3D%27submit%27%3E%0A%3C%2Fform%3E%0A%0Aend%28explode%28%27Polymorph%5CComponent%5CContent%5CModel%5CPost%27%29%29%3B'
   45    95      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.72 ms | 1404 KiB | 29 Q