本文整理汇总了PHP中daddslashes函数的典型用法代码示例。如果您正苦于以下问题:PHP daddslashes函数的具体用法?PHP daddslashes怎么用?PHP daddslashes使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了daddslashes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getstr
function getstr($string, $length, $in_slashes = 0, $out_slashes = 0, $bbcode = 0, $html = 0)
{
global $_G;
$string = trim($string);
$sppos = strpos($string, chr(0) . chr(0) . chr(0));
if ($sppos !== false) {
$string = substr($string, 0, $sppos);
}
if ($in_slashes) {
$string = dstripslashes($string);
}
$string = preg_replace("/\\[hide=?\\d*\\](.*?)\\[\\/hide\\]/is", '', $string);
if ($html < 0) {
$string = preg_replace("/(\\<[^\\<]*\\>|\r|\n|\\s|\\[.+?\\])/is", ' ', $string);
} elseif ($html == 0) {
$string = dhtmlspecialchars($string);
}
if ($length) {
$string = cutstr($string, $length);
}
if ($bbcode) {
require_once DISCUZ_ROOT . './source/class/class_bbcode.php';
$bb =& bbcode::instance();
$string = $bb->bbcode2html($string, $bbcode);
}
if ($out_slashes) {
$string = daddslashes($string);
}
return trim($string);
}
示例2: gpc
function gpc($pre)
{
$array = array();
$pre = str_replace(" ", '', $pre);
$pre = str_replace("\t", '', $pre);
if (strpos($pre, '|') !== false) {
$pre_array = explode('|', $pre);
}
foreach ($_GET as $key => $g) {
if ($pre_array) {
foreach ($pre_array as $v) {
$substr = '';
$substr = substr($key, 0, strlen($v));
if (strstr($substr, $v)) {
$array[$key] = daddslashes(htmlspecialchars($g));
}
}
} else {
$substr = '';
$substr = substr($key, 0, strlen($pre));
if (strstr($substr, $pre)) {
$array[$key] = daddslashes(htmlspecialchars($g));
}
}
}
return $array;
}
示例3: all
function all($tpl = '')
{
global $_G;
$url = URL . 'a=all';
$sql = make_sql();
$size = $_G[setting][cate_page] ? $_G[setting][cate_page] : 120;
if ($_GET[tag]) {
$tag = trim_html($tag, 1);
$tag = daddslashes($_GET[tag]);
$and .= "AND FIND_IN_SET('" . $tag . "', keywords) ";
$url .= "&tag=" . urlencode_utf8($tag);
$sql['and'] .= $and;
$sql['url'] .= $url;
}
$sql['key'] = 'all_';
$rs = D($sql, array('url' => $url . $sql[url], 'size' => $size));
$title = '';
if ($_GET[tag]) {
$title .= $_GET[tag];
}
$title .= '全部商品';
$this->add($rs);
seo($title);
$this->show($tpl);
}
示例4: fetch_all_by_search
public function fetch_all_by_search($aid, $authorid, $starttime, $endtime, $idtype, $message, $start = 0, $limit = 0, $type = 1)
{
$idtype = in_array($idtype, array('aid', 'topicid')) ? $idtype : 'aid';
$tablename = $idtype == 'aid' ? 'portal_article_title' : 'portal_topic';
$sql = '';
$sql .= $aid ? ' AND c.' . DB::field('id', $aid) : '';
$sql .= $authorid ? ' AND c.' . DB::field('uid', $authorid) : '';
$sql .= $starttime ? ' AND c.' . DB::field('dateline', $starttime, '>') : '';
$sql .= $endtime ? ' AND c.' . DB::field('dateline', $endtime, '<') : '';
if ($message != '') {
$sqlmessage = '';
$or = '';
$message = daddslashes($message);
$message = explode(',', str_replace(' ', '', $message));
for ($i = 0; $i < count($message); $i++) {
if (preg_match("/\\{(\\d+)\\}/", $message[$i])) {
$message[$i] = preg_replace("/\\\\{(\\d+)\\\\}/", ".{0,\\1}", preg_quote($message[$i], '/'));
$sqlmessage .= " {$or} c.message REGEXP '" . $message[$i] . "'";
} else {
$sqlmessage .= " {$or} c.message LIKE '%" . $message[$i] . "%'";
}
$or = 'OR';
}
if ($sqlmessage) {
$sql .= " AND ({$sqlmessage})";
}
}
if ($type == 2) {
return DB::result_first('SELECT count(*) FROM %t c WHERE 1 %i', array($this->_table, $sql));
} else {
return DB::fetch_all('SELECT c.*, a.title FROM %t c LEFT JOIN %t a ON a.`' . $idtype . '`=c.id WHERE 1 %i ORDER BY c.dateline DESC %i', array($this->_table, $tablename, $sql, DB::limit($start, $limit)));
}
}
示例5: userapp_update
function userapp_update()
{
global $_G;
if (!empty($_G['gp_id']) && is_numeric($_G['gp_id'])) {
$applist = array();
$userapp = DB::fetch_first("SELECT appid FROM " . DB::table('home_userapp_plying') . " WHERE uid='{$_G['uid']}'");
if (!empty($userapp['appid'])) {
$applist = explode(',', $userapp['appid']);
if (!empty($applist)) {
$applist = array_diff($applist, array(''));
$key = array_search($_G['gp_id'], $applist);
if ($key !== false) {
unset($applist[$key]);
}
array_unshift($applist, $_G['gp_id']);
while (count($applist) > $this->num) {
array_pop($applist);
}
}
}
if (empty($applist)) {
$applist = array($_G['gp_id']);
}
if (!empty($applist)) {
$appstr = implode(',', $applist);
DB::insert('home_userapp_plying', array('uid' => $_G['uid'], 'appid' => daddslashes($appstr)), false, true);
}
}
}
示例6: searchkey
function searchkey($keyword, $field, $returnsrchtxt = 0)
{
$srchtxt = '';
if ($field && $keyword) {
if (preg_match("(AND|\\+|&|\\s)", $keyword) && !preg_match("(OR|\\|)", $keyword)) {
$andor = ' AND ';
$keywordsrch = '1';
$keyword = preg_replace("/( AND |&| )/is", "+", $keyword);
} else {
$andor = ' OR ';
$keywordsrch = '0';
$keyword = preg_replace("/( OR |\\|)/is", "+", $keyword);
}
$keyword = str_replace('*', '%', addcslashes($keyword, '%_'));
$srchtxt = $returnsrchtxt ? $keyword : '';
foreach (explode('+', $keyword) as $text) {
$text = trim(daddslashes($text));
if ($text) {
$keywordsrch .= $andor;
$keywordsrch .= str_replace('{text}', $text, $field);
}
}
$keyword = " AND ({$keywordsrch})";
}
return $returnsrchtxt ? array($srchtxt, $keyword) : $keyword;
}
示例7: add
public function add()
{
$sid = intval($_GET['sid']);
$sname = daddslashes($_GET['sname']);
if (!isset($_SESSION['username']) || empty($_SESSION['username'])) {
$this->showmessage('请登录后操作!', "index.php?controller=user&method=login");
}
if (!isset($_POST['submit'])) {
VIEW::assign(array('title' => "添加" . $sname . "旅游攻略", 'sid' => $sid));
VIEW::display("addstrategy.html");
} else {
$strategy = daddslashes($_POST['strategy']);
$impression = daddslashes($_POST['impression']);
if (empty($strategy)) {
$this->showmessage("请填写您的旅游攻略!", 'index.php?controller=strategy&method=add&sid=' . $sid . '&sname=' . $sname);
}
$username = $_SESSION['username'];
$data = array('sid' => $sid, 'username' => $username, 'strategy' => $strategy, 'dateline' => time());
if (!empty($impression) && isset($impression)) {
$data['impression'] = $impression;
}
$strategyobj = M('strategy');
$strategyobj->addStrategy($data);
$this->showmessage('添加攻略成功!', 'index.php?controller=strategy&method=detail&sid=' . $sid . "&sname=" . $sname);
}
}
示例8: getstr
function getstr($string, $length, $in_slashes = 0, $out_slashes = 0, $censor = 0, $bbcode = 0, $html = 0)
{
global $_G;
$string = trim($string);
if ($in_slashes) {
$string = dstripslashes($string);
}
if ($html < 0) {
$string = preg_replace("/(\\<[^\\<]*\\>|\r|\n|\\s|\\[.+?\\])/is", ' ', $string);
} elseif ($html == 0) {
$string = dhtmlspecialchars($string);
}
if ($censor) {
if (!class_exists('discuz_censor')) {
include libfile('class/censor');
}
$censor = discuz_censor::instance();
$censor->check($string);
if ($censor->modbanned() || $censor->modmoderated()) {
showmessage('word_banned');
}
}
if ($length) {
$string = cutstr($string, $length);
}
if ($bbcode) {
require_once DISCUZ_ROOT . './source/class/class_bbcode.php';
$bb =& bbcode::instance();
$string = $bb->bbcode2html($string, $bbcode);
}
if ($out_slashes) {
$string = daddslashes($string);
}
return trim($string);
}
示例9: usesubmit
function usesubmit()
{
global $_G;
if (empty($_G['gp_pid'])) {
showmessage(lang('magic/namepost', 'namepost_info_nonexistence'));
}
$_G['tid'] = $_G['gp_ptid'];
$post = getpostinfo($_G['gp_pid'], 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.dateline', 'p.anonymous'));
$this->_check($post);
$query = DB::query("SELECT username FROM " . DB::table('common_member') . " WHERE uid='{$post['authorid']}'");
$author = daddslashes(DB::result($query, 0), 1);
$thread = getpostinfo($post['tid'], 'tid', array('tid', 'subject', 'author', 'replies', 'lastposter'));
$posttable = getposttablebytid($post['tid']);
if ($post['first']) {
$lastposter = $thread['replies'] > 0 ? $thread['lastposter'] : $author;
DB::query("UPDATE " . DB::table($posttable) . " SET anonymous='0' WHERE tid='{$post['tid']}' AND first='1'");
} else {
$lastposter = $author;
$author = $thread['author'];
DB::query("UPDATE " . DB::table($posttable) . " SET anonymous='0' WHERE pid='{$_G['gp_pid']}'");
}
$forum['lastpost'] = explode("\t", DB::result_first("SELECT lastpost FROM " . DB::table('forum_forum') . " WHERE fid='{$post['fid']}'"));
if ($thread['subject'] == $forum['lastpost'][1] && ($forum['lastpost'][3] == '' && $post['anonymous'])) {
$lastpost = "{$thread['tid']}\t{$thread['subject']}\t{$_G['timestamp']}\t{$lastposter}";
DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$lastpost}' WHERE fid='{$post['fid']}'", 'UNBUFFERED');
}
DB::query("UPDATE " . DB::table('forum_thread') . " SET author='{$author}', lastposter='{$lastposter}' WHERE tid='{$post['tid']}'");
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['gp_tid']);
if ($post['authorid'] != $_G['uid']) {
notification_add($post['authorid'], 'magic', lang('magic/namepost', 'namepost_notification'), array('pid' => $_G['gp_pid'], 'tid' => $_G['gp_tid'], 'subject' => $thread['subject'], 'magicname' => $this->magic['name']));
}
showmessage(lang('magic/namepost', 'namepost_succeed'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => true));
}
示例10: cronAction
public function cronAction()
{
$day = daddslashes(trim($this->reqVar('day', '')));
$time_stamp = time();
if (!empty($day)) {
$time_stamp = strtotime($day);
}
$ctime = date("Y-m-d", $time_stamp - 60 * 60 * 24 * 2);
// 2天注册的用户 android
$this->stat($ctime, 0);
$ctime = date("Y-m-d", $time_stamp - 60 * 60 * 24 * 4);
// 4天注册的用户
$this->stat($ctime, 1);
$ctime = date("Y-m-d", $time_stamp - 60 * 60 * 24 * 8);
// 8天注册的用户
$this->stat($ctime, 2);
$ctime = date("Y-m-d", $time_stamp - 60 * 60 * 24 * 2);
// 2天注册的用户 ios
$this->stat($ctime, 3);
$ctime = date("Y-m-d", $time_stamp - 60 * 60 * 24 * 4);
// 4天注册的用户
$this->stat($ctime, 4);
$ctime = date("Y-m-d", $time_stamp - 60 * 60 * 24 * 8);
// 8天注册的用户
$this->stat($ctime, 5);
}
示例11: usesubmit
function usesubmit()
{
global $_G;
$id = intval($_GET['id']);
if (empty($id)) {
showmessage(lang('magic/namepost', 'namepost_info_nonexistence'));
}
$idtype = !empty($_GET['idtype']) ? dhtmlspecialchars($_GET['idtype']) : '';
if (!in_array($idtype, array('pid', 'cid'))) {
showmessage(lang('magic/namepost', 'namepost_use_error'));
}
if ($idtype == 'pid') {
$_G['tid'] = intval($_GET['ptid']);
$post = getpostinfo($id, 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.dateline', 'p.anonymous'));
$this->_check($post);
$authorid = $post['authorid'];
$author = $post['anonymous'] ? '' : 1;
} elseif ($idtype == 'cid') {
$comment = C::t('home_comment')->fetch($id);
$authorid = $comment['authorid'];
$author = $comment['author'];
}
if ($author) {
showmessage('magicuse_bad_object');
}
$member = getuserbyuid($authorid);
if (!checkmagicperm($this->parameters['targetgroups'], $member['groupid'])) {
showmessage(lang('magic/namepost', 'namepost_info_user_noperm'));
}
$author = daddslashes($member['username']);
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, $idtype, $id);
showmessage(lang('magic/namepost', 'magic_namepost_succeed'), 'javascript:;', array('uid' => $authorid, 'username' => $author, 'avatar' => 1), array('alert' => 'right'));
}
示例12: tjAction
public function tjAction()
{
$password = $this->reqVar('passwd', '');
$startDate = daddslashes($this->reqVar('start_date', ''));
$whereStr = '';
if ($password == $this->password && !empty($startDate)) {
$startDateWhere = date("Y-m-d 00:00:00", strtotime($startDate));
$endDateWhere = date("Y-m-d 23:59:59", strtotime($startDate));
$whereStr = " ctime>='{$startDateWhere}' AND ctime<='{$endDateWhere}' AND ad_id='share_random'";
$startTime = time();
$cNum = $uNum = $ssNum = 0;
for ($i = 0; $i < 100; $i++) {
if (strlen($i) == 1) {
$tableStr = '0' . $i;
} else {
$tableStr = $i;
}
$scoreRe = $this->scoreModel->query("SELECT COUNT(*) as c_num, COUNT(DISTINCT uid) as u_num, SUM(score) as ss_num\n FROM z_score_log_{$tableStr}\n WHERE {$whereStr} LIMIT 1");
if ($scoreRe) {
foreach ($scoreRe as $key => $val) {
$cNum = $val['c_num'] + $cNum;
$uNum = $val['u_num'] + $uNum;
$ssNum = $val['ss_num'] + $ssNum;
}
}
}
echo '中奖数:' . $cNum . '--中奖用户数:' . $uNum . '--中奖金额:' . $ssNum / 100;
$runTime = time() - $startTime;
echo "<br/>运行时间为(秒)" . $runTime;
} else {
echo "参数错误!";
}
}
示例13: userlogin
function userlogin($username, $password, $questionid, $answer, $loginfield = 'username')
{
$return = array();
if ($loginfield == 'uid') {
$isuid = 1;
} elseif ($loginfield == 'email') {
$isuid = 2;
} elseif ($loginfield == 'auto') {
$isuid = 3;
} else {
$isuid = 0;
}
if (!function_exists('uc_user_login')) {
loaducenter();
}
if ($isuid == 3) {
if (preg_match('/^[1-9]\\d*$/', $username)) {
$return['ucresult'] = uc_user_login($username, $password, 1, 1, $questionid, $answer);
} elseif (isemail($username)) {
$return['ucresult'] = uc_user_login($username, $password, 2, 1, $questionid, $answer);
}
if ($return['ucresult'][0] <= 0) {
$return['ucresult'] = uc_user_login($username, $password, 0, 1, $questionid, $answer);
}
} else {
$return['ucresult'] = uc_user_login($username, $password, $isuid, 1, $questionid, $answer);
}
$tmp = array();
$duplicate = '';
list($tmp['uid'], $tmp['username'], $tmp['password'], $tmp['email'], $duplicate) = daddslashes($return['ucresult'], 1);
$return['ucresult'] = $tmp;
if ($duplicate && $return['ucresult']['uid'] > 0) {
if ($olduid = DB::result_first("SELECT uid FROM " . DB::table('common_member') . " WHERE username='" . addslashes($return['ucresult']['username']) . "'")) {
require_once libfile('function/membermerge');
if ($olduid != $return['ucresult']['uid']) {
membermerge($olduid, $return['ucresult']['uid']);
}
uc_user_merge_remove($return['ucresult']['username']);
} else {
$return['status'] = 0;
return $return;
}
}
if ($return['ucresult']['uid'] <= 0) {
$return['status'] = 0;
return $return;
}
$member = DB::fetch_first("SELECT * FROM " . DB::table('common_member') . " WHERE uid='" . $return['ucresult']['uid'] . "'");
if (!$member) {
$return['status'] = -1;
return $return;
}
$return['member'] = $member;
$return['status'] = 1;
if (addslashes($member['email']) != $return['ucresult']['email']) {
DB::query("UPDATE " . DB::table('common_member') . " SET email='" . $return['ucresult']['email'] . "' WHERE uid='" . $return['ucresult']['uid'] . "'");
}
return $return;
}
示例14: insert_new_reply
function insert_new_reply()
{
global $_G;
$tid = intval($_POST['tid']);
$post = array('tid' => $tid, 'author' => $_G['username'], 'authorid' => $_G['uid'], 'audio' => '', 'message' => $_POST['content'], 'fname' => '', 'first' => 0, 'dateline' => time());
C::t("#smart_video#video")->increase_by_where('smart_video_thread', 'reply', "tid={$tid}");
smart_record(1);
return C::t("#smart_video#video")->insert_new("smart_video_post", daddslashes($post), true);
}
示例15: raffleAction
public function raffleAction()
{
$ajax = daddslashes($this->reqVar('ajax', ''));
if ($ajax == 'tid') {
$tid = (int) $this->reqVar('tid', 0);
if ($tid > 0) {
$isThread = $this->siteThreadModel->query("SELECT 'X' FROM zs_forum_post WHERE tid='{$tid}' LIMIT 1");
if ($isThread) {
exit("1");
}
}
exit("0");
} else {
$dosubmit = daddslashes($this->postVar('dosubmit', ''));
$raffleAdd['tid'] = (int) $this->postVar('tid', 0);
$raffleAdd['num'] = (int) $this->postVar('num', 0);
$raffleAdd['is_images'] = (int) $this->postVar('is_images', 0);
$raffleAdd['creater'] = UNAME;
if (!empty($dosubmit)) {
if (empty($raffleAdd['tid'])) {
$this->redirect('请填写帖子ID!', '', 3);
die;
}
if (empty($raffleAdd['num'])) {
$this->redirect('请填写中奖人数!', '', 3);
die;
}
$whereStr = "";
if ($raffleAdd['is_images']) {
$whereStr = " AND attachment>0";
}
$sqlCountStr = "SELECT count(distinct(authorid)) as num FROM zs_forum_post WHERE tid='{$raffleAdd['tid']}' AND first=0 {$whereStr} LIMIT 1";
$fPostCountRe = $this->siteThreadModel->query($sqlCountStr);
if (empty($fPostCountRe[0]['num']) || $fPostCountRe[0]['num'] <= $raffleAdd['num']) {
$this->redirect('中奖人数超出回帖数了!', '', 3);
die;
}
$rid = $this->raffleModel->addRaffle($raffleAdd);
if ($rid > 0) {
$sqlStr = "SELECT pid FROM zs_forum_post WHERE tid='{$raffleAdd['tid']}' AND first=0 {$whereStr} group by authorid LIMIT 5000";
$fPostRe = $this->siteThreadModel->query($sqlStr);
if (!empty($fPostRe[0]['pid'])) {
//抽奖操作
$winnersSet = $raffleAdd;
$winnersSet['rid'] = $rid;
$winnersSet['post'] = $fPostRe;
$this->raffle($winnersSet);
$this->redirect('抽奖成功!', '/admin/thread_raffle/winners/?rid=' . $rid, 3);
die;
}
}
}
$this->getViewer()->needLayout(false);
$this->render('thread_raffle');
}
}