3v4l.org

run code in 300+ PHP versions simultaneously
// viewprofiles.php <?php include_once("header.php"); echo $user.' is currently logged in<br><br>'; echo <<<_END <form method="post" action="viewprofiles.php"><pre> <input type="submit" name ="choice" value="LIKE" /> <input type="submit" name ="choice" value="NEXT PROFILE" /> </pre></form> _END; $allusers = array(); //Create the $allusers array, comprised of all users except me $result = queryMysql("SELECT * FROM members"); $num = mysql_num_rows($result); for ($j = 0 ; $j < $num ; ++$j) { $row = mysql_fetch_row($result); if ($row[0] == $user) continue; $allusers[$j] = $row[0]; } //Create the $i_like_these_users array, comprised of all users i liked $result = queryMysql("SELECT * FROM likeprofile WHERE user='$user'"); $num = mysql_num_rows($result); for ($j = 0 ; $j < $num ; ++$j) { $row = mysql_fetch_row($result); $i_like_these_users[$j] = $row[1]; } //Create the $i_dislike_these_users array, comprised of all users i disliked $result = queryMysql("SELECT * FROM dislikeprofile WHERE user='$user'"); $num = mysql_num_rows($result); for ($j = 0 ; $j < $num ; ++$j) { $row = mysql_fetch_row($result); $i_dislike_these_users[$j] = $row[1]; } //Create the $usersiviewed array, comprised of all users i have either liked or disliked if (is_array($i_like_these_users) && is_array($i_dislike_these_users)) { $usersiviewed = array_merge($i_like_these_users,$i_dislike_these_users); } elseif(is_array($i_like_these_users)) { $usersiviewed = $i_like_these_users; } else { $usersiviewed = $i_dislike_these_users; } // this removes from the array $allusers (i.e., profiles i can view) all $usersviewed (i.e., all the profiles i have already either liked/disliked) if (is_array($usersiviewed)) { $peopleicanview = array_diff($allusers, $usersiviewed); $peopleicanview = array_values($peopleicanview); // this re-indexes the array } else { $peopleicanview = $allusers; $peopleicanview = array_values($peopleicanview); // this re-indexes the array } $current_user_profile = $peopleicanview[0]; echo 'check out '.$current_user_profile.'s picture <br />'; if (file_exists("$current_user_profile.jpg")) {echo "<img src='$current_user_profile.jpg' align='left' />";} // if i like or dislike this person, the likeprofile or dislikeprofile table is updated with my name and the name of the person who liked or disliked if (isset($_POST['choice']) && $_POST['choice'] == 'LIKE') { $ilike = $current_user_profile; $query = "INSERT INTO likeprofile VALUES" . "('$user', '$ilike')"; if (!queryMysql($query)) echo "INSERT failed: $query<br />" . mysql_error() . "<br /><br />"; } if (isset($_POST['choice']) && $_POST['choice'] == 'NEXT PROFILE') { $idontlike = $current_user_profile; $query = "INSERT INTO dislikeprofile VALUES" . "('$user', '$idontlike')"; if (!queryMysql($query)) echo "INSERT failed: $query<br />" . mysql_error() . "<br /><br />"; } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 16
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 43
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 74
Branch analysis from position: 74
2 jumps found. (Code = 44) Position 1 = 76, Position 2 = 66
Branch analysis from position: 76
2 jumps found. (Code = 46) Position 1 = 78, Position 2 = 80
Branch analysis from position: 78
2 jumps found. (Code = 43) Position 1 = 81, Position 2 = 87
Branch analysis from position: 81
1 jumps found. (Code = 42) Position 1 = 92
Branch analysis from position: 92
2 jumps found. (Code = 43) Position 1 = 94, Position 2 = 104
Branch analysis from position: 94
1 jumps found. (Code = 42) Position 1 = 109
Branch analysis from position: 109
2 jumps found. (Code = 43) Position 1 = 120, Position 2 = 124
Branch analysis from position: 120
2 jumps found. (Code = 46) Position 1 = 127, Position 2 = 131
Branch analysis from position: 127
2 jumps found. (Code = 43) Position 1 = 132, Position 2 = 153
Branch analysis from position: 132
2 jumps found. (Code = 43) Position 1 = 145, Position 2 = 153
Branch analysis from position: 145
2 jumps found. (Code = 46) Position 1 = 156, Position 2 = 160
Branch analysis from position: 156
2 jumps found. (Code = 43) Position 1 = 161, Position 2 = 182
Branch analysis from position: 161
2 jumps found. (Code = 43) Position 1 = 174, Position 2 = 182
Branch analysis from position: 174
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 182
Branch analysis from position: 182
Branch analysis from position: 160
Branch analysis from position: 153
Branch analysis from position: 153
Branch analysis from position: 131
Branch analysis from position: 124
Branch analysis from position: 104
2 jumps found. (Code = 43) Position 1 = 120, Position 2 = 124
Branch analysis from position: 120
Branch analysis from position: 124
Branch analysis from position: 87
2 jumps found. (Code = 43) Position 1 = 89, Position 2 = 91
Branch analysis from position: 89
1 jumps found. (Code = 42) Position 1 = 92
Branch analysis from position: 92
Branch analysis from position: 91
2 jumps found. (Code = 43) Position 1 = 94, Position 2 = 104
Branch analysis from position: 94
Branch analysis from position: 104
Branch analysis from position: 80
Branch analysis from position: 66
2 jumps found. (Code = 44) Position 1 = 76, Position 2 = 66
Branch analysis from position: 76
Branch analysis from position: 66
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 43
Branch analysis from position: 53
Branch analysis from position: 43
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 24
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 16
Branch analysis from position: 30
Branch analysis from position: 16
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 16
Branch analysis from position: 30
Branch analysis from position: 16
filename:       /in/o8jYP
function name:  (null)
number of ops:  183
compiled vars:  !0 = $user, !1 = $allusers, !2 = $result, !3 = $num, !4 = $j, !5 = $row, !6 = $i_like_these_users, !7 = $i_dislike_these_users, !8 = $usersiviewed, !9 = $peopleicanview, !10 = $current_user_profile, !11 = $ilike, !12 = $query, !13 = $idontlike
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     '%2F%2F+viewprofiles.php%0A'
    3     1        INCLUDE_OR_EVAL                                          'header.php', INCLUDE_ONCE
    5     2        CONCAT                                           ~15     !0, '+is+currently+logged+in%3Cbr%3E%3Cbr%3E'
          3        ECHO                                                     ~15
    8     4        ECHO                                                     '%3Cform+method%3D%22post%22+action%3D%22viewprofiles.php%22%3E%3Cpre%3E%0A%3Cinput+type%3D%22submit%22+name+%3D%22choice%22+value%3D%22LIKE%22+%2F%3E%0A%3Cinput+type%3D%22submit%22+name+%3D%22choice%22+value%3D%22NEXT+PROFILE%22+%2F%3E%0A%3C%2Fpre%3E%3C%2Fform%3E'
   15     5        ASSIGN                                                   !1, <array>
   18     6        INIT_FCALL_BY_NAME                                       'queryMysql'
          7        SEND_VAL_EX                                              'SELECT+%2A+FROM+members'
          8        DO_FCALL                                      0  $17     
          9        ASSIGN                                                   !2, $17
   19    10        INIT_FCALL_BY_NAME                                       'mysql_num_rows'
         11        SEND_VAR_EX                                              !2
         12        DO_FCALL                                      0  $19     
         13        ASSIGN                                                   !3, $19
   20    14        ASSIGN                                                   !4, 0
         15      > JMP                                                      ->28
   22    16    >   INIT_FCALL_BY_NAME                                       'mysql_fetch_row'
         17        SEND_VAR_EX                                              !2
         18        DO_FCALL                                      0  $22     
         19        ASSIGN                                                   !5, $22
   23    20        FETCH_DIM_R                                      ~24     !5, 0
         21        IS_EQUAL                                                 !0, ~24
         22      > JMPZ                                                     ~25, ->24
         23    > > JMP                                                      ->27
   24    24    >   FETCH_DIM_R                                      ~27     !5, 0
         25        ASSIGN_DIM                                               !1, !4
         26        OP_DATA                                                  ~27
   20    27    >   PRE_INC                                                  !4
         28    >   IS_SMALLER                                               !4, !3
         29      > JMPNZ                                                    ~29, ->16
   30    30    >   INIT_FCALL_BY_NAME                                       'queryMysql'
         31        ROPE_INIT                                     3  ~31     'SELECT+%2A+FROM+likeprofile+WHERE+user%3D%27'
         32        ROPE_ADD                                      1  ~31     ~31, !0
         33        ROPE_END                                      2  ~30     ~31, '%27'
         34        SEND_VAL_EX                                              ~30
         35        DO_FCALL                                      0  $33     
         36        ASSIGN                                                   !2, $33
   31    37        INIT_FCALL_BY_NAME                                       'mysql_num_rows'
         38        SEND_VAR_EX                                              !2
         39        DO_FCALL                                      0  $35     
         40        ASSIGN                                                   !3, $35
   32    41        ASSIGN                                                   !4, 0
         42      > JMP                                                      ->51
   34    43    >   INIT_FCALL_BY_NAME                                       'mysql_fetch_row'
         44        SEND_VAR_EX                                              !2
         45        DO_FCALL                                      0  $38     
         46        ASSIGN                                                   !5, $38
   35    47        FETCH_DIM_R                                      ~41     !5, 1
         48        ASSIGN_DIM                                               !6, !4
         49        OP_DATA                                                  ~41
   32    50        PRE_INC                                                  !4
         51    >   IS_SMALLER                                               !4, !3
         52      > JMPNZ                                                    ~43, ->43
   39    53    >   INIT_FCALL_BY_NAME                                       'queryMysql'
         54        ROPE_INIT                                     3  ~45     'SELECT+%2A+FROM+dislikeprofile+WHERE+user%3D%27'
         55        ROPE_ADD                                      1  ~45     ~45, !0
         56        ROPE_END                                      2  ~44     ~45, '%27'
         57        SEND_VAL_EX                                              ~44
         58        DO_FCALL                                      0  $47     
         59        ASSIGN                                                   !2, $47
   40    60        INIT_FCALL_BY_NAME                                       'mysql_num_rows'
         61        SEND_VAR_EX                                              !2
         62        DO_FCALL                                      0  $49     
         63        ASSIGN                                                   !3, $49
   41    64        ASSIGN                                                   !4, 0
         65      > JMP                                                      ->74
   43    66    >   INIT_FCALL_BY_NAME                                       'mysql_fetch_row'
         67        SEND_VAR_EX                                              !2
         68        DO_FCALL                                      0  $52     
         69        ASSIGN                                                   !5, $52
   44    70        FETCH_DIM_R                                      ~55     !5, 1
         71        ASSIGN_DIM                                               !7, !4
         72        OP_DATA                                                  ~55
   41    73        PRE_INC                                                  !4
         74    >   IS_SMALLER                                               !4, !3
         75      > JMPNZ                                                    ~57, ->66
   48    76    >   TYPE_CHECK                                  128  ~58     !6
         77      > JMPZ_EX                                          ~58     ~58, ->80
         78    >   TYPE_CHECK                                  128  ~59     !7
         79        BOOL                                             ~58     ~59
         80    > > JMPZ                                                     ~58, ->87
   50    81    >   INIT_FCALL                                               'array_merge'
         82        SEND_VAR                                                 !6
         83        SEND_VAR                                                 !7
         84        DO_ICALL                                         $60     
         85        ASSIGN                                                   !8, $60
         86      > JMP                                                      ->92
   52    87    >   TYPE_CHECK                                  128          !6
         88      > JMPZ                                                     ~62, ->91
   54    89    >   ASSIGN                                                   !8, !6
         90      > JMP                                                      ->92
   58    91    >   ASSIGN                                                   !8, !7
   62    92    >   TYPE_CHECK                                  128          !8
         93      > JMPZ                                                     ~65, ->104
   64    94    >   INIT_FCALL                                               'array_diff'
         95        SEND_VAR                                                 !1
         96        SEND_VAR                                                 !8
         97        DO_ICALL                                         $66     
         98        ASSIGN                                                   !9, $66
   65    99        INIT_FCALL                                               'array_values'
        100        SEND_VAR                                                 !9
        101        DO_ICALL                                         $68     
        102        ASSIGN                                                   !9, $68
        103      > JMP                                                      ->109
   68   104    >   ASSIGN                                                   !9, !1
   69   105        INIT_FCALL                                               'array_values'
        106        SEND_VAR                                                 !9
        107        DO_ICALL                                         $71     
        108        ASSIGN                                                   !9, $71
   73   109    >   FETCH_DIM_R                                      ~73     !9, 0
        110        ASSIGN                                                   !10, ~73
   74   111        CONCAT                                           ~75     'check+out+', !10
        112        CONCAT                                           ~76     ~75, 's+picture+%3Cbr+%2F%3E'
        113        ECHO                                                     ~76
   75   114        INIT_FCALL                                               'file_exists'
        115        NOP                                                      
        116        FAST_CONCAT                                      ~77     !10, '.jpg'
        117        SEND_VAL                                                 ~77
        118        DO_ICALL                                         $78     
        119      > JMPZ                                                     $78, ->124
   76   120    >   ROPE_INIT                                     3  ~80     '%3Cimg+src%3D%27'
        121        ROPE_ADD                                      1  ~80     ~80, !10
        122        ROPE_END                                      2  ~79     ~80, '.jpg%27+align%3D%27left%27+%2F%3E'
        123        ECHO                                                     ~79
   79   124    >   FETCH_IS                                         ~82     '_POST'
        125        ISSET_ISEMPTY_DIM_OBJ                         0  ~83     ~82, 'choice'
        126      > JMPZ_EX                                          ~83     ~83, ->131
        127    >   FETCH_R                      global              ~84     '_POST'
        128        FETCH_DIM_R                                      ~85     ~84, 'choice'
        129        IS_EQUAL                                         ~86     ~85, 'LIKE'
        130        BOOL                                             ~83     ~86
        131    > > JMPZ                                                     ~83, ->153
   81   132    >   ASSIGN                                                   !11, !10
   82   133        ROPE_INIT                                     5  ~89     '%28%27'
        134        ROPE_ADD                                      1  ~89     ~89, !0
        135        ROPE_ADD                                      2  ~89     ~89, '%27%2C+%27'
        136        ROPE_ADD                                      3  ~89     ~89, !11
        137        ROPE_END                                      4  ~88     ~89, '%27%29'
        138        CONCAT                                           ~92     'INSERT+INTO+likeprofile+VALUES', ~88
        139        ASSIGN                                                   !12, ~92
   83   140        INIT_FCALL_BY_NAME                                       'queryMysql'
        141        SEND_VAR_EX                                              !12
        142        DO_FCALL                                      0  $94     
        143        BOOL_NOT                                         ~95     $94
        144      > JMPZ                                                     ~95, ->153
        145    >   ROPE_INIT                                     3  ~97     'INSERT+failed%3A+'
        146        ROPE_ADD                                      1  ~97     ~97, !12
        147        ROPE_END                                      2  ~96     ~97, '%3Cbr+%2F%3E'
        148        INIT_FCALL_BY_NAME                                       'mysql_error'
        149        DO_FCALL                                      0  $99     
        150        CONCAT                                           ~100    ~96, $99
        151        CONCAT                                           ~101    ~100, '%3Cbr+%2F%3E%3Cbr+%2F%3E'
        152        ECHO                                                     ~101
   86   153    >   FETCH_IS                                         ~102    '_POST'
        154        ISSET_ISEMPTY_DIM_OBJ                         0  ~103    ~102, 'choice'
        155      > JMPZ_EX                                          ~103    ~103, ->160
        156    >   FETCH_R                      global              ~104    '_POST'
        157        FETCH_DIM_R                                      ~105    ~104, 'choice'
        158        IS_EQUAL                                         ~106    ~105, 'NEXT+PROFILE'
        159        BOOL                                             ~103    ~106
        160    > > JMPZ                                                     ~103, ->182
   88   161    >   ASSIGN                                                   !13, !10
   89   162        ROPE_INIT                                     5  ~109    '%28%27'
        163        ROPE_ADD                                      1  ~109    ~109, !0
        164        ROPE_ADD                                      2  ~109    ~109, '%27%2C+%27'
        165        ROPE_ADD                                      3  ~109    ~109, !13
        166        ROPE_END                                      4  ~108    ~109, '%27%29'
        167        CONCAT                                           ~112    'INSERT+INTO+dislikeprofile+VALUES', ~108
        168        ASSIGN                                                   !12, ~112
   90   169        INIT_FCALL_BY_NAME                                       'queryMysql'
        170        SEND_VAR_EX                                              !12
        171        DO_FCALL                                      0  $114    
        172        BOOL_NOT                                         ~115    $114
        173      > JMPZ                                                     ~115, ->182
        174    >   ROPE_INIT                                     3  ~117    'INSERT+failed%3A+'
        175        ROPE_ADD                                      1  ~117    ~117, !12
        176        ROPE_END                                      2  ~116    ~117, '%3Cbr+%2F%3E'
        177        INIT_FCALL_BY_NAME                                       'mysql_error'
        178        DO_FCALL                                      0  $119    
        179        CONCAT                                           ~120    ~116, $119
        180        CONCAT                                           ~121    ~120, '%3Cbr+%2F%3E%3Cbr+%2F%3E'
        181        ECHO                                                     ~121
   93   182    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.53 ms | 1412 KiB | 21 Q