国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

功能控制完備的PHP上載程序(1)

2024-05-04 23:02:13
字體:
來源:轉載
供稿:網友

 

主控程序 upfile.php

<?

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

#project name: test

#author : lanf

#home page: http://lanf.yeah.net

#e-mail:[email protected]

#time: 2001 . 9

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



##
驗證身份函數

function getuserright($username,$user){

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

echo "<html>
您沒有這個操作id的權限。<a href=javascript:window.history.back()>點這里返回修改</a></html>";

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 "<html>
這個操作id不允許上傳此種類型文件。<a href=javascript:window.history.back()>點這里返回修改</a></html>";

return false;};

};

if(strstr($filetype,$fileextent )' '$filetype="*") return true;

echo "<html>
這個操作id不允許上傳此種類型文件。<a href=javascript:window.history.back()>點這里返回修改</a></html>";

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:$referip<br>";

//}

//
到這里,$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 "<html>
錯誤的上傳站點#16。<a href=javascript:window.close()>點這里關閉窗口</a></html>";

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 "<html>
錯誤的上傳站點。<a href=javascript:window.close()>點這里關閉窗口</a></html>";

return true;

};

}else{

//
不帶*號的ip

if($limit==$referip){

return false;

}else{

echo "<html>
錯誤的上傳站點。<a href=javascript:window.close()>點這里關閉窗口</a></html>";

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")){



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 上蔡县| 泊头市| 大余县| 连城县| 清水河县| 岱山县| 隆安县| 茂名市| 龙泉市| 思茅市| 阳朔县| 旬阳县| 宜春市| 阳东县| 沽源县| 肇州县| 保山市| 深泽县| 巢湖市| 荥阳市| 南召县| 通海县| 潍坊市| 张家港市| 嘉荫县| 道孚县| 宜都市| 阿城市| 图木舒克市| 色达县| 紫云| 华容县| 民和| 津南区| 阳朔县| 兴山县| 新巴尔虎左旗| 南平市| 屯留县| 金山区| 黄山市|