3v4l.org

run code in 300+ PHP versions simultaneously
<?php include(__DIR__ . '/config.php'); global $_CONFIG; if(!array_key_exists('code', $_GET) || $_GET['code'] != $_CONFIG['code']) exit; define("MONO_ON", 1); require(__DIR__ . '/class/class_db_'.$_CONFIG['driver'].'.php'); $db = new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c = $db->connection_id; include(__DIR__ . '/global_funcs.php'); $db->query("UPDATE `fedjail` SET `fed_days` = `fed_days` - 1"); $q = $db->query("SELECT * FROM `fedjail` WHERE `fed_days` = 0"); $ids = array(); while($r = $db->fetch_row($q)) array_push($ids, $r['fed_userid']); if(count($ids) > 0) $db->query("UPDATE users SET fedjail=0 WHERE userid IN(".implode(",", $ids).")"); $db->query("DELETE FROM `fedjail` WHERE `fed_days` = 0"); $db->query("UPDATE `users` SET " . "`daysingang` = IF(`gang` > 0, `daysingang` + 1, 0), " . "`daysold` = `daysold` + 1, " . "`boxes_opened` = 0, " . "`mailban` = IF(`mailban` > 0, `mailban` - 1, 0), " . "`donatordays` = IF(`donatordays` > 0, `donatordays` - 1, 0), " . "`cdays` = IF(`course` > 0, `cdays` - 1, 0), " . "`bankmoney` = IF(`bankmoney` > 0, `bankmoney` + (`bankmoney` * .2), 0) " . "`cybermoney` + IF(`cybermoney` > 0, (`cybermoney` * 0.7), 0)" ); $q = $db->query("SELECT `userid`, `course` FROM `users` WHERE `cdays` = 0 AND `course` > 0"); while($r = $db->fetch_row($q)) { $db->query("INSERT INTO `coursesdone` VALUES(".$r['userid'].", ".$r['course'].")"); $cd = $db->query("SELECT * FROM `courses` WHERE `crID` = ".$r['course']); if($db->num_rows($cd)) { $coud = $db->fetch_row($cd); $upd = ""; $ev = ""; if($coud['crSTR']) { $upd .= ", `strength` = `strength` + ".$coud['crSTR']; $ev .= ", ".number_format($coud['crSTR'])." strength"; } if($coud['crGUARD']) { $upd .= ", `guard` = `guard` + ".$coud['crGUARD']; $ev .= ", ".number_format($coud['crGUARD'])." guard"; } if($coud['crLABOUR']) { $upd .= ", `labour` = `labour` + ".$coud['crLABOUR']; $ev .= ", ".number_format($coud['crLABOUR'])." labour"; } if($coud['crAGIL']) { $upd .= ", `agility` = `agility` + ".$coud['crAGIL']; $ev .= ", ".number_format($coud['crAGIL'])." agility"; } if($coud['crIQ']) { $upd .= ", `IQ` = `IQ` + ".$coud['crIQ']; $ev .= ", ".number_format($coud['crIQ'])." IQ"; } $ev = substr($ev, 1); if($upd) $db->query("UPDATE userstats SET `userid` = `userid` ".$upd." WHERE `userid` = ".$r['userid']); event_add($r['userid'], "Congratulations, you completed the ".$coud['crNAME']." and gained ".$ev."!"); } else event_add($r['userid'], "Unfortunately, the course you were taking was removed from the School's curriculum. Your course has been ended at no extra cost to you"); } $db->query("UPDATE `users` SET `course` = 0 WHERE `cdays` = 0"); $db->query("TRUNCATE TABLE `votes`"); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 60
Branch analysis from position: 60
2 jumps found. (Code = 44) Position 1 = 65, Position 2 = 55
Branch analysis from position: 65
2 jumps found. (Code = 43) Position 1 = 68, Position 2 = 77
Branch analysis from position: 68
1 jumps found. (Code = 42) Position 1 = 204
Branch analysis from position: 204
2 jumps found. (Code = 44) Position 1 = 209, Position 2 = 88
Branch analysis from position: 209
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 88
2 jumps found. (Code = 43) Position 1 = 107, Position 2 = 198
Branch analysis from position: 107
2 jumps found. (Code = 43) Position 1 = 115, Position 2 = 125
Branch analysis from position: 115
2 jumps found. (Code = 43) Position 1 = 127, Position 2 = 137
Branch analysis from position: 127
2 jumps found. (Code = 43) Position 1 = 139, Position 2 = 149
Branch analysis from position: 139
2 jumps found. (Code = 43) Position 1 = 151, Position 2 = 161
Branch analysis from position: 151
2 jumps found. (Code = 43) Position 1 = 163, Position 2 = 173
Branch analysis from position: 163
2 jumps found. (Code = 43) Position 1 = 179, Position 2 = 186
Branch analysis from position: 179
1 jumps found. (Code = 42) Position 1 = 204
Branch analysis from position: 204
Branch analysis from position: 186
Branch analysis from position: 173
Branch analysis from position: 161
Branch analysis from position: 149
Branch analysis from position: 137
Branch analysis from position: 125
Branch analysis from position: 198
2 jumps found. (Code = 44) Position 1 = 209, Position 2 = 88
Branch analysis from position: 209
Branch analysis from position: 88
Branch analysis from position: 77
Branch analysis from position: 55
2 jumps found. (Code = 44) Position 1 = 65, Position 2 = 55
Branch analysis from position: 65
Branch analysis from position: 55
Branch analysis from position: 11
filename:       /in/CH8Tl
function name:  (null)
number of ops:  216
compiled vars:  !0 = $_CONFIG, !1 = $db, !2 = $c, !3 = $q, !4 = $ids, !5 = $r, !6 = $cd, !7 = $coud, !8 = $upd, !9 = $ev
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INCLUDE_OR_EVAL                                          '%2Fin%2Fconfig.php', INCLUDE
    3     1        BIND_GLOBAL                                              !0, '_CONFIG'
    4     2        FETCH_R                      global              ~11     '_GET'
          3        ARRAY_KEY_EXISTS                                 ~12     'code', ~11
          4        BOOL_NOT                                         ~13     ~12
          5      > JMPNZ_EX                                         ~13     ~13, ->11
          6    >   FETCH_R                      global              ~14     '_GET'
          7        FETCH_DIM_R                                      ~15     ~14, 'code'
          8        FETCH_DIM_R                                      ~16     !0, 'code'
          9        IS_NOT_EQUAL                                     ~17     ~15, ~16
         10        BOOL                                             ~13     ~17
         11    > > JMPZ                                                     ~13, ->13
    5    12    > > EXIT                                                     
    6    13    >   INIT_FCALL                                               'define'
         14        SEND_VAL                                                 'MONO_ON'
         15        SEND_VAL                                                 1
         16        DO_ICALL                                                 
    7    17        FETCH_DIM_R                                      ~19     !0, 'driver'
         18        CONCAT                                           ~20     '%2Fin%2Fclass%2Fclass_db_', ~19
         19        CONCAT                                           ~21     ~20, '.php'
         20        INCLUDE_OR_EVAL                                          ~21, REQUIRE
    8    21        NEW                                              $23     'database'
         22        DO_FCALL                                      0          
         23        ASSIGN                                                   !1, $23
    9    24        INIT_METHOD_CALL                                         !1, 'configure'
         25        CHECK_FUNC_ARG                                           
         26        FETCH_DIM_FUNC_ARG                               $26     !0, 'hostname'
         27        SEND_FUNC_ARG                                            $26
         28        CHECK_FUNC_ARG                                           
         29        FETCH_DIM_FUNC_ARG                               $27     !0, 'username'
         30        SEND_FUNC_ARG                                            $27
         31        CHECK_FUNC_ARG                                           
         32        FETCH_DIM_FUNC_ARG                               $28     !0, 'password'
         33        SEND_FUNC_ARG                                            $28
         34        CHECK_FUNC_ARG                                           
         35        FETCH_DIM_FUNC_ARG                               $29     !0, 'database'
         36        SEND_FUNC_ARG                                            $29
         37        CHECK_FUNC_ARG                                           
         38        FETCH_DIM_FUNC_ARG                               $30     !0, 'persistent'
         39        SEND_FUNC_ARG                                            $30
         40        DO_FCALL                                      0          
   10    41        INIT_METHOD_CALL                                         !1, 'connect'
         42        DO_FCALL                                      0          
   11    43        FETCH_OBJ_R                                      ~33     !1, 'connection_id'
         44        ASSIGN                                                   !2, ~33
   12    45        INCLUDE_OR_EVAL                                          '%2Fin%2Fglobal_funcs.php', INCLUDE
   13    46        INIT_METHOD_CALL                                         !1, 'query'
         47        SEND_VAL_EX                                              'UPDATE+%60fedjail%60+SET+%60fed_days%60+%3D+%60fed_days%60+-+1'
         48        DO_FCALL                                      0          
   14    49        INIT_METHOD_CALL                                         !1, 'query'
         50        SEND_VAL_EX                                              'SELECT+%2A+FROM+%60fedjail%60+WHERE+%60fed_days%60+%3D+0'
         51        DO_FCALL                                      0  $37     
         52        ASSIGN                                                   !3, $37
   15    53        ASSIGN                                                   !4, <array>
   16    54      > JMP                                                      ->60
   17    55    >   INIT_FCALL                                               'array_push'
         56        SEND_REF                                                 !4
         57        FETCH_DIM_R                                      ~40     !5, 'fed_userid'
         58        SEND_VAL                                                 ~40
         59        DO_ICALL                                                 
   16    60    >   INIT_METHOD_CALL                                         !1, 'fetch_row'
         61        SEND_VAR_EX                                              !3
         62        DO_FCALL                                      0  $42     
         63        ASSIGN                                           ~43     !5, $42
         64      > JMPNZ                                                    ~43, ->55
   18    65    >   COUNT                                            ~44     !4
         66        IS_SMALLER                                               0, ~44
         67      > JMPZ                                                     ~45, ->77
   19    68    >   INIT_METHOD_CALL                                         !1, 'query'
         69        INIT_FCALL                                               'implode'
         70        SEND_VAL                                                 '%2C'
         71        SEND_VAR                                                 !4
         72        DO_ICALL                                         $46     
         73        CONCAT                                           ~47     'UPDATE+users+SET+fedjail%3D0+WHERE+userid+IN%28', $46
         74        CONCAT                                           ~48     ~47, '%29'
         75        SEND_VAL_EX                                              ~48
         76        DO_FCALL                                      0          
   21    77    >   INIT_METHOD_CALL                                         !1, 'query'
         78        SEND_VAL_EX                                              'DELETE+FROM+%60fedjail%60+WHERE+%60fed_days%60+%3D+0'
         79        DO_FCALL                                      0          
   22    80        INIT_METHOD_CALL                                         !1, 'query'
   30    81        SEND_VAL_EX                                              'UPDATE+%60users%60+SET+%60daysingang%60+%3D+IF%28%60gang%60+%3E+0%2C+%60daysingang%60+%2B+1%2C+0%29%2C+%60daysold%60+%3D+%60daysold%60+%2B+1%2C+%60boxes_opened%60+%3D+0%2C+%60mailban%60+%3D+IF%28%60mailban%60+%3E+0%2C+%60mailban%60+-+1%2C+0%29%2C+%60donatordays%60+%3D+IF%28%60donatordays%60+%3E+0%2C+%60donatordays%60+-+1%2C+0%29%2C+%60cdays%60+%3D+IF%28%60course%60+%3E+0%2C+%60cdays%60+-+1%2C+0%29%2C+%60bankmoney%60+%3D+IF%28%60bankmoney%60+%3E+0%2C+%60bankmoney%60+%2B+%28%60bankmoney%60+%2A+.2%29%2C+0%29+%60cybermoney%60+%2B+IF%28%60cybermoney%60+%3E+0%2C+%28%60cybermoney%60+%2A+0.7%29%2C+0%29'
         82        DO_FCALL                                      0          
   33    83        INIT_METHOD_CALL                                         !1, 'query'
         84        SEND_VAL_EX                                              'SELECT+%60userid%60%2C+%60course%60+FROM+%60users%60+WHERE+%60cdays%60+%3D+0+AND+%60course%60+%3E+0'
         85        DO_FCALL                                      0  $52     
         86        ASSIGN                                                   !3, $52
   34    87      > JMP                                                      ->204
   35    88    >   INIT_METHOD_CALL                                         !1, 'query'
         89        FETCH_DIM_R                                      ~54     !5, 'userid'
         90        CONCAT                                           ~55     'INSERT+INTO+%60coursesdone%60+VALUES%28', ~54
         91        CONCAT                                           ~56     ~55, '%2C+'
         92        FETCH_DIM_R                                      ~57     !5, 'course'
         93        CONCAT                                           ~58     ~56, ~57
         94        CONCAT                                           ~59     ~58, '%29'
         95        SEND_VAL_EX                                              ~59
         96        DO_FCALL                                      0          
   36    97        INIT_METHOD_CALL                                         !1, 'query'
         98        FETCH_DIM_R                                      ~61     !5, 'course'
         99        CONCAT                                           ~62     'SELECT+%2A+FROM+%60courses%60+WHERE+%60crID%60+%3D+', ~61
        100        SEND_VAL_EX                                              ~62
        101        DO_FCALL                                      0  $63     
        102        ASSIGN                                                   !6, $63
   37   103        INIT_METHOD_CALL                                         !1, 'num_rows'
        104        SEND_VAR_EX                                              !6
        105        DO_FCALL                                      0  $65     
        106      > JMPZ                                                     $65, ->198
   38   107    >   INIT_METHOD_CALL                                         !1, 'fetch_row'
        108        SEND_VAR_EX                                              !6
        109        DO_FCALL                                      0  $66     
        110        ASSIGN                                                   !7, $66
   39   111        ASSIGN                                                   !8, ''
   40   112        ASSIGN                                                   !9, ''
   41   113        FETCH_DIM_R                                      ~70     !7, 'crSTR'
        114      > JMPZ                                                     ~70, ->125
   42   115    >   FETCH_DIM_R                                      ~71     !7, 'crSTR'
        116        CONCAT                                           ~72     '%2C+%60strength%60+%3D+%60strength%60+%2B+', ~71
        117        ASSIGN_OP                                     8          !8, ~72
   43   118        INIT_FCALL                                               'number_format'
        119        FETCH_DIM_R                                      ~74     !7, 'crSTR'
        120        SEND_VAL                                                 ~74
        121        DO_ICALL                                         $75     
        122        CONCAT                                           ~76     '%2C+', $75
        123        CONCAT                                           ~77     ~76, '+strength'
        124        ASSIGN_OP                                     8          !9, ~77
   45   125    >   FETCH_DIM_R                                      ~79     !7, 'crGUARD'
        126      > JMPZ                                                     ~79, ->137
   46   127    >   FETCH_DIM_R                                      ~80     !7, 'crGUARD'
        128        CONCAT                                           ~81     '%2C+%60guard%60+%3D+%60guard%60+%2B+', ~80
        129        ASSIGN_OP                                     8          !8, ~81
   47   130        INIT_FCALL                                               'number_format'
        131        FETCH_DIM_R                                      ~83     !7, 'crGUARD'
        132        SEND_VAL                                                 ~83
        133        DO_ICALL                                         $84     
        134        CONCAT                                           ~85     '%2C+', $84
        135        CONCAT                                           ~86     ~85, '+guard'
        136        ASSIGN_OP                                     8          !9, ~86
   49   137    >   FETCH_DIM_R                                      ~88     !7, 'crLABOUR'
        138      > JMPZ                                                     ~88, ->149
   50   139    >   FETCH_DIM_R                                      ~89     !7, 'crLABOUR'
        140        CONCAT                                           ~90     '%2C+%60labour%60+%3D+%60labour%60+%2B+', ~89
        141        ASSIGN_OP                                     8          !8, ~90
   51   142        INIT_FCALL                                               'number_format'
        143        FETCH_DIM_R                                      ~92     !7, 'crLABOUR'
        144        SEND_VAL                                                 ~92
        145        DO_ICALL                                         $93     
        146        CONCAT                                           ~94     '%2C+', $93
        147        CONCAT                                           ~95     ~94, '+labour'
        148        ASSIGN_OP                                     8          !9, ~95
   53   149    >   FETCH_DIM_R                                      ~97     !7, 'crAGIL'
        150      > JMPZ                                                     ~97, ->161
   54   151    >   FETCH_DIM_R                                      ~98     !7, 'crAGIL'
        152        CONCAT                                           ~99     '%2C+%60agility%60+%3D+%60agility%60+%2B+', ~98
        153        ASSIGN_OP                                     8          !8, ~99
   55   154        INIT_FCALL                                               'number_format'
        155        FETCH_DIM_R                                      ~101    !7, 'crAGIL'
        156        SEND_VAL                                                 ~101
        157        DO_ICALL                                         $102    
        158        CONCAT                                           ~103    '%2C+', $102
        159        CONCAT                                           ~104    ~103, '+agility'
        160        ASSIGN_OP                                     8          !9, ~104
   57   161    >   FETCH_DIM_R                                      ~106    !7, 'crIQ'
        162      > JMPZ                                                     ~106, ->173
   58   163    >   FETCH_DIM_R                                      ~107    !7, 'crIQ'
        164        CONCAT                                           ~108    '%2C+%60IQ%60+%3D+%60IQ%60+%2B+', ~107
        165        ASSIGN_OP                                     8          !8, ~108
   59   166        INIT_FCALL                                               'number_format'
        167        FETCH_DIM_R                                      ~110    !7, 'crIQ'
        168        SEND_VAL                                                 ~110
        169        DO_ICALL                                         $111    
        170        CONCAT                                           ~112    '%2C+', $111
        171        CONCAT                                           ~113    ~112, '+IQ'
        172        ASSIGN_OP                                     8          !9, ~113
   61   173    >   INIT_FCALL                                               'substr'
        174        SEND_VAR                                                 !9
        175        SEND_VAL                                                 1
        176        DO_ICALL                                         $115    
        177        ASSIGN                                                   !9, $115
   62   178      > JMPZ                                                     !8, ->186
   63   179    >   INIT_METHOD_CALL                                         !1, 'query'
        180        CONCAT                                           ~117    'UPDATE+userstats+SET+%60userid%60+%3D+%60userid%60+', !8
        181        CONCAT                                           ~118    ~117, '+WHERE+%60userid%60+%3D+'
        182        FETCH_DIM_R                                      ~119    !5, 'userid'
        183        CONCAT                                           ~120    ~118, ~119
        184        SEND_VAL_EX                                              ~120
        185        DO_FCALL                                      0          
   64   186    >   INIT_FCALL_BY_NAME                                       'event_add'
        187        CHECK_FUNC_ARG                                           
        188        FETCH_DIM_FUNC_ARG                               $122    !5, 'userid'
        189        SEND_FUNC_ARG                                            $122
        190        FETCH_DIM_R                                      ~123    !7, 'crNAME'
        191        CONCAT                                           ~124    'Congratulations%2C+you+completed+the+', ~123
        192        CONCAT                                           ~125    ~124, '+and+gained+'
        193        CONCAT                                           ~126    ~125, !9
        194        CONCAT                                           ~127    ~126, '%21'
        195        SEND_VAL_EX                                              ~127
        196        DO_FCALL                                      0          
        197      > JMP                                                      ->204
   66   198    >   INIT_FCALL_BY_NAME                                       'event_add'
        199        CHECK_FUNC_ARG                                           
        200        FETCH_DIM_FUNC_ARG                               $129    !5, 'userid'
        201        SEND_FUNC_ARG                                            $129
        202        SEND_VAL_EX                                              'Unfortunately%2C+the+course+you+were+taking+was+removed+from+the+School%27s+curriculum.+Your+course+has+been+ended+at+no+extra+cost+to+you'
        203        DO_FCALL                                      0          
   34   204    >   INIT_METHOD_CALL                                         !1, 'fetch_row'
        205        SEND_VAR_EX                                              !3
        206        DO_FCALL                                      0  $131    
        207        ASSIGN                                           ~132    !5, $131
        208      > JMPNZ                                                    ~132, ->88
   68   209    >   INIT_METHOD_CALL                                         !1, 'query'
        210        SEND_VAL_EX                                              'UPDATE+%60users%60+SET+%60course%60+%3D+0+WHERE+%60cdays%60+%3D+0'
        211        DO_FCALL                                      0          
   69   212        INIT_METHOD_CALL                                         !1, 'query'
        213        SEND_VAL_EX                                              'TRUNCATE+TABLE+%60votes%60'
        214        DO_FCALL                                      0          
   70   215      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.56 ms | 1416 KiB | 23 Q