-
Notifications
You must be signed in to change notification settings - Fork 0
/
delect.php
31 lines (30 loc) · 962 Bytes
/
delect.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
$savePath = './session_save_dir/';
session_save_path($savePath);
session_start();
$name=$_POST['name'];
$filename=$_POST['filename'];
$dir='./upload/'.$name.'/';
//判断是否登陆
if (!isset($_SESSION['islogin']) || $_SESSION['islogin']!==1) {
echo ("<script>alert('未登陆,即将跳转到登陆界面');</script>");
echo '<script>window.location.href="login.php"</script>';
die();
}
//判断用户是否正确
if ($name!==$_SESSION['name']) {
echo ("<script>alert('用户信息错误');</script>");
echo ('<script>window.location.href="index.php"</script>');
die();
}
if ($_SERVER["REQUEST_METHOD"] == "POST"){
$status=unlink($dir.$filename);
if($status){
echo "<script>alert('删除成功');</script>";
echo ('<script>window.location.href="index.php"</script>');
}else{
echo "<script>alert('删除失败');</script>";
echo ('<script>window.location.href="index.php"</script>');
}
}
?>