Skip to content

Commit

Permalink
清理不必要的注释和给Pass-19的save_name参数添加默认值
Browse files Browse the repository at this point in the history
c0ny1 committed Jun 3, 2018
1 parent 67542e4 commit ca3fdc4
Showing 3 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Pass-19/index.php
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@
<p>请选择要上传的图片:<p>
<input class="input_file" type="file" name="upload_file"/>
<p>保存名称:<p>
<input class="input_text" type="text" name="save_name" style="" /><br/>
<input class="input_text" type="text" name="save_name" value="upload-19.jpg" /><br/>
<input class="button" type="submit" name="submit" value="上传"/>
</form>
<div id="msg">
10 changes: 5 additions & 5 deletions css/index.css
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@
#head{
width: 100%;
margin: 0px auto;
/*border: 1px solid #ddd;*/
margin-bottom: 10px;
min-width: 1050px;
}
@@ -71,7 +70,6 @@ p code {
border: 1px #ddd;
width: 100%;
float: left;

border: 1px solid #000;
padding-top: 20px;
padding-bottom: 20px;
@@ -86,7 +84,6 @@ p code {

}


#menu ul{
margin: 0 0 0 0;
padding: 0 0 0 0;
@@ -139,11 +136,14 @@ p code {
}

.input_text{
padding: 5px;
width: 240px;
height:22px;
height: 22px;
line-height: 22px;
border: 0px;
-webkit-border-radius: 5px;
color: #888888;
background: #323232;
border: 0px;
}

.button{
16 changes: 7 additions & 9 deletions rmdir.php
Original file line number Diff line number Diff line change
@@ -3,17 +3,16 @@
//循环删除目录和文件函数
error_reporting(0);
header("Content-Type: text/html;charset=utf-8");
function delDirAndFile($dirName){
function del_dir($dir){
$n_success = 0;
$n_fail = 0;
if($handle = opendir("$dirName")){
if($handle = opendir("$dir")){
while( false !== ($item = readdir($handle))){
if($item != "." && $item != ".."){
if (is_dir("$dirName/$item")) {
delDirAndFile("$dirName/$item");
if (is_dir("$dir/$item")) {
del_dir("$dir/$item");
}else{
if(unlink("$dirName/$item")){
//echo "成功删除文件: $dirName/$item<br />n";
if(unlink("$dir/$item")){
$n_success++;
}else{
$n_fail++;
@@ -22,8 +21,7 @@ function delDirAndFile($dirName){
}
}
closedir( $handle );
if(rmdir($dirName)){
//echo "成功删除目录: $dirName<br />n";
if(rmdir($dir)){
$n_success++;
}else{
$n_fail++;
@@ -33,7 +31,7 @@ function delDirAndFile($dirName){
}

if($_GET['action'] == 'clean_upload_file'){
echo delDirAndFile("upload");
echo del_dir("upload");
mkdir("upload");
}
?>

0 comments on commit ca3fdc4

Please sign in to comment.