3v4l.org

run code in 300+ PHP versions simultaneously
<?php function CheckReg($_con, $_vid) { $_sql = "SELECT * FROM application WHERE vid=$_vid AND (accepted=0 OR accepted=2 OR accepted=3)"; $_sth = mysqli_query($_con, $_sql); if (mysqli_fetch_array($_sth, MYSQLI_BOTH) == "") { return "0"; } else { return "1"; } } switch ($_GET["page"]) { // Sub Pages and main //******************************************************** // register as trainee //******************************************************** case "register": if (CheckReg($mysqli, $d->vid) == "1") { ?> <h3>Sorry, registration not avalaible, you have areally requested a registration (and still pending), or your subscription still in progress.</h3> <? include ("footer.php"); exit; }; if (!$_POST['register']) { $requestnum = $d->ratingatc + 1; $requestname = RequestRating($requestnum); ?> <h3 class="page-title">Register</h3> <div class="gcontainer"> <form action="index.php?page=register" method="post" name="register"> <fieldset><legend>Registration to the school</legend> <label>[INSERT THE RULE'S HERE]: </label><span>bla bla bla</span> <label>You request school for: </label><span><? echo $requestname; ?></span> <label>I agree with the rule's</label><span><input id="agree" type="checkbox" name="agree" value="agree"></span> </fieldset> <div class="color form-more"> <input name="register" class="submit" type="submit" value="Register"> </div> </form> </div> <? } else { if ($_POST["agree"] == "") { ?> <span>You don't have accepted the AUP! Please come back and fullfil the rule's</span> <? include ("footer.php"); exit; } else { // 0 - registered, 1 - refused, 2 - accepted, 3 - in progress, 4 - end, 5 - expelled $request = $d->ratingatc + 1; $sql = "INSERT INTO application (id, vid, request, accepted, reason, class) VALUES ('', '$d->vid', '$request', '0', '', '')"; safecommit($mysqli, $sql, "<h4>Failed to register your application, please contact WM, thank's</h4>", "<h4>Registration done. You're been contacted back on your email for future info.</h4>"); }; }; break; //******************************************************** // Default webpage //******************************************************** default: ?> <H4>Hi <? echo $d->firstname; ?> <? echo $d->lastname; ?> (<a href="https://www.ivao.aero/Member.aspx?Id=<? echo $d->vid; ?>"><? echo $d->vid; ?></a>)!<span class='notice'>Your rating ATC is <? echo RequestRating($d->ratingatc);?></span></H4> <span>Welcome to the school. You can request a subscription here.</span> <? break; // END switch }; ?>
Finding entry points
Branch analysis from position: 0
3 jumps found. (Code = 188) Position 1 = 6, Position 2 = 56, Position 3 = 3
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 16
Branch analysis from position: 13
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 31
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 77
Branch analysis from position: 77
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 39
Branch analysis from position: 35
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 77
Branch analysis from position: 77
Branch analysis from position: 56
1 jumps found. (Code = 42) Position 1 = 77
Branch analysis from position: 77
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
Branch analysis from position: 6
filename:       /in/GLm0N
function name:  (null)
number of ops:  79
compiled vars:  !0 = $mysqli, !1 = $d, !2 = $requestnum, !3 = $requestname, !4 = $request, !5 = $sql
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   FETCH_R                      global              ~6      '_GET'
          1        FETCH_DIM_R                                      ~7      ~6, 'page'
          2      > SWITCH_STRING                                            ~7, [ 'register':->6, ], ->56
   18     3    >   CASE                                                     ~7, 'register'
          4      > JMPNZ                                                    ~8, ->6
          5    > > JMP                                                      ->56
   19     6    >   INIT_FCALL                                               'checkreg'
          7        SEND_VAR                                                 !0
          8        FETCH_OBJ_R                                      ~9      !1, 'vid'
          9        SEND_VAL                                                 ~9
         10        DO_FCALL                                      0  $10     
         11        IS_EQUAL                                                 $10, '1'
         12      > JMPZ                                                     ~11, ->16
   20    13    >   ECHO                                                     '+%0A++++%09%09%3Ch3%3ESorry%2C+registration+not+avalaible%2C+you+have+areally+requested+a+registration+%28and+still+pending%29%2C+or+your+subscription+still+in+progress.%3C%2Fh3%3E%0A++++%09'
   23    14        INCLUDE_OR_EVAL                                          'footer.php', INCLUDE
   24    15      > EXIT                                                     
   27    16    >   FETCH_R                      global              ~13     '_POST'
         17        FETCH_DIM_R                                      ~14     ~13, 'register'
         18        BOOL_NOT                                         ~15     ~14
         19      > JMPZ                                                     ~15, ->31
   29    20    >   FETCH_OBJ_R                                      ~16     !1, 'ratingatc'
         21        ADD                                              ~17     ~16, 1
         22        ASSIGN                                                   !2, ~17
   30    23        INIT_FCALL_BY_NAME                                       'RequestRating'
         24        SEND_VAR_EX                                              !2
         25        DO_FCALL                                      0  $19     
         26        ASSIGN                                                   !3, $19
   32    27        ECHO                                                     '%09%09%09%3Ch3+class%3D%22page-title%22%3ERegister%3C%2Fh3%3E%0A%09%09%09%3Cdiv+class%3D%22gcontainer%22%3E%0A%09%09%09%3Cform+action%3D%22index.php%3Fpage%3Dregister%22+method%3D%22post%22+name%3D%22register%22%3E%0A%09%09%09%3Cfieldset%3E%3Clegend%3ERegistration+to+the+school%3C%2Flegend%3E%0A%09%09%09%09%3Clabel%3E%5BINSERT+THE+RULE%27S+HERE%5D%3A+%3C%2Flabel%3E%3Cspan%3Ebla+bla+bla%3C%2Fspan%3E%0A++++++++%09%09%3Clabel%3EYou+request+school+for%3A+%3C%2Flabel%3E%3Cspan%3E'
   37    28        ECHO                                                     !3
         29        ECHO                                                     '%3C%2Fspan%3E%0A%09%09%09%09%3Clabel%3EI+agree+with+the+rule%27s%3C%2Flabel%3E%3Cspan%3E%3Cinput+id%3D%22agree%22+type%3D%22checkbox%22+name%3D%22agree%22+value%3D%22agree%22%3E%3C%2Fspan%3E%0A%09%09%09%09%3C%2Ffieldset%3E%0A++++++++%09%09%3Cdiv+class%3D%22color+form-more%22%3E%0A++++++++++++%09%09%3Cinput+name%3D%22register%22+class%3D%22submit%22+type%3D%22submit%22+value%3D%22Register%22%3E%0A++++++++%09%09%3C%2Fdiv%3E%0A%09%09%09%3C%2Fform%3E%0A%09%3C%2Fdiv%3E%0A'
         30      > JMP                                                      ->55
   48    31    >   FETCH_R                      global              ~21     '_POST'
         32        FETCH_DIM_R                                      ~22     ~21, 'agree'
         33        IS_EQUAL                                                 ~22, ''
         34      > JMPZ                                                     ~23, ->39
   50    35    >   ECHO                                                     '++++++++++++%3Cspan%3EYou+don%27t+have+accepted+the+AUP%21+Please+come+back+and+fullfil+the+rule%27s%3C%2Fspan%3E%0A++++++++++++'
   52    36        INCLUDE_OR_EVAL                                          'footer.php', INCLUDE
   53    37      > EXIT                                                     
         38*       JMP                                                      ->55
   56    39    >   FETCH_OBJ_R                                      ~25     !1, 'ratingatc'
         40        ADD                                              ~26     ~25, 1
         41        ASSIGN                                                   !4, ~26
   57    42        ROPE_INIT                                     5  ~30     'INSERT+INTO+application+%28id%2C+vid%2C+request%2C+accepted%2C+reason%2C+class%29+VALUES+%28%27%27%2C+%27'
         43        FETCH_OBJ_R                                      ~28     !1, 'vid'
         44        ROPE_ADD                                      1  ~30     ~30, ~28
         45        ROPE_ADD                                      2  ~30     ~30, '%27%2C+%27'
         46        ROPE_ADD                                      3  ~30     ~30, !4
         47        ROPE_END                                      4  ~29     ~30, '%27%2C+%270%27%2C+%27%27%2C+%27%27%29'
         48        ASSIGN                                                   !5, ~29
   58    49        INIT_FCALL_BY_NAME                                       'safecommit'
         50        SEND_VAR_EX                                              !0
         51        SEND_VAR_EX                                              !5
         52        SEND_VAL_EX                                              '%3Ch4%3EFailed+to+register+your+application%2C+please+contact+WM%2C+thank%27s%3C%2Fh4%3E'
         53        SEND_VAL_EX                                              '%3Ch4%3ERegistration+done.+You%27re+been+contacted+back+on+your+email+for+future+info.%3C%2Fh4%3E'
         54        DO_FCALL                                      0          
   61    55    > > JMP                                                      ->77
   69    56    >   ECHO                                                     '%09%09%3CH4%3EHi+'
         57        FETCH_OBJ_R                                      ~35     !1, 'firstname'
         58        ECHO                                                     ~35
         59        ECHO                                                     '+'
         60        FETCH_OBJ_R                                      ~36     !1, 'lastname'
         61        ECHO                                                     ~36
         62        ECHO                                                     '+%28%3Ca+href%3D%22https%3A%2F%2Fwww.ivao.aero%2FMember.aspx%3FId%3D'
         63        FETCH_OBJ_R                                      ~37     !1, 'vid'
         64        ECHO                                                     ~37
         65        ECHO                                                     '%22%3E'
         66        FETCH_OBJ_R                                      ~38     !1, 'vid'
         67        ECHO                                                     ~38
         68        ECHO                                                     '%3C%2Fa%3E%29%21%3Cspan+class%3D%27notice%27%3EYour+rating+ATC+is+'
         69        INIT_FCALL_BY_NAME                                       'RequestRating'
         70        CHECK_FUNC_ARG                                           
         71        FETCH_OBJ_FUNC_ARG                               $39     !1, 'ratingatc'
         72        SEND_FUNC_ARG                                            $39
         73        DO_FCALL                                      0  $40     
         74        ECHO                                                     $40
         75        ECHO                                                     '%3C%2Fspan%3E%3C%2FH4%3E+%0A%0A%09%09%3Cspan%3EWelcome+to+the+school.+You+can+request+a+subscription+here.%3C%2Fspan%3E%0A%09'
   73    76      > JMP                                                      ->77
         77    >   FREE                                                     ~7
   79    78      > RETURN                                                   1

Function checkreg:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GLm0N
function name:  CheckReg
number of ops:  22
compiled vars:  !0 = $_con, !1 = $_vid, !2 = $_sql, !3 = $_sth
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        ROPE_INIT                                     3  ~5      'SELECT+%2A+FROM+application+WHERE+vid%3D'
          3        ROPE_ADD                                      1  ~5      ~5, !1
          4        ROPE_END                                      2  ~4      ~5, '+AND+%28accepted%3D0+OR+accepted%3D2+OR+accepted%3D3%29'
          5        ASSIGN                                                   !2, ~4
    4     6        INIT_FCALL_BY_NAME                                       'mysqli_query'
          7        SEND_VAR_EX                                              !0
          8        SEND_VAR_EX                                              !2
          9        DO_FCALL                                      0  $8      
         10        ASSIGN                                                   !3, $8
    5    11        INIT_FCALL_BY_NAME                                       'mysqli_fetch_array'
         12        SEND_VAR_EX                                              !3
         13        FETCH_CONSTANT                                   ~10     'MYSQLI_BOTH'
         14        SEND_VAL_EX                                              ~10
         15        DO_FCALL                                      0  $11     
         16        IS_EQUAL                                                 $11, ''
         17      > JMPZ                                                     ~12, ->20
    6    18    > > RETURN                                                   '0'
         19*       JMP                                                      ->21
    8    20    > > RETURN                                                   '1'
   10    21*     > RETURN                                                   null

End of function checkreg

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.38 ms | 1411 KiB | 14 Q