Initial commit,修正
This commit is contained in:
+68
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Fm453
|
||||
* @site www.hiluker.com
|
||||
* @remark:服务器类函数集
|
||||
*/
|
||||
defined('HI_FM') or exit("Access Denied");
|
||||
|
||||
//定义授权信息数据库
|
||||
function fmFunc_authDb(){
|
||||
$database = array(
|
||||
'host' => 'www.hiluker.com', //数据库IP或是域名
|
||||
//'host' => '127.0.0.1', //数据库IP或是域名
|
||||
'username' => 'formodules', // 数据库连接用户名
|
||||
'password' => '', // 数据库连接密码
|
||||
'database' => 'fm453_access', // 数据库名
|
||||
'port' => 3306, // 数据库连接端口
|
||||
'tablepre' => '', // 表前缀,如果没有前缀留空即可pre_
|
||||
'charset' => 'utf8', // 数据库默认编码
|
||||
'pconnect' => 0, // 是否使用长连接
|
||||
);
|
||||
return $database;
|
||||
}
|
||||
|
||||
//判断来路域名
|
||||
function fmFunc_server_via_domain() {
|
||||
global $_FM;
|
||||
if(isset($_SERVER["HTTP_REFERER"])) {
|
||||
$url = $_SERVER["HTTP_REFERER"]; //获取完整的来路URL
|
||||
$str = str_replace("http://","",$url); //去掉http://
|
||||
$str = str_replace("https://","",$url); //去掉https://
|
||||
$strdomain = explode("/",$str); // 以“/”分开成数组
|
||||
$domain = $strdomain[0]; //取第一个“/”以前的字符
|
||||
}else{
|
||||
$domain = '';
|
||||
}
|
||||
$_FM['viaDomain'] = $domain;
|
||||
return $domain;
|
||||
}
|
||||
|
||||
//判断来路ip
|
||||
function fmFunc_server_via_ip() {
|
||||
global $_FM;
|
||||
$ip = '';
|
||||
if(!empty($_SERVER["HTTP_CLIENT_IP"])){
|
||||
$ip = $_SERVER["HTTP_CLIENT_IP"];
|
||||
}elseif(!empty($_SERVER["HTTP_X_FORWARDED_FOR"])){
|
||||
$ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
|
||||
}elseif(!empty($_SERVER["REMOTE_ADDR"])){
|
||||
$ip = $_SERVER["REMOTE_ADDR"];
|
||||
}
|
||||
$_FM['viaIp'] = $ip;
|
||||
return $ip;
|
||||
}
|
||||
|
||||
//生成客户侧的用户uid
|
||||
function fmFunc_server_hash_id($id) {
|
||||
global $_FM;
|
||||
require Yii::getAlias('@frontend/controllers/_public/plat.php');
|
||||
$str = '';
|
||||
$str .= '+'.$siteId;
|
||||
$str .= '+'.$platid;
|
||||
$str .= '+'.$uniacid;
|
||||
$str .= '+'.$shopid;
|
||||
$str .= '+'.$id;
|
||||
$id = md5($str);
|
||||
return $id;
|
||||
}
|
||||
Reference in New Issue
Block a user