PHP 压缩文件夹的类!
<?php
/*
$Id: PHPZip.php
*/
class PHPZip {
var $datasec = array();
var $ctrl_dir = array();
var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00";
var $old_offset = 0;
function Zip($dir, $zipfilename) {
if (@function_exists('gzcompress')) {
@set_time_limit("0");
$this->openFile($dir,$dir);
$out = $this -> filezip();
$fp = fopen($zipfilename, "w");
fwrite($fp, $out, strlen($out));
fclose($fp);
}
}
function openFile($path, $zipName) {
$temp_path = $path;
$temp_zip_path = $zipName;
$zipDir = $zipName;
if ($handle = @opendir($path)) {
while (false !== ($file = readdir($handle))) {
if($file !='.' and $file !='..'){
if(ereg('\.' , $file.@basename())) {
$fd = fopen($path.'/'.$file, "r");
$fileValue = @fread ($fd, 1024000);
fclose ($fd);
$this -> addFile($fileValue, $zipName . '/' . $file);
} else {
$this ->openFile($path.'/'.$file, $zipName . '/' . $file);
}
&nbs
相关文档:
用PHP过滤提交表单的html代码里可能有被利用引入外部危险内容的代码。例如,有些时候用户提交表单中含有html内容,但这可能造成显示页面布局混乱,需要过滤掉。
以下是程序代码:
复制代码
function uhtml($str)
{
$farr = array(
......
可用于php的计数器和表单的提交,防止反复刷新。
复制代码
<?php
session_start();
$allow_sep = "30000";
if (isset($_SESSION["post_sep"]))
{
if (time() - $_SESSION["post_sep"] < $allow_sep)
{
exit("请不要反复刷新");
}
else
{
$_SESSION["post_sep"] = time();
}
}
e ......
asp,asp.net,php,jsp下的301转向代码
使用.htaccess文件来进行301重定向。
如果空间不支持.htaccess文件,那么我们还可以通过php/asp代码来进行301重定向。
为了将搜索引擎的记录更新到现在的域名上面,做了几个301重定向的东东,给大家分享一下.
asp 301转向代码
在 index.asp 或 default.asp 的最顶部加入以 ......
(1)、yum安装mysql
//yum安装
yum -y install mysql mysql_server
//在服务清单中添加mysql服务
chkconfig --add mysqld
//服务启动
service mysqld start
//初始化mysql数据库
/usr/bin/mysql_secure_installation
(2)、安装apache
yum -y install httpd
service httpd start
添加iptables允许访 ......
global定义一个全局变量,这个全局变量不是应用整个网站,而是应用与当前页面(包括require和include文件)文件。
$aa="test";
function test()
{
global $aa;
echo $aa;
}
test(); //print test
函数内定义的变量函数外可以调用,在函数外定义的的变量函数内不能使用。
gl ......