本文整理汇总了PHP中check_ipop_limit函数的典型用法代码示例。如果您正苦于以下问题:PHP check_ipop_limit函数的具体用法?PHP check_ipop_limit怎么用?PHP check_ipop_limit使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_ipop_limit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_unsubscribe
public function do_unsubscribe()
{
//开始发送验证码
if (check_ipop_limit(CLIENT_IP, "sms_send_code_un", intval(app_conf("SUBMIT_DELAY")))) {
$mobile = addslashes(trim($_REQUEST['mobile']));
$verify = md5(trim($_REQUEST['verify']));
$session_verify = es_session::get('verify');
if ($verify != $session_verify) {
$result['type'] = 0;
$result['message'] = $GLOBALS['lang']['VERIFY_CODE_ERROR'];
ajax_return($result);
}
$mobile_subscribe = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "mobile_list where mobile='" . $mobile . "' and is_effect = 1");
if (!$mobile_subscribe) {
$result['type'] = 0;
$result['message'] = $GLOBALS['lang']['MOBILE_NOT_SUBSCRIBE'];
ajax_return($result);
}
$code = rand(1111, 9999);
$GLOBALS['db']->query("update " . DB_PREFIX . "mobile_list set verify_code = '" . $code . "' where id = " . $mobile_subscribe['id']);
send_verify_sms($mobile_subscribe['mobile'], $code);
$result['type'] = 1;
ajax_return($result);
} else {
$result['type'] = 0;
$result['message'] = $GLOBALS['lang']['SUBMIT_TOO_FAST'];
ajax_return($result);
}
}
示例2: dologin
public function dologin()
{
if (check_ipop_limit(get_client_ip(), "supplier_dologin", intval(app_conf("SUBMIT_DELAY")))) {
$account_name = htmlspecialchars(addslashes(trim($_REQUEST['account_name'])));
$account_password = htmlspecialchars(addslashes(trim($_REQUEST['account_password'])));
$account = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_account where account_name = '" . $account_name . "' and account_password = '" . md5($account_password) . "' and is_effect = 1 and is_delete = 0");
if ($account) {
if (intval($_REQUEST['save_password']) == 1) {
es_cookie::set("sp_account_name", $account_name, 3600 * 24 * 30);
es_cookie::set("sp_account_password", md5($account_password), 3600 * 24 * 30);
}
//$account_locations = $GLOBALS['db']->getAll("select location_id from ".DB_PREFIX."supplier_account_location_link where account_id = ".$account['id']);
$account_locations = $GLOBALS['db']->getAll("select id from " . DB_PREFIX . "supplier_location where supplier_id = " . $account['supplier_id']);
$account_location_ids = array(0);
foreach ($account_locations as $row) {
$account_location_ids[] = $row['id'];
}
$account['location_ids'] = $account_location_ids;
es_session::set("account_info", $account);
$result['status'] = 1;
$GLOBALS['db']->query("update " . DB_PREFIX . "supplier_account set login_time = " . get_gmtime() . ",login_ip = '" . get_client_ip() . "' where id = " . $account['id']);
ajax_return($result);
} else {
$result['status'] = 0;
$result['msg'] = $GLOBALS['lang']['SUPPLIER_LOGIN_FAILED'];
ajax_return($result);
}
} else {
$result['status'] = 0;
$result['msg'] = $GLOBALS['lang']['SUBMIT_TOO_FAST'];
ajax_return($result);
}
}
示例3: index
public function index()
{
$mobile = strim($GLOBALS['request']['mobile']);
if (app_conf("SMS_ON") == 0) {
$root['status'] = 0;
$root['info'] = '短信功能关闭';
output($root);
}
if ($mobile == '') {
$root['status'] = 0;
$root['info'] = '手机号码不能为空';
output($root);
}
if (!check_mobile($mobile)) {
$root['status'] = 0;
$root['info'] = "请输入正确的手机号码";
output($root);
}
if (!check_ipop_limit(CLIENT_IP, "register_verify_phone", 60, 0)) {
$root['status'] = 0;
$root['info'] = '发送太快了';
output($root);
}
$sql = "SELECT * FROM " . DB_PREFIX . "user WHERE mobile = " . $mobile;
$user = $GLOBALS['db']->getRow($sql);
if (empty($user)) {
$root['status'] = 0;
$root['info'] = "手机号未在本站注册过";
output($root);
}
//删除超过5分钟的验证码
$sql = "DELETE FROM " . DB_PREFIX . "sms_mobile_verify WHERE mobile_phone = '{$mobile}' and add_time <=" . (get_gmtime() - 300);
$GLOBALS['db']->query($sql);
$code = rand(100000, 999999);
$message = "您正在找回密码,验证码:" . $code . ",如非本人操作,请忽略本短信【" . app_conf("SHOP_TITLE") . "】";
require_once APP_ROOT_PATH . "system/utils/es_sms.php";
$sms = new sms_sender();
$send = $sms->sendSms($mobile, $message);
if ($send['status']) {
$add_time = get_gmtime();
$GLOBALS['db']->query("insert into " . DB_PREFIX . "sms_mobile_verify(mobile_phone,code,add_time,send_count,ip) values('{$mobile}','{$code}','{$add_time}',1," . "'" . CLIENT_IP . "')");
/* 插入一条发送成功记录到队列表中 */
$msg_data['dest'] = $mobile;
$msg_data['send_type'] = 0;
$msg_data['content'] = addslashes($message);
$msg_data['send_time'] = $add_time;
$msg_data['is_send'] = 1;
$msg_data['is_success'] = 1;
$msg_data['create_time'] = $add_time;
$msg_data['user_id'] = intval($user['id']);
$msg_data['title'] = "密码找回验证";
$GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data);
$root['info'] = "验证码发出,请注意查收";
$root['status'] = 1;
} else {
$root['info'] = "发送失败" . $send['msg'];
$root['status'] = 0;
}
output($root);
}
示例4: index
public function index()
{
$email = strim($GLOBALS['request']['email']);
//用户名或邮箱
$pwd = strim($GLOBALS['request']['pwd']);
//密码
if (app_conf("SMS_ON") == 0) {
$root['response_code'] = 0;
$root['show_err'] = $GLOBALS['lang']['SMS_OFF'];
//短信未开启
output($root);
}
//检查用户,用户密码
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
$root['user_id'] = $user_id;
if ($user_id > 0) {
$mobile = $user['mobile'];
$code = intval($user['bind_verify']);
if ($mobile == '') {
$root['response_code'] = 0;
$root['show_err'] = $GLOBALS['lang']['MOBILE_EMPTY_TIP'];
output($root);
}
if (!check_mobile($mobile)) {
$root['response_code'] = 0;
$root['show_err'] = $GLOBALS['lang']['FILL_CORRECT_MOBILE_PHONE'];
output($root);
}
if (!check_ipop_limit(get_client_ip(), "mobile_verify", 60, 0)) {
$root['response_code'] = 0;
$root['show_err'] = $GLOBALS['lang']['MOBILE_SMS_SEND_FAST'];
//短信发送太快
output($root);
}
//开始生成手机验证
if ($code == 0) {
//已经生成过了,则使用旧的验证码;反之生成一个新的
$code = rand(1111, 9999);
$GLOBALS['db']->query("update " . DB_PREFIX . "user set bind_verify = '" . $code . "',verify_create_time = '" . TIME_UTC . "' where id = " . $user_id);
}
//使用立即发送方式
$result = send_verify_sms($mobile, $code, $user, true);
//
$root['response_code'] = $result['status'];
if ($root['response_code'] == 1) {
$root['show_err'] = $GLOBALS['lang']['MOBILE_VERIFY_SEND_OK'];
} else {
$root['show_err'] = $result['msg'];
if ($root['show_err'] == null || $root['show_err'] == '') {
$root['show_err'] = "验证码发送失败";
}
}
} else {
$root['response_code'] = 0;
$root['show_err'] = "未登录";
$root['user_login_status'] = 0;
}
output($root);
}
示例5: reopen
public function reopen()
{
$user_id = intval($GLOBALS['user_info']['id']);
if ($user_id == 0) {
$GLOBALS['tmpl']->assign("ajax", 1);
$data['open_win'] = 1;
$data['html'] = $GLOBALS['tmpl']->fetch("inc/login_form.html");
ajax_return($data);
} else {
$deal_id = intval($_REQUEST['id']);
if (!check_ipop_limit(get_client_ip(), "reopen", 3600, $deal_id)) {
$data['open_win'] = 0;
$data['info'] = $GLOBALS['lang']['REOPEN_SUBMIT_FAST'];
$data['status'] = 0;
ajax_return($data);
} else {
$GLOBALS['db']->query("update " . DB_PREFIX . "deal set reopen = reopen + 1 where id = " . $deal_id . " and time_status = 2");
$rs = $GLOBALS['db']->affected_rows();
if ($rs == 0) {
$data['open_win'] = 0;
$data['info'] = $GLOBALS['lang']['REOPEN_SUBMIT_FAILED'];
$data['status'] = 0;
ajax_return($data);
} else {
$data['open_win'] = 0;
$data['status'] = 1;
$data['info'] = $GLOBALS['lang']['REOPEN_SUBMIT_OK'];
ajax_return($data);
}
}
}
}
示例6: index
public function index()
{
$mobile = addslashes(htmlspecialchars(trim($GLOBALS['request']['mobile'])));
$root = array();
if (app_conf("SMS_ON") == 0) {
$root['response_code'] = 0;
$root['show_err'] = $GLOBALS['lang']['SMS_OFF'];
//短信未开启
output($root);
}
if ($mobile == '') {
$root['response_code'] = 0;
$root['show_err'] = $GLOBALS['lang']['MOBILE_EMPTY_TIP'];
//请输入你的手机号
output($root);
}
if (!check_mobile($mobile)) {
$root['response_code'] = 0;
$root['show_err'] = $GLOBALS['lang']['FILL_CORRECT_MOBILE_PHONE'];
//请填写正确的手机号码
output($root);
}
if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where mobile = '" . $mobile . "'") > 0) {
$field_show_name = $GLOBALS['lang']['USER_TITLE_mobile'];
//手机号码
$root['response_code'] = 0;
$root['show_err'] = sprintf($GLOBALS['lang']['EXIST_ERROR_TIP'], $field_show_name);
//已存在,请重新输入
output($root);
}
if (!check_ipop_limit(CLIENT_IP, "mobile_verify", 60, 0)) {
$root['response_code'] = 0;
$root['show_err'] = $GLOBALS['lang']['MOBILE_SMS_SEND_FAST'];
//短信发送太快
output($root);
}
//删除超过5分钟的验证码
$GLOBALS['db']->query("DELETE FROM " . DB_PREFIX . "mobile_verify_code WHERE create_time <=" . TIME_UTC - 300);
$verify_code = $GLOBALS['db']->getOne("select verify_code from " . DB_PREFIX . "mobile_verify_code where mobile = '" . $mobile . "' and create_time>=" . (TIME_UTC - 180) . " ORDER BY id DESC");
if (intval($verify_code) == 0) {
//如果数据库中存在验证码,则取数据库中的(上次的 );确保连接发送时,前后2条的验证码是一至的.==为了防止延时
//开始生成手机验证
$verify_code = rand(1111, 9999);
$GLOBALS['db']->autoExecute(DB_PREFIX . "mobile_verify_code", array("verify_code" => $verify_code, "mobile" => $mobile, "create_time" => TIME_UTC, "client_ip" => CLIENT_IP), "INSERT");
}
//使用立即发送方式
$result = send_verify_sms($mobile, $verify_code, null, true);
//
$root['response_code'] = $result['status'];
if ($root['response_code'] == 1) {
$root['show_err'] = $GLOBALS['lang']['MOBILE_VERIFY_SEND_OK'];
} else {
$root['show_err'] = $result['msg'];
if ($root['show_err'] == null || $root['show_err'] == '') {
$root['show_err'] = "验证码发送失败";
}
}
//../system/sms/FW_sms.php 提示账户或密码错误地址
output($root);
}
示例7: go
public function go()
{
$url = strim($_REQUEST['url']);
$link_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "link where (url = '" . $url . "' or url = 'http://" . $url . "') and is_effect = 1");
if ($link_item) {
if (check_ipop_limit(get_client_ip(), "Link", 10, $link_item['id'])) {
$GLOBALS['db']->query("update " . DB_PREFIX . "link set count = count + 1 where id = " . $link_item['id']);
}
}
}
示例8: index
public function index()
{
$root = array();
$ajax = intval($_REQUEST['ajax']);
$root['ajax'] = $ajax;
$email = strim($GLOBALS['request']['email']);
//用户名或邮箱
$pwd = strim($GLOBALS['request']['pwd']);
//密码
//检查用户,用户密码
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
if ($user_id > 0) {
$comment['deal_id'] = intval($_REQUEST['id']);
$deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $comment['deal_id'] . " and is_delete = 0 and is_effect = 1 ");
if (!$deal_info) {
$root['info'] = "该项目暂时不能评论";
output($root);
}
if (!check_ipop_limit(get_client_ip(), "deal_savedealcomment", 3)) {
$root['info'] = "提交太快";
}
output($root);
$comment['content'] = strim($_REQUEST['content']);
$comment['user_id'] = intval($GLOBALS['user_info']['id']);
$comment['create_time'] = NOW_TIME;
$comment['user_name'] = $GLOBALS['user_info']['user_name'];
$comment['pid'] = intval($_REQUEST['pid']);
$comment['deal_user_id'] = intval($GLOBALS['db']->getOne("select user_id from " . DB_PREFIX . "deal where id = " . $comment['deal_id']));
$comment['reply_user_id'] = intval($GLOBALS['db']->getOne("select user_id from " . DB_PREFIX . "deal_comment where id = " . $comment['pid']));
$comment['deal_user_name'] = $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . intval($comment['deal_user_id']));
$comment['reply_user_name'] = $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . intval($comment['reply_user_id']));
$GLOBALS['db']->autoExecute(DB_PREFIX . "deal_comment", $comment);
$comment['id'] = $GLOBALS['db']->insert_id();
$GLOBALS['db']->query("update " . DB_PREFIX . "deal set comment_count = comment_count+1 where id = " . $comment['deal_id']);
if (intval($_REQUEST['syn_weibo']) == 1) {
$weibo_info = array();
$weibo_info['content'] = $comment['content'] . " " . get_domain() . url("deal#show", array("id" => $comment['deal_id']));
$img = $GLOBALS['db']->getOne("select image from " . DB_PREFIX . "deal where id = " . intval($comment['deal_id']));
if ($img) {
$weibo_info['img'] = APP_ROOT_PATH . "/" . $img;
}
syn_weibo($weibo_info);
}
if ($ajax == 1) {
$data['status'] = 1;
ajax_return($data);
} else {
showSuccess("发表成功");
}
} else {
$root['user_login_status'] = 0;
output($root);
}
}
示例9: index
public function index()
{
$mobile = addslashes(htmlspecialchars(trim($GLOBALS['request']['mobile'])));
$root = array();
if (app_conf("SMS_ON") == 0) {
$root['response_code'] = 0;
$root['show_err'] = $GLOBALS['lang']['SMS_OFF'];
output($root);
}
if ($mobile == '') {
$root['response_code'] = 0;
$root['show_err'] = $GLOBALS['lang']['MOBILE_EMPTY_TIP'];
output($root);
}
if (!check_mobile($mobile)) {
$root['response_code'] = 0;
$root['show_err'] = $GLOBALS['lang']['FILL_CORRECT_MOBILE_PHONE'];
output($root);
}
if (!check_ipop_limit(get_client_ip(), "mobile_verify", 60, 0)) {
$root['response_code'] = 0;
$root['show_err'] = $GLOBALS['lang']['MOBILE_SMS_SEND_FAST'];
output($root);
}
$sql = "select id,bind_verify from " . DB_PREFIX . "user where mobile = '" . $mobile . "' and is_delete = 0";
$user_info = $GLOBALS['db']->getRow($sql);
$user_id = intval($user_info['id']);
$code = intval($user_info['bind_verify']);
if ($user_id == 0) {
//$field_show_name = $GLOBALS['lang']['USER_TITLE_mobile'];
$root['response_code'] = 0;
$root['show_err'] = '手机号码不存在或被禁用';
output($root);
}
//开始生成手机验证
if ($code == 0) {
//已经生成过了,则使用旧的验证码;反之生成一个新的
$code = rand(1111, 9999);
$GLOBALS['db']->query("update " . DB_PREFIX . "user set bind_verify = '" . $code . "',verify_create_time = '" . TIME_UTC . "' where id = " . $user_id);
}
//使用立即发送方式
$result = send_verify_sms($mobile, $code, null, true);
//
$root['response_code'] = $result['status'];
if ($root['response_code'] == 1) {
$root['show_err'] = $GLOBALS['lang']['MOBILE_VERIFY_SEND_OK'];
} else {
$root['show_err'] = $result['msg'];
if ($root['show_err'] == null || $root['show_err'] == '') {
$root['show_err'] = "验证码发送失败";
}
}
$root['post_type'] = trim($GLOBALS['request']['post_type']);
output($root);
}
示例10: index
public function index()
{
$mobile = addslashes(htmlspecialchars(trim($GLOBALS['request']['mobile'])));
$root = array();
if (app_conf("SMS_ON") == 0) {
$root['response_code'] = 0;
$root['show_err'] = '短信未开启';
output($root);
}
if ($mobile == '') {
$root['response_code'] = 0;
$root['show_err'] = '请输入你的手机号';
output($root);
}
if (!check_mobile($mobile)) {
$root['response_code'] = 0;
$root['show_err'] = '请填写正确的手机号码';
output($root);
}
if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where mobile = '" . $mobile . "'") > 0) {
$field_show_name = '手机号码';
$root['response_code'] = 0;
$root['show_err'] = sprintf('%s已存在,请重新输入', $field_show_name);
output($root);
}
if (!check_ipop_limit(get_client_ip(), "mobile_verify", 60, 0)) {
$root['response_code'] = 0;
$root['show_err'] = '短信发送太快,请稍后再试';
output($root);
}
//删除超过5分钟的验证码
$GLOBALS['db']->query("DELETE FROM " . DB_PREFIX . "mobile_verify_code WHERE create_time <=" . get_gmtime() - 300);
$verify_code = $GLOBALS['db']->getOne("select verify_code from " . DB_PREFIX . "mobile_verify_code where mobile = '" . $mobile . "' and create_time>=" . (TIME_UTC - 180) . " ORDER BY id DESC");
if (intval($verify_code) == 0) {
//如果数据库中存在验证码,则取数据库中的(上次的 );确保连接发送时,前后2条的验证码是一至的.==为了防止延时
//开始生成手机验证
$verify_code = rand(1111, 9999);
$GLOBALS['db']->autoExecute(DB_PREFIX . "mobile_verify_code", array("verify_code" => $verify_code, "mobile" => $mobile, "create_time" => get_gmtime(), "client_ip" => get_client_ip()), "INSERT");
}
//使用立即发送方式
$result = send_verify_sms($mobile, $verify_code, null, true);
//
$root['response_code'] = $result['status'];
if ($root['response_code'] == 1) {
$root['show_err'] = '验证短信已经发送,请注意查收';
} else {
$root['show_err'] = $result['msg'];
if ($root['show_err'] == null || $root['show_err'] == '') {
$root['show_err'] = "验证码发送失败";
}
}
output($root);
}
示例11: dologin
public function dologin()
{
if (!$_POST) {
app_redirect("404.html");
exit;
}
if (!check_hash_key()) {
showErr("非法请求!", $ajax);
}
foreach ($_POST as $k => $v) {
$_POST[$k] = htmlspecialchars(addslashes($v));
}
$ajax = intval($_REQUEST['ajax']);
$_POST['user_pwd'] = strim(FW_DESPWD($_POST['user_pwd']));
require_once APP_ROOT_PATH . "system/libs/user.php";
if (check_ipop_limit(CLIENT_IP, "user_dologin", intval(app_conf("SUBMIT_DELAY")))) {
$result = do_login_user($_POST['email'], $_POST['user_pwd']);
} else {
showErr($GLOBALS['lang']['SUBMIT_TOO_FAST'], $ajax, url("shop", "authorized#login"));
}
if ($result['status']) {
$s_user_info = es_session::get("authorized_info");
$jump_url = url("index", "authorized#account");
$s_user_info = es_session::get("authorized_info");
if ($ajax == 1) {
$return['status'] = 1;
$return['info'] = $GLOBALS['lang']['LOGIN_SUCCESS'];
$return['data'] = $result['msg'];
$return['jump'] = $jump_url;
ajax_return($return);
} else {
$GLOBALS['tmpl']->assign('integrate_result', $result['msg']);
showSuccess($GLOBALS['lang']['LOGIN_SUCCESS'], $ajax, $jump_url);
}
} else {
if ($result['data'] == ACCOUNT_NO_EXIST_ERROR) {
$err = $GLOBALS['lang']['USER_NOT_EXIST'];
}
if ($result['data'] == ACCOUNT_PASSWORD_ERROR) {
$err = $GLOBALS['lang']['PASSWORD_ERROR'];
}
if ($result['data'] == ACCOUNT_NO_VERIFY_ERROR) {
$err = $GLOBALS['lang']['USER_NOT_VERIFY'];
if (app_conf("MAIL_ON") == 1 && $ajax == 0) {
$GLOBALS['tmpl']->assign("page_title", $err);
$GLOBALS['tmpl']->assign("user_info", $result['user']);
$GLOBALS['tmpl']->display("verify_user.html");
exit;
}
}
showErr($err, $ajax);
}
}
示例12: dovote
public function dovote()
{
$ok = false;
$ajax = intval($_REQUEST['ajax']);
foreach ($_REQUEST['name'] as $vote_ask_id => $names) {
foreach ($names as $kk => $name) {
if ($name != '') {
$ok = true;
}
}
}
if (!$ok) {
showErr("请选择要调查的内容", $ajax, '');
}
$vote_id = intval($_REQUEST['vote_id']);
if (check_ipop_limit(get_client_ip(), "vote", 3600, $vote_id)) {
foreach ($_REQUEST['name'] as $vote_ask_id => $names) {
foreach ($names as $kk => $name) {
$name = htmlspecialchars(addslashes(trim($name)));
$result = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "vote_result where name = '" . $name . "' and vote_id = " . $vote_id . " and vote_ask_id = " . $vote_ask_id);
$is_add = true;
if ($result) {
$GLOBALS['db']->query("update " . DB_PREFIX . "vote_result set count = count + 1 where name = '" . $name . "' and vote_id = " . $vote_id . " and vote_ask_id = " . $vote_ask_id);
if (intval($GLOBALS['db']->affected_rows()) != 0) {
$is_add = false;
}
}
if ($is_add) {
if ($name != '') {
$result = array();
$result['name'] = $name;
$result['vote_id'] = $vote_id;
$result['vote_ask_id'] = $vote_ask_id;
$result['count'] = 1;
$GLOBALS['db']->autoExecute(DB_PREFIX . "vote_result", $result);
}
}
}
}
$vote_list = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "vote_list where vote_id = " . $vote_id);
$vote_list = array();
$vote_list['vote_id'] = $vote_id;
$vote_list['value'] = serialize($_REQUEST['name']);
$GLOBALS['db']->autoExecute(DB_PREFIX . "vote_list", $vote_list);
showSuccess("调查提交成功", $ajax, url("vote#index"));
} else {
showErr("你已经提交过该问卷", $ajax, '');
}
}
示例13: index
public function index()
{
$GLOBALS['tmpl']->caching = true;
$cache_id = md5(MODULE_NAME . ACTION_NAME . trim($_REQUEST['id']) . $GLOBALS['deal_city']['id']);
if (!$GLOBALS['tmpl']->is_cached('page/help_index.html', $cache_id)) {
$id = intval($_REQUEST['id']);
$uname = addslashes(trim($_REQUEST['id']));
if ($id == 0 && $uname == '') {
$id = $GLOBALS['db']->getOne("select a.id from " . DB_PREFIX . "article as a left join " . DB_PREFIX . "article_cate as ac on a.cate_id = ac.id where ac.type_id = 1 order by a.sort desc");
} elseif ($id == 0 && $uname != '') {
$id = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "article where uname = '" . $uname . "'");
}
$article = get_article($id);
if (!$article || $article['type_id'] != 1) {
app_redirect(APP_ROOT . "/");
} else {
if (check_ipop_limit(get_client_ip(), "article", 60, $article['id'])) {
//每一分钟访问更新一次点击数
$GLOBALS['db']->query("update " . DB_PREFIX . "article set click_count = click_count + 1 where id =" . $article['id']);
}
if ($article['rel_url'] != '') {
if (!preg_match("/http:\\/\\//i", $article['rel_url'])) {
if (substr($article['rel_url'], 0, 2) == 'u:') {
app_redirect(parse_url_tag($article['rel_url']));
} else {
app_redirect(APP_ROOT . "/" . $article['rel_url']);
}
} else {
app_redirect($article['rel_url']);
}
}
}
$article = get_article($id);
$GLOBALS['tmpl']->assign("article", $article);
$seo_title = $article['seo_title'] != '' ? $article['seo_title'] : $article['title'];
$GLOBALS['tmpl']->assign("page_title", $seo_title);
$seo_keyword = $article['seo_keyword'] != '' ? $article['seo_keyword'] : $article['title'];
$GLOBALS['tmpl']->assign("page_keyword", $seo_keyword . ",");
$seo_description = $article['seo_description'] != '' ? $article['seo_description'] : $article['title'];
$GLOBALS['tmpl']->assign("page_description", $seo_description . ",");
$GLOBALS['tmpl']->assign("relate_help", $cate_list);
}
$GLOBALS['tmpl']->display("page/help_index.html", $cache_id);
}
示例14: dovote
public function dovote()
{
$ok = false;
foreach ($_REQUEST['name'] as $vote_ask_id => $names) {
foreach ($names as $kk => $name) {
if ($name != '') {
$ok = true;
}
}
}
if (!$ok) {
showErr($GLOBALS['lang']['YOU_DONT_CHOICE']);
}
$vote_id = intval($_REQUEST['vote_id']);
if (check_ipop_limit(get_client_ip(), "vote", 3600, $vote_id)) {
foreach ($_REQUEST['name'] as $vote_ask_id => $names) {
foreach ($names as $kk => $name) {
$name = htmlspecialchars(addslashes(trim($name)));
$result = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "vote_result where name = '" . $name . "' and vote_id = " . $vote_id . " and vote_ask_id = " . $vote_ask_id);
$is_add = true;
if ($result) {
$GLOBALS['db']->query("update " . DB_PREFIX . "vote_result set count = count + 1 where name = '" . $name . "' and vote_id = " . $vote_id . " and vote_ask_id = " . $vote_ask_id);
if (intval($GLOBALS['db']->affected_rows()) != 0) {
$is_add = false;
}
}
if ($is_add) {
if ($name != '') {
$result = array();
$result['name'] = $name;
$result['vote_id'] = $vote_id;
$result['vote_ask_id'] = $vote_ask_id;
$result['count'] = 1;
$GLOBALS['db']->autoExecute(DB_PREFIX . "vote_result", $result);
}
}
}
}
showSuccess($GLOBALS['lang']['VOTE_SUCCESS']);
} else {
showErr($GLOBALS['lang']['YOU_VOTED']);
}
}
示例15: reply
public function reply()
{
$ajax = 1;
global_run();
if (!$GLOBALS['user_info']) {
$result['status'] = -1000;
$result['info'] = "未登录";
ajax_return($result);
}
if ($_REQUEST['content'] == '') {
showErr($GLOBALS['lang']['MESSAGE_CONTENT_EMPTY'], $ajax);
}
/*验证每天只允许评论5次*/
$day_send_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic_reply where create_time>" . to_timespan(to_date(NOW_TIME, "Y-m-d"), "Y-m-d") . " and create_time<" . NOW_TIME);
if ($day_send_count >= 8) {
showErr('今天你已经发很多了哦~', $ajax);
}
if (!check_ipop_limit(get_client_ip(), "message", intval(app_conf("SUBMIT_DELAY")), 0)) {
showErr($GLOBALS['lang']['MESSAGE_SUBMIT_FAST'], $ajax);
}
$topic_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic where id = " . intval($_REQUEST['topic_id']));
if (!$topic_info) {
showErr("主题不存在", $ajax);
}
$reply_data = array();
$reply_data['topic_id'] = intval($_REQUEST['topic_id']);
$reply_data['user_id'] = intval($GLOBALS['user_info']['id']);
$reply_data['user_name'] = $GLOBALS['user_info']['user_name'];
$reply_data['reply_id'] = intval($_REQUEST['reply_id']);
$reply_data['create_time'] = NOW_TIME;
$reply_data['is_effect'] = 1;
$reply_data['is_delete'] = 0;
$reply_data['content'] = strim(valid_str(addslashes($_REQUEST['content'])));
require_once APP_ROOT_PATH . 'system/model/topic.php';
$reply_id = insert_topic_reply($reply_data);
//返回页面的数据
$reply_data['reply_id'] = $reply_id;
$reply_data['create_time'] = to_date(NOW_TIME, "Y-m-d H:i");
$reply_data['avatar'] = show_avatar($reply_data['user_id'], "small");
$reply_data['user_url'] = url("index", "uc_home#index", array("id" => $reply_data['user_id']));
$reply_data['status'] = 1;
ajax_return($reply_data);
}