搜索
首页php教程php手册功能控制完备的PHP上载程序(1)

 

主控程序 upfile.php



####################################################################

#Project Name: Test

#Author : lanf

#Home Page: http://lanf.yeah.net

#E-mail:imbusy@263.net

#Time: 2001 . 9

####################################################################



##
验证身份函数

function getUserRight($username,$user){

if($username==$user' '$user=="*") return true;

echo "
您没有这个操作ID的权限。href=javascript:window.history.back()>点这里返回修改";

return false;

}

##
验证身份函数结束



##
文件类型验证函数

function getFileType($filename,$fileType){

$fileExtent=strrchr($filename, ".");$fileExtent=substr($fileExtent,1);

$fileExtent=strtolower($fileExtent);$fileType=strtolower($fileType);

if(strstr($fileType,"jpg")|| strstr($fileType,"gif")' 'strstr($fileType,"png") ){

if(!GetImageSize($imgfile)) {

echo "
这个操作ID不允许上传此种类型文件。href=javascript:window.history.back()>点这里返回修改";

return false;};

};

if(strstr($fileType,$fileExtent )' '$fileType="*") return true;

echo "
这个操作ID不允许上传此种类型文件。href=javascript:window.history.back()>点这里返回修改";

return false;

}

##
文件类型验证函数结束



##
上传站点验证函数

function checkFromSiteErr($siteFrom,$limitSite){

//
取得站点域名的ip地址;http://202.108.240.75 www.yyy.com

//echo $siteFrom;

$step1=substr($siteFrom,7);//echo "br
>$step1";

$step2=strpos($step1, "/");//echo "br>$step2";

$step3=substr($step1,0,$step2);//echo "br>$step3";

//if(eregi("^[0-9]+.[0-9]+.[0-9]+.[0-9]+$",$step3)){;}else{

$referIP=gethostbyname($step3);//echo "br>ip:$referIPbr>";

//}

//到这里,$referIP已经是一个上一个页面的ip地址。



//
匹配相关的内容。

if(strpos($limitSite,",",1)){

//
说明是一组值

$pieces = explode(",",$limitSite);

while(list($key,$value) = each($pieces)){

$limit=gethostbyname($value);

if($starPos=strpos($limit,"*")){

//
*号的IP

$tempLimit=substr($limit,0,$starPos);

$tempFromIP=substr($referIP,0,$starPos);

if($tempLimit==$tempFromIP){

return false;

}else{

continue;

};

}else{

//
不带*号的IP

if($limit==$referIP){

return false;

}else{

continue;

};

};

}

echo "
错误的上传站点#16href=javascript:window.close()>点这里关闭窗口";

return true;

}else{

//
说明只有一个限制

$limit=gethostbyname($limitSite);

if($starPos=strpos($limit,"*")){

//
*号的IP

$tempLimit=substr($limit,0,$starPos);

$tempFromIP=substr($referIP,0,$starPos);

if($tempLimit==$tempFromIP){

return false;

}else{

echo "
错误的上传站点。href=javascript:window.close()>点这里关闭窗口";

return true;

};

}else{

//
不带*号的IP

if($limit==$referIP){

return false;

}else{

echo "
错误的上传站点。href=javascript:window.close()>点这里关闭窗口";

return true;

};

};

}

};

##
上传站点验证函数结束



##
日志记录函数

function putLog($actionID,$message,$flag="a"){

if(!file_exists("./log")){

echo "
当前目录没有建立属性为0777log目录,正在尝试建立……";

if(@mkdir("./log",0777)){echo "
建立成功!!!";}else{echo "失败!权限不足,请手动建立 ./log br> 日志没有被记录……"; return false;}

}

 $logfile="./log/".$actionID.$flag.".log";

 $cmdstr="echo "".$message."" >> ".$logfile;

 if (!file_exists($logfile)) {passthru("touch ".$logfile); chmod($logfile,0777);}

 passthru($cmdstr);

 return true;

};

##
日志记录函数



##
取配置文件参数函数

function get_config($conf,$actionID="",$actionType=""){

//$conf
配置文件名,$actionID 操作ID $actionType 操作类型

global $targetDir,$user,$maxLength,$fileType,$checkFile,$limitSite,$callback;



$actionID=trim($actionID);

if($actionID=="") return false;

$keylength=strlen($actionID);



$fileArray=file($conf);



$canshuZoneId=0;



if($actionType=="upload"){

//
假如是上传文件的话

while (list($key,$value) = each($fileArray)) {

$value=trim($value);

//
判断参数区域,将参数提取限制在上传文件设置区

$Zone_temp=substr($value,0,1);

if($Zone_temp=="["){//
开始一个参数区域

if(strstr($value, "up")){



声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

Atom编辑器mac版下载

Atom编辑器mac版下载

最流行的的开源编辑器

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

适用于 Eclipse 的 SAP NetWeaver 服务器适配器

适用于 Eclipse 的 SAP NetWeaver 服务器适配器

将Eclipse与SAP NetWeaver应用服务器集成。

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

PhpStorm Mac 版本

PhpStorm Mac 版本

最新(2018.2.1 )专业的PHP集成开发工具