📄 template.php
字号:
<?php
!$_SERVER['PHP_SELF'] && $_SERVER['PHP_SELF']=$_SERVER['SCRIPT_NAME'];
substr($_SERVER['PHP_SELF'],-9,-4)!=='admin' && exit('Forbidden');
require_once(R_P.'cache/template.php');
$query=query("SELECT * FROM duoxun_templates ORDER BY templateid ASC");
while($rs=fetch_array($query)) {
$catedb[]=$rs;
}
if(!empty($_GET['do']) && $_GET['do']==='set') {
$templateid=$_POST['templateid'];
$query=query("UPDATE duoxun_settings SET value='$templateid' WHERE name='templateid'");
if($query) {
settings();
templates();
header("Location: job.php?job=template&set=success");
} else {
header("Location: job.php?job=template&set=fail");
}
}
if(!empty($_GET['edit']) && $_GET['edit']==='success') {
$id=$catedb[$_POST['templateid']]['templateid'];
$name=$_POST['name'];
$charset=$_POST['charset'];
$tplpath=$_POST['tplpath'];
$imgpath=$_POST['imgpath'];
$query=query("UPDATE duoxun_templates SET name='$name',charset='$charset',tplpath='$tplpath',imgpath='$imgpath' WHERE templateid='$id'");
if($query) {
include_once(R_P.'cache/set.php');
if($id==$templateid) {
templates();
}
header("Location: job.php?job=template&edit=success");
} else {
header("Location: job.php?job=template&edit=fail");
}
}
if(!empty($_GET['add']) && $_GET['add']==='success') {
$name=$_POST['name'];
$charset=$_POST['charset'];
$tplpath=$_POST['tplpath'];
$imgpath=$_POST['imgpath'];
if($name=='' || $charset=='' || $tplpath=='' || $imgpath=='') {
header("Location: job.php?job=template&add=fail");
}
$query=query("INSERT INTO duoxun_templates (name,charset,tplpath,imgpath) VALUES ('$name','$charset','$tplpath','$imgpath')");
if($query) {
header("Location: job.php?job=template&add=success");
} else {
header("Location: job.php?job=template&add=fail");
}
}
require_once template('template','admin');
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -