I hereby claim:
- I am acheng93 on github.
- I am 93jc (https://keybase.io/93jc) on keybase.
- I have a public key ASDvAC2QO5kABTe4RWFde3iC95vFltaN386dBaqBUbJgeQo
To claim this, I am signing this object:
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
div{ | |
padding: 6px 16px; | |
border: 1px solid #446d88; | |
background: #58a linear-gradient(#77a0bb, #58a); border-radius: 4px; | |
box-shadow: 0 1px 5px gray; | |
color: white; | |
text-shadow: 0 -1px 1px #335166; |
I hereby claim:
To claim this, I am signing this object:
<?php | |
function RemoveXSS($val) { | |
// remove all non-printable characters. CR(0a) and LF(0b) and TAB(9) are allowed | |
// this prevents some character re-spacing such as <java\0script> | |
// note that you have to handle splits with \n, \r, and \t later since they *are* allowed in some inputs | |
$val = preg_replace('/([\x00-\x08,\x0b-\x0c,\x0e-\x19])/', '', $val); | |
// straight replacements, the user should never need these since they're normal characters | |
// this prevents like <IMG SRC=@avascript:alert('XSS')> | |
$search = 'abcdefghijklmnopqrstuvwxyz'; |
<?php | |
date_default_timezone_set('PRC'); | |
/** | |
* [时间戳转换成“刚刚”,“5分钟前”,“3小时前”等] | |
* @param [string] $time [时间戳] | |
* @return [string] | |
*/ | |
function transfer_time($time) |
<?php | |
/** | |
* 思路:先CURL获取图片到缓冲区,然后正则获取图片的Content-Length信息 | |
* [获取远程图片大小] | |
* @param [string] $uri [远程图片地址] | |
* @param string $user [网页授权用户名] | |
* @param string $pw [网页授权密码] | |
* @return [string] | |
*/ | |
function remote_filesize($uri,$user='',$pw='') |
<?php | |
$array1 = array( | |
0=>array('id'=>8,'name'=>'Apple','age'=> 18), | |
1=>array('id'=>8,'name'=>'Bed','age'=>17), | |
2=>array('id'=>5,'name'=>'Cos','age'=>16), | |
3=>array('id'=>5,'name'=>'Cos','age'=>14) | |
); | |
function sortArrByManyField(){ | |
$args = func_get_args(); | |
if(empty($args)){ |
<?php | |
function GetIP(){ | |
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")) |
<?php | |
//方法一、使用linux命令 | |
file = 'access.log'; | |
$file = escapeshellarg($file); // 对命令行参数进行安全转义 | |
$line = `tail -n 1 $file`; | |
echo $line; | |
//方法二、使用php的fseek | |
//第一种:首先通过fseek找到文件的最后一位EOF,然后找最后一行的起始位置,取这一行的数据,再找次一行的起始位置,再取这一行的位置,依次类推,直到找到了$num行。 | |
function tail($fp,$n,$base=5) |
<?php | |
//方法一 | |
$password_length = 8; | |
function make_seed() { | |
list($usec, $sec) = explode(' ', microtime()); | |
return (float) $sec + ((float) $usec * 100000); | |
} | |
srand(make_seed()); |
<?php | |
session_start(); | |
Header("Content-type: image/gif"); | |
class SecurityCode | |
{ | |
private $codes = ''; | |
function __construct() | |
{ |