本文整理汇总了PHP中getReferer函数的典型用法代码示例。如果您正苦于以下问题:PHP getReferer函数的具体用法?PHP getReferer怎么用?PHP getReferer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getReferer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _init_env
private function _init_env()
{
error_reporting(E_ERROR);
define('MAGIC_QUOTES_GPC', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc());
// ' " \ NULL 等字符转义 当magic_quotes_gpc=On的时候,函数get_magic_quotes_gpc()就会返回1
define('GZIP', function_exists('ob_gzhandler'));
// ob 缓存压缩输出
if (function_exists('date_default_timezone_set')) {
@date_default_timezone_set('Etc/GMT-8');
//东八区 北京时间
}
define('TIMESTAMP', time());
if (!defined('BLOG_FUNCTION') && !@(include BLOG_ROOT . '/source/functions.php')) {
exit('functions.php is missing');
}
define('IS_ROBOT', checkrobot());
global $_B;
$_B = array('uid' => 0, 'username' => '', 'groupid' => 0, 'timestamp' => TIMESTAMP, 'clientip' => $this->_get_client_ip(), 'mobile' => '', 'agent' => '', 'admin' => 0);
checkmobile();
$_B['PHP_SELF'] = bhtmlspecialchars($this->_get_script_url());
$_B['basefilename'] = basename($_B['PHP_SELF']);
$sitepath = substr($_B['PHP_SELF'], 0, strrpos($_B['PHP_SELF'], '/'));
$_B['siteurl'] = bhtmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . $sitepath . '/');
getReferer();
$url = parse_url($_B['siteurl']);
$_B['siteroot'] = isset($url['path']) ? $url['path'] : '';
$_B['siteport'] = empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT'];
$this->b =& $_B;
}
示例2: del
function del()
{
global $db;
$m_id = be("get", "m_id");
$db->query("delete from {pre}cj_zhuiju WHERE m_id =" . $m_id);
echo "<script language=\"javascript\">setTimeout(\"makeNextUrl();\",1);function makeNextUrl(){location.href='" . getReferer() . "';}</script>";
}
示例3: chkLogin
function chkLogin()
{
global $db;
$m_id = getCookie("adminid");
$m_id = chkSql($m_id, true);
$m_name = getCookie("adminname");
// writetofile("operate.log", "loginame:{".$m_name ."};action:{".be("all","action")."};referce:{".getReferer()."}.request:{".$_SERVER["REQUEST_URI"]."};parameters GET:{".json_encode($_GET)."}" );
writetofile("operate.log", "loginame:{" . $m_name . "};action:{" . be("all", "action") . "};referce:{" . getReferer() . "}.request:{" . $_SERVER["REQUEST_URI"] . "};parameters POST:{" . json_encode($_POST) . "}");
$m_name = chkSql($m_name, true);
if (!isN($m_name) && !isN($m_id)) {
$row = $db->getRow("SELECT * FROM {pre}manager WHERE m_name='" . $m_name . "' AND m_id= '" . $m_id . "' AND m_status ='1'");
if ($row) {
$loginValidate = md5($row["m_random"] . $row["m_name"] . $row["m_id"]);
if (getCookie("admincheck") != $loginValidate) {
sCookie("admincheck", "");
die("<script>top.location.href='index.php?action=login';</script>");
}
} else {
sCookie("admincheck", "");
die("<script>top.location.href='index.php?action=login';</script>");
}
} else {
die("<script>top.location.href='index.php?action=login';</script>");
}
}
示例4: showTip
protected function showTip($msg, $url = '', $show_type = 'html', $msg_type = 'succ', $is_show = 1, $time = 2000)
{
/**
* 如果默认为空,则跳转至上一步链接
*/
$url = $url != '' ? $url : getReferer();
$msg_type = in_array($msg_type, array('succ', 'error')) ? $msg_type : 'error';
if (is_array($url)) {
foreach ($url as $k => $v) {
$url[$k]['url'] = $v['url'] ? $v['url'] : getReferer();
}
}
/**
* 读取信息布局的语言包
*/
Language::read("msg");
/**
* html输出形式
* 指定为指定项目目录下的error模板文件
*/
Tpl::setDir('');
Tpl::output('html_title', Language::get('nc_html_title'));
Tpl::output('msg', $msg);
Tpl::output('url', $url);
Tpl::output('msg_type', $msg_type);
Tpl::output('is_show', $is_show);
Tpl::showpage('msg', $this->layout, $time);
exit;
}
示例5: editall
function editall()
{
global $db;
$t_id = be("arr", "ids");
$ids = explode(",", $t_id);
foreach ($ids as $id) {
$t_flag = be("post", "t_flag" . $id);
$t_sort = be("post", "disp_order" . $id);
if (isN($t_sort)) {
$t_sort = $db->getOne("SELECT MAX(disp_order) FROM {pre}vod_topic_items") + 1;
}
if (!isNum($t_sort)) {
echo "信息填写不完整!";
exit;
}
$db->Update("{pre}vod_topic_items", array("flag", "disp_order"), array($t_flag, $t_sort), "id=" . $id);
}
updateCacheFile();
$topic_id = getBody(getReferer(), 'topic_id=', '&');
if (isN($topic_id)) {
$topic_id = getBodys(getReferer(), 'topic_id=');
}
if (!isN($topic_id)) {
replaceTopRecommend($topic_id);
}
echo "修改完毕";
}
示例6: del
function del()
{
$fpath = "../template/" . app_templatedir . "/ads/";
$file = be("get", "file");
if (file_exists($fpath . $file)) {
unlink($fpath . $file);
}
redirect(getReferer());
}
示例7: setflag
function setflag()
{
global $db;
$f_id = be("arr", "f_id");
$f_flag = be("get", "f_flag");
$sql = "update {pre}cj_filters set f_flag='" . $f_flag . "' Where f_id in(" . $f_id . ")";
$db->query($sql);
redirect(getReferer());
}
示例8: del
function del()
{
global $db;
$c_id = be("arr", "c_id");
$ids = explode(",", $c_id);
foreach ($ids as $id) {
$db->query("delete from {pre}cj_change where c_id = " . $id);
}
redirect(getReferer());
}
示例9: signin
private function signin($site)
{
cookie('referer', getReferer(), 300);
if (!in_array($site, array('qq', 'sina', 'ren', 'tao'))) {
$this->error('参数错误');
}
include_once APP_PATH . "/Lib/Extend/apilogin/{$site}.class.php";
$platform = new $site();
redirect($platform->getUrl());
}
示例10: indexOp
/**
* 登录操作
*
*/
public function indexOp(){
$lang = Language::getLangContent();
$model_member = Model('member');
//检查登录状态
$model_member->checkloginMember();
$script="document.getElementsByName('codeimage')[0].src='".APP_SITE_URL."/index.php?act=seccode&op=makecode&nchash='+NC_HASH+'&t=' + Math.random();";
$result = chksubmit(true,true,'num');
if ($result !== false){
if ($result === -11){
showDialog(L('login_index_login_illegal'),'','error',$script,2);
}elseif ($result === -12){
showDialog(L('login_index_wrong_checkcode'),'','error',$script,2);
}
if (process::islock('login')) {
showDialog(L('login_index_op_repeat'),APP_SITE_URL);
}
$array = array();
$array['member_name'] = $_POST['user_name'];
$array['member_passwd'] = md5($_POST['password']);
$member_info = $model_member->infoMember($array);
if(is_array($member_info) and !empty($member_info)) {
if(!$member_info['member_state']){
showDialog($lang['login_index_account_stop']);
}
} else {
process::addprocess('login');
showDialog($lang['login_index_login_fail'],'','error',$script,2);
}
$model_member->createSession($member_info);
process::clear('login');
// cookie中的cart存入数据库
Model('cart')->mergecart($member_info,$_SESSION['store_id']);
// cookie中的浏览记录存入数据库
Model('goods_browse')->mergebrowse($_SESSION['member_id'],$_SESSION['store_id']);
//添加会员积分
$model_member->addPoint($member_info);
showDialog(L('login_index_login_success'),'reload','succ','',2);
}
if(empty($_GET['ref_url'])) $_GET['ref_url'] = getReferer();
Tpl::output('html_title',C('site_name').' - '.$lang['login_index_login']);
Tpl::output('nchash',getNchash());
if ($_GET['inajax'] == 1){
Tpl::showpage('login_inajax','null_layout');
}else{
return false;
}
}
示例11: loginOp
public function loginOp()
{
//检测登陆
$this->checklogin();
if (isset($_POST) && !empty($_POST)) {
$obj_validate = new Validate();
$obj_validate->validateparam = array(array("input" => $_POST["member_name"], "require" => "true", "message" => $lang['nc_login_username_is_not_null']), array("input" => $_POST["password"], "require" => "true", "message" => $lang['nc_login_password_is_not_null']));
$error = $obj_validate->validate();
if ($error != '') {
$this->showTip(Language::get('error') . $error, '', 'html', 'error', '', '2000');
}
$params = array();
$params['member_name'] = trim($_POST['member_name']);
$params['password'] = md5($_POST['password']);
$model = Model();
$memberinfo = $model->table('member')->where($params)->find();
if (empty($memberinfo)) {
$this->showTip(Language::get('nc_username_and_password_is_wrong'), '', 'html', 'error', '', '2000');
}
$_SESSION['is_login'] = '1';
$_SESSION['member_id'] = $memberinfo['member_id'];
$_SESSION['member_name'] = $memberinfo['member_name'];
$_SESSION['avatar'] = $memberinfo['avatar'];
$_SESSION['store_id'] = $memberinfo['store_id'];
$_SESSION['member_degree'] = $memberinfo['member_degree'];
$model->table('member')->where(array('member_id' => $memberinfo['member_id']))->update(array('login_time' => time(), 'login_num' => $memberinfo['login_num'] + 1));
//选择城市
$area_id = $memberinfo['usercity'];
$model_area = Model('area');
$area_info = $model_area->getOne(array('area_id' => $area_id));
if (get_magic_quotes_gpc()) {
$area_str = serialize($area_info);
} else {
$area_str = addslashes(serialize($area_info));
}
setcookie('city', $area_str, time() + 3600 * 24 * 30);
$_POST['ref_url'] = strstr($_POST['ref_url'], 'logout') === false && !empty($_POST['ref_url']) ? $_POST['ref_url'] : 'index.php?act=index';
if (!empty($_POST['ref_url'])) {
header('Location: ' . $_POST['ref_url']);
//$this->showTip(Language::get('nc_member_login_succ'),$_POST['ref_url'],'succ');
} else {
$this->showTip(Language::get('nc_member_login_fail'), 'index.php?act=login', 'html', 'error');
}
}
Tpl::output('nchash', substr(md5(BASE_SITE_URL . $_GET['act'] . $_GET['op']), 0, 8));
if (empty($_GET['ref_url'])) {
$_GET['ref_url'] = getReferer();
}
Tpl::output('banner', 1);
Tpl::showpage('login');
}
示例12: loginOp
/**
* 登录操作
*
*/
public function loginOp()
{
//检测登陆
$this->checklogin();
if (isset($_POST) && !empty($_POST)) {
$obj_validate = new Validate();
$obj_validate->validateparam = array(array("input" => $_POST["member_name"], "require" => "true", "message" => $lang['nc_login_username_is_not_null']), array("input" => $_POST["password"], "require" => "true", "message" => $lang['nc_login_password_is_not_null']));
$error = $obj_validate->validate();
if ($error != '') {
$this->showTip(Language::get('error') . $error, '', 'error');
}
$params = array();
$params['member_name'] = trim($_POST['member_name']);
$params['password'] = md5($_POST['password']);
$model = Model();
$memberinfo = $model->table('member')->where($params)->find();
if (empty($memberinfo)) {
$this->showTip(Language::get('login_index_login_again'), '', 'error');
}
$_SESSION['is_login'] = '1';
$_SESSION['member_id'] = $memberinfo['member_id'];
$_SESSION['member_name'] = $memberinfo['member_name'];
$_SESSION['avatar'] = $memberinfo['avatar'];
$_SESSION['store_id'] = $memberinfo['store_id'];
$model->table('member')->where(array('member_id' => $memberinfo['member_id']))->setInc('login_num', 1);
//选择城市
$area_id = $memberinfo['usercity'];
$model_area = Model('area');
$area_info = $model_area->getOne(array('area_id' => $area_id));
if (get_magic_quotes_gpc()) {
$area_str = serialize($area_info);
} else {
$area_str = serialize(@addslashes($area_info));
}
setCookie('city', $area_str);
$_POST['ref_url'] = strstr($_POST['ref_url'], 'logout') === false && !empty($_POST['ref_url']) ? $_POST['ref_url'] : 'index.php?act=index';
if ($_GET['inajax'] == 1) {
showDialog(Language::get('login_index_login_success'), 'reload', succ);
}
if (!empty($_POST['ref_url'])) {
$this->showTip(Language::get('login_index_login_success'), $_POST['ref_url'], 'succ');
} else {
$this->showTip(Language::get('login_index_login_again'), 'index.php?act=login', 'error');
}
}
if (empty($_GET['ref_url'])) {
$_GET['ref_url'] = getReferer();
}
Tpl::output('banner', 1);
Tpl::showpage('login');
}
示例13: moveToNext
function moveToNext()
{
global $db;
$l_id = be("get", "l_id");
$CurSort = $db->getOne("SELECT l_sort FROM {pre}link WHERE l_id = " . $l_id);
$Lessthan = $db->getOne("SELECT COUNT(*) FROM {pre}link WHERE l_sort > " . $CurSort);
if ($Lessthan > 0) {
$l_sort = $db->getOne("select top 1 l_sort FROM {pre}link WHERE l_sort>" . $CurSort . " ORDER BY l_sort DESC");
$db->Update("{pre}link", array("l_sort"), array($l_sort + 1), "l_id=" . $l_id);
} else {
$db->Update("{pre}link", array("l_sort"), array($CurSort + 1), "l_id=" . $l_id);
}
redirect(getReferer());
}
示例14: showmsgbatchOp
/**
* 系统站内信查看操作
*
* @param
* @return
*/
public function showmsgbatchOp()
{
Language::read('member_home_message');
$model_message = Model('message');
$message_id = intval($_GET['message_id']);
$drop_type = trim($_GET['drop_type']);
$referer_url = getReferer();
if (!in_array($drop_type, array('msg_system', 'msg_seller')) || $message_id <= 0) {
showMessage(Language::get('wrong_argument'), $referer_url, 'html', 'error');
}
//查询站内信
$param = array();
$param['message_id'] = "{$message_id}";
$param['to_member_id'] = "{$_SESSION['member_id']}";
$param['no_del_member_id'] = "{$_SESSION['member_id']}";
$message_info = $model_message->getRowMessage($param);
if (empty($message_info)) {
showMessage(Language::get('home_message_no_record'), $referer_url, 'html', 'error');
}
if ($drop_type == 'msg_system') {
$message_info['from_member_name'] = Language::get('home_message_system_message');
}
if ($drop_type == 'msg_seller') {
//查询店铺信息
$model_store = Model('store');
$store_info = $model_store->getStoreInfo(array('member_id' => "{$message_info['from_member_id']}"));
$message_info['from_member_name'] = $store_info['store_name'];
$message_info['store_id'] = $store_info['store_id'];
}
$message_list[0] = $message_info;
Tpl::output('message_list', $message_list);
//站内信列表
//更新为已读信息
$tmp_readid_str = '';
if (!empty($message_info['read_member_id'])) {
$tmp_readid_arr = explode(',', $message_info['read_member_id']);
if (!in_array($_SESSION['member_id'], $tmp_readid_arr)) {
$tmp_readid_arr[] = $_SESSION['member_id'];
}
foreach ($tmp_readid_arr as $readid_k => $readid_v) {
if ($readid_v == '') {
unset($tmp_readid_arr[$readid_k]);
}
}
$tmp_readid_arr = array_unique($tmp_readid_arr);
//去除相同
sort($tmp_readid_arr);
//排序
$tmp_readid_str = "," . implode(',', $tmp_readid_arr) . ",";
} else {
$tmp_readid_str = ",{$_SESSION['member_id']},";
}
$model_message->updateCommonMessage(array('read_member_id' => $tmp_readid_str), array('message_id' => "{$message_id}"));
//更新未读站内信数量cookie值
$cookie_name = 'msgnewnum' . $_SESSION['member_id'];
$countnum = $model_message->countNewMessage($_SESSION['member_id']);
setNcCookie($cookie_name, $countnum, 2 * 3600);
//保存2小时
Tpl::output('message_num', $countnum);
//查询新接收到普通的消息
$newcommon = $this->receivedCommonNewNum();
Tpl::output('newcommon', $newcommon);
//查询新接收到系统的消息
$newsystem = $this->receivedSystemNewNum();
Tpl::output('newsystem', $newsystem);
//查询新接收到卖家的消息
$newpersonal = $this->receivedPersonalNewNum();
Tpl::output('newpersonal', $newpersonal);
Tpl::output('drop_type', $drop_type);
self::profile_menu('message', 'showmsg');
Tpl::output('menu_sign', 'message');
Tpl::output('menu_sign_url', 'index.php?act=home&op=message');
Tpl::output('menu_sign1', 'showmsg');
//查询会员信息
$this->get_member_info();
Tpl::output('header_menu_sign', 'message');
//默认选中顶部“站内信”菜单
Tpl::showpage('message_view');
}
示例15: adv_editOp
/**
*
* 修改广告
*/
public function adv_editOp()
{
if ($_POST['form_submit'] != 'ok') {
$adv = Model('adv');
$condition['adv_id'] = intval($_GET['adv_id']);
$adv_list = $adv->getList($condition);
$ap_info = $adv->getApList();
Tpl::output('ref_url', getReferer());
Tpl::output('adv_list', $adv_list);
Tpl::output('ap_info', $ap_info);
Tpl::showpage('adv.edit');
} else {
$lang = Language::getLangContent();
$adv = Model('adv');
$upload = new UploadFile();
/**
* 验证
*/
$obj_validate = new Validate();
$obj_validate->validateparam = array(array("input" => $_POST["adv_name"], "require" => "true", "message" => $lang['ap_can_not_null']), array("input" => $_POST["adv_start_date"], "require" => "true", "message" => $lang['must_select_start_time']), array("input" => $_POST["adv_end_date"], "require" => "true", "message" => $lang['must_select_end_time']));
$error = $obj_validate->validate();
if ($error != '') {
showMessage($error);
} else {
$param['adv_id'] = intval($_GET['adv_id']);
$param['adv_title'] = trim($_POST['adv_name']);
$param['adv_start_date'] = $this->getunixtime(trim($_POST['adv_start_date']));
$param['adv_end_date'] = $this->getunixtime(trim($_POST['adv_end_date']));
/**
* 建立图片广告信息的入库数组
*/
if ($_POST['mark'] == '0') {
if ($_FILES['adv_pic']['name'] != '') {
$upload->set('default_dir', ATTACH_ADV);
$result = $upload->upfile('adv_pic');
if (!$result) {
showMessage($upload->error, '', '', 'error');
}
$ac = array('adv_pic' => $upload->file_name, 'adv_pic_url' => trim($_POST['adv_pic_url']));
$ac = serialize($ac);
$param['adv_content'] = $ac;
} else {
$ac = array('adv_pic' => trim($_POST['pic_ori']), 'adv_pic_url' => trim($_POST['adv_pic_url']));
$ac = serialize($ac);
$param['adv_content'] = $ac;
}
}
/**
* 建立文字广告信息的入库数组
*/
if ($_POST['mark'] == '1') {
//判断页面编码确定汉字所占字节数
switch (CHARSET) {
case 'UTF-8':
$charrate = 3;
break;
case 'GBK':
$charrate = 2;
break;
}
if (strlen($_POST['adv_word']) > $_POST['adv_word_len'] * $charrate) {
$error = $lang['wordadv_toolong'];
showMessage($error);
die;
}
$ac = array('adv_word' => trim($_POST['adv_word']), 'adv_word_url' => trim($_POST['adv_word_url']));
$ac = serialize($ac);
$param['adv_content'] = $ac;
}
/**
* 建立Flash广告信息的入库数组
*/
if ($_POST['mark'] == '3') {
if ($_FILES['flash_swf']['name'] != '') {
$upload->set('default_dir', ATTACH_ADV);
$result = $upload->upfile('flash_swf');
$ac = array('flash_swf' => $upload->file_name, 'flash_url' => trim($_POST['flash_url']));
$ac = serialize($ac);
$param['adv_content'] = $ac;
} else {
$ac = array('flash_swf' => trim($_POST['flash_ori']), 'flash_url' => trim($_POST['flash_url']));
$ac = serialize($ac);
$param['adv_content'] = $ac;
}
}
$result = $adv->update($param);
if ($result) {
$url = array(array('url' => trim($_POST['ref_url']), 'msg' => $lang['goback_ap_manage']));
$this->log(L('adv_change_succ') . '[' . $_POST["ap_name"] . ']', null);
showMessage($lang['adv_change_succ'], $url);
} else {
showMessage($lang['adv_change_fail'], $url);
}
}
}
}