95 lines
3.6 KiB
PHP
95 lines
3.6 KiB
PHP
|
|
<?php header('Content-type: application/json');
|
||
|
|
if ( !defined('PATHTOINCLUDES') ) define('PATHTOINCLUDES', $_SERVER["DOCUMENT_ROOT"] . '/include/analytics/');
|
||
|
|
include(PATHTOINCLUDES."base.php");
|
||
|
|
include(PATHTOINCLUDES."word_filter.php");
|
||
|
|
$args = array(
|
||
|
|
'thepid' => FILTER_VALIDATE_INT,
|
||
|
|
'thename' =>FILTER_SANITIZE_STRING,
|
||
|
|
'theuid' => FILTER_VALIDATE_INT,
|
||
|
|
'thecment' => FILTER_SANITIZE_STRING
|
||
|
|
);
|
||
|
|
$sanitizeinputs = filter_input_array(INPUT_POST, $args);
|
||
|
|
//$sanitizeinputs = filter_input_array(INPUT_POST, $args);
|
||
|
|
$em="";
|
||
|
|
$comment_review="";
|
||
|
|
$thepost=$_POST["thecment"];
|
||
|
|
$theimgid=$_POST["thepid"];
|
||
|
|
$theuser=$_POST["thename"];
|
||
|
|
$theuserid=$_POST["theuid"];
|
||
|
|
$thepost=strip_tags($thepost,"<strong><em><br>");
|
||
|
|
$thepost=filter_words($thepost);
|
||
|
|
|
||
|
|
|
||
|
|
$sql=sprintf("INSERT INTO `hc_comment` (`hc_comment`.`hc_imgid`,`hc_comment`.`hc_uid`,`hc_comment`.`hc_uname`,`hc_comment`.`hc_comment`)
|
||
|
|
VALUES (%s, %s, %s,%s)",
|
||
|
|
GetSQLValueString($theimgid, "int"),
|
||
|
|
GetSQLValueString($theuserid, "int"),
|
||
|
|
GetSQLValueString($_POST["thename"], "text"),
|
||
|
|
GetSQLValueString($thepost, "text"));
|
||
|
|
|
||
|
|
$query=$database->database_query($sql) or $em=$em.$database->database_error();
|
||
|
|
$hcid=$database->database_insert_id();
|
||
|
|
if($em=="")
|
||
|
|
{
|
||
|
|
$thenow=date('m/d/Y h:m:s');
|
||
|
|
$sqlcu="SELECT
|
||
|
|
`se_users`.`user_photo`,
|
||
|
|
`se_users`.`user_blocklist`,
|
||
|
|
`se_users`.`user_invisible`
|
||
|
|
FROM
|
||
|
|
`se_users`
|
||
|
|
WHERE
|
||
|
|
`se_users`.`user_id` = ".$theuserid."
|
||
|
|
LIMIT 1";
|
||
|
|
$querycu=$database->database_query($sqlcu) or $em .= $database->database_error();
|
||
|
|
$row = $database->database_fetch_row($querycu);
|
||
|
|
$uimg=$row[0];
|
||
|
|
$ubl=$row[1];
|
||
|
|
$uinv=$row[2];
|
||
|
|
if($uimg != "")
|
||
|
|
{
|
||
|
|
$uipi = pathinfo($uimg);
|
||
|
|
$uiname=$uipi['filename'];
|
||
|
|
$uiext=$uipi['extension'];
|
||
|
|
$udir = (((int)($theuserid/1000))*1000)+1000;
|
||
|
|
$theudir=$_SERVER["DOCUMENT_ROOT"]."/uploads_user/".$udir."/".$theuserid."/";
|
||
|
|
$uthumb=$theudir.$uiname."_thumb.".$uiext;
|
||
|
|
if(file_exists($uthumb))
|
||
|
|
{
|
||
|
|
|
||
|
|
$uphoto="/uploads_user/".$udir."/".$theuserid."/".$uiname."_thumb.".$uiext;
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
$ufull=$theudir.$uiname.".".$uiext;
|
||
|
|
if(file_exists($ufull))
|
||
|
|
{
|
||
|
|
$uphoto="/uploads_user/".$udir."/".$theuserid."/".$uiname.".".$uiext;
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
$uphoto="/images/nophoto.png";
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
//
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
$uphoto="/images/nophoto.png";
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
$comment_review .=' <div id="comment_'.$hcid.'">
|
||
|
|
<div style="margin-top: 10px; margin-bottom: 20px;">
|
||
|
|
<div style="float: left; text-align: center; width: 90px;">
|
||
|
|
<a href="http://bateworld.com/profile.php?user='.stripslashes($theuser).'" target="_blank"><img src="'.$uphoto.'" class="photo" width="75" border="0" style="height:auto;"></a></div><div style="overflow: hidden;"><div class="profile_comment_author"><a href="http://bateworld.com/profile.php?user="'.stripslashes($theuser).'target="_blank"><b>'.stripslashes($theuser).'</b></a><span id="hc_cmsg_'.$hcid.'" style="padding-left:20px;font-weight:bold;"></span></div><div class="profile_comment_date">'.$thenow.'</div><div class="profile_comment_body" id="profile_comment_body_'.$hcid.'" contenteditable="true" onblur="edit_comment_act(\''.$hcid.'\');">'.stripslashes($thepost).'</div><div class="profile_comment_links"><input type="button" class="button" style="padding:2px 6px 2px 6px;color:yellow;background:red;border-radius:2px;" value="delete" onclick="del_comment_act(\''.$hcid.'\');"><input type="button" class="button" value="edit" style="padding:2px 6px 2px 6px;color:#ccc;background:black;border-radius:2px;" onclick="edit_comment(\''.$hcid.'\');"></div></div></div></div>';
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
//$hc_cid=$database->database_insert_id();
|
||
|
|
$arr = array ('error'=>$em,'cment'=>$sql,'rcment'=> $comment_review);
|
||
|
|
echo json_encode($arr);
|
||
|
|
?>
|