3v4l.org

run code in 300+ PHP versions simultaneously
<?php include 'config.php'; $user = $_POST['username']; $pass = $_POST['password']; if($_SERVER['REQUEST_METHOD'] == "POST"){ if($user == "" or $pass == ""){ echo '<div class="errorbox">Please fill in all fields!</div>'; }else{ $username = trim(mysqli_real_escape_string($user)); $password = trim(md5(mysqli_real_escape_string($pass))); $query = " SELECT username, password FROM accounts WHERE username = '$username' AND password = '$password' "; $results = mysqli_query($connection, $query) or die (mysqli_error()); $num_row = mysqli_num_rows($results); if($num_row == 1){ while($row = mysqli_fetch_array($results)){ $_COOKIE['userId'] = $row['userId']; header("Location: register.php"); } }else{ return false; } return true; } } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <link type="image/gif" rel="icon" href="favicon.ico" /> <script type="text/javascript" src="js/logo_login.js"></script> <link type="text/css" rel="stylesheet" href="css/login.css" /> <title>M-Tutorials | Login</title> </head> <body> <img class="talk_cloud" src="images/already_account.png" /> <div class="login"> <form action="" method="post"> <input class="input_login" type="text" name="username" placeholder="Username" /> <input class="input_login" type="password" name="password" placeholder="Password" /> <input class="submit_login" type="submit" name="submit_login" value="Register" /> </form> <a href="index.php"><div class="logo"></div></a> </div> </body> </html>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 73
Branch analysis from position: 11
2 jumps found. (Code = 47) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 73
Branch analysis from position: 73
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 47) Position 1 = 47, Position 2 = 51
Branch analysis from position: 47
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 51
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 71
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
2 jumps found. (Code = 44) Position 1 = 70, Position 2 = 58
Branch analysis from position: 70
1 jumps found. (Code = 42) Position 1 = 72
Branch analysis from position: 72
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 58
2 jumps found. (Code = 44) Position 1 = 70, Position 2 = 58
Branch analysis from position: 70
Branch analysis from position: 58
Branch analysis from position: 71
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
Branch analysis from position: 73
filename:       /in/mAW0o
function name:  (null)
number of ops:  75
compiled vars:  !0 = $user, !1 = $pass, !2 = $username, !3 = $password, !4 = $query, !5 = $results, !6 = $connection, !7 = $num_row, !8 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INCLUDE_OR_EVAL                                          'config.php', INCLUDE
    4     1        FETCH_R                      global              ~10     '_POST'
          2        FETCH_DIM_R                                      ~11     ~10, 'username'
          3        ASSIGN                                                   !0, ~11
    5     4        FETCH_R                      global              ~13     '_POST'
          5        FETCH_DIM_R                                      ~14     ~13, 'password'
          6        ASSIGN                                                   !1, ~14
    7     7        FETCH_R                      global              ~16     '_SERVER'
          8        FETCH_DIM_R                                      ~17     ~16, 'REQUEST_METHOD'
          9        IS_EQUAL                                                 ~17, 'POST'
         10      > JMPZ                                                     ~18, ->73
    8    11    >   IS_EQUAL                                         ~19     !0, ''
         12      > JMPNZ_EX                                         ~19     ~19, ->15
         13    >   IS_EQUAL                                         ~20     !1, ''
         14        BOOL                                             ~19     ~20
         15    > > JMPZ                                                     ~19, ->18
    9    16    >   ECHO                                                     '%3Cdiv+class%3D%22errorbox%22%3EPlease+fill+in+all+fields%21%3C%2Fdiv%3E'
         17      > JMP                                                      ->73
   11    18    >   INIT_FCALL                                               'trim'
         19        INIT_FCALL_BY_NAME                                       'mysqli_real_escape_string'
         20        SEND_VAR_EX                                              !0
         21        DO_FCALL                                      0  $21     
         22        SEND_VAR                                                 $21
         23        DO_ICALL                                         $22     
         24        ASSIGN                                                   !2, $22
   12    25        INIT_FCALL                                               'trim'
         26        INIT_FCALL                                               'md5'
         27        INIT_FCALL_BY_NAME                                       'mysqli_real_escape_string'
         28        SEND_VAR_EX                                              !1
         29        DO_FCALL                                      0  $24     
         30        SEND_VAR                                                 $24
         31        DO_ICALL                                         $25     
         32        SEND_VAR                                                 $25
         33        DO_ICALL                                         $26     
         34        ASSIGN                                                   !3, $26
   13    35        ROPE_INIT                                     5  ~29     '%0A+++++++++++++++SELECT+username%2C+password+FROM+accounts+WHERE+username+%3D+%27'
   14    36        ROPE_ADD                                      1  ~29     ~29, !2
         37        ROPE_ADD                                      2  ~29     ~29, '%27+AND+password+%3D+%27'
         38        ROPE_ADD                                      3  ~29     ~29, !3
         39        ROPE_END                                      4  ~28     ~29, '%27%0A+++++++++++'
   13    40        ASSIGN                                                   !4, ~28
   17    41        INIT_FCALL_BY_NAME                                       'mysqli_query'
         42        SEND_VAR_EX                                              !6
         43        SEND_VAR_EX                                              !4
         44        DO_FCALL                                      0  $33     
         45        ASSIGN                                           ~34     !5, $33
         46      > JMPNZ_EX                                         ~34     ~34, ->51
         47    >   INIT_FCALL_BY_NAME                                       'mysqli_error'
         48        DO_FCALL                                      0  $35     
         49      > EXIT                                                     $35
         50*       BOOL                                             ~34     <true>
   18    51    >   INIT_FCALL_BY_NAME                                       'mysqli_num_rows'
         52        SEND_VAR_EX                                              !5
         53        DO_FCALL                                      0  $36     
         54        ASSIGN                                                   !7, $36
   20    55        IS_EQUAL                                                 !7, 1
         56      > JMPZ                                                     ~38, ->71
   21    57    > > JMP                                                      ->65
   22    58    >   FETCH_DIM_R                                      ~41     !8, 'userId'
         59        FETCH_W                      global              $39     '_COOKIE'
         60        ASSIGN_DIM                                               $39, 'userId'
         61        OP_DATA                                                  ~41
   23    62        INIT_FCALL                                               'header'
         63        SEND_VAL                                                 'Location%3A+register.php'
         64        DO_ICALL                                                 
   21    65    >   INIT_FCALL_BY_NAME                                       'mysqli_fetch_array'
         66        SEND_VAR_EX                                              !5
         67        DO_FCALL                                      0  $43     
         68        ASSIGN                                           ~44     !8, $43
         69      > JMPNZ                                                    ~44, ->58
         70    > > JMP                                                      ->72
   26    71    > > RETURN                                                   <false>
   28    72    > > RETURN                                                   <true>
   32    73    >   ECHO                                                     '%3C%21DOCTYPE+html%3E%0A%3Chtml%3E%0A++++%3Chead%3E%0A++++++++%3Cmeta+http-equiv%3D%22Content-Type%22+content%3D%22text%2Fhtml%3B+charset%3DUTF-8%22+%2F%3E%0A++++++++%3Cscript+src%3D%22%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.11.0%2Fjquery.min.js%22%3E%3C%2Fscript%3E%0A++++++++%3Clink+type%3D%22image%2Fgif%22+rel%3D%22icon%22+href%3D%22favicon.ico%22+%2F%3E%0A++++++++%3Cscript+type%3D%22text%2Fjavascript%22+src%3D%22js%2Flogo_login.js%22%3E%3C%2Fscript%3E%0A++++++++%3Clink+type%3D%22text%2Fcss%22+rel%3D%22stylesheet%22+href%3D%22css%2Flogin.css%22+%2F%3E%0A++++++++%3Ctitle%3EM-Tutorials+%7C+Login%3C%2Ftitle%3E%0A++++%3C%2Fhead%3E%0A++++%3Cbody%3E%0A++++++++%3Cimg+class%3D%22talk_cloud%22+src%3D%22images%2Falready_account.png%22+%2F%3E%0A++++++++%3Cdiv+class%3D%22login%22%3E%0A++++++++++++%3Cform+action%3D%22%22+method%3D%22post%22%3E%0A++++++++++++++++%3Cinput+class%3D%22input_login%22+type%3D%22text%22+name%3D%22username%22+placeholder%3D%22Username%22+%2F%3E%0A++++++++++++++++%3Cinput+class%3D%22input_login%22+type%3D%22password%22+name%3D%22password%22+placeholder%3D%22Password%22+%2F%3E%0A++++++++++++++++%3Cinput+class%3D%22submit_login%22+type%3D%22submit%22+name%3D%22submit_login%22+value%3D%22Register%22+%2F%3E%0A++++++++++++%3C%2Fform%3E%0A++++++++++++%3Ca+href%3D%22index.php%22%3E%3Cdiv+class%3D%22logo%22%3E%3C%2Fdiv%3E%3C%2Fa%3E%0A++++++++%3C%2Fdiv%3E%0A++++%3C%2Fbody%3E%0A%3C%2Fhtml%3E'
   53    74      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.42 ms | 1404 KiB | 19 Q