$canshuZoneId = 1;
}else{
if ($canshuZoneId ==0) {
Continue
}else{
Break
}
}
}else{
if ($canshuZoneId ==0) continue;
}//Zone Selection End
$id _temp=substr ($value, 0, $keylength);
if ($id _temp== $actionID) {
Start taking parameters
$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 end, can run to this step shows that no matching IDs were found
return false;
}elseif ($actionType = = "Del") {
If you are deleting a file operation
while (the list ($key, $value) = each ($fileArray)) {
$value =trim ($value);
To determine the parameter range, restrict parameter extraction to the delete file Settings area
$Zone _temp=substr ($value, 0, 1);
if ($Zone _temp== "[") {//start a parameter area
if (Strstr ($value, "Del")) {
$canshuZoneId = 1;
}else{
if ($canshuZoneId ==0) {
Continue
}else{
Break
}
}
}else{
if ($canshuZoneId ==0) continue;
}//Zone Selection End
$id _temp=substr ($value, 0, $keylength);
if ($id _temp== $actionID) {
Start taking parameters
$user =trim (STRRCHR ($value, ""));
return true;
}else{
Continue
}
}//while end, can run to this step shows that no matching IDs were found
return false;
}else{//is neither up nor Del
return false;
};
return false;
}
# #取配置文件参数函数结束
Main program
$configureFile = "config.inc.php";
$actiontype =trim ($actiontype);
# #上传文件
if ($actiontype = = "Upload") {
if (!) ( $actionid && $username && $password && $userfile _name)) {
echo "
Exit
}
if (!get_config ($configureFile, $actionid, $actiontype)) {echo
if ($userfile _size> $maxLength *1024) {echo
if (!getuserright ($username, $user) &&!getfiletype ($userfile _name, $fileType)) {exit;}//Adjustable
if ($limitSite!= "*") if (Checkfromsiteerr ($HTTP _referer, $limitSite) exit;
if ($checkFile!= "*") {
$cmd _return_var=passthru ($checkFile.) ". $userfile _name);//Command line parameters ask to check file name + space + upload filename
$cmd _return_var=true;//program to be used when developing, please delete
if (! $cmd _return_var) {
echo "
Exit
}
};//calls the external program check, does not meet the requirements of the file return False, meet the requirements return true;
if ("" ==trim ($newname)) {$newname = $userfile _name;};/ /process file name
$targetFileName = $targetDir. " /". $newname;
if (file_exists ($targetFileName)) {
$oldTargetSize =filesize ($targetFileName);
if ($userfile _size<= $oldTargetSize) {
echo
Exit
}
};
Copy ($userfile, $targetFileName) or die;
chmod ($targetFileName, 0666);//110110110
Log information
$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 "
Exit
}
if (!get_config ($configureFile, $actionid, $actiontype)) {echo
if (!getuserright ($username, $user)) {exit;}