3v4l.org

run code in 300+ PHP versions simultaneously
<?php $username = $_POST['username']; $pass = $_POST['Password']; $mysqli = new mysqli("localhost", "438613", "website", "438613"); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } else{ $username = $mysqli->real_escape_string($username); $pass = $mysqli->real_escape_string($pass); if($row=$mysqli->query("SELECT password FROM accounts WHERE username='$username'")){ if($row->num_rows == 0){ echo "No user with this email!"; header( "refresh:3;url=index.php" ); } else{ $result = $row->fetch_assoc(); $db_pass = $result["password"]; if (password_verify($pass, $db_pass)) { echo "The password is correct!"; session_start(); unset($_SESSION['user']); $_SESSION['user'] = $username; if (isset($_POST['remember'])) { $year = time() + 31536000; setcookie("user", $username, $year);; } header("Location:main.php"); exit(); } else{ echo "Incorrect password!"; header( "refresh:3;url=index.php" ); } } } else{ echo "Select error: (" . $mysqli->errno . ") " . $mysqli->error; } } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 22
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 92
Branch analysis from position: 92
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 86
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 46
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 85
Branch analysis from position: 85
1 jumps found. (Code = 42) Position 1 = 92
Branch analysis from position: 92
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 56, Position 2 = 81
Branch analysis from position: 56
2 jumps found. (Code = 43) Position 1 = 67, Position 2 = 76
Branch analysis from position: 67
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 76
Branch analysis from position: 81
1 jumps found. (Code = 42) Position 1 = 92
Branch analysis from position: 92
Branch analysis from position: 86
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5OmOM
function name:  (null)
number of ops:  93
compiled vars:  !0 = $username, !1 = $pass, !2 = $mysqli, !3 = $row, !4 = $result, !5 = $db_pass, !6 = $year
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   FETCH_R                      global              ~7      '_POST'
          1        FETCH_DIM_R                                      ~8      ~7, 'username'
          2        ASSIGN                                                   !0, ~8
    4     3        FETCH_R                      global              ~10     '_POST'
          4        FETCH_DIM_R                                      ~11     ~10, 'Password'
          5        ASSIGN                                                   !1, ~11
    6     6        NEW                                              $13     'mysqli'
          7        SEND_VAL_EX                                              'localhost'
          8        SEND_VAL_EX                                              '438613'
          9        SEND_VAL_EX                                              'website'
         10        SEND_VAL_EX                                              '438613'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !2, $13
    7    13        FETCH_OBJ_R                                      ~16     !2, 'connect_errno'
         14      > JMPZ                                                     ~16, ->22
    8    15    >   FETCH_OBJ_R                                      ~17     !2, 'connect_errno'
         16        CONCAT                                           ~18     'Failed+to+connect+to+MySQL%3A+%28', ~17
         17        CONCAT                                           ~19     ~18, '%29+'
         18        FETCH_OBJ_R                                      ~20     !2, 'connect_error'
         19        CONCAT                                           ~21     ~19, ~20
         20        ECHO                                                     ~21
         21      > JMP                                                      ->92
   13    22    >   INIT_METHOD_CALL                                         !2, 'real_escape_string'
         23        SEND_VAR_EX                                              !0
         24        DO_FCALL                                      0  $22     
         25        ASSIGN                                                   !0, $22
   14    26        INIT_METHOD_CALL                                         !2, 'real_escape_string'
         27        SEND_VAR_EX                                              !1
         28        DO_FCALL                                      0  $24     
         29        ASSIGN                                                   !1, $24
   16    30        INIT_METHOD_CALL                                         !2, 'query'
         31        ROPE_INIT                                     3  ~27     'SELECT+password+FROM+accounts+WHERE+username%3D%27'
         32        ROPE_ADD                                      1  ~27     ~27, !0
         33        ROPE_END                                      2  ~26     ~27, '%27'
         34        SEND_VAL_EX                                              ~26
         35        DO_FCALL                                      0  $29     
         36        ASSIGN                                           ~30     !3, $29
         37      > JMPZ                                                     ~30, ->86
   17    38    >   FETCH_OBJ_R                                      ~31     !3, 'num_rows'
         39        IS_EQUAL                                                 ~31, 0
         40      > JMPZ                                                     ~32, ->46
   18    41    >   ECHO                                                     'No+user+with+this+email%21'
   19    42        INIT_FCALL                                               'header'
         43        SEND_VAL                                                 'refresh%3A3%3Burl%3Dindex.php'
         44        DO_ICALL                                                 
         45      > JMP                                                      ->85
   23    46    >   INIT_METHOD_CALL                                         !3, 'fetch_assoc'
         47        DO_FCALL                                      0  $34     
         48        ASSIGN                                                   !4, $34
   24    49        FETCH_DIM_R                                      ~36     !4, 'password'
         50        ASSIGN                                                   !5, ~36
   26    51        INIT_FCALL                                               'password_verify'
         52        SEND_VAR                                                 !1
         53        SEND_VAR                                                 !5
         54        DO_ICALL                                         $38     
         55      > JMPZ                                                     $38, ->81
   27    56    >   ECHO                                                     'The+password+is+correct%21'
   29    57        INIT_FCALL                                               'session_start'
         58        DO_ICALL                                                 
   30    59        FETCH_UNSET                                      $40     '_SESSION'
         60        UNSET_DIM                                                $40, 'user'
   31    61        FETCH_W                      global              $41     '_SESSION'
         62        ASSIGN_DIM                                               $41, 'user'
         63        OP_DATA                                                  !0
   33    64        FETCH_IS                                         ~43     '_POST'
         65        ISSET_ISEMPTY_DIM_OBJ                         0          ~43, 'remember'
         66      > JMPZ                                                     ~44, ->76
   34    67    >   INIT_FCALL                                               'time'
         68        DO_ICALL                                         $45     
         69        ADD                                              ~46     $45, 31536000
         70        ASSIGN                                                   !6, ~46
   35    71        INIT_FCALL                                               'setcookie'
         72        SEND_VAL                                                 'user'
         73        SEND_VAR                                                 !0
         74        SEND_VAR                                                 !6
         75        DO_ICALL                                                 
   38    76    >   INIT_FCALL                                               'header'
         77        SEND_VAL                                                 'Location%3Amain.php'
         78        DO_ICALL                                                 
   39    79      > EXIT                                                     
         80*       JMP                                                      ->85
   43    81    >   ECHO                                                     'Incorrect+password%21'
   44    82        INIT_FCALL                                               'header'
         83        SEND_VAL                                                 'refresh%3A3%3Burl%3Dindex.php'
         84        DO_ICALL                                                 
         85    > > JMP                                                      ->92
   50    86    >   FETCH_OBJ_R                                      ~51     !2, 'errno'
         87        CONCAT                                           ~52     'Select+error%3A+%28', ~51
         88        CONCAT                                           ~53     ~52, '%29+'
         89        FETCH_OBJ_R                                      ~54     !2, 'error'
         90        CONCAT                                           ~55     ~53, ~54
         91        ECHO                                                     ~55
   55    92    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.99 ms | 1404 KiB | 23 Q