3v4l.org

run code in 300+ PHP versions simultaneously
<? define("DEFAULT_FILE", "textfile.txt"); // Default file that is used when ?file= is not defined. /// END CONFIG, START MAIN SCRIPT // if ($_GET[file] == "") $file = DEFAULT_FILE; else $file = $_GET[file]; if ($_POST[update] == "true") { $fh = fopen($file, 'w') or die("Can't open file."); fwrite($fh, stripslashes($_POST[body])); fclose($fh); } if ($_POST[bsubmit]=="Update") { echo ' <span style="font-weight: bold" > ' ; echo ' ====>>> Read/updated ! <<<==== ' ; echo '</span> ' ; echo '</div> ' ; echo '<div style="text-align: left;"> ' ; } if ($_POST[bsubmit]=="Shopping") { echo ' <span style="font-weight: bold" > ' ; echo ' ====>>> Shopping ! <<<==== ' ; echo '</span> ' ; echo '</div> ' ; define("DEFAULT_FILE", "shopping.txt"); echo '<div style="text-align: left;"> ' ; } if ($_POST[bsubmit]=="Shopping") { echo ' <span style="font-weight: bold" > ' ; echo ' ====>>> To Do List ! <<<==== ' ; echo '</span> ' ; echo '</div> ' ; define("DEFAULT_FILE", "todo.txt"); echo '<div style="text-align: left;"> ' ; } if ($_POST[bsubmit]=="Default") { echo ' <span style="font-weight: bold" > ' ; echo ' ====>>> Textfile List ! <<<==== ' ; echo '</span> ' ; echo '</div> ' ; define("DEFAULT_FILE", "textfile.txt"); echo '<div style="text-align: left;"> ' ; } if ($_POST[bsubmit]=="Reset") { echo ' <span style="font-weight: bold" > ' ; echo ' ====>>> Reset ! <<<==== ' ; echo '</span> ' ; echo '</div> ' ; echo '<div style="text-align: left;"> ' ; $fh = fopen($file, 'w') or die("Can't open file."); fwrite($fh, stripslashes("Reset performed")); fclose($fh); } if ($_POST[bsubmit]=="Save") { $fh = fopen($file, 'w') or die("Can't open file."); fwrite($fh, stripslashes($_POST[body])); fclose($fh); echo ' <span style="font-weight: bold" > ' ; echo ' ====>>> Saved ! <<<==== ' ; echo '</span> ' ; echo '</div> ' ; echo '<div style="text-align: left;"> ' ; } ?> <html><head><title>BCSNotepad</title></head><body> <center><table width=400><tr><td style='border: 2px dashed #003b53; padding:10px; font-family:verdana; font-size:10px; color: #003b53;' align='center'> You are editing: <i><?=$file?></i><br><br> <form action='<?=$PHP_SELF?>?file=<?=$file?>' method='post'> <form action='<?=$PHP_SELF?>?file=<?=$file?>' method='post'> <textarea name='body' rows="25" cols="100" style="font-family: Verdana; padding: 5px; background-color: LightYellow" ><? if (file_exists($file)) readfile($file); else $message = "The file ".$file." does not exist and will<br>be created when you click Save.<br><br>"; ?></textarea><br><br> <?=$message?> <FORM action="notepad.php" method="post"> <INPUT type="submit" name="bsubmit" value="Update"> <INPUT type="submit" name="bsubmit" value="Save"> <INPUT type="submit" name="bsubmit" value="Reset"> </FORM> </form> </td></tr></table></center> </body></html>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 42
Branch analysis from position: 21
2 jumps found. (Code = 47) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 52
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 66
Branch analysis from position: 57
2 jumps found. (Code = 43) Position 1 = 71, Position 2 = 80
Branch analysis from position: 71
2 jumps found. (Code = 43) Position 1 = 85, Position 2 = 94
Branch analysis from position: 85
2 jumps found. (Code = 43) Position 1 = 99, Position 2 = 122
Branch analysis from position: 99
2 jumps found. (Code = 47) Position 1 = 110, Position 2 = 112
Branch analysis from position: 110
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 112
2 jumps found. (Code = 43) Position 1 = 127, Position 2 = 153
Branch analysis from position: 127
2 jumps found. (Code = 47) Position 1 = 133, Position 2 = 135
Branch analysis from position: 133
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 135
2 jumps found. (Code = 43) Position 1 = 168, Position 2 = 172
Branch analysis from position: 168
1 jumps found. (Code = 42) Position 1 = 175
Branch analysis from position: 175
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 172
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 153
Branch analysis from position: 122
Branch analysis from position: 94
Branch analysis from position: 80
Branch analysis from position: 66
Branch analysis from position: 52
Branch analysis from position: 42
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 42
Branch analysis from position: 21
Branch analysis from position: 42
filename:       /in/k0lEi
function name:  (null)
number of ops:  179
compiled vars:  !0 = $file, !1 = $fh, !2 = $PHP_SELF, !3 = $message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'define'
          1        SEND_VAL                                                 'DEFAULT_FILE'
          2        SEND_VAL                                                 'textfile.txt'
          3        DO_ICALL                                                 
    6     4        FETCH_CONSTANT                                   ~6      'file'
          5        FETCH_R                      global              ~5      '_GET'
          6        FETCH_DIM_R                                      ~7      ~5, ~6
          7        IS_EQUAL                                                 ~7, ''
          8      > JMPZ                                                     ~8, ->12
    7     9    >   FETCH_CONSTANT                                   ~9      'DEFAULT_FILE'
         10        ASSIGN                                                   !0, ~9
         11      > JMP                                                      ->16
    9    12    >   FETCH_CONSTANT                                   ~12     'file'
         13        FETCH_R                      global              ~11     '_GET'
         14        FETCH_DIM_R                                      ~13     ~11, ~12
         15        ASSIGN                                                   !0, ~13
   11    16    >   FETCH_CONSTANT                                   ~16     'update'
         17        FETCH_R                      global              ~15     '_POST'
         18        FETCH_DIM_R                                      ~17     ~15, ~16
         19        IS_EQUAL                                                 ~17, 'true'
         20      > JMPZ                                                     ~18, ->42
   12    21    >   INIT_FCALL                                               'fopen'
         22        SEND_VAR                                                 !0
         23        SEND_VAL                                                 'w'
         24        DO_ICALL                                         $19     
         25        ASSIGN                                           ~20     !1, $19
         26      > JMPNZ_EX                                         ~20     ~20, ->29
         27    > > EXIT                                                     'Can%27t+open+file.'
         28*       BOOL                                             ~20     <true>
   13    29    >   INIT_FCALL                                               'fwrite'
         30        SEND_VAR                                                 !1
         31        INIT_FCALL                                               'stripslashes'
         32        FETCH_CONSTANT                                   ~22     'body'
         33        FETCH_R                      global              ~21     '_POST'
         34        FETCH_DIM_R                                      ~23     ~21, ~22
         35        SEND_VAL                                                 ~23
         36        DO_ICALL                                         $24     
         37        SEND_VAR                                                 $24
         38        DO_ICALL                                                 
   14    39        INIT_FCALL                                               'fclose'
         40        SEND_VAR                                                 !1
         41        DO_ICALL                                                 
   18    42    >   FETCH_CONSTANT                                   ~28     'bsubmit'
         43        FETCH_R                      global              ~27     '_POST'
         44        FETCH_DIM_R                                      ~29     ~27, ~28
         45        IS_EQUAL                                                 ~29, 'Update'
         46      > JMPZ                                                     ~30, ->52
   20    47    >   ECHO                                                     '+%3Cspan+style%3D%22font-weight%3A+bold%22+%3E+'
   21    48        ECHO                                                     '+%3D%3D%3D%3D%3E%3E%3E+++Read%2Fupdated+%21+++%3C%3C%3C%3D%3D%3D%3D+'
   22    49        ECHO                                                     '%3C%2Fspan%3E+'
   23    50        ECHO                                                     '%3C%2Fdiv%3E+'
   24    51        ECHO                                                     '%3Cdiv+style%3D%22text-align%3A+left%3B%22%3E+'
   28    52    >   FETCH_CONSTANT                                   ~32     'bsubmit'
         53        FETCH_R                      global              ~31     '_POST'
         54        FETCH_DIM_R                                      ~33     ~31, ~32
         55        IS_EQUAL                                                 ~33, 'Shopping'
         56      > JMPZ                                                     ~34, ->66
   30    57    >   ECHO                                                     '+%3Cspan+style%3D%22font-weight%3A+bold%22+%3E+'
   31    58        ECHO                                                     '+%3D%3D%3D%3D%3E%3E%3E+++Shopping+%21+++%3C%3C%3C%3D%3D%3D%3D+'
   32    59        ECHO                                                     '%3C%2Fspan%3E+'
   33    60        ECHO                                                     '%3C%2Fdiv%3E+'
   34    61        INIT_FCALL                                               'define'
         62        SEND_VAL                                                 'DEFAULT_FILE'
         63        SEND_VAL                                                 'shopping.txt'
         64        DO_ICALL                                                 
   35    65        ECHO                                                     '%3Cdiv+style%3D%22text-align%3A+left%3B%22%3E+'
   38    66    >   FETCH_CONSTANT                                   ~37     'bsubmit'
         67        FETCH_R                      global              ~36     '_POST'
         68        FETCH_DIM_R                                      ~38     ~36, ~37
         69        IS_EQUAL                                                 ~38, 'Shopping'
         70      > JMPZ                                                     ~39, ->80
   40    71    >   ECHO                                                     '+%3Cspan+style%3D%22font-weight%3A+bold%22+%3E+'
   41    72        ECHO                                                     '+%3D%3D%3D%3D%3E%3E%3E+++To+Do+List+%21+++%3C%3C%3C%3D%3D%3D%3D+'
   42    73        ECHO                                                     '%3C%2Fspan%3E+'
   43    74        ECHO                                                     '%3C%2Fdiv%3E+'
   44    75        INIT_FCALL                                               'define'
         76        SEND_VAL                                                 'DEFAULT_FILE'
         77        SEND_VAL                                                 'todo.txt'
         78        DO_ICALL                                                 
   45    79        ECHO                                                     '%3Cdiv+style%3D%22text-align%3A+left%3B%22%3E+'
   49    80    >   FETCH_CONSTANT                                   ~42     'bsubmit'
         81        FETCH_R                      global              ~41     '_POST'
         82        FETCH_DIM_R                                      ~43     ~41, ~42
         83        IS_EQUAL                                                 ~43, 'Default'
         84      > JMPZ                                                     ~44, ->94
   51    85    >   ECHO                                                     '+%3Cspan+style%3D%22font-weight%3A+bold%22+%3E+'
   52    86        ECHO                                                     '+%3D%3D%3D%3D%3E%3E%3E+++Textfile+List+%21+++%3C%3C%3C%3D%3D%3D%3D+'
   53    87        ECHO                                                     '%3C%2Fspan%3E+'
   54    88        ECHO                                                     '%3C%2Fdiv%3E+'
   55    89        INIT_FCALL                                               'define'
         90        SEND_VAL                                                 'DEFAULT_FILE'
         91        SEND_VAL                                                 'textfile.txt'
         92        DO_ICALL                                                 
   56    93        ECHO                                                     '%3Cdiv+style%3D%22text-align%3A+left%3B%22%3E+'
   63    94    >   FETCH_CONSTANT                                   ~47     'bsubmit'
         95        FETCH_R                      global              ~46     '_POST'
         96        FETCH_DIM_R                                      ~48     ~46, ~47
         97        IS_EQUAL                                                 ~48, 'Reset'
         98      > JMPZ                                                     ~49, ->122
   65    99    >   ECHO                                                     '+%3Cspan+style%3D%22font-weight%3A+bold%22+%3E+'
   66   100        ECHO                                                     '+%3D%3D%3D%3D%3E%3E%3E+++Reset+%21+++%3C%3C%3C%3D%3D%3D%3D+'
   67   101        ECHO                                                     '%3C%2Fspan%3E+'
   68   102        ECHO                                                     '%3C%2Fdiv%3E+'
   69   103        ECHO                                                     '%3Cdiv+style%3D%22text-align%3A+left%3B%22%3E+'
   70   104        INIT_FCALL                                               'fopen'
        105        SEND_VAR                                                 !0
        106        SEND_VAL                                                 'w'
        107        DO_ICALL                                         $50     
        108        ASSIGN                                           ~51     !1, $50
        109      > JMPNZ_EX                                         ~51     ~51, ->112
        110    > > EXIT                                                     'Can%27t+open+file.'
        111*       BOOL                                             ~51     <true>
   71   112    >   INIT_FCALL                                               'fwrite'
        113        SEND_VAR                                                 !1
        114        INIT_FCALL                                               'stripslashes'
        115        SEND_VAL                                                 'Reset+performed'
        116        DO_ICALL                                         $52     
        117        SEND_VAR                                                 $52
        118        DO_ICALL                                                 
   72   119        INIT_FCALL                                               'fclose'
        120        SEND_VAR                                                 !1
        121        DO_ICALL                                                 
   80   122    >   FETCH_CONSTANT                                   ~56     'bsubmit'
        123        FETCH_R                      global              ~55     '_POST'
        124        FETCH_DIM_R                                      ~57     ~55, ~56
        125        IS_EQUAL                                                 ~57, 'Save'
        126      > JMPZ                                                     ~58, ->153
   82   127    >   INIT_FCALL                                               'fopen'
        128        SEND_VAR                                                 !0
        129        SEND_VAL                                                 'w'
        130        DO_ICALL                                         $59     
        131        ASSIGN                                           ~60     !1, $59
        132      > JMPNZ_EX                                         ~60     ~60, ->135
        133    > > EXIT                                                     'Can%27t+open+file.'
        134*       BOOL                                             ~60     <true>
   83   135    >   INIT_FCALL                                               'fwrite'
        136        SEND_VAR                                                 !1
        137        INIT_FCALL                                               'stripslashes'
        138        FETCH_CONSTANT                                   ~62     'body'
        139        FETCH_R                      global              ~61     '_POST'
        140        FETCH_DIM_R                                      ~63     ~61, ~62
        141        SEND_VAL                                                 ~63
        142        DO_ICALL                                         $64     
        143        SEND_VAR                                                 $64
        144        DO_ICALL                                                 
   84   145        INIT_FCALL                                               'fclose'
        146        SEND_VAR                                                 !1
        147        DO_ICALL                                                 
   85   148        ECHO                                                     '+%3Cspan+style%3D%22font-weight%3A+bold%22+%3E+'
   86   149        ECHO                                                     '+%3D%3D%3D%3D%3E%3E%3E+++Saved+%21+++%3C%3C%3C%3D%3D%3D%3D+'
   87   150        ECHO                                                     '%3C%2Fspan%3E+'
   88   151        ECHO                                                     '%3C%2Fdiv%3E+'
   89   152        ECHO                                                     '%3Cdiv+style%3D%22text-align%3A+left%3B%22%3E+'
   97   153    >   ECHO                                                     '%3Chtml%3E%3Chead%3E%3Ctitle%3EBCSNotepad%3C%2Ftitle%3E%3C%2Fhead%3E%3Cbody%3E%0A%3Ccenter%3E%3Ctable+width%3D400%3E%3Ctr%3E%3Ctd+style%3D%27border%3A+2px+dashed+%23003b53%3B+padding%3A10px%3B+font-family%3Averdana%3B+font-size%3A10px%3B+color%3A+%23003b53%3B%27+align%3D%27center%27%3E%0AYou+are+editing%3A+%3Ci%3E'
   99   154        ECHO                                                     !0
        155        ECHO                                                     '%3C%2Fi%3E%3Cbr%3E%3Cbr%3E%0A%3Cform+action%3D%27'
  100   156        ECHO                                                     !2
        157        ECHO                                                     '%3Ffile%3D'
        158        ECHO                                                     !0
        159        ECHO                                                     '%27+method%3D%27post%27%3E%0A%0A%0A%3Cform+action%3D%27'
  103   160        ECHO                                                     !2
        161        ECHO                                                     '%3Ffile%3D'
        162        ECHO                                                     !0
        163        ECHO                                                     '%27+method%3D%27post%27%3E%0A%3Ctextarea+name%3D%27body%27++rows%3D%2225%22+cols%3D%22100%22++style%3D%22font-family%3A+Verdana%3B+padding%3A+5px%3B+background-color%3A+LightYellow%22+++%3E'
  105   164        INIT_FCALL                                               'file_exists'
        165        SEND_VAR                                                 !0
        166        DO_ICALL                                         $67     
        167      > JMPZ                                                     $67, ->172
  106   168    >   INIT_FCALL                                               'readfile'
        169        SEND_VAR                                                 !0
        170        DO_ICALL                                                 
        171      > JMP                                                      ->175
  108   172    >   CONCAT                                           ~69     'The+file+', !0
        173        CONCAT                                           ~70     ~69, '+does+not+exist+and+will%3Cbr%3Ebe+created+when+you+click+Save.%3Cbr%3E%3Cbr%3E'
        174        ASSIGN                                                   !3, ~70
  109   175    >   ECHO                                                     '%3C%2Ftextarea%3E%3Cbr%3E%3Cbr%3E%0A'
  110   176        ECHO                                                     !3
        177        ECHO                                                     '+%0A%0A%0A%3CFORM+action%3D%22notepad.php%22+method%3D%22post%22%3E%0A++++%3CINPUT+type%3D%22submit%22+name%3D%22bsubmit%22+value%3D%22Update%22%3E%0A++++%3CINPUT+type%3D%22submit%22+name%3D%22bsubmit%22+value%3D%22Save%22%3E%0A++++%3CINPUT+type%3D%22submit%22+name%3D%22bsubmit%22+value%3D%22Reset%22%3E%0A%0A%3C%2FFORM%3E%0A%0A%0A%0A%3C%2Fform%3E%0A%3C%2Ftd%3E%3C%2Ftr%3E%3C%2Ftable%3E%3C%2Fcenter%3E%0A%3C%2Fbody%3E%3C%2Fhtml%3E'
  124   178      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.59 ms | 1417 KiB | 27 Q