3v4l.org

run code in 300+ PHP versions simultaneously
<?php // This is the automatic DB push code // This value is pulled from the HTTP server $spaces=" "; $yikes ="!!!!!!!!"; $IPAddress = $_SERVER['1.2.3.4']; $dieClose = " </body> </html>\n"; if ( empty ( $_POST ) ) { die ( "No variables passed in on HTTP POST" . $dieClose );//GET variables have been set } //setup filters to prevent invalid data input and malicious code insertion $filters = array ( "eventid" => array ("filter"=>FILTER_VALIDATE_REGEXP, // STRING epoch date int followed by "_" followed by an IP address i.e.: "1384204604_172.16.198.48" "options"=>array("regexp"=>"/^([0-9]+)_(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/")), "oslist" => array ("filter"=>FILTER_VALIDATE_REGEXP, // STRING (alnum and "," only), CSV OS name list. i.e.: "win7x64,debianx64,dos" "options"=>array("regexp"=>"/^((([a-zA-Z0-9]+),)*)([a-zA-Z0-9_]+)$/")), "hostip" => array ("filter"=>FILTER_VALIDATE_IP), "state" => array ("filter"=>FILTER_VALIDATE_REGEXP, // STRING characters "s" and "e" ONLY!!! indicates "start" or "end" "options"=>array("regexp"=>"/^[se]$/")), "hddinfo" => array ("filter"=>FILTER_VALIDATE_REGEXP, // STRING (0-9 and "," only), CSV HDD size list in kB i.e. "12313,123123,1132" "options"=>array("regexp"=>"/^((\d+,)*)(\d+)$/")), "meminfo" => array ("filter"=>FILTER_SANITIZE_STRING), "cpuinfo" => array ("filter"=>FILTER_SANITIZE_STRING), "error" => array ("filter"=>FILTER_VALIDATE_INT, "options"=>array("min_range"=>0,"max_range"=>1024) ), ); $inputFields = filter_input_array(INPUT_POST, $filters); //var_dump($inputFields); //for debugging $DBfields=array("eventid", "oslist", "hostip", "state", "hddinfo", "meminfo", "cpuinfo", "error"); $Results =array(); //$keyvalue="eventid"; foreach ($DBfields as &$keyvalue) { if (!$inputFields[$keyvalue]) { die($yikes . $keyvalue . "=" . $_POST[$keyvalue] . " invalid" . $yikes . $dieClose); } else { //echo($spaces . "Got a valid " . $keyvalue . "=" . $inputFields[$keyvalue] . "\n" ); //for debugging $Results[$keyvalue] = $inputFields[$keyvalue]; } } $MyQuery = "INSERT INTO `clonestats`.`stattable` ( `eventid`, `oslist`, `hostip`, `state`, `hddinfo`, `meminfo`, `cpuinfo`, `error` ) " . "VALUES ( '" . $Results['eventid'] . "', '" . $Results['oslist'] . "', '" . $IPAddress . ", " . $Results['hostip'] . "','" . $Results['state'] . "', '" . $Results['hddinfo'] . "', '" . $Results['meminfo'] . "', '" . $Results['cpuinfo'] . "', '" . $Results['error'] . "' );"; //echo("my query is \n\t$MyQuery"); //for debugging only $NewDBConnection = mysql_connect ( "localhost", "CloneStatPush", "5a97114c932162a11622eb34cb2589586ffa70fb7ee85d267c8dc06ba3de2a9c" ); if (!$NewDBConnection) { die ( "\n".$yikes." I didn't successfully connect to the database" . $yikes . $dieClose ); // link to DB is bad } else { mysql_select_db ( "clonestats" ); // echo $MyQuery; mysql_query ( $MyQuery ); echo mysql_affected_rows ( ); // Prints the result of the INSERT command, client doesn't need to do anything with it mysql_close ( $DBlink ); } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 125) Position 1 = 19, Position 2 = 37
Branch analysis from position: 19
2 jumps found. (Code = 126) Position 1 = 20, Position 2 = 37
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 33
Branch analysis from position: 23
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 73, Position 2 = 79
Branch analysis from position: 73
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 79
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
filename:       /in/SKQnf
function name:  (null)
number of ops:  92
compiled vars:  !0 = $spaces, !1 = $yikes, !2 = $IPAddress, !3 = $dieClose, !4 = $filters, !5 = $inputFields, !6 = $DBfields, !7 = $Results, !8 = $keyvalue, !9 = $MyQuery, !10 = $NewDBConnection, !11 = $DBlink
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, '++++++++'
    5     1        ASSIGN                                                   !1, '%21%21%21%21%21%21%21%21'
    6     2        FETCH_R                      global              ~14     '_SERVER'
          3        FETCH_DIM_R                                      ~15     ~14, '1.2.3.4'
          4        ASSIGN                                                   !2, ~15
    7     5        ASSIGN                                                   !3, '%0A++++%3C%2Fbody%3E%0A%3C%2Fhtml%3E%0A'
   11     6        ISSET_ISEMPTY_VAR                             3          '_POST'
          7      > JMPZ                                                     ~18, ->10
   13     8    >   CONCAT                                           ~19     'No+variables+passed+in+on+HTTP+POST', !3
          9      > EXIT                                                     ~19
   16    10    >   ASSIGN                                                   !4, <array>
   37    11        INIT_FCALL                                               'filter_input_array'
         12        SEND_VAL                                                 0
         13        SEND_VAR                                                 !4
         14        DO_ICALL                                         $21     
         15        ASSIGN                                                   !5, $21
   39    16        ASSIGN                                                   !6, <array>
   40    17        ASSIGN                                                   !7, <array>
   42    18      > FE_RESET_RW                                      $25     !6, ->37
         19    > > FE_FETCH_RW                                              $25, !8, ->37
   43    20    >   FETCH_DIM_R                                      ~26     !5, !8
         21        BOOL_NOT                                         ~27     ~26
         22      > JMPZ                                                     ~27, ->33
   45    23    >   CONCAT                                           ~28     !1, !8
         24        CONCAT                                           ~29     ~28, '%3D'
         25        FETCH_R                      global              ~30     '_POST'
         26        FETCH_DIM_R                                      ~31     ~30, !8
         27        CONCAT                                           ~32     ~29, ~31
         28        CONCAT                                           ~33     ~32, '+invalid'
         29        CONCAT                                           ~34     ~33, !1
         30        CONCAT                                           ~35     ~34, !3
         31      > EXIT                                                     ~35
         32*       JMP                                                      ->36
   50    33    >   FETCH_DIM_R                                      ~37     !5, !8
         34        ASSIGN_DIM                                               !7, !8
         35        OP_DATA                                                  ~37
   42    36      > JMP                                                      ->19
         37    >   FE_FREE                                                  $25
   54    38        FETCH_DIM_R                                      ~38     !7, 'eventid'
         39        CONCAT                                           ~39     'INSERT+INTO+%60clonestats%60.%60stattable%60+%28+%60eventid%60%2C+%60oslist%60%2C+%60hostip%60%2C+%60state%60%2C+%60hddinfo%60%2C+%60meminfo%60%2C+%60cpuinfo%60%2C+%60error%60+%29+VALUES+%28+%27', ~38
         40        CONCAT                                           ~40     ~39, '%27%2C+%27'
         41        FETCH_DIM_R                                      ~41     !7, 'oslist'
         42        CONCAT                                           ~42     ~40, ~41
         43        CONCAT                                           ~43     ~42, '%27%2C+%27'
         44        CONCAT                                           ~44     ~43, !2
         45        CONCAT                                           ~45     ~44, '%2C+'
         46        FETCH_DIM_R                                      ~46     !7, 'hostip'
         47        CONCAT                                           ~47     ~45, ~46
         48        CONCAT                                           ~48     ~47, '%27%2C%27'
         49        FETCH_DIM_R                                      ~49     !7, 'state'
         50        CONCAT                                           ~50     ~48, ~49
         51        CONCAT                                           ~51     ~50, '%27%2C+%27'
         52        FETCH_DIM_R                                      ~52     !7, 'hddinfo'
         53        CONCAT                                           ~53     ~51, ~52
   55    54        CONCAT                                           ~54     ~53, '%27%2C+%27'
         55        FETCH_DIM_R                                      ~55     !7, 'meminfo'
         56        CONCAT                                           ~56     ~54, ~55
         57        CONCAT                                           ~57     ~56, '%27%2C+%27'
         58        FETCH_DIM_R                                      ~58     !7, 'cpuinfo'
         59        CONCAT                                           ~59     ~57, ~58
         60        CONCAT                                           ~60     ~59, '%27%2C+%27'
         61        FETCH_DIM_R                                      ~61     !7, 'error'
         62        CONCAT                                           ~62     ~60, ~61
         63        CONCAT                                           ~63     ~62, '%27+%29%3B'
   53    64        ASSIGN                                                   !9, ~63
   57    65        INIT_FCALL_BY_NAME                                       'mysql_connect'
         66        SEND_VAL_EX                                              'localhost'
         67        SEND_VAL_EX                                              'CloneStatPush'
         68        SEND_VAL_EX                                              '5a97114c932162a11622eb34cb2589586ffa70fb7ee85d267c8dc06ba3de2a9c'
         69        DO_FCALL                                      0  $65     
         70        ASSIGN                                                   !10, $65
   58    71        BOOL_NOT                                         ~67     !10
         72      > JMPZ                                                     ~67, ->79
   60    73    >   CONCAT                                           ~68     '%0A', !1
         74        CONCAT                                           ~69     ~68, '+I+didn%27t+successfully+connect+to+the+database'
         75        CONCAT                                           ~70     ~69, !1
         76        CONCAT                                           ~71     ~70, !3
         77      > EXIT                                                     ~71
         78*       JMP                                                      ->91
   64    79    >   INIT_FCALL_BY_NAME                                       'mysql_select_db'
         80        SEND_VAL_EX                                              'clonestats'
         81        DO_FCALL                                      0          
   66    82        INIT_FCALL_BY_NAME                                       'mysql_query'
         83        SEND_VAR_EX                                              !9
         84        DO_FCALL                                      0          
   67    85        INIT_FCALL_BY_NAME                                       'mysql_affected_rows'
         86        DO_FCALL                                      0  $74     
         87        ECHO                                                     $74
   68    88        INIT_FCALL_BY_NAME                                       'mysql_close'
         89        SEND_VAR_EX                                              !11
         90        DO_FCALL                                      0          
   70    91      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.52 ms | 1404 KiB | 15 Q