当前位置:网站首页>Pass-19,20
Pass-19,20
2022-07-26 17:10:00 【m0_ sixty-two million ninety-four thousand eight hundred and fo】
Pass-19
$is_upload = false;
$msg = null;
if (isset($_POST['submit'])) {
if (file_exists(UPLOAD_PATH)) {
$deny_ext = array("php","php5","php4","php3","php2","html","htm","phtml","pht","jsp","jspa","jspx","jsw","jsv","jspf","jtml","asp","aspx","asa","asax","ascx","ashx","asmx","cer","swf","htaccess");
$file_name = $_POST['save_name'];
$file_ext = pathinfo($file_name,PATHINFO_EXTENSION);
if(!in_array($file_ext,$deny_ext)) {
$temp_file = $_FILES['upload_file']['tmp_name'];
$img_path = UPLOAD_PATH . '/' .$file_name;
if (move_uploaded_file($temp_file, $img_path)) {
$is_upload = true;
}else{
$msg = ' Upload error !';
}
}else{
$msg = ' Do not save as this type of file !';
}
} else {
$msg = UPLOAD_PATH . ' Folder does not exist , Please create... By hand !';
}
}Directly in php Back plus /.
php/. It's not equal to php, Bypass inspection
When saving files, the system will /. Delete , The file becomes php preservation 
Pass-20
$is_upload = false;
$msg = null;
if(!empty($_FILES['upload_file'])){
// Check MIME
$allow_type = array('image/jpeg','image/png','image/gif');
if(!in_array($_FILES['upload_file']['type'],$allow_type)){
$msg = " Do not upload this type of file !";
}else{
// check filenames
$file = empty($_POST['save_name']) ? $_FILES['upload_file']['name'] : $_POST['save_name'];
if (!is_array($file)) {
$file = explode('.', strtolower($file));
}
$ext = end($file);
$allow_suffix = array('jpg','png','gif');
if (!in_array($ext, $allow_suffix)) {
$msg = " Do not upload this suffix file !";
}else{
$file_name = reset($file) . '.' . $file[count($file) - 1];
$temp_file = $_FILES['upload_file']['tmp_name'];
$img_path = UPLOAD_PATH . '/' .$file_name;
if (move_uploaded_file($temp_file, $img_path)) {
$msg = " File upload succeeded !";
$is_upload = true;
} else {
$msg = " File upload failed !";
}
}
}
}else{
$msg = " Please select the file to upload !";
}This question is a white list
First, match image/jpeg,image/png,image/gif
Then the suffix should have jpg.png,gif
Follow the idea of the above question , The file name is split into an array

边栏推荐
- 操作系统迁移实战之在openEuler上部署MySQL数据库
- Marketing guide | several common micro blog marketing methods
- [basic course of flight control development 2] crazy shell · open source formation UAV - timer (LED flight information light and indicator light flash)
- Are CRM and ERP the same thing? What's the difference?
- ES:Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes
- Create MySQL function: access denied; you need (at least one of) the SUPER privilege(s) for this operation
- [development tutorial 7] crazy shell · open source Bluetooth heart rate waterproof sports Bracelet - capacitive touch
- “青出于蓝胜于蓝”,为何藏宝计划(TPC)是持币生息最后的一朵白莲花
- [basic course of flight control development 1] crazy shell · open source formation UAV GPIO (LED flight information light and signal light control)
- srec_ Use of common cat parameters
猜你喜欢
![[fluent -- advanced] packaging](/img/aa/bd6ecad52cbe4a34db75f067aa4dfe.png)
[fluent -- advanced] packaging

【飞控开发基础教程3】疯壳·开源编队无人机-串口(基础收发)

Matlab论文插图绘制模板第40期—带偏移扇区的饼图

Alibaba cloud Toolkit - project one click deployment tool

2022软件测试技能 Postman+newman+jenkins 持续集成 实战教程

Use verdaccio to build your own NPM private library

UPC 2022 summer personal training game 07 (part)

TCP 和 UDP 可以使用相同端口吗?

Marxan模型保护区优化与保护空缺甄选技术、InVEST生态系统中的应用

Current limiting comparison: how to choose sentinel vs hystrix?
随机推荐
[ctfshow web] deserialization
【开发教程7】疯壳·开源蓝牙心率防水运动手环-电容触摸
srec_ Use of common cat parameters
Packet capturing and streaming software and network diagnosis
Implementing DDD based on ABP -- aggregation and aggregation root practice
Alibaba side: analysis of ten classic interview questions
37.【重载运算符的类别】
The difference and efficiency comparison of three methods of C # conversion integer
Merge multiple row headers based on apache.poi operation
Matlab论文插图绘制模板第40期—带偏移扇区的饼图
Quickly build a development platform for enterprise applications
Win11系统如何一键进行重装?
Threads and processes
[Development Tutorial 9] crazy shell arm function mobile phone-i2c tutorial
Are CRM and ERP the same thing? What's the difference?
regular expression
How to connect tdengine with idea database tool?
Relationship between standardization, normalization and regularization
About the idea plug-in I wrote that can generate service and mapper with one click (with source code)
Set up typera drawing bed