-
Notifications
You must be signed in to change notification settings - Fork 16
/
delete.php
47 lines (43 loc) · 1017 Bytes
/
delete.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
session_start();
require("common.php");
if (isset($_REQUEST['id'])) {
$id = $_REQUEST['id'] ;
if (isset($_SESSION['is_login'])) {
//删除
$sql="select * from mp3 where id = '$id' limit 1 ";
$result=mysql_query($sql)OR die("<br>读取数据库错误!<br>");
if($row=mysql_fetch_array($result))
{
$delurl=$row['url'];
$delname=basename($delurl);
$res = delete_mp3($delname);
if ($res['success'] == 1 ) {
$sql="delete from mp3 where id='$id'";
mysql_query($sql);
$success =1 ;
$tips = "删除成功";
}else{
$success = 0 ;
$tips = "删除失败";
}
}
}else{
$success = -1 ;
$tips = "尚未登录";
}
}
elseif ($_REQUEST['name']) {
$name = $_REQUEST['name'] ;
$password = $_REQUEST['password'];
if ($name == NAME && $password == PASSWORD) {
$_SESSION['is_login'] = 1 ;
$success = 1 ;
$tips = "验证成功";
}else{
$success = -1 ;
$tips = "验证失败";
}
}
echo json_encode(array("success"=>$success , "tips"=>$tips));
?>