📄 sort.php
字号:
<?php
// ------------------------------ -------- ------------------------------ //
require ("../include/config.inc.php");
require ("./global.php");
include ("../include/header.inc.php");
// ------------------------------ -------- ------------------------------ //
mysql_connect($dbhost,$dbuser,$dbpasswd) or die ("数据库连接失败");
// check cookie
islogin($HTTP_COOKIE_VARS[$cookie_name][1],$HTTP_COOKIE_VARS[$cookie_name][2]);
$cookie_user = $HTTP_COOKIE_VARS[$cookie_name][1];
// get groupid
$sql = "SELECT groupid FROM $ym_article_user_table WHERE username='$cookie_user'";
$result = mysql_db_query($dbname, $sql);
$objresult = mysql_fetch_object($result);
$mygroupid = $objresult->groupid;
if ($mygroupid == "1"):
echo "<center><br>\n";
// 搜索跳转
echo "<title>控制面板</title>\n";
echo "<center><br>\n";
echo "<br><table border=0 cellpadding=3 cellspacing=0 style='border-collapse:collapse' bordercolor=#efefef width=735>\n";
echo "<tr>\n";
echo "<td class=shadow2 width=190 valign=bottom>\n";
// 本类/总数
all_and_this();
// 搜索表单
$typesql = "SELECT COUNT(*) AS rcnt FROM $ym_article_sort_table ORDER BY id";
$typeresult = mysql_db_query($dbname, $typesql);
$typerow = mysql_fetch_array($typeresult);
$typesql = "SELECT * FROM $ym_article_sort_table ORDER BY id";
$typeresult = mysql_db_query($dbname, $typesql);
echo "</td>\n";
echo "<form method=POST action=list.php>\n";
echo "<td width=405 align=center valign=bottom>\n";
echo "<img src='../images/search.gif' width=16 heigth=16> ";
echo "标题<input type=checkbox name=title value='1' ";
echo ($name == 0 ? '' : checked);
echo ">\n";
echo "内容<input type=checkbox name=text value='1' ";
echo ($brief == 0 ? '' : checked);
echo ">\n";
echo "<input class=border type=text name=keyword size=12 style='color:#000000; background-color:#efefef'>\n";
echo "<select size=1 name=searchtype style='color:#000000; border-style:solid; border-width:1; background-color:#efefef'>\n";
echo "<option value=0 selected>所有文章</option>\n";
while ($typerow=mysql_fetch_array($typeresult)) {
echo "<option value=".$typerow[id].">".$typerow[name]."</option>\n";
}
echo "</select> \n";
echo "<input class=border type=submit value=搜索 name=search style='color: #000000; background-color: #efefef'>\n";
echo "</td></form>";
// 跳转分类
goto($type);
echo "</tr>\n";
echo "</table>\n";
echo "<br>\n";
echo "<table border=0 cellspacing=0 style='border-collapse:collapse' width=735 height=233 cellpadding=3>\n";
echo "<tr>\n";
// 栏目菜单
echo "<td width=185 valign=top>\n";
adminmenu();
echo "</td>\n";
echo "<td width=550 height=233 valign=top>\n";
// 转到搜索
if ($search):
search($keyword,$searchtype,$title,$text);
end;
else:
// 发送删除分类
if ($senddelsort):
delsort($id);
end;
else:
// 删除分类
if ($delsort):
$sql = "SELECT * FROM $ym_article_sort_table WHERE id=$id";
$result = mysql_db_query($dbname, $sql);
$obj = mysql_fetch_object($result);
$sort = $obj->name;
echo "<form method=POST action=sort.php>\n";
echo "<center><br><br><br><br><br>";
echo "编号:<input type=text name=id value='$id' size=3 class=border style='color:#000000; background-color:#efefef' readonly> \n";
echo "名称:<input type=text name=sort value='$sort' size=15 class=border style='color:#000000; background-color:#efefef'> \n";
echo "<br><br>注意:删除此分类将同时删除此类下的所有记录,确定吗?";
echo "<br><br><input type=submit value=' 确 定 ' name=senddelsort class=border style='color: #000000; background-color: #efefef'> \n";
echo "<a href=javascript:history.back(1)>点击这里返回</a>";
echo "</form>";
end;
else:
// 发送编辑分类
if ($sendeditsort):
editsort($id,$sort,$description);
end;
else:
// 编辑分类
if ($editsort):
if ($id == ""):
echo "<center><br><br><br><br><br>未选择分类 ";
echo "<a href=./sort.php>点击这里返回</a>";
else:
echo "<table border=0 cellspacing=0 width=90% cellpadding=3>\n";
echo "<tr>\n";
echo "<td class=shadow2 align=center>\n";
echo "<b><font class=p3>--==编辑分类==--</font></b>";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<form method=POST action=sort.php>\n";
echo "<td align=center><br><br>\n";
$sql = "SELECT * FROM $ym_article_sort_table WHERE id=$id";
$result = mysql_db_query($dbname, $sql);
$obj = mysql_fetch_object($result);
$sort = $obj->name;
$description = $obj->description;
echo "分类:编号 ";
echo "<input type=text name=id value='$id' size=3 class=border style='color:#000000; background-color:#efefef' readonly> \n";
echo " 名称 ";
echo "<input type=text name=sort value='$sort' size=15 class=border style='color:#000000; background-color:#efefef'> \n";
echo " 描述 ";
echo "<input type=text name=description value='$description' size=15 class=border style='color:#000000; background-color:#efefef'> \n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align=center>\n";
echo "<br><input type=submit value=提交 name=sendeditsort class=border style='color: #000000; background-color: #efefef'> \n";
echo "<input type=reset value=重填 class=border style='color: #000000; background-color: #efefef'>\n";
echo "</td>\n";
echo "</form>\n";
echo "</tr>\n";
echo "</table>\n";
endif;
else:
// 添加分类
if ($addsort):
addsort($newsort,$description);
end;
else:
// ------------------------------ 管理显示 ------------------------------ //
echo "<center>";
echo "<table border=0 cellspacing=0 width=90% cellpadding=3>\n";
echo "<tr>\n";
echo "<td class=shadow2 align=center>\n";
echo "<b><font class=p3>--==分类管理==--</font></b>";
echo "</td>\n";
echo "</tr>\n";
// ------------------------------ 添加分类 ------------------------------
echo "<tr>\n";
echo "<td class=shadow2>\n";
echo "<br><b>添加分类:</b>";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<form method=POST action=sort.php>\n";
echo "<td>\n";
echo "分类:名称 ";
echo "<input type=text name=newsort size=12 class=border style='color:#000000; background-color:#efefef'>\n";
echo " 描述 ";
echo "<input type=text name=description size=12 class=border style='color:#000000; background-color:#efefef'> \n";
echo "<input type=submit value=添加 name=addsort class=border style='color: #000000; background-color: #efefef'>\n";
echo "</td>\n";
echo "</form>";
echo "</tr>\n";
// ------------------------------ 编辑分类 ------------------------------
echo "<tr>\n";
echo "<td class=shadow2>\n";
echo "<br><br><b>编辑分类:</b>";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<form method=POST action=sort.php>\n";
echo "<td>\n";
echo "分类:";
$typesql = "SELECT COUNT(*) AS rcnt FROM $ym_article_sort_table ORDER BY id";
$typeresult = mysql_db_query($dbname, $typesql);
$typerow = mysql_fetch_array($typeresult);
$typesql = "SELECT * FROM $ym_article_sort_table ORDER BY id";
$typeresult = mysql_db_query($dbname, $typesql);
echo "<select size=1 name=id style='color:#000000; border-style:solid; border-width:1; background-color:#efefef'>\n";
echo "<option value='' selected>选择分类</option>\n";
while ($typerow=mysql_fetch_array($typeresult)) {
echo "<option value=".$typerow[id].">".$typerow[name]."</option>\n";
}
echo "</select> \n";
echo "<input type=submit value=编辑 name=editsort class=border style='color: #000000; background-color: #efefef'>\n";
echo "</td>\n";
echo "</form>";
echo "</tr>\n";
// ------------------------------ 删除分类 ------------------------------
echo "<tr>\n";
echo "<td class=shadow2>\n";
echo "<br><br><b>删除分类:</b>";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<form method=POST action=sort.php>\n";
echo "<td>\n";
echo "分类:";
$typesql = "SELECT COUNT(*) AS rcnt FROM $ym_article_sort_table ORDER BY id";
$typeresult = mysql_db_query($dbname, $typesql);
$typerow = mysql_fetch_array($typeresult);
$typesql = "SELECT * FROM $ym_article_sort_table ORDER BY id";
$typeresult = mysql_db_query($dbname, $typesql);
echo "<select size=1 name=id style='color:#000000; border-style:solid; border-width:1; background-color:#efefef'>\n";
echo "<option value='' selected>选择分类</option>\n";
while ($typerow=mysql_fetch_array($typeresult)) {
echo "<option value=".$typerow[id].">".$typerow[name]."</option>\n";
}
echo "</select> \n";
echo "<input type=submit value=删除 name=delsort class=border style='color: #000000; background-color: #efefef'>\n";
echo "</td>\n";
echo "</form>";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class=shadow2><br><p style='line-height:150%'>\n";
echo "<br><img src=../images/note.gif> <b><font color=red>注意:</font></b>";
echo "\"删除分类\"将删除分类下所有的记录,如果该分类下的记录仍然有用,请先利用\"批量转移\"功能将该分类下的记录转移到其他分类!";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
// ------------------------------ 结束显示 ------------------------------ //
endif; // if addsort
endif; // if editsort
endif; // if sendeditsort
endif; // if delsort
endif; // if senddelsort
endif; // if search
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br><hr width=735>\n";
else:
echo "<p><center><a href=javascript:history.back(1)>您不是超级管理员, 点击这里返回.</a></p>\n";
endif;
mysql_close();
// ------------------------------ -------- ------------------------------ //
include ("../include/footer.inc.php");
// ------------------------------ -------- ------------------------------ //
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -