3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (isset($_POST['id'])) $id=stripslashes($_POST['id']); else { if (isset($_GET['id'])) $id=stripslashes($_GET['id']); else $id=""; } if (isset($_POST['cmd'])) $cmd=stripslashes($_POST['cmd']); else { if (isset($_GET['cmd'])) $cmd=stripslashes($_GET['cmd']); else $cmd=1; } function ahex2bin($s,$l) { for ($i = 0; $i < $l*2; $i += 2) { if($i < strlen($s)) $bin .= chr(hexdec(substr($s,$i,2))); else $bin .= chr(0); } return $bin; } $fp = fsockopen("udp://127.0.0.1", 80, $errno, $errstr); if (!$fp) { $answer="ERROR: $errno - $errstr<br>"; } else { $cmd = chr(0xfc).chr($cmd); $cmd = $cmd.ahex2bin($id,6).chr(0).chr(0).chr(0).chr(0).$data; if(fwrite($fp, $cmd)===FALSE) $answer="ERROR: write<br>"; else $answer="OK<br>"; fclose($fp); } echo $answer; ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 31
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 58
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 86
Branch analysis from position: 86
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 58
2 jumps found. (Code = 43) Position 1 = 80, Position 2 = 82
Branch analysis from position: 80
1 jumps found. (Code = 42) Position 1 = 83
Branch analysis from position: 83
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 82
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 41
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 58
Branch analysis from position: 51
Branch analysis from position: 58
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 20
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 31
Branch analysis from position: 24
Branch analysis from position: 31
filename:       /in/e1kn9
function name:  (null)
number of ops:  88
compiled vars:  !0 = $id, !1 = $cmd, !2 = $fp, !3 = $errno, !4 = $errstr, !5 = $answer, !6 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   FETCH_IS                                         ~7      '_POST'
          1        ISSET_ISEMPTY_DIM_OBJ                         0          ~7, 'id'
          2      > JMPZ                                                     ~8, ->10
    4     3    >   INIT_FCALL                                               'stripslashes'
          4        FETCH_R                      global              ~9      '_POST'
          5        FETCH_DIM_R                                      ~10     ~9, 'id'
          6        SEND_VAL                                                 ~10
          7        DO_ICALL                                         $11     
          8        ASSIGN                                                   !0, $11
          9      > JMP                                                      ->21
    7    10    >   FETCH_IS                                         ~13     '_GET'
         11        ISSET_ISEMPTY_DIM_OBJ                         0          ~13, 'id'
         12      > JMPZ                                                     ~14, ->20
    8    13    >   INIT_FCALL                                               'stripslashes'
         14        FETCH_R                      global              ~15     '_GET'
         15        FETCH_DIM_R                                      ~16     ~15, 'id'
         16        SEND_VAL                                                 ~16
         17        DO_ICALL                                         $17     
         18        ASSIGN                                                   !0, $17
         19      > JMP                                                      ->21
   10    20    >   ASSIGN                                                   !0, ''
   13    21    >   FETCH_IS                                         ~20     '_POST'
         22        ISSET_ISEMPTY_DIM_OBJ                         0          ~20, 'cmd'
         23      > JMPZ                                                     ~21, ->31
   14    24    >   INIT_FCALL                                               'stripslashes'
         25        FETCH_R                      global              ~22     '_POST'
         26        FETCH_DIM_R                                      ~23     ~22, 'cmd'
         27        SEND_VAL                                                 ~23
         28        DO_ICALL                                         $24     
         29        ASSIGN                                                   !1, $24
         30      > JMP                                                      ->42
   17    31    >   FETCH_IS                                         ~26     '_GET'
         32        ISSET_ISEMPTY_DIM_OBJ                         0          ~26, 'cmd'
         33      > JMPZ                                                     ~27, ->41
   18    34    >   INIT_FCALL                                               'stripslashes'
         35        FETCH_R                      global              ~28     '_GET'
         36        FETCH_DIM_R                                      ~29     ~28, 'cmd'
         37        SEND_VAL                                                 ~29
         38        DO_ICALL                                         $30     
         39        ASSIGN                                                   !1, $30
         40      > JMP                                                      ->42
   20    41    >   ASSIGN                                                   !1, 1
   35    42    >   INIT_FCALL                                               'fsockopen'
         43        SEND_VAL                                                 'udp%3A%2F%2F127.0.0.1'
         44        SEND_VAL                                                 80
         45        SEND_REF                                                 !3
         46        SEND_REF                                                 !4
         47        DO_ICALL                                         $33     
         48        ASSIGN                                                   !2, $33
   37    49        BOOL_NOT                                         ~35     !2
         50      > JMPZ                                                     ~35, ->58
   39    51    >   ROPE_INIT                                     5  ~37     'ERROR%3A+'
         52        ROPE_ADD                                      1  ~37     ~37, !3
         53        ROPE_ADD                                      2  ~37     ~37, '+-+'
         54        ROPE_ADD                                      3  ~37     ~37, !4
         55        ROPE_END                                      4  ~36     ~37, '%3Cbr%3E'
         56        ASSIGN                                                   !5, ~36
         57      > JMP                                                      ->86
   43    58    >   INIT_FCALL                                               'chr'
         59        SEND_VAR                                                 !1
         60        DO_ICALL                                         $41     
         61        CONCAT                                           ~42     '%FC', $41
         62        ASSIGN                                                   !1, ~42
   44    63        INIT_FCALL                                               'ahex2bin'
         64        SEND_VAR                                                 !0
         65        SEND_VAL                                                 6
         66        DO_FCALL                                      0  $44     
         67        CONCAT                                           ~45     !1, $44
         68        CONCAT                                           ~46     ~45, '%00'
         69        CONCAT                                           ~47     ~46, '%00'
         70        CONCAT                                           ~48     ~47, '%00'
         71        CONCAT                                           ~49     ~48, '%00'
         72        CONCAT                                           ~50     ~49, !6
         73        ASSIGN                                                   !1, ~50
   46    74        INIT_FCALL                                               'fwrite'
         75        SEND_VAR                                                 !2
         76        SEND_VAR                                                 !1
         77        DO_ICALL                                         $52     
         78        TYPE_CHECK                                    4          $52
         79      > JMPZ                                                     ~53, ->82
   47    80    >   ASSIGN                                                   !5, 'ERROR%3A+write%3Cbr%3E'
         81      > JMP                                                      ->83
   49    82    >   ASSIGN                                                   !5, 'OK%3Cbr%3E'
   51    83    >   INIT_FCALL                                               'fclose'
         84        SEND_VAR                                                 !2
         85        DO_ICALL                                                 
   53    86    >   ECHO                                                     !5
   56    87      > RETURN                                                   1

Function ahex2bin:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 4
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 20
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 4
Branch analysis from position: 25
Branch analysis from position: 4
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 4
Branch analysis from position: 25
Branch analysis from position: 4
filename:       /in/e1kn9
function name:  ahex2bin
number of ops:  27
compiled vars:  !0 = $s, !1 = $l, !2 = $i, !3 = $bin
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   25     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->22
   27     4    >   STRLEN                                           ~5      !0
          5        IS_SMALLER                                               !2, ~5
          6      > JMPZ                                                     ~6, ->20
   28     7    >   INIT_FCALL                                               'chr'
          8        INIT_FCALL                                               'hexdec'
          9        INIT_FCALL                                               'substr'
         10        SEND_VAR                                                 !0
         11        SEND_VAR                                                 !2
         12        SEND_VAL                                                 2
         13        DO_ICALL                                         $7      
         14        SEND_VAR                                                 $7
         15        DO_ICALL                                         $8      
         16        SEND_VAR                                                 $8
         17        DO_ICALL                                         $9      
         18        ASSIGN_OP                                     8          !3, $9
         19      > JMP                                                      ->21
   30    20    >   ASSIGN_OP                                     8          !3, '%00'
   25    21    >   ASSIGN_OP                                     1          !2, 2
         22    >   MUL                                              ~13     !1, 2
         23        IS_SMALLER                                               !2, ~13
         24      > JMPNZ                                                    ~14, ->4
   32    25    > > RETURN                                                   !3
   33    26*     > RETURN                                                   null

End of function ahex2bin

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.17 ms | 1410 KiB | 28 Q