代码拉取完成,页面将自动刷新
<?php
session_start();
//var_dump($_SESSION['username']);
if($_SESSION['username']==""){echo "<script language='javascript'>;alert('请登录账户后操作');location.href='login/login.php'</script>";}
else if($_SESSION['class']=="0"){echo "<script language='javascript'>;alert('请使用管理员身份登录');location.href='login/login.php'</script>";}
?>
<?php
include("db.php");
$id=$_GET['id'];
$sql1="select * from upload where id='{$id}'";
$mysqli_result=$mysqli->query($sql1);
//var_dump($mysqli_result);
/*通过id得到fpath字段*/
if($row=$mysqli_result->fetch_array()){
$fpath=iconv("UTF-8", "gb2312", $row['fpath']);
}
//var_dump($fpath);
unlink($fpath);
$sql2="delete from upload where id='{$id}'";
$re=$mysqli->query($sql2);
if($mysqli->affected_rows>0){
echo '<script>alert("删除成功");location.href="admin_file.php";</script>';
}else{
echo 'fail';//echo '<script>alert("删除失败");location.href="admin_file.php";</script>';
}
?>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。