3v4l.org

run code in 300+ PHP versions simultaneously
<?php $error = ''; if ($_POST) { if (empty($_POST['username']) || empty($_POST['password'])) { $error = "<span>Please fill the required fields</span>"; } $hashed_password = password_hash("disco313", PASSWORD_DEFAULT); //Connect to database $host = ""; $dbname = ""; $user = ""; $pass = ""; $charset = "UTF8MB4"; // if your db does not use CHARSET=UTF8MB4, you should probably be fixing that $dsn = "mysql:host={$host};dbname={$dbname};charset={$charset}"; $options = [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, // highly recommended PDO::ATTR_EMULATE_PREPARES => false // ALWAYS! ALWAYS! ALWAYS! ]; $db = new PDO($dsn, $user, $pass, $options); $stmnt = $db->prepare( "SELECT * FROM register WHERE 'username' = :username AND 'password' = :password"); if ($stmt->execute($stmnt) ){ session_start(); header('Location: http://localhost/Scmr/php/Home.php'); } else { $error = "<span>Please enter the correct username and password</span>"; } } echo "└[∵]┐└[∵]┘┌[∵]┘└[∵]┐└[∵]┘┌[∵]┘" ; exit;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 51
Branch analysis from position: 3
2 jumps found. (Code = 47) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 50
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 50
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 11
Branch analysis from position: 9
Branch analysis from position: 51
filename:       /in/gGEtM
function name:  (null)
number of ops:  54
compiled vars:  !0 = $error, !1 = $hashed_password, !2 = $host, !3 = $dbname, !4 = $user, !5 = $pass, !6 = $charset, !7 = $dsn, !8 = $options, !9 = $db, !10 = $stmnt, !11 = $stmt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, ''
    3     1        FETCH_R                      global              ~13     '_POST'
          2      > JMPZ                                                     ~13, ->51
    4     3    >   FETCH_IS                                         ~14     '_POST'
          4        ISSET_ISEMPTY_DIM_OBJ                         1  ~15     ~14, 'username'
          5      > JMPNZ_EX                                         ~15     ~15, ->9
          6    >   FETCH_IS                                         ~16     '_POST'
          7        ISSET_ISEMPTY_DIM_OBJ                         1  ~17     ~16, 'password'
          8        BOOL                                             ~15     ~17
          9    > > JMPZ                                                     ~15, ->11
    5    10    >   ASSIGN                                                   !0, '%3Cspan%3EPlease+fill+the+required+fields%3C%2Fspan%3E'
    8    11    >   INIT_FCALL                                               'password_hash'
         12        SEND_VAL                                                 'disco313'
         13        SEND_VAL                                                 '2y'
         14        DO_ICALL                                         $19     
         15        ASSIGN                                                   !1, $19
   11    16        ASSIGN                                                   !2, ''
   12    17        ASSIGN                                                   !3, ''
   13    18        ASSIGN                                                   !4, ''
   14    19        ASSIGN                                                   !5, ''
   15    20        ASSIGN                                                   !6, 'UTF8MB4'
   16    21        ROPE_INIT                                     6  ~27     'mysql%3Ahost%3D'
         22        ROPE_ADD                                      1  ~27     ~27, !2
         23        ROPE_ADD                                      2  ~27     ~27, '%3Bdbname%3D'
         24        ROPE_ADD                                      3  ~27     ~27, !3
         25        ROPE_ADD                                      4  ~27     ~27, '%3Bcharset%3D'
         26        ROPE_END                                      5  ~26     ~27, !6
         27        ASSIGN                                                   !7, ~26
   17    28        ASSIGN                                                   !8, <array>
   21    29        NEW                                              $32     'PDO'
         30        SEND_VAR_EX                                              !7
         31        SEND_VAR_EX                                              !4
         32        SEND_VAR_EX                                              !5
         33        SEND_VAR_EX                                              !8
         34        DO_FCALL                                      0          
         35        ASSIGN                                                   !9, $32
   23    36        INIT_METHOD_CALL                                         !9, 'prepare'
   24    37        SEND_VAL_EX                                              'SELECT+%2A+FROM+register+WHERE+%27username%27+%3D+%3Ausername+AND+%27password%27+%3D+%3Apassword'
         38        DO_FCALL                                      0  $35     
   23    39        ASSIGN                                                   !10, $35
   26    40        INIT_METHOD_CALL                                         !11, 'execute'
         41        SEND_VAR_EX                                              !10
         42        DO_FCALL                                      0  $37     
         43      > JMPZ                                                     $37, ->50
   27    44    >   INIT_FCALL                                               'session_start'
         45        DO_ICALL                                                 
   28    46        INIT_FCALL                                               'header'
         47        SEND_VAL                                                 'Location%3A+http%3A%2F%2Flocalhost%2FScmr%2Fphp%2FHome.php'
         48        DO_ICALL                                                 
         49      > JMP                                                      ->51
   30    50    >   ASSIGN                                                   !0, '%3Cspan%3EPlease+enter+the+correct+username+and+password%3C%2Fspan%3E'
   34    51    >   ECHO                                                     '%E2%94%94%5B%E2%88%B5%5D%E2%94%90%E2%94%94%5B%E2%88%B5%5D%E2%94%98%E2%94%8C%5B%E2%88%B5%5D%E2%94%98%E2%94%94%5B%E2%88%B5%5D%E2%94%90%E2%94%94%5B%E2%88%B5%5D%E2%94%98%E2%94%8C%5B%E2%88%B5%5D%E2%94%98'
   35    52      > EXIT                                                     
   36    53*     > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.33 ms | 1400 KiB | 19 Q