当前位置:网站首页>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

边栏推荐
- [untitled]
- 接口比较器
- Vs2017 opens the project and prompts the solution of migration
- 2022软件测试技能 Postman+newman+jenkins 持续集成 实战教程
- Digital intelligence transformation, management first | jnpf strives to build a "full life cycle management" platform
- Pyqt5 rapid development and practice 3.4 signal and slot correlation
- Wechat applet - network data request
- 2 - configuration and use of routes
- Response object - response character data
- JD Sanmian: I want to query a table with tens of millions of data. How can I operate it?
猜你喜欢

How to write unit tests

Oracle创建表分区后,查询的时候不给出partition,但是会给分区字段指定的值,会不会自动按照分区查询?

Win11系统如何一键进行重装?

“青出于蓝胜于蓝”,为何藏宝计划(TPC)是持币生息最后的一朵白莲花

Use verdaccio to build your own NPM private library

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

IDEA 阿里云多模块部署

Execution process of select statement in MySQL

My SQL is OK. Why is it still so slow? MySQL locking rules

Docker install redis? How to configure persistence policy?
随机推荐
Marketing guide | several common micro blog marketing methods
[ctfshow-web]反序列化
How to ensure cache and database consistency
How to balance open utilization and privacy security compliance of public data?
My meeting of OA project (meeting seating & submission for approval)
Pack tricks
Oracle创建表分区后,查询的时候不给出partition,但是会给分区字段指定的值,会不会自动按照分区查询?
The difference between anonymous methods and lambda expressions
"Green is better than blue". Why is TPC the last white lotus to earn interest with money
Alibaba cloud Toolkit - project one click deployment tool
6种方法帮你搞定SimpleDateFormat类不是线程安全的问题
快速学会配置yum的本地源和网络源,并学会yum的使用
Win11怎么自动清理回收站?
Wechat applet - network data request
[Luogu p8063] shortest paths (graph theory)
Tcpdump命令详解
导数、微分、偏导数、全微分、方向导数、梯度的定义与关系
Packet capturing and streaming software and network diagnosis
Win11 auto delete file setting method
Who is safe to open the VIP account of CICC securities?