-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
45 lines (36 loc) · 1.05 KB
/
Copy pathadmin.php
File metadata and controls
45 lines (36 loc) · 1.05 KB
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
<?PHP
//引用类文件
require './table.php';
//设置各个目录的路径,这里是安装的重点
$smarty->template_dir = "templates/templates";
$smarty->compile_dir = "templates/templates_c";
$smarty->config_dir = "templates/config";
$smarty->cache_dir = "templates/cache";
//smarty模板有高速缓存的功能,如果这里是true的话即打开caching,但是会造成网页不立即更新的问题,当然也可以通过其他的办法解决
$smarty->caching = false;
@session_start(); //开启session
//注销
if(@$_POST['action']=='logout')
{
session_destroy();
header("Location: login.php");
}
//未登录
if(empty($_SESSION['username']))
{
header("Location: login.php");
}
//删除文件
if (@$_POST['function']=="delart")
{
$sql = "delete from article_table WHERE id=".$_POST['artid'];
$s->execute_sql($sql);
//删除本地缓存
$filename="templates/article/".$_POST['artid'].".tpl";
@unlink($filename);
header("Location: admin.php");
exit;
}
$smarty->display('admin.tpl');
$smarty->display('table.tpl');
?>