3v4l.org

run code in 300+ PHP versions simultaneously
<?php session_start(); //db include_once('db.php'); $user_email = $_SESSION['email']; $resultuid = mysql_query("SELECT `id` FROM `tbluser` WHERE `email` = '$user_email'") or die(mysql_error()); $row_id = mysql_fetch_assoc($resultuid); $user_id = $row_id['id']; // id of the user if(isSet($_POST['comment'])){ $gid=$_GET['gid']; $comment=$_POST['comment']; $msg_id=$_POST['msg_id']; $ip=$_SERVER['REMOTE_ADDR']; $comment=htmlentities($comment); $time=time(); $ip=$_SERVER['REMOTE_ADDR']; $query = mysql_query("SELECT id,comment FROM `group_comments` WHERE uid='$user_id' and msg_id='$msg_id' order by id desc limit 1 ") or die(mysql_error()); $result = mysql_fetch_array($query); if ($comment!=$result['comment']) { $query = mysql_query("INSERT INTO `group_comments` (comment, uid, msg_id, created) VALUES ('$comment', '$uid','$msg_id', '$time')") or die(mysql_error()); $newquery = mysql_query("SELECT id, uid, comment, msg_id, created FROM group_comments WHERE uid='$user_id' AND msg_id='$msg_id' order by id desc limit 1 "); $result = mysql_fetch_array($newquery); $com_id=$result['id']; $comment=tolink(htmlentities($result['comment'] )); $time=$result['created']; $uid=$result['uid']; $uinf = mysql_query("SELECT * FROM `tbluser` WHERE `id` = '$uid'") or die(mysql_error()); $row_user = mysql_fetch_array($uinf); $fullname = $row_user['fname'].' '.$row_user['lname']; // full name of user $user_photo = $row_user['photo']; $user_photo="http://nitofa.com/user_pics/users/$user_photo"; header("Location: /groups/?id=".$gid."&msg=Comment posted!#stcommentbody".$com_id); ?> <div class="stcommentbody" id="stcommentbody<?php echo $com_id; ?>"> <div class="stcommentimg"> <img src="<?php echo $user_photo; ?>" class='small_face'/> </div> <div class="stcommenttext"> <!-- <a class="stcommentdelete" href="#" id='<?php echo $com_id; ?>'>X</a> --> <b><a href="<?php echo 'http://nitofa.com/browse-user.php?fid='.$uid;?>"><?php echo $fullname; ?></a></b> <?php echo $comment; ?> <div class="stcommenttime"><?php time_stamp($time); ?></div> </div> </div> <?php } } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 165
Branch analysis from position: 27
2 jumps found. (Code = 47) Position 1 = 59, Position 2 = 63
Branch analysis from position: 59
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 63
2 jumps found. (Code = 43) Position 1 = 70, Position 2 = 165
Branch analysis from position: 70
2 jumps found. (Code = 47) Position 1 = 84, Position 2 = 88
Branch analysis from position: 84
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 88
2 jumps found. (Code = 47) Position 1 = 123, Position 2 = 127
Branch analysis from position: 123
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 127
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 165
Branch analysis from position: 165
filename:       /in/CPDhh
function name:  (null)
number of ops:  166
compiled vars:  !0 = $user_email, !1 = $resultuid, !2 = $row_id, !3 = $user_id, !4 = $gid, !5 = $comment, !6 = $msg_id, !7 = $ip, !8 = $time, !9 = $query, !10 = $result, !11 = $uid, !12 = $newquery, !13 = $com_id, !14 = $uinf, !15 = $row_user, !16 = $fullname, !17 = $user_photo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'session_start'
          1        DO_ICALL                                                 
    5     2        INCLUDE_OR_EVAL                                          'db.php', INCLUDE_ONCE
    7     3        FETCH_R                      global              ~20     '_SESSION'
          4        FETCH_DIM_R                                      ~21     ~20, 'email'
          5        ASSIGN                                                   !0, ~21
    9     6        INIT_FCALL_BY_NAME                                       'mysql_query'
          7        ROPE_INIT                                     3  ~24     'SELECT+%60id%60+FROM+%60tbluser%60+WHERE+%60email%60+%3D+%27'
          8        ROPE_ADD                                      1  ~24     ~24, !0
          9        ROPE_END                                      2  ~23     ~24, '%27'
         10        SEND_VAL_EX                                              ~23
         11        DO_FCALL                                      0  $26     
         12        ASSIGN                                           ~27     !1, $26
         13      > JMPNZ_EX                                         ~27     ~27, ->18
         14    >   INIT_FCALL_BY_NAME                                       'mysql_error'
         15        DO_FCALL                                      0  $28     
         16      > EXIT                                                     $28
         17*       BOOL                                             ~27     <true>
   11    18    >   INIT_FCALL_BY_NAME                                       'mysql_fetch_assoc'
         19        SEND_VAR_EX                                              !1
         20        DO_FCALL                                      0  $29     
         21        ASSIGN                                                   !2, $29
   13    22        FETCH_DIM_R                                      ~31     !2, 'id'
         23        ASSIGN                                                   !3, ~31
   16    24        FETCH_IS                                         ~33     '_POST'
         25        ISSET_ISEMPTY_DIM_OBJ                         0          ~33, 'comment'
         26      > JMPZ                                                     ~34, ->165
   17    27    >   FETCH_R                      global              ~35     '_GET'
         28        FETCH_DIM_R                                      ~36     ~35, 'gid'
         29        ASSIGN                                                   !4, ~36
   18    30        FETCH_R                      global              ~38     '_POST'
         31        FETCH_DIM_R                                      ~39     ~38, 'comment'
         32        ASSIGN                                                   !5, ~39
   19    33        FETCH_R                      global              ~41     '_POST'
         34        FETCH_DIM_R                                      ~42     ~41, 'msg_id'
         35        ASSIGN                                                   !6, ~42
   20    36        FETCH_R                      global              ~44     '_SERVER'
         37        FETCH_DIM_R                                      ~45     ~44, 'REMOTE_ADDR'
         38        ASSIGN                                                   !7, ~45
   21    39        INIT_FCALL                                               'htmlentities'
         40        SEND_VAR                                                 !5
         41        DO_ICALL                                         $47     
         42        ASSIGN                                                   !5, $47
   22    43        INIT_FCALL                                               'time'
         44        DO_ICALL                                         $49     
         45        ASSIGN                                                   !8, $49
   23    46        FETCH_R                      global              ~51     '_SERVER'
         47        FETCH_DIM_R                                      ~52     ~51, 'REMOTE_ADDR'
         48        ASSIGN                                                   !7, ~52
   24    49        INIT_FCALL_BY_NAME                                       'mysql_query'
         50        ROPE_INIT                                     5  ~55     'SELECT+id%2Ccomment+FROM+%60group_comments%60+WHERE+uid%3D%27'
         51        ROPE_ADD                                      1  ~55     ~55, !3
         52        ROPE_ADD                                      2  ~55     ~55, '%27+and+msg_id%3D%27'
         53        ROPE_ADD                                      3  ~55     ~55, !6
         54        ROPE_END                                      4  ~54     ~55, '%27+order+by+id+desc+limit+1+'
         55        SEND_VAL_EX                                              ~54
         56        DO_FCALL                                      0  $58     
         57        ASSIGN                                           ~59     !9, $58
         58      > JMPNZ_EX                                         ~59     ~59, ->63
         59    >   INIT_FCALL_BY_NAME                                       'mysql_error'
         60        DO_FCALL                                      0  $60     
         61      > EXIT                                                     $60
         62*       BOOL                                             ~59     <true>
   25    63    >   INIT_FCALL_BY_NAME                                       'mysql_fetch_array'
         64        SEND_VAR_EX                                              !9
         65        DO_FCALL                                      0  $61     
         66        ASSIGN                                                   !10, $61
   27    67        FETCH_DIM_R                                      ~63     !10, 'comment'
         68        IS_NOT_EQUAL                                             !5, ~63
         69      > JMPZ                                                     ~64, ->165
   28    70    >   INIT_FCALL_BY_NAME                                       'mysql_query'
         71        ROPE_INIT                                     9  ~66     'INSERT+INTO+%60group_comments%60+%28comment%2C+uid%2C+msg_id%2C+created%29+VALUES+%28%27'
         72        ROPE_ADD                                      1  ~66     ~66, !5
         73        ROPE_ADD                                      2  ~66     ~66, '%27%2C+%27'
         74        ROPE_ADD                                      3  ~66     ~66, !11
         75        ROPE_ADD                                      4  ~66     ~66, '%27%2C%27'
         76        ROPE_ADD                                      5  ~66     ~66, !6
         77        ROPE_ADD                                      6  ~66     ~66, '%27%2C+%27'
         78        ROPE_ADD                                      7  ~66     ~66, !8
         79        ROPE_END                                      8  ~65     ~66, '%27%29'
         80        SEND_VAL_EX                                              ~65
         81        DO_FCALL                                      0  $71     
         82        ASSIGN                                           ~72     !9, $71
         83      > JMPNZ_EX                                         ~72     ~72, ->88
         84    >   INIT_FCALL_BY_NAME                                       'mysql_error'
         85        DO_FCALL                                      0  $73     
         86      > EXIT                                                     $73
         87*       BOOL                                             ~72     <true>
   29    88    >   INIT_FCALL_BY_NAME                                       'mysql_query'
         89        ROPE_INIT                                     5  ~75     'SELECT+id%2C+uid%2C+comment%2C+msg_id%2C+created+FROM+group_comments+WHERE+uid%3D%27'
         90        ROPE_ADD                                      1  ~75     ~75, !3
         91        ROPE_ADD                                      2  ~75     ~75, '%27+AND+msg_id%3D%27'
         92        ROPE_ADD                                      3  ~75     ~75, !6
         93        ROPE_END                                      4  ~74     ~75, '%27+order+by+id+desc+limit+1+'
         94        SEND_VAL_EX                                              ~74
         95        DO_FCALL                                      0  $78     
         96        ASSIGN                                                   !12, $78
   30    97        INIT_FCALL_BY_NAME                                       'mysql_fetch_array'
         98        SEND_VAR_EX                                              !12
         99        DO_FCALL                                      0  $80     
        100        ASSIGN                                                   !10, $80
   32   101        FETCH_DIM_R                                      ~82     !10, 'id'
        102        ASSIGN                                                   !13, ~82
   33   103        INIT_FCALL_BY_NAME                                       'tolink'
        104        INIT_FCALL                                               'htmlentities'
        105        FETCH_DIM_R                                      ~84     !10, 'comment'
        106        SEND_VAL                                                 ~84
        107        DO_ICALL                                         $85     
        108        SEND_VAR_NO_REF_EX                                       $85
        109        DO_FCALL                                      0  $86     
        110        ASSIGN                                                   !5, $86
   34   111        FETCH_DIM_R                                      ~88     !10, 'created'
        112        ASSIGN                                                   !8, ~88
   35   113        FETCH_DIM_R                                      ~90     !10, 'uid'
        114        ASSIGN                                                   !11, ~90
   36   115        INIT_FCALL_BY_NAME                                       'mysql_query'
        116        ROPE_INIT                                     3  ~93     'SELECT+%2A+FROM+%60tbluser%60+WHERE+%60id%60+%3D+%27'
        117        ROPE_ADD                                      1  ~93     ~93, !11
        118        ROPE_END                                      2  ~92     ~93, '%27'
        119        SEND_VAL_EX                                              ~92
        120        DO_FCALL                                      0  $95     
        121        ASSIGN                                           ~96     !14, $95
        122      > JMPNZ_EX                                         ~96     ~96, ->127
        123    >   INIT_FCALL_BY_NAME                                       'mysql_error'
        124        DO_FCALL                                      0  $97     
        125      > EXIT                                                     $97
        126*       BOOL                                             ~96     <true>
   37   127    >   INIT_FCALL_BY_NAME                                       'mysql_fetch_array'
        128        SEND_VAR_EX                                              !14
        129        DO_FCALL                                      0  $98     
        130        ASSIGN                                                   !15, $98
   38   131        FETCH_DIM_R                                      ~100    !15, 'fname'
        132        CONCAT                                           ~101    ~100, '+'
        133        FETCH_DIM_R                                      ~102    !15, 'lname'
        134        CONCAT                                           ~103    ~101, ~102
        135        ASSIGN                                                   !16, ~103
   39   136        FETCH_DIM_R                                      ~105    !15, 'photo'
        137        ASSIGN                                                   !17, ~105
   40   138        NOP                                                      
        139        FAST_CONCAT                                      ~107    'http%3A%2F%2Fnitofa.com%2Fuser_pics%2Fusers%2F', !17
        140        ASSIGN                                                   !17, ~107
   41   141        INIT_FCALL                                               'header'
        142        CONCAT                                           ~109    'Location%3A+%2Fgroups%2F%3Fid%3D', !4
        143        CONCAT                                           ~110    ~109, '%26msg%3DComment+posted%21%23stcommentbody'
        144        CONCAT                                           ~111    ~110, !13
        145        SEND_VAL                                                 ~111
        146        DO_ICALL                                                 
   43   147        ECHO                                                     '%3Cdiv+class%3D%22stcommentbody%22+id%3D%22stcommentbody'
        148        ECHO                                                     !13
        149        ECHO                                                     '%22%3E%0A%3Cdiv+class%3D%22stcommentimg%22%3E%0A%3Cimg+src%3D%22'
   45   150        ECHO                                                     !17
        151        ECHO                                                     '%22+class%3D%27small_face%27%2F%3E%0A%3C%2Fdiv%3E+%0A%3Cdiv+class%3D%22stcommenttext%22%3E%0A%3C%21--+%3Ca+class%3D%22stcommentdelete%22+href%3D%22%23%22+id%3D%27'
   48   152        ECHO                                                     !13
        153        ECHO                                                     '%27%3EX%3C%2Fa%3E+--%3E%0A%3Cb%3E%3Ca+href%3D%22'
   49   154        CONCAT                                           ~113    'http%3A%2F%2Fnitofa.com%2Fbrowse-user.php%3Ffid%3D', !11
        155        ECHO                                                     ~113
        156        ECHO                                                     '%22%3E'
        157        ECHO                                                     !16
        158        ECHO                                                     '%3C%2Fa%3E%3C%2Fb%3E+'
        159        ECHO                                                     !5
   50   160        ECHO                                                     '%3Cdiv+class%3D%22stcommenttime%22%3E'
        161        INIT_FCALL_BY_NAME                                       'time_stamp'
        162        SEND_VAR_EX                                              !8
        163        DO_FCALL                                      0          
        164        ECHO                                                     '%3C%2Fdiv%3E+%0A%3C%2Fdiv%3E%0A%3C%2Fdiv%3E%0A'
   56   165    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.32 ms | 1412 KiB | 21 Q