功能控制完备的PHP上载程序(2)
$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 "操作ID、用户名、密码、上传文件缺一不可!href=javascript:window.history.back()>点这里返回修改";
exit;
}
if(!get_config($configureFile,$actionid,$actiontype)){echo "不合法的操作ID。href=javascript:window.history.back()>点这里返回修改";exit;}
if($userfile_size>$maxLength*1024){echo "上传的文件超过规定大小的上限。href=javascript:window.history.back()>点这里返回修改";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 "您上传的文件没有通过我们的检查,请上传符合要求的文件。href=javascript:window.history.back()>点这里返回修改";
exit;
}
};//调用外部程序检查,不符合要求的文件返回 false,符合要求返回true;
if(""==trim($newname)){$newname=$userfile_name;};//处理文件名
$targetFileName=$targetDir."/".$newname;
if(file_exists($targetFileName)){
$oldTargetSize=filesize($targetFileName);
if($userfile_sizeoldTargetSize ){
echo "您要上传的目标文件已经存在。上传动作被取消。href=javascript:window.history.back()>点这里返回修改";
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 "操作ID、用户名、密码缺一不可!href=javascript:window.history.back()>点这里返回修改";
exit;
}
if(!get_config($configureFile,$actionid,$actiontype)){echo "不合法的操作ID。href=javascript:window.history.back()>点这里返回修改";exit;}
if(!getUserRight($username,$user)){exit;}

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Many users will choose the Huawei brand when choosing smart watches. Among them, Huawei GT3pro and GT4 are very popular choices. Many users are curious about the difference between Huawei GT3pro and GT4. Let’s introduce the two to you. . What are the differences between Huawei GT3pro and GT4? 1. Appearance GT4: 46mm and 41mm, the material is glass mirror + stainless steel body + high-resolution fiber back shell. GT3pro: 46.6mm and 42.9mm, the material is sapphire glass + titanium body/ceramic body + ceramic back shell 2. Healthy GT4: Using the latest Huawei Truseen5.5+ algorithm, the results will be more accurate. GT3pro: Added ECG electrocardiogram and blood vessel and safety

Why Snipping Tool Not Working on Windows 11 Understanding the root cause of the problem can help find the right solution. Here are the top reasons why the Snipping Tool might not be working properly: Focus Assistant is On: This prevents the Snipping Tool from opening. Corrupted application: If the snipping tool crashes on launch, it might be corrupted. Outdated graphics drivers: Incompatible drivers may interfere with the snipping tool. Interference from other applications: Other running applications may conflict with the Snipping Tool. Certificate has expired: An error during the upgrade process may cause this issu simple solution. These are suitable for most users and do not require any special technical knowledge. 1. Update Windows and Microsoft Store apps

Part 1: Initial Troubleshooting Steps Checking Apple’s System Status: Before delving into complex solutions, let’s start with the basics. The problem may not lie with your device; Apple's servers may be down. Visit Apple's System Status page to see if the AppStore is working properly. If there's a problem, all you can do is wait for Apple to fix it. Check your internet connection: Make sure you have a stable internet connection as the "Unable to connect to AppStore" issue can sometimes be attributed to a poor connection. Try switching between Wi-Fi and mobile data or resetting network settings (General > Reset > Reset Network Settings > Settings). Update your iOS version:

In PHP programming, spaces are often encountered when processing strings, including Chinese spaces. In actual development, we often use the trim function to remove spaces at both ends of a string, but the processing of Chinese spaces is relatively complicated. This article will introduce how to use the trim function in PHP to process Chinese spaces and provide specific code examples. First, let us understand the types of Chinese spaces. In Chinese, spaces include not only common English spaces (space), but also some other special spaces.

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

Guide to using the trim() function in PHP The trim() function is very commonly used in PHP and is used to remove spaces or other specified characters at the beginning and end of a string. This article will introduce the use of trim() function in detail and provide specific code examples. 1. Function syntax The syntax of the trim() function is as follows: trim(string$str,string$character_mask=""):string This function accepts two parameters,

Use the strings.Trim function to remove the specified character set at the beginning and end of a string. In the Go language, the strings.Trim function is a very practical function that can remove the specified character set at the beginning and end of a string, making the string more tidy and standardized. This article will introduce how to use the strings.Trim function and show some code examples. First, let’s take a look at the prototype of the strings.Trim function: funcTrim(sstring,cutsetstri

The trim function of the solid-state drive is mainly to optimize the solid-state drive, solve the problem of slowdown and lifespan of the SSD after use, and improve the efficiency of the SSD by preparing data blocks for reuse. The Trim function is a function that almost all SSD solid state drives have. It is an ATA command. When the system confirms that the SSD supports Trim and deletes data, it does not notify the hard disk of the deletion command and only uses the Volume Bitmap to remember that the data here has been deleted. This enables faster data processing.
