<?php
// +----------------------------------------------------------------------
// | Fanwe 方维p2p借贷系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011 http://www.fanwe.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: 云淡风轻(88522820@qq.com)
// +----------------------------------------------------------------------
//前后台加载的函数库
require_once 'system_init.php';
//获取真实路径
function get_real_path()
{
return APP_ROOT_PATH;
}
//获取GMTime
function get_gmtime()
{
return (time() - date('Z'));
}
function to_date($utc_time, $format = 'Y-m-d H:i:s') {
if (empty ( $utc_time )) {
return '';
}
$timezone = intval(app_conf('TIME_ZONE'));
$time = $utc_time + $timezone * 3600;
return date ($format, $time );
}
function to_timespan($str, $format = 'Y-m-d H:i:s')
{
$timezone = intval(app_conf('TIME_ZONE'));
//$timezone = 8;
$time = intval(strtotime($str));
if($time!=0)
$time = $time - $timezone * 3600;
return $time;
}
/**
* 获取指定时间与当前时间的时间间隔
*
* @access public
* @param integer $time
*
* @return string
*/
function getBeforeTimelag($time)
{
if($time == 0)
return "";
static $today_time = NULL,
$before_lang = NULL,
$beforeday_lang = NULL,
$today_lang = NULL,
$yesterday_lang = NULL,
$hours_lang = NULL,
$minutes_lang = NULL,
$months_lang = NULL,
$date_lang = NULL,
$sdate = 86400;
if($today_time === NULL)
{
$today_time = TIME_UTC;
$before_lang = '前';
$beforeday_lang = '前天';
$today_lang = '今天';
$yesterday_lang = '昨天';
$hours_lang = '小时';
$minutes_lang = '分钟';
$months_lang = '月';
$date_lang = '日';
}
$now_day = to_timespan(to_date($today_time,"Y-m-d")); //今天零点时间
$pub_day = to_timespan(to_date($time,"Y-m-d")); //发布期零点时间
$timelag = $now_day - $pub_day;
$year_time = to_date($time,'Y');
$today_year = to_date($today_time,'Y');
if($year_time < $today_year)
return to_date($time,'Y:m:d H:i');
$timelag_str = to_date($time,' H:i');
$day_time = 0;
if($timelag / $sdate >= 1)
{
$day_time = floor($timelag / $sdate);
$timelag = $timelag % $sdate;
}
switch($day_time)
{
case '0':
$timelag_str = $today_lang.$timelag_str;
break;
case '1':
$timelag_str = $yesterday_lang.$timelag_str;
break;
case '2':
$timelag_str = $beforeday_lang.$timelag_str;
break;
default:
$timelag_str = to_date($time,'m'.$months_lang.'d'.$date_lang.' H:i');
break;
}
return $timelag_str;
}
//获取客户端IP
function get_client_ip() {
if (getenv ( "HTTP_CLIENT_IP" ) && strcasecmp ( getenv ( "HTTP_CLIENT_IP" ), "unknown" ))
$ip = getenv ( "HTTP_CLIENT_IP" );
else if (getenv ( "HTTP_X_FORWARDED_FOR" ) && strcasecmp ( getenv ( "HTTP_X_FORWARDED_FOR" ), "unknown" ))
$ip = getenv ( "HTTP_X_FORWARDED_FOR" );
else if (getenv ( "REMOTE_ADDR" ) && strcasecmp ( getenv ( "REMOTE_ADDR" ), "unknown" ))
$ip = getenv ( "REMOTE_ADDR" );
else if (isset ( $_SERVER ['REMOTE_ADDR'] ) && $_SERVER ['REMOTE_ADDR'] && strcasecmp ( $_SERVER ['REMOTE_ADDR'], "unknown" ))
$ip = $_SERVER ['REMOTE_ADDR'];
else
$ip = "unknown";
return ($ip);
}
//过滤注入
function filter_injection(&$request)
{
$pattern = "/(select[\s])|(insert[\s])|(update[\s])|(delete[\s])|(from[\s])|(where[\s])/i";
foreach($request as $k=>$v)
{
if(preg_match($pattern,$k,$match))
{
die("SQL Injection denied!");
}
if(is_array($v))
{
filter_injection($v);
}
else
{
if(preg_match($pattern,$v,$match))
{
die("SQL Injection denied!");
}
}
}
}
//过滤请求
function filter_request(&$request)
{
if(MAGIC_QUOTES_GPC)
{
foreach($request as $k=>$v)
{
if(is_array($v))
{
filter_request($request[$k]);
}
else
{
$request[$k] = stripslashes(trim($v));
}
}
}
}
function adddeepslashes(&$request)
{
foreach($request as $k=>$v)
{
if(is_array($v))
{
adddeepslashes($request[$k]);
}
else
{
$request[$k] = addslashes(trim($v));
}
}
}
//request转码
function convert_req(&$req)
{
foreach($req as $k=>$v)
{
if(is_array($v))
{
convert_req($req[$k]);
}
else
{
if(!is_u8($v))
{
$req[$k] = iconv("gbk","utf-8",$v);
}
}
}
}
function stripdeepslashes(&$request)
{
if(is_array($request))
{
foreach($request as $k=>$v)
{
if(is_array($v))
{
stripdeepslashes($request[$k]);
}
else
{
$request[$k] = stripslashes(trim($v));
}
}
}
else
$request = stripslashes($request);
}
function quotes($content)
{
//if $content is an array
if (is_array($content))
{
foreach ($content as $key=>$value)
{
//$content[$key] = mysql_real_escape_string($value);
$content[$key] = addslashes($value);
}
} else
{
//if $content is not an array
addslashes($content);
//mysql_real_escape_string($content);
}
return $content;
}
function strim($str)
{
return quotes(htmlspecialchars(trim($str)));
}
function btrim($str)
{
return quotes(trim($str));
}
function is_u8($string)
{
return preg_match('%^(?:
[\x09\x0A\x0D\x20-\x7E] # ASCII
| [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
| \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
| \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
| \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
)*$%xs', $string);
}
//清除缓存
function clear_cache()
{
//系统后台缓存
syn_dealing();
clear_dir_file(get_real_path()."public/runtime/admin/Cache/");
clear_dir_file(get_real_path()."public/runtime/admin/Data/_fields/");
clear_dir_file(get_real_path()."public/runtime/admin/Temp/");
clear_dir_file(get_real_path()."public/runtime/admin/Logs/");
@unlink(get_real_path()."public/runtime/admin/~app.php");
@unlink(get_real_path()."public/runtime/admin/~runtime.php");
@unlink(get_real_path()."public/runtime/admin/lang.js");
@unlink(get_real_path()."public/runtime/app/config_cache.php");
//数据缓存
clear_dir_file(get_real_path()."public/runtime/app/data_caches/");
clear_dir_file(get_real_path()."public/runtime/app/db_caches/");
$GLOBALS['cache']->clear();
clear_dir_file(get_real_path()."public/runtime/data/");
//模板页面缓存
clear_dir_file(get_real_path()."public/runtime/app/tpl_caches/");
clear_dir_file(get_real_path()."public/runtime/app/tpl_compiled/");
@unlink(get_real_path()."public/runtime/app/lang.js");
//脚本缓存
clear_dir_file(get_real_path()."public/runtime/statics/");
}
function clear_dir_file($path)
{
if ( $dir = opendir( $path ) )
{
while ( $file = readdir( $dir ) )
{
$check = is_dir( $path. $file );
if ( !$check )
{
@unlink( $path . $file );
}
else
{
if($file!='.'&&$file!='..')
{
clear_dir_file($path.$file."/");
}
}
}
closedir( $dir );
rmdir($path);
return true;
}
}
//同步未过期团购的状态
function syn_de
没有合适的资源?快使用搜索试试~ 我知道了~
方维p2p借贷系统5.1.zip

共3111个文件
gif:777个
php:638个
html:486个


方维p2p借贷5.1源码 完整版无限制
资源推荐
资源详情
资源评论















收起资源包目录





































































































共 3111 条
- 1
- 2
- 3
- 4
- 5
- 6
- 32
资源评论

- 唐僧洗头用飘柔2022-06-23打酱油来的
一花一草一木一世界
- 粉丝: 63
- 资源: 4

上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助

会员权益专享
安全验证
文档复制为VIP权益,开通VIP直接复制
