function save_shortcut() { $this->data->status = 'error'; $this->data->html = 'Unable to create shortcut.'; $this->data->shortcut_url = ''; $shortcut_url = $_SERVER['HTTP_REFERER']; $name = $this->input->post('bookmarkName'); if ($this->store_id && $this->user_id) { $count = $this->db->select('count(*) as count')->where('shortcut_name', $name)->where('user_id', $this->user_id)->get($this->_table_shortcuts)->row()->count; if (!$count) { $data = array('store_id' => (int) $this->store_id, 'user_id' => (int) $this->user_id, 'shortcut_name' => $name, 'shortcut_url' => $shortcut_url, 'shortcut_add_date' => date('Y-m-d H:i:s')); if ($this->db->insert($this->_table_shortcuts, $data)) { $this->data->html = 'Shortcut "' . $name . '" successfully created.'; $this->data->status = "success"; $this->data->shortcut_url = $shortcut_url; $this->data->id = $this->db->insert_id(); } } else { $this->data->html = "Shortcut name already exists."; } } else { $this->data->html = "Shortcut name already exists."; $this->data->status = "redirect"; } ajax_return($this->data); }
public function do_upload_img() { if (intval($_REQUEST['upload_type']) == 0) { $result = $this->uploadFile(); } else { $result = $this->uploadImage(); } if ($result['status'] == 1) { $list = $result['data']; if (intval($_REQUEST['upload_type']) == 0) { $file_url = "." . $list[0]['recpath'] . $list[0]['savename']; } else { $file_url = "." . $list[0]['bigrecpath'] . $list[0]['savename']; } /*$html = '<html>'; $html.= '<head>'; $html.= '<title>Insert Image</title>'; $html.= '<meta http-equiv="content-type" content="text/html; charset=utf-8">'; $html.= '</head>'; $html.= '<body>'; $html.= '<script type="text/javascript">'; //$html.='alert("'.$_POST['id'].'");'; //$html.='alert(parent.parent.document.getElementById("'.$_POST['id'].'").value);'; //$html.='parent.parent.document.getElementById("'.$_POST['id'].'").value="'.$file_url.'";'; $html.= 'parent.parent.KE.plugin["upload_image"].insert("' . $_POST['id'] . '", "' . $file_url . '","' . $_POST['imgTitle'] . '","' . $_POST['imgWidth'] . '","' . $_POST['imgHeight'] . '","' . $_POST['imgBorder'] . '","' . $_POST['align'] . '");'; $html.= '</script>'; $html.= '</body>'; $html.= '</html>'; echo $html;*/ ajax_return(array('error' => 0, 'url' => str_replace("./public/", SITE_DOMAIN . APP_ROOT . "/public/", $file_url))); } else { //echo "<script>alert('".$result['info']."');</script>"; ajax_return(array('error' => 1, 'message' => $result['info'])); } }
function updatePassword() { //加载表单验证类 $this->load->library('form_validation'); //开始验证,验证规则在config/form_validation.php $valid = $this->form_validation->run('index/_update_password'); if (!$valid) { //未通过验证 $msg = $this->form_validation->error_string(); ajax_return($msg, 3); } $uid = $this->user_info->sellerid; $options = array(); $options['where']['sellerid'] = $uid; $password = $this->input->get_post('password'); $data = array(); $data['password'] = md5($password); $old_password = md5($this->input->post('old_password')); if ($data['password'] == $old_password) { ajax_return(lang('new_pass_old_pass_same')); } $options['where']['password'] = $old_password; $tof = $this->model->update($data, $options); //信息返回操作 if ($tof) { ajax_return(lang('update_success'), 0, '', base_url('bp/main')); } else { ajax_return(lang('update_pwd_failed')); } }
public function init() { if (!$GLOBALS['user_info']) { if ($_REQUEST['ajax'] == 1) { ajax_return(array("status" => 0, "info" => "请先登录")); } else { es_session::set('before_login', $_SERVER['REQUEST_URI']); app_redirect(url("index", "user#login")); } } $id = intval($_REQUEST['id']); $this->space_user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $id . " and is_effect= 1 and is_delete = 0"); $user_id = intval($GLOBALS['user_info']['id']); if (!$this->space_user) { showErr($GLOBALS['lang']['USER_NOT_EXISTS']); } $focus_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_id . " and focused_user_id = " . $this->space_user['id']); if ($focus_data) { $this->space_user['focused'] = 1; } $province_str = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "region_conf where id = " . $this->space_user['province_id']); $city_str = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "region_conf where id = " . $this->space_user['city_id']); if ($province_str . $city_str == '') { $user_location = $GLOBALS['lang']['LOCATION_NULL']; } else { $user_location = $province_str . " " . $city_str; } $this->space_user['fav_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic where user_id = " . $this->space_user['id'] . " and fav_id <> 0"); $this->space_user['user_location'] = $user_location; $this->space_user['group_name'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "user_group where id = " . $this->space_user['group_id'] . " "); $GLOBALS['tmpl']->assign("space_user", $this->space_user); $GLOBALS['tmpl']->assign('user_statics', sys_user_status($id, true)); }
function files() { global $CatPage; if (getRequestValue('chancefiles') == "true") { require_once BASE_DIR_ADMIN . "jquery/File-Upload/upload.class.php"; exit; } if (false !== ($newfile = getRequestValue('newfile', 'post', false)) and false !== ($orgfile = getRequestValue('orgfile', 'post')) and false !== ($curent_dir = getRequestValue('curent_dir', 'post'))) { $dir = CONTENT_DIR_REL . $curent_dir . "/" . CONTENT_FILES_DIR_NAME . "/"; if (true !== ($error = moveFileDir($dir . $orgfile, $dir . $newfile, true))) { ajax_return("error", true, $error, true, "js-dialog-reload"); } ajax_return("success", true); } $pagecontent = ""; require_once BASE_DIR_ADMIN . "jquery/File-Upload/fileupload.php"; $pagecontent .= '<ul class="js-files mo-ul">'; $text_files = getLanguageValue("files"); foreach ($CatPage->get_CatArray(true, false) as $pos => $cat) { $pagecontent .= '<li class="js-file-dir mo-li ui-widget-content ui-corner-all">'; $pagecontent .= getFileUpload($cat, $CatPage->get_HrefText($cat, false), $text_files); $pagecontent .= '</li>'; } $pagecontent .= '</ul>'; return $pagecontent; }
public function do_exchange() { global_run(); if (check_save_login() != LOGIN_STATUS_LOGINED) { $result['status'] = 2; ajax_return($result); } $id = intval($_REQUEST['id']); $ecv_type = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "ecv_type where id = " . $id); if (!$ecv_type) { showErr($GLOBALS['lang']['INVALID_VOUCHER'], 1); } else { $exchange_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "ecv where ecv_type_id = " . $id . " and user_id = " . intval($GLOBALS['user_info']['id'])); if ($ecv_type['exchange_limit'] > 0 && $exchange_count >= $ecv_type['exchange_limit']) { $msg = sprintf($GLOBALS['lang']['EXCHANGE_VOUCHER_LIMIT'], $ecv_type['exchange_limit']); showErr($msg, 1); } elseif ($ecv_type['exchange_score'] > intval($GLOBALS['db']->getOne("select score from " . DB_PREFIX . "user where id = " . intval($GLOBALS['user_info']['id'])))) { showErr($GLOBALS['lang']['INSUFFCIENT_SCORE'], 1); } else { require_once APP_ROOT_PATH . "system/libs/voucher.php"; $rs = send_voucher($ecv_type['id'], $GLOBALS['user_info']['id'], 1); if ($rs) { require_once APP_ROOT_PATH . "system/model/user.php"; $msg = sprintf($GLOBALS['lang']['EXCHANGE_VOUCHER_USE_SCORE'], $ecv_type['name'], $ecv_type['exchange_score']); modify_account(array('money' => 0, 'score' => "-" . $ecv_type['exchange_score']), $GLOBALS['user_info']['id'], $msg); showSuccess($GLOBALS['lang']['EXCHANGE_SUCCESS'], 1); } else { showSuccess($GLOBALS['lang']['EXCHANGE_FAILED'], 1, url('index', 'uc_voucher')); } } } }
public function save() { $gid = (int) $this->input->get_post('gid'); $data['title'] = htmlspecialchars($this->input->get_post('title')); //判断名称是否有重复 $item = $this->model->getOne(array('title' => $data['title'])); if ($item && intval($item->gid) != intval($gid)) { ajax_return(lang('group_name_exist')); } $items = $this->input->get_post('items'); if (!$items) { ajax_return('请至少选择一个权限栏目!'); } $data['items'] = @implode(",", $items); //保存信息 if ($gid > 0) { $data['gid'] = $gid; $result = $this->model->update($data); $this->user_model->update(array('token' => ''), array('gid' => $gid)); } else { $result = $this->model->add($data); } //信息返回操作 if ($result) { ajax_return(lang('save_success'), 0, '', '/admin/user/group'); } else { ajax_return(lang('save_failed')); } die; }
public function save() { $id = (int) $this->input->get_post('id'); $data['groupName'] = htmlspecialchars(trim($this->input->get_post('groupname'))); if ($id > 0) { $data['groupId'] = $id; $result = $this->model->update($data); } else { $data['sellerid'] = $this->sellerid; $options = array('select' => '*'); $options['where'] = $data; $item = $this->rouji_group_model->getOne($options); if (!empty($item)) { ajax_return("添加失败,组名称已经存在", 1); die; } $result = $this->model->add($data); } //信息返回操作 if ($result) { ajax_return(lang('save_success'), 0, '', base_url('bp/channelManage/groups')); } else { ajax_return(lang('save_failed'), 1); } die; }
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 = '******' 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); } }
public function use_youhui() { require_once APP_ROOT_PATH . "system/model/biz_verify.php"; $s_account_info = $GLOBALS['account_info']; $sn = strim($_REQUEST['youhui_sn']); $location_id = intval($_REQUEST['location_id']); ajax_return(biz_use_youhui($s_account_info, $sn, $location_id)); }
public function do_reply_dp() { $s_account_info = $GLOBALS['account_info']; $account_id = intval($s_account_info['id']); $dp_id = intval($_REQUEST['dp_id']); $reply_content = strim($_REQUEST['reply_content']); require_once APP_ROOT_PATH . 'system/model/review.php'; ajax_return(biz_do_reply_dp($account_id, $dp_id, $reply_content)); }
public function biz_register() { global_run(); $msg = $this->upload("biz_register", true); $msg['origin_img'] = $msg['url']; $msg['url'] = get_spec_image($msg['url'], 88, 75, 1); $msg['url_path'] = $msg['url']; ajax_return($msg); }
public function clean_cache() { $this->load->helper('file'); $path = config_item('cache_path'); $path = $path == '' ? APPPATH . 'cache/' : $path; delete_files($path); $this->cache->clean(); ajax_return('清理成功', 0); }
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); } }
/** * 注册信息保存 * @author Jason */ public function saveData() { $clubData = I(); $Club = D('Club'); $rSave = $Club->SaveData($clubData); if ($rSave) { ajax_return('资料提交成功,我们会在三个工作日内审核您的资料~', C('Ok'), 'Ok'); } else { ajax_return('资料提交失败!', C('Error'), 'Error'); } }
public function submit() { $m_name = addslashes(htmlspecialchars(trim($_REQUEST['m_name']))); $a_name = addslashes(htmlspecialchars(trim($_REQUEST['a_name']))); $id = intval($_REQUEST['id']); $change = intval($_REQUEST['op_change']); $reason = addslashes(htmlspecialchars(trim($_REQUEST['reason']))); $func = "op_" . $m_name . "_" . $a_name; $res = $this->{$func}($id, $change, $reason); ajax_return($res); }
public function submit() { global_run(); $m_name = strim($_REQUEST['m_name']); $a_name = strim($_REQUEST['a_name']); $id = intval($_REQUEST['id']); $change = intval($_REQUEST['op_change']); $reason = strim($_REQUEST['reason']); $func = "op_" . $m_name . "_" . $a_name; $res = $this->{$func}($id, $change, $reason); ajax_return($res); }
/** * 简历申请信息核对 * * @param $postData array 需要核对的信息 */ function checkInfo($postData) { foreach ($postData as $key => $value) { switch ($key) { case 'college': if ($postData[$key] == '') { ajax_return('请输入学院', C('ConllegeError'), 'ConllegeError'); } break; case 'class': if ($postData[$key] == '') { ajax_return('请输入班级', C('ClassError'), 'ClassError'); } break; case 'telephone': if ($postData[$key] == '') { ajax_return('请输入手机号', C('PhoneError'), 'PhoneError'); } if (!preg_match("/1[34578]{1}\\d{9}\$/", $postData[$key])) { ajax_return('请输入正确的手机号码', C('PhoneError'), 'PhoneError'); } break; case 'email': if ($postData[$key] == '') { ajax_return('请输入邮箱', C('EmailError'), 'EmailError'); } if (!preg_match("/^([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)\$/i", $postData[$key])) { ajax_return('请输入正确的邮箱地址', C('EmailError'), 'EmailError'); } break; case 'qq': if ($postData[$key] == '') { ajax_return('请输入QQ', C('QQError'), 'QQError'); } if (!preg_match('/^[1-9][0-9]{4,10}$/', $postData[$key])) { ajax_return('请输入正确的qq号码', C('QQError'), 'QQError'); } break; case 'hobby': if ($postData[$key] == '') { ajax_return('请输入爱好', C('HobbyError'), 'HobbyError'); } break; case 'reason': if ($postData[$key] == '') { ajax_return('请输入加入理由', C('ReasonError'), 'ReasonError'); } break; default: break; } } }
public function ajaxTopic() { $start = $_REQUEST['s']; $len = 3; $topic_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "zhuanti where state=1 order by sort desc limit " . $start . "," . $len); if (empty($topic_list)) { $result = array("status" => 0, "msg" => "没有了"); } else { $result = array("status" => 1, "msg" => $topic_list); } ajax_return(json_encode($result)); }
public function postSelectAdminName(Request $request) { $admin_name = trim($request->get('user_name')); $admin_pass = trim($request->get('user_pass')); if (!$admin_name || !$admin_pass) { echo json_encode(array('result' => 'NO_NAME_OR_PASS')); exit; } else { $is = ajax_return(); echo $is; } }
/** * 申请加入数据处理 */ public function applyJoin() { $postData = I(); $apply_club = D('ApplyClub'); //数据验证 $apply_club->checkInfo($postData); $r = $apply_data_insert($postData); if ($r) { ajax_return('资料已经提交啦,敬候佳音吧~', C('Ok'), 'Ok'); } else { ajax_return('资料未能提交成功', C('Error'), 'Error'); } }
public function do_delete_quota() { $result['status'] = 0; $quota_id = intval($_REQUEST['quota_id']); $GLOBALS['db']->query("delete from " . DB_PREFIX . "deal_quota_submit where id = " . $quota_id . " and status=0 "); if ($GLOBALS['db']->affected_rows()) { $result['status'] = 1; $error_msg = "删除成功"; } else { $error_msg = "删除失败"; } $result['info'] = $error_msg; ajax_return($result); }
public function fetch_icon() { $file = APP_ROOT_PATH . "public/iconfont/iconfont.css"; $cnt = file_get_contents($file); preg_match_all("/content[^\\da-zA-Z]+([\\da-zA-Z]+)/", $cnt, $matches); if ($matches) { $html = ""; foreach ($matches[1] as $v) { $code = "&#x" . $v . ";"; $html .= "<a href='javascript:void(0);' class='diyfont pickfont' rel=" . $code . ">" . $code . "</a>"; } } $html .= "<a href='javascript:void(0);' class='diyfont pickfont' rel=''>清除</a>"; $data['html'] = $html; ajax_return($data); }
public function get_medal() { $id = intval($_REQUEST['id']); $medal = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "medal where id = " . $id); $file = APP_ROOT_PATH . "system/medal/" . $medal['class_name'] . "_medal.php"; $cls = $medal['class_name'] . "_medal"; $result['status'] = 0; $result['info'] = "勋章不存在"; if (file_exists($file)) { require_once $file; if (class_exists($cls)) { $o = new $cls(); $result = $o->get_medal(); } } ajax_return($result); }
public function index() { if (!$GLOBALS['user_info']) { //$data['html'] = $GLOBALS['tmpl']->display("inc/user_login_box.html","",true); $data['status'] = 2; } else { $id = intval($_REQUEST['id']); $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $id . " and is_delete = 0 and is_effect = 1 and user_id = " . intval($GLOBALS['user_info']['id'])); if (!$deal_info) { showErr("不能更新该项目的动态", 1); } else { $GLOBALS['tmpl']->assign("deal_info", $deal_info); //$data['html'] = $GLOBALS['tmpl']->fetch("inc/add_update.html"); $data['status'] = 1; } } ajax_return($data); }
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_id = intval($_REQUEST['id']); $comment_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_comment where id = " . $comment_id . " and user_id = " . intval($GLOBALS['user_info']['id'])); if ($comment_item) { $GLOBALS['db']->query("delete from " . DB_PREFIX . "deal_comment where id = " . $comment_id . " and user_id = " . intval($GLOBALS['user_info']['id'])); if ($comment_item['log_id'] == 0) { $GLOBALS['db']->query("update " . DB_PREFIX . "deal set comment_count = comment_count - 1 where id = " . $comment_item['deal_id']); } if ($ajax == 1) { if ($GLOBALS['db']->affected_rows() > 0) { $data['status'] = 1; $data['logid'] = $comment_item['log_id']; $data['counthtml'] = "评论(" . $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_comment where log_id = " . $comment_item['log_id']) . ")"; ajax_return($data); } else { $root['info'] = "删除失败"; output($root); } } else { $root['info'] = "记录删除成功"; output($root); //showSuccess("记录删除成功"); } } else { $root['info'] = "您无权删除该记录"; output($root); } } else { $root['user_login_status'] = 0; output($root); } }
public function remove_msg() { global_run(); if (check_save_login() != LOGIN_STATUS_LOGINED) { $data['status'] = 1000; ajax_return($data); } else { $id = intval($_REQUEST['id']); $GLOBALS['db']->query("update " . DB_PREFIX . "msg_box set is_delete = 1 where id = " . $id . " and user_id = " . $GLOBALS['user_info']['id']); if ($GLOBALS['db']->affected_rows()) { $data['status'] = 1; ajax_return($data); } else { $data['status'] = 0; $data['info'] = "删除失败"; ajax_return($data); } } }
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); }
public function handle() { header("Content-type: text/html; charset=utf-8"); $email = I('email'); $password = md5(I('password')); //接受数据验证 if ($email == "") { ajax_return('邮箱不能为空', C('EmailError'), 'EmailError'); } if ($password == "") { ajax_return('密码不能为空', C('PasswdError'), 'PasswdError'); } $rUser = M('student')->where("email='{$email}'")->find(); if ($rUser && $rUser['password'] == $password) { session('stu_id', $rUser['id']); session('username', $rUser['name']); ajax_return('登陆成功', C('Ok'), 'Ok'); } else { ajax_return('用户不存在', C('NoUser'), 'NoUser'); } }
function check_bp($bpid = null, $bpoid = null, $url = '') { $_ci =& get_instance(); $msg = null; if (empty($bpid)) { $msg = lang('bpid_not_null'); } else { if (!isset($_ci->bp_info)) { $_ci->load->model('bp_info'); } if (!$_ci->bp_info->getOne(array('bpid' => $bpid, 'bpoid' => $bpoid))) { $_ci->lang->load('bp'); $msg = lang('bpid_is_not_valid'); } } if ($msg) { if ($_ci->input->is_ajax_request()) { ajax_return($msg); } $_ci->session->set_flashdata('flash_danger', $msg); redirect($url); } }