3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); ini_set('display_errors', 1); session_start(); $crcTable = NULL; function make64int($high,$low) { return ($high<<32) | $low; } function right_shift($value) { $sign = (1<<63) & $value; return ($value >> 1) ^ $sign; } function makeCRCTable() { global $crcTable; $crcTable = array(); for ($n = 0; $n < 0x100; $n++) { $c = $n; for($k = 0; $k < 16; $k++) { $c = ($c&1 ? make64int(0xC96C5795,0xD7870F42) ^ right_shift($c) : right_shift($c)); } $crcTable[$n] = $c; } } function checkCRC($data) { global $crcTable; if ( $crcTable == NULL ) makeCRCTable(); $crc = make64int(0xFFFFFFFF,0xFFFFFFFF); for($i=0; $i<strlen($data); $i++) { $crc = (($crc << 8) ^ $crcTable[($crc ^ ord($data[$i])) & 0xFF])&make64int(0xFFFFFFFF,0xFFFFFFFF); } return $crc ^ make64int(0xFFFFFFFF,0xFFFFFFFF); } if($_SERVER["REQUEST_METHOD"] == "POST") { $myusername=urldecode($_POST['username']); $mypassword=urldecode($_POST['password']); if( $myusername == 'admin' and checkCRC($mypassword) == make64int(0xDF3EB920,0xCBBCB200) ) { $_SESSION['loggedin'] = true; header("Location: index.php"); exit(); } else { echo 'Invalid Login/Password<br>'; } } ?> <form action="" method="post"> <label>UserName :</label> <input type="text" name="username" value="admin"/><br /> message.html(make64int(0xDF3EB920,0xCBBCB200).Tostring()) <label>Password :</label> <input type="password" name="password" maxlength="8"/><br /> <input type="submit" value="Submit"/><br /><br /> </form> <a href=login.php.txt>view source</a>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 47
Branch analysis from position: 14
2 jumps found. (Code = 46) Position 1 = 28, Position 2 = 37
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 46
Branch analysis from position: 38
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
Branch analysis from position: 47
filename:       /in/HfSlh
function name:  (null)
number of ops:  49
compiled vars:  !0 = $crcTable, !1 = $myusername, !2 = $mypassword
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 32767
          2        DO_ICALL                                                 
    4     3        INIT_FCALL                                               'ini_set'
          4        SEND_VAL                                                 'display_errors'
          5        SEND_VAL                                                 1
          6        DO_ICALL                                                 
    6     7        INIT_FCALL                                               'session_start'
          8        DO_ICALL                                                 
    8     9        ASSIGN                                                   !0, null
   55    10        FETCH_R                      global              ~7      '_SERVER'
         11        FETCH_DIM_R                                      ~8      ~7, 'REQUEST_METHOD'
         12        IS_EQUAL                                                 ~8, 'POST'
         13      > JMPZ                                                     ~9, ->47
   57    14    >   INIT_FCALL                                               'urldecode'
         15        FETCH_R                      global              ~10     '_POST'
         16        FETCH_DIM_R                                      ~11     ~10, 'username'
         17        SEND_VAL                                                 ~11
         18        DO_ICALL                                         $12     
         19        ASSIGN                                                   !1, $12
   58    20        INIT_FCALL                                               'urldecode'
         21        FETCH_R                      global              ~14     '_POST'
         22        FETCH_DIM_R                                      ~15     ~14, 'password'
         23        SEND_VAL                                                 ~15
         24        DO_ICALL                                         $16     
         25        ASSIGN                                                   !2, $16
   59    26        IS_EQUAL                                         ~18     !1, 'admin'
         27      > JMPZ_EX                                          ~18     ~18, ->37
         28    >   INIT_FCALL                                               'checkcrc'
         29        SEND_VAR                                                 !2
         30        DO_FCALL                                      0  $19     
         31        INIT_FCALL                                               'make64int'
         32        SEND_VAL                                                 3745429792
         33        SEND_VAL                                                 3418141184
         34        DO_FCALL                                      0  $20     
         35        IS_EQUAL                                         ~21     $19, $20
         36        BOOL                                             ~18     ~21
         37    > > JMPZ                                                     ~18, ->46
   61    38    >   FETCH_W                      global              $22     '_SESSION'
         39        ASSIGN_DIM                                               $22, 'loggedin'
         40        OP_DATA                                                  <true>
   62    41        INIT_FCALL                                               'header'
         42        SEND_VAL                                                 'Location%3A+index.php'
         43        DO_ICALL                                                 
   63    44      > EXIT                                                     
         45*       JMP                                                      ->47
   67    46    >   ECHO                                                     'Invalid+Login%2FPassword%3Cbr%3E'
   72    47    >   ECHO                                                     '%3Cform+action%3D%22%22+method%3D%22post%22%3E%0A%3Clabel%3EUserName+%3A%3C%2Flabel%3E%0A%3Cinput+type%3D%22text%22+name%3D%22username%22+value%3D%22admin%22%2F%3E%3Cbr+%2F%3E%0Amessage.html%28make64int%280xDF3EB920%2C0xCBBCB200%29.Tostring%28%29%29%0A%3Clabel%3EPassword+%3A%3C%2Flabel%3E%0A%3Cinput+type%3D%22password%22+name%3D%22password%22+maxlength%3D%228%22%2F%3E%3Cbr+%2F%3E%0A%3Cinput+type%3D%22submit%22+value%3D%22Submit%22%2F%3E%3Cbr+%2F%3E%3Cbr+%2F%3E%0A%3C%2Fform%3E%0A%3Ca+href%3Dlogin.php.txt%3Eview+source%3C%2Fa%3E'
   80    48      > RETURN                                                   1

Function make64int:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HfSlh
function name:  make64int
number of ops:  6
compiled vars:  !0 = $high, !1 = $low
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        SL                                               ~2      !0, 32
          3        BW_OR                                            ~3      !1, ~2
          4      > RETURN                                                   ~3
   13     5*     > RETURN                                                   null

End of function make64int

Function right_shift:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HfSlh
function name:  right_shift
number of ops:  7
compiled vars:  !0 = $value, !1 = $sign
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1        BW_AND                                           ~2      !0, -9223372036854775808
          2        ASSIGN                                                   !1, ~2
   18     3        SR                                               ~4      !0, 1
          4        BW_XOR                                           ~5      !1, ~4
          5      > RETURN                                                   ~5
   19     6*     > RETURN                                                   null

End of function right_shift

Function makecrctable:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 4
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 7
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 4
Branch analysis from position: 32
Branch analysis from position: 4
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 19
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 7
Branch analysis from position: 27
Branch analysis from position: 7
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 7
Branch analysis from position: 27
Branch analysis from position: 7
filename:       /in/HfSlh
function name:  makeCRCTable
number of ops:  33
compiled vars:  !0 = $crcTable, !1 = $n, !2 = $c, !3 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   BIND_GLOBAL                                              !0, 'crcTable'
   25     1        ASSIGN                                                   !0, <array>
   27     2        ASSIGN                                                   !1, 0
          3      > JMP                                                      ->30
   29     4    >   ASSIGN                                                   !2, !1
   30     5        ASSIGN                                                   !3, 0
          6      > JMP                                                      ->25
   32     7    >   BW_AND                                           ~8      !2, 1
          8      > JMPZ                                                     ~8, ->19
          9    >   INIT_FCALL                                               'make64int'
         10        SEND_VAL                                                 3379320725
         11        SEND_VAL                                                 3615952706
         12        DO_FCALL                                      0  $9      
         13        INIT_FCALL                                               'right_shift'
         14        SEND_VAR                                                 !2
         15        DO_FCALL                                      0  $10     
         16        BW_XOR                                           ~11     $9, $10
         17        QM_ASSIGN                                        ~12     ~11
         18      > JMP                                                      ->23
         19    >   INIT_FCALL                                               'right_shift'
         20        SEND_VAR                                                 !2
         21        DO_FCALL                                      0  $13     
         22        QM_ASSIGN                                        ~12     $13
         23    >   ASSIGN                                                   !2, ~12
   30    24        PRE_INC                                                  !3
         25    >   IS_SMALLER                                               !3, 16
         26      > JMPNZ                                                    ~16, ->7
   34    27    >   ASSIGN_DIM                                               !0, !1
         28        OP_DATA                                                  !2
   27    29        PRE_INC                                                  !1
         30    >   IS_SMALLER                                               !1, 256
         31      > JMPNZ                                                    ~19, ->4
   36    32    > > RETURN                                                   null

End of function makecrctable

Function checkcrc:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 13
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 13
Branch analysis from position: 32
Branch analysis from position: 13
Branch analysis from position: 6
filename:       /in/HfSlh
function name:  checkCRC
number of ops:  39
compiled vars:  !0 = $data, !1 = $crcTable, !2 = $crc, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   RECV                                             !0      
   40     1        BIND_GLOBAL                                              !1, 'crcTable'
   41     2        IS_EQUAL                                                 !1, null
          3      > JMPZ                                                     ~4, ->6
   42     4    >   INIT_FCALL                                               'makecrctable'
          5        DO_FCALL                                      0          
   44     6    >   INIT_FCALL                                               'make64int'
          7        SEND_VAL                                                 4294967295
          8        SEND_VAL                                                 4294967295
          9        DO_FCALL                                      0  $6      
         10        ASSIGN                                                   !2, $6
   46    11        ASSIGN                                                   !3, 0
         12      > JMP                                                      ->29
   48    13    >   SL                                               ~9      !2, 8
         14        INIT_FCALL                                               'ord'
         15        FETCH_DIM_R                                      ~10     !0, !3
         16        SEND_VAL                                                 ~10
         17        DO_ICALL                                         $11     
         18        BW_XOR                                           ~12     !2, $11
         19        BW_AND                                           ~13     ~12, 255
         20        FETCH_DIM_R                                      ~14     !1, ~13
         21        BW_XOR                                           ~15     ~9, ~14
         22        INIT_FCALL                                               'make64int'
         23        SEND_VAL                                                 4294967295
         24        SEND_VAL                                                 4294967295
         25        DO_FCALL                                      0  $16     
         26        BW_AND                                           ~17     $16, ~15
         27        ASSIGN                                                   !2, ~17
   46    28        PRE_INC                                                  !3
         29    >   STRLEN                                           ~20     !0
         30        IS_SMALLER                                               !3, ~20
         31      > JMPNZ                                                    ~21, ->13
   51    32    >   INIT_FCALL                                               'make64int'
         33        SEND_VAL                                                 4294967295
         34        SEND_VAL                                                 4294967295
         35        DO_FCALL                                      0  $22     
         36        BW_XOR                                           ~23     !2, $22
         37      > RETURN                                                   ~23
   52    38*     > RETURN                                                   null

End of function checkcrc

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.76 ms | 1402 KiB | 34 Q