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

首頁 > 開發 > PHP > 正文

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

2024-05-04 23:02:13
字體:
來源:轉載
供稿:網友
  • 本文來源于網頁設計愛好者web開發社區http://www.html.org.cn收集整理,歡迎訪問。
  •  

    $canshuzoneid=1;

    }else{

    if($canshuzoneid==0) {

    continue;

    }else{

    break;

    }

    }

    }else{

    if($canshuzoneid==0) continue;

    }//
    區域選擇結束





    $id_temp=substr($value,0,$keylength);

    if($id_temp==$actionid){

    //
    開始取參數

    $callback=trim(strrchr($value, " "));

    $value=trim(substr($value,0,strlen($value)-strlen($callback)));



    $limitsite=trim(strrchr($value, " "));

    $value=trim(substr($value,0,strlen($value)-strlen($limitsite)));



    $checkfile=trim(strrchr($value, " "));

    $value=trim(substr($value,0,strlen($value)-strlen($checkfile)));



    $filetype=trim(strrchr($value, " "));

    $value=trim(substr($value,0,strlen($value)-strlen($filetype)));



    $maxlength=trim(strrchr($value, " "));

    $value=trim(substr($value,0,strlen($value)-strlen($maxlength)));



    $user=trim(strrchr($value, " "));

    $value=trim(substr($value,0,strlen($value)-strlen($user)));



    $targetdir=trim(strrchr($value, " "));

    $value=trim(substr($value,0,strlen($value)-strlen($targetdir)));



    return true;

    }else{

    continue;

    }



    }//while
    結束,能運行到這一步說明沒有找到匹配的id

    return false;



    }elseif($actiontype=="del"){



    //
    如果是刪除文件操作

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

    $value=trim($value);

    //
    判斷參數區域,將參數提取限制在 刪除 文件設置區

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

    if($zone_temp=="["){//
    開始一個參數區域

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

    $canshuzoneid=1;

    }else{

    if($canshuzoneid==0) {

    continue;

    }else{

    break;

    }

    }

    }else{

    if($canshuzoneid==0) continue;

    }//
    區域選擇結束





    $id_temp=substr($value,0,$keylength);

    if($id_temp==$actionid){

    //
    開始取參數

    $user=trim(strrchr($value, " "));



    return true;

    }else{

    continue;

    }



    }//while
    結束,能運行到這一步說明沒有找到匹配的id



    return false;

    }else{//
    既不是up,也不是del

    return false;

    };



    return false;

    }

    ##
    取配置文件參數函數結束



    //
    主程序

    $configurefile="config.inc.php";

    $actiontype=trim($actiontype);



    ##
    上傳文件

    if($actiontype=="upload"){

    if(!($actionid && $username && $password && $userfile_name)) {

    echo "<html>
    操作id、用戶名、密碼、上傳文件缺一不可!<a href=javascript:window.history.back()>點這里返回修改</a></html>";

    exit;

    }



    if(!get_config($configurefile,$actionid,$actiontype)){echo "<html>
    不合法的操作id<a href=javascript:window.history.back()>點這里返回修改</a></html>";exit;}



    if($userfile_size>$maxlength*1024){echo "<html>
    上傳的文件超過規定大小的上限。<a href=javascript:window.history.back()>點這里返回修改</a></html>";exit;}



    if(!getuserright($username,$user) && !getfiletype($userfile_name,$filetype)){exit;} //
    可調整



    if($limitsite!="*") if(checkfromsiteerr($http_referer,$limitsite)) exit;



    if($checkfile!="*") {

    $cmd_return_var=passthru($checkfile." ".$userfile_name);//
    命令行參數要求問檢查文件名 + 空格 + 上傳文件名

    //$cmd_return_var=true;//
    程序開發的時候使用,請刪除
    if(!$cmd_return_var){

    echo "<html>
    您上傳的文件沒有通過我們的檢查,請上傳符合要求的文件。<a href=javascript:window.history.back()>點這里返回修改</a></html>";

    exit;

    }

    };//
    調用外部程序檢查,不符合要求的文件返回 false,符合要求返回true;



    if(""==trim($newname)){$newname=$userfile_name;};//
    處理文件名

    $targetfilename=$targetdir."/".$newname;



    if(file_exists($targetfilename)){

    $oldtargetsize=filesize($targetfilename);

    if($userfile_size<=$oldtargetsize ){

    echo "<html>
    您要上傳的目標文件已經存在。上傳動作被取消。<a href=javascript:window.history.back()>點這里返回修改</a></html>";

    exit;

    }

    };



    copy($userfile,$targetfilename) or die;

    chmod($targetfilename,0666);//110110110





    //
    日志信息

    $message=date("y-m-d h:i:s")." remote_ip:".$remote_addr." username:".$username." filename:".$newname."";

    putlog($actionid,$message);



    header("location:".$callback);

    exit;

    };

    ##
    上傳完畢

    ##
    刪除管理

    if($actiontype=="del"){

    if(!($actionid && $username && $password )) {

    echo "<html>
    操作id、用戶名、密碼缺一不可!<a href=javascript:window.history.back()>點這里返回修改</a></html>";

    exit;

    }

       

    if(!get_config($configurefile,$actionid,$actiontype)){echo "<html>
    不合法的操作id<a href=javascript:window.history.back()>點這里返回修改</a></html>";exit;}



    if(!getuserright($username,$user)){exit;}

    發表評論 共有條評論
    用戶名: 密碼:
    驗證碼: 匿名發表
    主站蜘蛛池模板: 建瓯市| 额敏县| 平舆县| 阿勒泰市| 赫章县| 招远市| 山东省| 和政县| 马鞍山市| 阳原县| 通河县| 芮城县| 大渡口区| 绥滨县| 东兰县| 阳谷县| 波密县| 焦作市| 内乡县| 盱眙县| 沂水县| 南阳市| 镇赉县| 祁门县| 清水河县| 毕节市| 徐汇区| 军事| 越西县| 溧阳市| 电白县| 龙井市| 聂拉木县| 治县。| 鄂托克旗| 福清市| 蒙城县| 镇沅| 汉阴县| 弥勒县| 海丰县|