易截截图软件、单文件、免安装、纯绿色、仅160KB

PHP header() examples 完整代码


/*** Function: PHP header() examples (PHP)
**
Desc: Some examples on how to use the header() function of PHPYou find
a detailed tutorial at expertsrt.com (English) or at ffm.junetz.de
(German).These is also a good help about caching at web-caching.com.
**
Example: see below.
<br/><br/><b>Tip:</b>
You can use these sites to check your headers: <a
href="http://web-sniffer.net/">web-sniffer.net</a>,
<a
href="http://www.delorie.com/web/headers.html">delorie.com</a>
or <a
href="http://www.forret.com/projects/analyze/">www.forret.com</a>.
** Author: Jonas John
*/
// fix 404 pages:
header('HTTP/1.1 200 OK');
// set 404 header:
header('HTTP/1.1 404 Not Found');
// set Moved Permanently header (good for redrictions)
// use with location header
header('HTTP/1.1 301 Moved Permanently');
// redirect to a new location:
header('Location: http://www.example.org/');
// redrict with delay:
header('Refresh: 10; url=http://www.example.org/');
print 'You will be redirected in 10 seconds';
// you could also use the HTML syntax:// <meta http-equiv="refresh" content="10;http://www.example.org/ />
// override X-Powered-By: PHP:
header('X-Powered-By: PHP/4.4.0');
header('X-Powered-By: Brain/0.6b');
// content language (en = English)
header('Content-language: en');
// last modified (good for caching)
$time = time() – 60; // or filemtime($fn), etc
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT');
// header for telling the browser that the content
// did not get changed
header('HTTP/1.1 304 Not Modified');
// set content length (good for caching):
header('Content-Length: 1234');
// Headers for an download:
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="example.zip"');


相关文档:

在PHP中全面阻止SQL注入式攻击之二

一、 注入式攻击的类型
  可能存在许多不同类型的攻击动机,但是乍看上去,似乎存在更多的类型。这是非常真实的-如果恶意用户发现了一个能够执行多个查询的办法的话。本文后面,我们会对此作详细讨论。
  如果你的脚本正在执行一个SELECT指令,那么,攻击者可以强迫显示一个表格中的每一行记录-通过把一个例如"1=1"这 ......

PHP程序员最易犯10种错误(转载)


PHP是个伟大的web开发语言,灵活的语言,但是看到php程序员周而复始的犯的一些错误。我做了下面这个列表,列出了PHP程序员经常犯的10中错误,大多数和安全相关。看看你犯了几种:
1.不转意html entities
一个基本的常识:所有不可信任的输入(特别是用户从form中提交的数据) ,输出之前都要转意。
echo $_GET['usenam ......

用PHP构建自定义搜索引擎Sphinx

1. 创建索引
$ sudo /usr/local/bin/indexer --config /usr/local/etc/sphinx.conf --all
Sphinx 0.9.7
Copyright (c) 2001-2007, Andrew Aksyonoff
using config file '/usr/local/etc/sphinx.conf'...
indexing index 'catalog'...
collected 8 docs, 0.0 MB
sorted 0.0 Mhits, 82.8% done
total 8 docs, 149 byt ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号