3v4l.org

run code in 300+ PHP versions simultaneously
<?php $db = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName); if ($db->connect_error) { die("Unable to connect database: " . $db->connect_error); } if(isset($_POST['importSubmit'])){ //validate whether uploaded file is a csv file $csvMimes = array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'); if(!empty($_FILES['file']['name']) && in_array($_FILES['file']['type'],$csvMimes)){ if(is_uploaded_file($_FILES['file']['tmp_name'])){ //open uploaded csv file with read only mode $csvFile = fopen($_FILES['file']['tmp_name'], 'r'); //skip first line fgetcsv($csvFile); //parse data from csv file line by line while(($line = fgetcsv($csvFile)) !== FALSE){ //insert member data into database $$db->query("INSERT INTO `table 25` (tipologia, inventario, nordcom, marca, modello, sn, cpu, os, cdr, cdc, urgenza, sede, padiglione, piano, stanza, nome, cognome, telefono, ram, stato, datainstallazione, datadisponibilita, datareso, note) VALUES ('".$line[0]."','".$line[1]."','".$line[2]."','".$line[3]."','".$line[3]."','".$line[4]."','".$line[5]."','".$line[6]."','".$line[7]."','".$line[8]."','".$line[9]."','".$line[10]."','".$line[11]."','".$line[12]."','".$line[13]."','".$line[14]."','".$line[15]."','".$line[16]."','".$line[17]."','".$line[18]."','".$line[19]."','".$line[20]."','".$line[21]."','".$line[22]."','".$line[23]."','".$line[24]."')"); } //close opened csv file fclose($csvFile); $qstring = '?status=succ'; }else{ $qstring = '?status=err'; } }else{ $qstring = '?status=invalid_file'; } } //redirect to the listing page header("Location: import.php".$qstring); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 145
Branch analysis from position: 15
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 29
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 144
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 142
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 131
Branch analysis from position: 131
2 jumps found. (Code = 44) Position 1 = 137, Position 2 = 49
Branch analysis from position: 137
1 jumps found. (Code = 42) Position 1 = 143
Branch analysis from position: 143
1 jumps found. (Code = 42) Position 1 = 145
Branch analysis from position: 145
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 137, Position 2 = 49
Branch analysis from position: 137
Branch analysis from position: 49
Branch analysis from position: 142
1 jumps found. (Code = 42) Position 1 = 145
Branch analysis from position: 145
Branch analysis from position: 144
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
Branch analysis from position: 145
filename:       /in/FOguc
function name:  (null)
number of ops:  150
compiled vars:  !0 = $db, !1 = $dbHost, !2 = $dbUsername, !3 = $dbPassword, !4 = $dbName, !5 = $csvMimes, !6 = $csvFile, !7 = $line, !8 = $qstring
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $9      'mysqli'
          1        SEND_VAR_EX                                              !1
          2        SEND_VAR_EX                                              !2
          3        SEND_VAR_EX                                              !3
          4        SEND_VAR_EX                                              !4
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $9
    4     7        FETCH_OBJ_R                                      ~12     !0, 'connect_error'
          8      > JMPZ                                                     ~12, ->12
    5     9    >   FETCH_OBJ_R                                      ~13     !0, 'connect_error'
         10        CONCAT                                           ~14     'Unable+to+connect+database%3A+', ~13
         11      > EXIT                                                     ~14
    8    12    >   FETCH_IS                                         ~15     '_POST'
         13        ISSET_ISEMPTY_DIM_OBJ                         0          ~15, 'importSubmit'
         14      > JMPZ                                                     ~16, ->145
   11    15    >   ASSIGN                                                   !5, <array>
   12    16        FETCH_IS                                         ~18     '_FILES'
         17        FETCH_DIM_IS                                     ~19     ~18, 'file'
         18        ISSET_ISEMPTY_DIM_OBJ                         1  ~20     ~19, 'name'
         19        BOOL_NOT                                         ~21     ~20
         20      > JMPZ_EX                                          ~21     ~21, ->29
         21    >   INIT_FCALL                                               'in_array'
         22        FETCH_R                      global              ~22     '_FILES'
         23        FETCH_DIM_R                                      ~23     ~22, 'file'
         24        FETCH_DIM_R                                      ~24     ~23, 'type'
         25        SEND_VAL                                                 ~24
         26        SEND_VAR                                                 !5
         27        DO_ICALL                                         $25     
         28        BOOL                                             ~21     $25
         29    > > JMPZ                                                     ~21, ->144
   13    30    >   INIT_FCALL                                               'is_uploaded_file'
         31        FETCH_R                      global              ~26     '_FILES'
         32        FETCH_DIM_R                                      ~27     ~26, 'file'
         33        FETCH_DIM_R                                      ~28     ~27, 'tmp_name'
         34        SEND_VAL                                                 ~28
         35        DO_ICALL                                         $29     
         36      > JMPZ                                                     $29, ->142
   16    37    >   INIT_FCALL                                               'fopen'
         38        FETCH_R                      global              ~30     '_FILES'
         39        FETCH_DIM_R                                      ~31     ~30, 'file'
         40        FETCH_DIM_R                                      ~32     ~31, 'tmp_name'
         41        SEND_VAL                                                 ~32
         42        SEND_VAL                                                 'r'
         43        DO_ICALL                                         $33     
         44        ASSIGN                                                   !6, $33
   19    45        INIT_FCALL                                               'fgetcsv'
         46        SEND_VAR                                                 !6
         47        DO_ICALL                                                 
   22    48      > JMP                                                      ->131
   24    49    >   FETCH_R                      local               ~36     !0
         50        INIT_METHOD_CALL                                         ~36, 'query'
         51        FETCH_DIM_R                                      ~37     !7, 0
         52        CONCAT                                           ~38     'INSERT+INTO+%60table+25%60+%28tipologia%2C+inventario%2C+nordcom%2C+marca%2C+modello%2C+sn%2C+cpu%2C+os%2C+cdr%2C+cdc%2C+urgenza%2C+sede%2C+padiglione%2C+piano%2C+stanza%2C+nome%2C+cognome%2C+telefono%2C+ram%2C+stato%2C+datainstallazione%2C+datadisponibilita%2C+datareso%2C+note%29+VALUES+%28%27', ~37
         53        CONCAT                                           ~39     ~38, '%27%2C%27'
         54        FETCH_DIM_R                                      ~40     !7, 1
         55        CONCAT                                           ~41     ~39, ~40
         56        CONCAT                                           ~42     ~41, '%27%2C%27'
         57        FETCH_DIM_R                                      ~43     !7, 2
         58        CONCAT                                           ~44     ~42, ~43
         59        CONCAT                                           ~45     ~44, '%27%2C%27'
         60        FETCH_DIM_R                                      ~46     !7, 3
         61        CONCAT                                           ~47     ~45, ~46
         62        CONCAT                                           ~48     ~47, '%27%2C%27'
         63        FETCH_DIM_R                                      ~49     !7, 3
         64        CONCAT                                           ~50     ~48, ~49
         65        CONCAT                                           ~51     ~50, '%27%2C%27'
         66        FETCH_DIM_R                                      ~52     !7, 4
         67        CONCAT                                           ~53     ~51, ~52
         68        CONCAT                                           ~54     ~53, '%27%2C%27'
         69        FETCH_DIM_R                                      ~55     !7, 5
         70        CONCAT                                           ~56     ~54, ~55
         71        CONCAT                                           ~57     ~56, '%27%2C%27'
         72        FETCH_DIM_R                                      ~58     !7, 6
         73        CONCAT                                           ~59     ~57, ~58
         74        CONCAT                                           ~60     ~59, '%27%2C%27'
         75        FETCH_DIM_R                                      ~61     !7, 7
         76        CONCAT                                           ~62     ~60, ~61
         77        CONCAT                                           ~63     ~62, '%27%2C%27'
         78        FETCH_DIM_R                                      ~64     !7, 8
         79        CONCAT                                           ~65     ~63, ~64
         80        CONCAT                                           ~66     ~65, '%27%2C%27'
         81        FETCH_DIM_R                                      ~67     !7, 9
         82        CONCAT                                           ~68     ~66, ~67
         83        CONCAT                                           ~69     ~68, '%27%2C%27'
         84        FETCH_DIM_R                                      ~70     !7, 10
         85        CONCAT                                           ~71     ~69, ~70
         86        CONCAT                                           ~72     ~71, '%27%2C%27'
         87        FETCH_DIM_R                                      ~73     !7, 11
         88        CONCAT                                           ~74     ~72, ~73
         89        CONCAT                                           ~75     ~74, '%27%2C%27'
         90        FETCH_DIM_R                                      ~76     !7, 12
         91        CONCAT                                           ~77     ~75, ~76
         92        CONCAT                                           ~78     ~77, '%27%2C%27'
         93        FETCH_DIM_R                                      ~79     !7, 13
         94        CONCAT                                           ~80     ~78, ~79
         95        CONCAT                                           ~81     ~80, '%27%2C%27'
         96        FETCH_DIM_R                                      ~82     !7, 14
         97        CONCAT                                           ~83     ~81, ~82
         98        CONCAT                                           ~84     ~83, '%27%2C%27'
         99        FETCH_DIM_R                                      ~85     !7, 15
        100        CONCAT                                           ~86     ~84, ~85
        101        CONCAT                                           ~87     ~86, '%27%2C%27'
        102        FETCH_DIM_R                                      ~88     !7, 16
        103        CONCAT                                           ~89     ~87, ~88
        104        CONCAT                                           ~90     ~89, '%27%2C%27'
        105        FETCH_DIM_R                                      ~91     !7, 17
        106        CONCAT                                           ~92     ~90, ~91
        107        CONCAT                                           ~93     ~92, '%27%2C%27'
        108        FETCH_DIM_R                                      ~94     !7, 18
        109        CONCAT                                           ~95     ~93, ~94
        110        CONCAT                                           ~96     ~95, '%27%2C%27'
        111        FETCH_DIM_R                                      ~97     !7, 19
        112        CONCAT                                           ~98     ~96, ~97
        113        CONCAT                                           ~99     ~98, '%27%2C%27'
        114        FETCH_DIM_R                                      ~100    !7, 20
        115        CONCAT                                           ~101    ~99, ~100
        116        CONCAT                                           ~102    ~101, '%27%2C%27'
        117        FETCH_DIM_R                                      ~103    !7, 21
        118        CONCAT                                           ~104    ~102, ~103
        119        CONCAT                                           ~105    ~104, '%27%2C%27'
        120        FETCH_DIM_R                                      ~106    !7, 22
        121        CONCAT                                           ~107    ~105, ~106
        122        CONCAT                                           ~108    ~107, '%27%2C%27'
        123        FETCH_DIM_R                                      ~109    !7, 23
        124        CONCAT                                           ~110    ~108, ~109
        125        CONCAT                                           ~111    ~110, '%27%2C%27'
        126        FETCH_DIM_R                                      ~112    !7, 24
        127        CONCAT                                           ~113    ~111, ~112
        128        CONCAT                                           ~114    ~113, '%27%29'
        129        SEND_VAL_EX                                              ~114
        130        DO_FCALL                                      0          
   22   131    >   INIT_FCALL                                               'fgetcsv'
        132        SEND_VAR                                                 !6
        133        DO_ICALL                                         $116    
        134        ASSIGN                                           ~117    !7, $116
        135        TYPE_CHECK                                  1018          ~117
        136      > JMPNZ                                                    ~118, ->49
   28   137    >   INIT_FCALL                                               'fclose'
        138        SEND_VAR                                                 !6
        139        DO_ICALL                                                 
   30   140        ASSIGN                                                   !8, '%3Fstatus%3Dsucc'
        141      > JMP                                                      ->143
   32   142    >   ASSIGN                                                   !8, '%3Fstatus%3Derr'
        143    > > JMP                                                      ->145
   35   144    >   ASSIGN                                                   !8, '%3Fstatus%3Dinvalid_file'
   40   145    >   INIT_FCALL                                               'header'
        146        CONCAT                                           ~123    'Location%3A+import.php', !8
        147        SEND_VAL                                                 ~123
        148        DO_ICALL                                                 
   41   149      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
195.24 ms | 1400 KiB | 25 Q