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 | |
/** | |
* Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER. | |
* | |
* Also forces $_REQUEST to be $_GET + $_POST. If $_SERVER, $_COOKIE, | |
* or $_ENV are needed, use those superglobals directly. | |
* | |
* @access private | |
* @since 3.0.0 | |
*/ |
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 | |
function html_escape($var) | |
{ | |
if (is_array($var)) | |
{ | |
return array_map('html_escape', $var); | |
} | |
else | |
{ | |
return htmlspecialchars($var, ENT_QUOTES); |
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 | |
if(!function_exists('hex2bin')) { | |
/** | |
* 16进制串转字符串 | |
* @param {string} $h 16进制串 | |
* @return {string} 对应字符串,参数有误返回NULL | |
*/ | |
function hex2bin($h){ | |
if (!is_string($h)) return null; | |
$r=''; |
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 | |
function a_week_ago(){ | |
$today = getdate(); | |
$start_time = mktime(0,0,0,$today['mon'],$today['mday']-7,$today['year']); | |
$end_time = time(); | |
} |
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 | |
$x = function($bar, $foo="9") { | |
echo $foo, $bar, "\n"; | |
}; | |
class MissingArgumentException extends Exception { | |
} | |
function call_user_func_named_array($method, $arr){ |
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 | |
/** | |
*@param $domain string IP address or URL | |
*/ | |
function pingDomain($domain){ | |
$data = parse_url($domain); | |
if (isset($data['host'])) { | |
$domain = $data['host']; | |
}else{ | |
$domain = $data['path']; |
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 | |
/** | |
* 判断URL是否存在/可访问 | |
* @param string $url url | |
* @return bool 存在返回true。不存在返回false | |
*/ | |
function url_exist($url){ | |
$curl = curl_init(); | |
curl_setopt($curl, CURLOPT_URL, $url); |
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 | |
/** | |
* 不用内置函数自己实现十进制转二进制 | |
* @param integer $num 十进制数 | |
* @return string 二进制字符串 | |
*/ | |
function my_dec2bin($num){ | |
if(!is_integer($num)){ | |
return ''; | |
} |
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
Private Sub Command1_Click() | |
Dim strSoapAction As String | |
Dim strUrl As String | |
Dim strxml As String | |
Dim returnMsg As String | |
strUrl = "http://xxx.com/xxx" | |
strSoapAction = "http://yyy.com/zzz" | |
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 | |
ignore_user_abort(true); | |
set_time_limit(0); // disable the time limit for this script | |
$path = "/absolute_path_to_your_files/"; // change the path to fit your websites document structure | |
$dl_file = preg_replace("([^\w\s\d\-_~,;:\[\]\(\].]|[\.]{2,})", '', $_GET['download_file']); // simple file name validation | |
$dl_file = filter_var($dl_file, FILTER_SANITIZE_URL); // Remove (more) invalid characters | |
$fullPath = $path.$dl_file; | |
OlderNewer