This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
set_time_limit(0); | |
$host = ""; | |
$user = ""; | |
$pass = ""; | |
$db = ""; | |
$charset = "utf8"; | |
$link = mysql_connect($host, $user, $pass); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function aweek($gdate = "", $first = 0){ | |
if(!$gdate) $gdate = date("Y-m-d"); | |
$w = date("w", strtotime($gdate)); | |
$dn = $w ? $w - $first : 6; | |
$st = date("Y-m-d", strtotime("$gdate -".$dn." days")); | |
$en = date("Y-m-d", strtotime("$st +6 days")); | |
return array($st, $en); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//获得当前的脚本网址 | |
function get_php_url(){ | |
if(!empty($_SERVER["REQUEST_URI"])){ | |
$scriptName = $_SERVER["REQUEST_URI"]; | |
$nowurl = $scriptName; | |
}else{ | |
$scriptName = $_SERVER["PHP_SELF"]; | |
if(empty($_SERVER["QUERY_STRING"])) $nowurl = $scriptName; | |
else $nowurl = $scriptName."?".$_SERVER["QUERY_STRING"]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//格式化数据(防止注入) | |
function site_addslashes($string, $force = 0) { | |
!defined('MAGIC_QUOTES_GPC') && define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc()); | |
if(!MAGIC_QUOTES_GPC || $force) { | |
if(is_array($string)) { | |
foreach($string as $key => $val) { | |
$string[$key] = daddslashes($val, $force); | |
} | |
} else { | |
$string = addslashes($string); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 获得用户的真实IP地址 | |
* | |
* @access public | |
* @return string | |
*/ | |
function real_ip() | |
{ | |
static $realip = NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isCrawler() { | |
if(ini_get('browscap')) { | |
$browser= get_browser(NULL, true); | |
if($browser['crawler']) { | |
return true; | |
} | |
} else if (isset($_SERVER['HTTP_USER_AGENT'])){ | |
$agent= $_SERVER['HTTP_USER_AGENT']; | |
$crawlers= array( | |
"/Googlebot/", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function make_crand_chinese($length="5") { | |
$string = ''; | |
for($i=0;$i<$length;$i++) { | |
$string .= chr(rand(0xB0,0xF7)).chr(rand(0xA1,0xFE)); | |
} | |
return $string; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @return {[type]} [description] | |
*/ | |
function test() | |
{ | |
} |