3v4l.org

run code in 300+ PHP versions simultaneously
<?php $mysql = array(); $db = mysqli_init(); $db->real_connect('localhost', 'myuser', 'mypass', 'mydb'); /* SQL Injection Example */ $_POST['username'] = chr(0xbf) . chr(0x27) . ' OR username = username /*'; $_POST['password'] = 'guess'; $mysql['username'] = addslashes($_POST['username']); $mysql['password'] = addslashes($_POST['password']); $sql = "SELECT * FROM users WHERE username = '{$mysql['username']}' AND password = '{$mysql['password']}'"; $result = $db->query($sql); if ($result->num_rows) { /* Success */ } else { /* Failure */ } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 45
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
filename:       /in/0Ybve
function name:  (null)
number of ops:  46
compiled vars:  !0 = $mysql, !1 = $db, !2 = $sql, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL_BY_NAME                                       'mysqli_init'
          2        DO_FCALL                                      0  $5      
          3        ASSIGN                                                   !1, $5
    5     4        INIT_METHOD_CALL                                         !1, 'real_connect'
          5        SEND_VAL_EX                                              'localhost'
          6        SEND_VAL_EX                                              'myuser'
          7        SEND_VAL_EX                                              'mypass'
          8        SEND_VAL_EX                                              'mydb'
          9        DO_FCALL                                      0          
    9    10        FETCH_W                      global              $8      '_POST'
         11        ASSIGN_DIM                                               $8, 'username'
         12        OP_DATA                                                  '%BF%27+OR+username+%3D+username+%2F%2A'
   10    13        FETCH_W                      global              $10     '_POST'
         14        ASSIGN_DIM                                               $10, 'password'
         15        OP_DATA                                                  'guess'
   12    16        INIT_FCALL                                               'addslashes'
         17        FETCH_R                      global              ~13     '_POST'
         18        FETCH_DIM_R                                      ~14     ~13, 'username'
         19        SEND_VAL                                                 ~14
         20        DO_ICALL                                         $15     
         21        ASSIGN_DIM                                               !0, 'username'
         22        OP_DATA                                                  $15
   13    23        INIT_FCALL                                               'addslashes'
         24        FETCH_R                      global              ~17     '_POST'
         25        FETCH_DIM_R                                      ~18     ~17, 'password'
         26        SEND_VAL                                                 ~18
         27        DO_ICALL                                         $19     
         28        ASSIGN_DIM                                               !0, 'password'
         29        OP_DATA                                                  $19
   15    30        ROPE_INIT                                     5  ~23     'SELECT+%2A+FROM+++users%0A+++++++++++++++WHERE+username+%3D+%27'
   16    31        FETCH_DIM_R                                      ~20     !0, 'username'
         32        ROPE_ADD                                      1  ~23     ~23, ~20
         33        ROPE_ADD                                      2  ~23     ~23, '%27%0A+++++++++++++++AND+password+%3D+%27'
   17    34        FETCH_DIM_R                                      ~21     !0, 'password'
         35        ROPE_ADD                                      3  ~23     ~23, ~21
         36        ROPE_END                                      4  ~22     ~23, '%27'
   15    37        ASSIGN                                                   !2, ~22
   19    38        INIT_METHOD_CALL                                         !1, 'query'
         39        SEND_VAR_EX                                              !2
         40        DO_FCALL                                      0  $27     
         41        ASSIGN                                                   !3, $27
   21    42        FETCH_OBJ_R                                      ~29     !3, 'num_rows'
         43      > JMPZ                                                     ~29, ->45
         44    > > JMP                                                      ->45
   27    45    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.09 ms | 1400 KiB | 15 Q