3v4l.org

run code in 300+ PHP versions simultaneously
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/font-resize.js"></script> <script type="text/javascript"> $(document).ready(function() { fontResize(); $(window).bind('resize', function() { fontResize(); }); } ); </script> <?php function encode($string,$key) { $key = sha1($key); $strLen = strlen($string); $keyLen = strlen($key); for ($i = 0; $i < $strLen; $i++) { $ordStr = ord(substr($string,$i,1)); if ($j == $keyLen) { $j = 0; } $ordKey = ord(substr($key,$j,1)); $j++; $hash .= strrev(base_convert(dechex($ordStr + $ordKey),16,36)); } return $hash; } function decode($string,$key) { $key = sha1($key); $strLen = strlen($string); $keyLen = strlen($key); for ($i = 0; $i < $strLen; $i+=2) { $ordStr = hexdec(base_convert(strrev(substr($string,$i,2)),36,16)); if ($j == $keyLen) { $j = 0; } $ordKey = ord(substr($key,$j,1)); $j++; $hash .= chr($ordStr - $ordKey); } return $hash; } ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><? echo htmlspecialchars($_GET["name"]) . '!'; ?></title> <style type="text/css"> .BIG { font-size: 1050%; font-weight: bold; font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif; text-align: center; } </style> </head> <body class="BIG"> <?php $name = htmlspecialchars($_GET['name']); $urlENC = encode( $name ,"whateverkey"); $urlDEC = decode( $urlENC ,"whateverkey"); echo htmlspecialchars($_GET["url"]) . ''; //echo htmlspecialchars($_POST['name']); //echo $urlENC; ?> <br /> <? echo $urlDEC; ?> </body>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PPMtN
function name:  (null)
number of ops:  37
compiled vars:  !0 = $name, !1 = $urlENC, !2 = $urlDEC
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     '%3C%21DOCTYPE+html+PUBLIC+%22-%2F%2FW3C%2F%2FDTD+XHTML+1.0+Transitional%2F%2FEN%22+%22http%3A%2F%2Fwww.w3.org%2FTR%2Fxhtml1%2FDTD%2Fxhtml1-transitional.dtd%22%3E%0A+%3Cscript+type%3D%22text%2Fjavascript%22+src%3D%22js%2Fjquery.js%22%3E%3C%2Fscript%3E%0A++++%3Cscript+type%3D%22text%2Fjavascript%22+src%3D%22js%2Ffont-resize.js%22%3E%3C%2Fscript%3E%0A++++%3Cscript+type%3D%22text%2Fjavascript%22%3E%0A++++++++%24%28document%29.ready%28function%28%29%0A+++++++++++++%7B+++++++%0A+++++++++++++++++fontResize%28%29%3B%0A+++++++++++++++++%24%28window%29.bind%28%27resize%27%2C+function%28%29+%7B%0A+++++++++++++++++++++fontResize%28%29%3B%0A+++++++++++++++++%7D%29%3B%0A+++++++++++++%7D%0A++++++++%29%3B%0A++++%3C%2Fscript%3E%0A%0A'
   44     1        ECHO                                                     '%0A%3Chtml+xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22%3E%0A%3Chead%3E%0A%3Cmeta+http-equiv%3D%22Content-Type%22+content%3D%22text%2Fhtml%3B+charset%3Dutf-8%22+%2F%3E%0A%3Ctitle%3E'
   48     2        INIT_FCALL                                               'htmlspecialchars'
          3        FETCH_R                      global              ~3      '_GET'
          4        FETCH_DIM_R                                      ~4      ~3, 'name'
          5        SEND_VAL                                                 ~4
          6        DO_ICALL                                         $5      
          7        CONCAT                                           ~6      $5, '%21'
          8        ECHO                                                     ~6
          9        ECHO                                                     '%3C%2Ftitle%3E%0A%3Cstyle+type%3D%22text%2Fcss%22%3E%0A.BIG+%7B%0A%09font-size%3A+1050%25%3B%0A%09font-weight%3A+bold%3B%0A%09font-family%3A+%22Palatino+Linotype%22%2C+%22Book+Antiqua%22%2C+Palatino%2C+serif%3B%0A%09text-align%3A+center%3B%0A%7D%0A%3C%2Fstyle%3E%0A%3C%2Fhead%3E%0A%3Cbody+class%3D%22BIG%22%3E%0A%0A%0A'
   62    10        INIT_FCALL                                               'htmlspecialchars'
         11        FETCH_R                      global              ~7      '_GET'
         12        FETCH_DIM_R                                      ~8      ~7, 'name'
         13        SEND_VAL                                                 ~8
         14        DO_ICALL                                         $9      
         15        ASSIGN                                                   !0, $9
   63    16        INIT_FCALL                                               'encode'
         17        SEND_VAR                                                 !0
         18        SEND_VAL                                                 'whateverkey'
         19        DO_FCALL                                      0  $11     
         20        ASSIGN                                                   !1, $11
   64    21        INIT_FCALL                                               'decode'
         22        SEND_VAR                                                 !1
         23        SEND_VAL                                                 'whateverkey'
         24        DO_FCALL                                      0  $13     
         25        ASSIGN                                                   !2, $13
   65    26        INIT_FCALL                                               'htmlspecialchars'
         27        FETCH_R                      global              ~15     '_GET'
         28        FETCH_DIM_R                                      ~16     ~15, 'url'
         29        SEND_VAL                                                 ~16
         30        DO_ICALL                                         $17     
         31        CONCAT                                           ~18     $17, ''
         32        ECHO                                                     ~18
   68    33        ECHO                                                     '%3Cbr+%2F%3E%0A'
   69    34        ECHO                                                     !2
   70    35        ECHO                                                     '%0A%3C%2Fbody%3E'
   71    36      > RETURN                                                   1

Function encode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 12
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 24
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 12
Branch analysis from position: 50
Branch analysis from position: 12
Branch analysis from position: 24
filename:       /in/PPMtN
function name:  encode
number of ops:  52
compiled vars:  !0 = $string, !1 = $key, !2 = $strLen, !3 = $keyLen, !4 = $i, !5 = $ordStr, !6 = $j, !7 = $ordKey, !8 = $hash
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   17     2        INIT_FCALL                                               'sha1'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                         $9      
          5        ASSIGN                                                   !1, $9
   18     6        STRLEN                                           ~11     !0
          7        ASSIGN                                                   !2, ~11
   19     8        STRLEN                                           ~13     !1
          9        ASSIGN                                                   !3, ~13
   20    10        ASSIGN                                                   !4, 0
         11      > JMP                                                      ->48
   21    12    >   INIT_FCALL                                               'ord'
         13        INIT_FCALL                                               'substr'
         14        SEND_VAR                                                 !0
         15        SEND_VAR                                                 !4
         16        SEND_VAL                                                 1
         17        DO_ICALL                                         $16     
         18        SEND_VAR                                                 $16
         19        DO_ICALL                                         $17     
         20        ASSIGN                                                   !5, $17
   22    21        IS_EQUAL                                                 !6, !3
         22      > JMPZ                                                     ~19, ->24
         23    >   ASSIGN                                                   !6, 0
   23    24    >   INIT_FCALL                                               'ord'
         25        INIT_FCALL                                               'substr'
         26        SEND_VAR                                                 !1
         27        SEND_VAR                                                 !6
         28        SEND_VAL                                                 1
         29        DO_ICALL                                         $21     
         30        SEND_VAR                                                 $21
         31        DO_ICALL                                         $22     
         32        ASSIGN                                                   !7, $22
   24    33        PRE_INC                                                  !6
   25    34        INIT_FCALL                                               'strrev'
         35        INIT_FCALL                                               'base_convert'
         36        INIT_FCALL                                               'dechex'
         37        ADD                                              ~25     !5, !7
         38        SEND_VAL                                                 ~25
         39        DO_ICALL                                         $26     
         40        SEND_VAR                                                 $26
         41        SEND_VAL                                                 16
         42        SEND_VAL                                                 36
         43        DO_ICALL                                         $27     
         44        SEND_VAR                                                 $27
         45        DO_ICALL                                         $28     
         46        ASSIGN_OP                                     8          !8, $28
   20    47        PRE_INC                                                  !4
         48    >   IS_SMALLER                                               !4, !2
         49      > JMPNZ                                                    ~31, ->12
   27    50    > > RETURN                                                   !8
   28    51*     > RETURN                                                   null

End of function encode

Function decode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 12
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 32
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 12
Branch analysis from position: 50
Branch analysis from position: 12
Branch analysis from position: 32
filename:       /in/PPMtN
function name:  decode
number of ops:  52
compiled vars:  !0 = $string, !1 = $key, !2 = $strLen, !3 = $keyLen, !4 = $i, !5 = $ordStr, !6 = $j, !7 = $ordKey, !8 = $hash
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   31     2        INIT_FCALL                                               'sha1'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                         $9      
          5        ASSIGN                                                   !1, $9
   32     6        STRLEN                                           ~11     !0
          7        ASSIGN                                                   !2, ~11
   33     8        STRLEN                                           ~13     !1
          9        ASSIGN                                                   !3, ~13
   34    10        ASSIGN                                                   !4, 0
         11      > JMP                                                      ->48
   35    12    >   INIT_FCALL                                               'hexdec'
         13        INIT_FCALL                                               'base_convert'
         14        INIT_FCALL                                               'strrev'
         15        INIT_FCALL                                               'substr'
         16        SEND_VAR                                                 !0
         17        SEND_VAR                                                 !4
         18        SEND_VAL                                                 2
         19        DO_ICALL                                         $16     
         20        SEND_VAR                                                 $16
         21        DO_ICALL                                         $17     
         22        SEND_VAR                                                 $17
         23        SEND_VAL                                                 36
         24        SEND_VAL                                                 16
         25        DO_ICALL                                         $18     
         26        SEND_VAR                                                 $18
         27        DO_ICALL                                         $19     
         28        ASSIGN                                                   !5, $19
   36    29        IS_EQUAL                                                 !6, !3
         30      > JMPZ                                                     ~21, ->32
         31    >   ASSIGN                                                   !6, 0
   37    32    >   INIT_FCALL                                               'ord'
         33        INIT_FCALL                                               'substr'
         34        SEND_VAR                                                 !1
         35        SEND_VAR                                                 !6
         36        SEND_VAL                                                 1
         37        DO_ICALL                                         $23     
         38        SEND_VAR                                                 $23
         39        DO_ICALL                                         $24     
         40        ASSIGN                                                   !7, $24
   38    41        PRE_INC                                                  !6
   39    42        INIT_FCALL                                               'chr'
         43        SUB                                              ~27     !5, !7
         44        SEND_VAL                                                 ~27
         45        DO_ICALL                                         $28     
         46        ASSIGN_OP                                     8          !8, $28
   34    47        ASSIGN_OP                                     1          !4, 2
         48    >   IS_SMALLER                                               !4, !2
         49      > JMPNZ                                                    ~31, ->12
   41    50    > > RETURN                                                   !8
   42    51*     > RETURN                                                   null

End of function decode

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.12 ms | 1411 KiB | 33 Q