3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Wall_Updates { // Updates public function Updates($uid) { $query = mysql_query("SELECT M.msg_id, M.uid_fk, M.message, M.created, U.id FROM messages M, tbluser U WHERE M.uid_fk=U.id and M.uid_fk='$uid' order by M.msg_id desc ") or die(mysql_error()); while($row=mysql_fetch_array($query)) $data[]=$row; return $data; } //Comments public function Comments($msg_id) { $query = mysql_query("SELECT C.com_id, C.uid_fk, C.comment, C.created, U.id FROM message_comments C, tbluser U WHERE C.uid_fk=U.id and C.msg_id_fk='$msg_id' order by C.com_id asc ") or die(mysql_error()); while($row=mysql_fetch_array($query)) $data[]=$row; if(!empty($data)) { return $data; } } //Profile Image public function Avatar($uid) { $query = mysql_query("SELECT * FROM tbluser WHERE id = '$uid'") or die(mysql_error()); $row=mysql_fetch_array($query); if(!empty($row)) { $user_photo = $row['photo']; $data="http://nitofa.com/user_pics/users/$user_photo"; return $data; } else { $data="default.jpg"; // url to default image (if user has no image) return $data; } } //Insert Update public function Insert_Update($uid, $update) { $update=htmlentities($update); $time=time(); $ip=$_SERVER['REMOTE_ADDR']; $query = mysql_query("SELECT msg_id,message FROM `messages` WHERE uid_fk='$uid' order by msg_id desc limit 1") or die(mysql_error()); $result = mysql_fetch_array($query); if ($update!=$result['message']) { $query = mysql_query("INSERT INTO `messages` (message, uid_fk, ip,created) VALUES ('$update', '$uid', '$ip','$time')") or die(mysql_error()); $newquery = mysql_query("SELECT M.msg_id, M.uid_fk, M.message, M.created, U.id FROM messages M, tbluser U where M.uid_fk=U.id and M.uid_fk='$uid' order by M.msg_id desc limit 1 "); $result = mysql_fetch_array($newquery); return $result; } else { return false; } } //Delete update public function Delete_Update($uid, $msg_id) { $query = mysql_query("DELETE FROM `message_comments` WHERE msg_id_fk = '$msg_id' ") or die(mysql_error()); $query = mysql_query("DELETE FROM `messages` WHERE msg_id = '$msg_id' and uid_fk='$uid'") or die(mysql_error()); return true; } //Insert Comments public function Insert_Comment($uid,$msg_id,$comment) { $comment=htmlentities($comment); $time=time(); $ip=$_SERVER['REMOTE_ADDR']; $query = mysql_query("SELECT com_id,comment FROM `message_comments` WHERE uid_fk='$uid' and msg_id_fk='$msg_id' order by com_id desc limit 1 ") or die(mysql_error()); $result = mysql_fetch_array($query); if ($comment!=$result['comment']) { $query = mysql_query("INSERT INTO `message_comments` (comment, uid_fk,msg_id_fk,ip,created) VALUES ('$comment', '$uid','$msg_id', '$ip','$time')") or die(mysql_error()); $newquery = mysql_query("SELECT C.com_id, C.uid_fk, C.comment, C.msg_id_fk, C.created, U.id FROM message_comments C, tbluser U where C.uid_fk=U.id and C.uid_fk='$uid' and C.msg_id_fk='$msg_id' order by C.com_id desc limit 1 "); $result = mysql_fetch_array($newquery); return $result; } else { return false; } } //Delete Comments public function Delete_Comment($uid, $com_id) { $query = mysql_query("DELETE FROM `message_comments` WHERE uid_fk='$uid' and com_id='$com_id'") or die(mysql_error()); return true; } //Insert Photo public function Insert_Photo($uid, $update, $photo) { $update=htmlentities($update); $photoandupdate=$update."<br/>".$photo; $time=time(); $ip=$_SERVER['REMOTE_ADDR']; $query = mysql_query("SELECT msg_id,message FROM `messages` WHERE uid_fk='$uid' order by msg_id desc limit 1") or die(mysql_error()); $result = mysql_fetch_array($query); if ($photoandupdate!=$result['message']) { $query = mysql_query("INSERT INTO `messages` (message, uid_fk, ip,created) VALUES ('$photoandupdate', '$uid', '$ip','$time')") or die(mysql_error()); $newquery = mysql_query("SELECT M.msg_id, M.uid_fk, M.message, M.created, U.id FROM messages M, tbluser U where M.uid_fk=U.id and M.uid_fk='$uid' order by M.msg_id desc limit 1 "); $result = mysql_fetch_array($newquery); return $result; } else { return false; } } //Insert Docs public function Insert_Photo($uid, $update, $filepath) { $update=htmlentities($update); $fileandupdate=$update."<br/><i><b>Attachment:</b></i>".$filepath; $time=time(); $ip=$_SERVER['REMOTE_ADDR']; $query = mysql_query("SELECT msg_id,message FROM `messages` WHERE uid_fk='$uid' order by msg_id desc limit 1") or die(mysql_error()); $result = mysql_fetch_array($query); if ($fileandupdate!=$result['message']) { $query = mysql_query("INSERT INTO `messages` (message, uid_fk, ip,created) VALUES ('$fileandupdate', '$uid', '$ip','$time')") or die(mysql_error()); $newquery = mysql_query("SELECT M.msg_id, M.uid_fk, M.message, M.created, U.id FROM messages M, tbluser U where M.uid_fk=U.id and M.uid_fk='$uid' order by M.msg_id desc limit 1 "); $result = mysql_fetch_array($newquery); return $result; } else { return false; } } } ?>
Output for 5.3.25 - 5.3.26, 5.4.16
Fatal error: Cannot redeclare Wall_Updates::Insert_Photo() in /in/RHvVp on line 139
Process exited with code 255.
Output for 5.3.0 - 5.3.24, 5.4.0 - 5.4.15
Fatal error: Cannot redeclare Wall_Updates::Insert_Photo() in RHvVp on line 139
Process exited with code 255.