php用户密码修改代码
php用户密码修改代码
php实现编码的转换
php实现编码的转换,这里会把gb2312转换成utf-8
新闻小偷代码,php小偷程序
php 实现文章上一页与下一页 代码
php 实现文章上一页与下一页 代码,这是我要写一个小作品时用到了,今天把它拿出来各各位分享一下下,记得以前我总想法不明白怎么实现文章上下一页的做法,后来在一个BBS看到了原来是判断当前ID然后order by 或asc就可以简单的实现了.
php生成xml 类
php生成中文验证码程序
php生成静态[html]页面代码
dedecms采集去除a标签代码
DedeCMS采集规则-过滤-替换-技巧2009-01-14 15:491.采集去除链接
[Copy to clipboard]CODE:
{dede:trim}]*)>([^<]*){/dede:trim}
--------------------------------
php 字符截取与图片过滤函数
本文章免费为各位朋友提供一款哦,如果你喜欢的话不防进来看看这款图片过滤正则表达试
function msubstr($str, $start, $len) {
$tmpstr = "";
$strlen = $start + $len;
for($i = 0; $i < $strlen; $i++) {
if(ord(substr($str, $i, 1)) > 0xa0) {
$tmpstr .= substr($str, $i, 2);
$i++;
} else
$tmpstr .= substr($str, $i, 1);
}
return $tmpstr;
}
//过滤图片
function img_empty($content){
$content=eregi_replace("<IMG ([a-zA-Z0-9~!& ?:"/._#=~&%]+)>","",$content);
return $content;
}
php 域名处理函数
下面这款个一个是判断输入的域名是不是合法的,然后再把http,https,ftp进行处理,分析再发送
function _scan_url()
{
$req = $this->_url;
$pos = strpos($req, '://');
$this->_protocol = strtolower(substr($req, 0, $pos));
$req = substr($req, $pos+3);
$pos = strpos($req, '/');
if($pos === false)
$pos = strlen($req);
$host = substr($req, 0, $pos);
if(strpos($host, ':') !== false)
{
list($this->_host, $this->_port) = explode(':', $host);
}
else
{
$this->_host = $host;
$this->_port = ($this->_protocol == 'https') ? 443 : 80;
}
$this->_uri = substr($req, $pos);
if($this->_uri == '')
$this->_uri = '/';
}
php 读取远程网站内容[反盗连]
这是一款利用php fsockopen来读取远程服务器的内容哦,下面这段程序的做法就是可以反盗连呢,好了下面来看看吧。
function DownloadToString()
{
$crlf = "rn";
$response="";
// generate request
$req = 'GET ' . $this->_uri . ' HTTP/1.0' . $crlf
. 'Host: ' . $this->_host . $crlf
. $crlf;
// fetch
$this->_fp = @fsockopen(($this->_protocol == 'https' ? 'ssl://' : '') . $this->_host, $this->_port);
@fwrite($this->_fp, $req);
while(is_resource($this->_fp) && $this->_fp && !feof($this->_fp))
$response .= fread($this->_fp, 1024);
@fclose($this->_fp);
// split header and body
$pos = strpos($response, $crlf . $crlf);
if($pos === false)
return($response);
$header = substr($response, 0, $pos);
$body = substr($response, $pos + 2 * strlen($crlf));
// parse headers
$headers = array();
$lines = explode($crlf, $header);
foreach($lines as $line)
if(($pos = strpos($line, ':')) !== false)
$headers[strtolower(trim(substr($line, 0, $pos)))] = trim(substr($line, $pos+1));
// redirection?
if(isset($headers['location']))
{
$http = new HTTPRequest($headers['location']);
return($http->DownloadToString($http));
}
else
{
return($body);
}
}
}