本文整理汇总了PHP中Safe::removeXSS方法的典型用法代码示例。如果您正苦于以下问题:PHP Safe::removeXSS方法的具体用法?PHP Safe::removeXSS怎么用?PHP Safe::removeXSS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Safe
的用法示例。
在下文中一共展示了Safe::removeXSS方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insertXueshu
public function insertXueshu($arr)
{
$user = new User($this->arr);
if ($user->islogin()) {
$user_id = $user->getUserId();
$huida_id = isset($arr['huida_id']) ? (int) $arr['huida_id'] : 0;
$kinds = C::safe($arr['kinds'], $this->dbc);
$title = C::safe($arr['title'], $this->dbc);
$content = Safe::removeXSS($arr['content']);
$filename = sha1(uniqid() . $user_id) . '.txt';
// $table = $this->arr['xml']->xueshu['table'];
$table = $this->table;
$file_dir = $this->arr['xml']->xueshu['dir'];
$root_dir = $this->arr['root_dir'];
if (file_put_contents(dirname(dirname(__FILE__)) . '/' . $file_dir . $filename, $content)) {
$query = sprintf("INSERT INTO %s (user_id,kinds,title,filename,huida_id)\n\t\t\t\t\t\tVALUES(%d,'%s','%s','%s', %d)", $table, $user_id, $kinds, $title, $filename, $huida_id);
$result = C::query($query, $this->dbc);
if ($result) {
$arr = array('isok' => '1', 'info' => 'Ok', 'content' => $content);
} else {
$arr = array('isok' => '0', 'code' => 3, 'info' => mysql_error($this->dbc));
}
if ($huida_id !== 0) {
$query = sprintf("UPDATE %s SET huida = huida + 1 WHERE xueshu_id = %d", $table, $huida_id);
C::query($query, $this->dbc);
}
} else {
$arr = array('isok' => '0', 'code' => 2, 'info' => 'can not write into file!');
}
} else {
$arr = array('isok' => '0', 'code' => 1, 'info' => 'have not login!');
}
return $arr;
}