📄 verity.php
字号:
<?php
require("../mysql.inc.php");
?>
<?
$action=$_REQUEST["action"];
$admin=$_REQUEST["admin"];
$deleteid=$_REQUEST["deleteid"];
$id=$_REQUEST["id"];
$title=$_REQUEST["title"];
$url=$_REQUEST["url"];
$leibieid=$_REQUEST["leibieid"];
$pn=$_REQUEST["pn"];
$verityid=$_REQUEST["verityid"];
//echo $action.$id.$title.$leibieid.$url;
session_start();
$isadmin=$_SESSION["isadmin"];
if ($isadmin!=true) {
header("location:location:index.php?u=$admin");exit();
}
if ($action=="delete") {
mysql_query("delete from wz_detail where id=$deleteid");
header("location:".getenv("HTTP_REFERER"));exit();
}
if ($action=="modify") {
if ($id!="" && $title!="" && $url!="" && $leibieid!="") {
mysql_query("update wz_detail set title='$title',url='$url',classid=$leibieid where id=$id");
header("location:verity.php?pn=".$pn);exit();
}
}
function showerr($message) {
echo "<Script>alert('$message');location.replace('verity.php?pn=$pn');</Script>";
exit();
}
if ($action=="verity") {
mysql_query("update wz_detail set verity=1 where id=$verityid");
showerr("所选网址已审核通过,如要修改请到[网址添加修改].");
}
?>
<HTML>
<HEAD>
<TITLE>网址添加修改</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<style type="text/css">
body {font-size:13px}
td {font-size:13px;}
input {
COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; FONT-SIZE: 12px
}
button {
COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; FONT-SIZE: 12px
}
.formHeader {
BACKGROUND: #d0d0d0; COLOR: #000000; FONT-WEIGHT: bold
}
</style>
<?php
$rs=array("one","two","three","fore","five");
$s=array("one","tow","three","fore","five");
$get_leibie=mysql_query("select classid,classname,level from wz_fenlei where verity=1");
$yi=0;
while ($yy=mysql_fetch_array($get_leibie)) {
$leibie[$yi]["id"]=$yy["classid"];
$leibie[$yi]["name"]=$yy["classname"];
$leibie[$yi]["level"]=$yy["level"];
$yi++;
}
function get_substr($ss,$arrayy) {
global $leibie;
for ($j=0;$j<count($leibie);$j++) {
if ($leibie[$j]["id"]==$arrayy) {
$xss=$ss." -[".$leibie[$j]["name"]."]子类";
return $xss;
}
}
return $ss;
}
$select="<select name=\"leibieid\">";
$select.="<option value=\"0\">请选择类别</option>";
for ($i=0;$i<count($leibie);$i++) {
$leibiestr=$leibie[$i]["name"];
if ($leibie[$i]["level"]!=1) {
$temp2=mysql_query("select topclass from wz_fenlei where classid=".$leibie[$i]["id"]);
if ($temp2) {
$temp3=mysql_fetch_array($temp2);
if (is_array($temp3)) {
$leibiestr=get_substr($leibiestr,$temp3["topclass"]);
}
}
}
else {
$leibiestr=$leibiestr."(一级分类)";
}
$select.="<option value='".$leibie[$i]["id"]."'".$selected.">".$leibiestr."</option>";
}
$select.="</select>";
$select=addslashes($select);
echo "<Script Language='JavaScript'>select_str='$select';</Script>"."\n";
?>
<Script Language="JavaScript">
function editrow(tbid,row,id,title,url,leibie) {
tbobj=document.all(tbid);
old1=tbobj.rows[row].cells[1].innerHTML;
tbobj.rows[row].cells[1].innerHTML= "<input type='hidden' value='"+old1+"'><input style='width:100%' class=\"inputText\" name='title' value=\"" + title + "\">";
old2=tbobj.rows[row].cells[2].innerHTML;
tbobj.rows[row].cells[2].innerHTML= "<input type='hidden' value='"+old2+"'><input style='width:300px' class=\"inputText\" name='url' value=\"" + url + "\">";
old3=tbobj.rows[row].cells[3].innerHTML;
tbobj.rows[row].cells[3].innerHTML= "<input type='hidden' value='"+old3+"'>"+select_str;
tbobj.rows[row].cells[3].children[1].value=leibie;
old4=tbobj.rows[row].cells[4].innerHTML;
tbobj.rows[row].cells[4].innerHTML= "<input type='hidden' value=''><input type=\"submit\" value=\"提交\" class=\"inputText\"> <button onclick=\"rerow("+row+","+tbid+");return false\">取消编辑</button>";
tbobj.rows[row].cells[4].children[0].value=old4;
//alert(tbobj.rows[row].cells[4].innerHTML);
return false;
}
function rerow(row,tbobj) {
tbobj.rows[row].cells[1].innerHTML=tbobj.rows[row].cells[1].children[0].value;
tbobj.rows[row].cells[2].innerHTML=tbobj.rows[row].cells[2].children[0].value;
tbobj.rows[row].cells[3].innerHTML=tbobj.rows[row].cells[3].children[0].value;
tbobj.rows[row].cells[4].innerHTML=tbobj.rows[row].cells[4].children[0].value;
return false;
}
</Script>
</HEAD>
<BODY>
<br>
<Script Language="JavaScript">
function check(xx) {
if (xx.title.value=="") {
alert("网站标题不能为空!");
return false;
}
if (xx.url.value=="") {
alert("网站url不能为空!");
return false;
}
if (xx.leibieid.value=="0") {
alert("网站类别不能为空!");
return false;
}
return true;
}
</Script>
<table border="0" width="100%" style="border:none">
<tr><td style="border:none">
<big>未审核网站列表</big>
</td>
<td style="border:none">
</td>
</table>
<table bordercolor="black" cellspacing="4" id="listtb" width='100%'>
<tr>
<td nowrap class='formHeader'>编号</td>
<td width='150' class='formHeader'>网站名称</td>
<td class='formHeader' width="300">网站url</td>
<td nowrap class='formHeader'>所属分类</td>
<td nowrap class='formHeader'>操作</td>
</tr>
<?php
if ($pn=="") $pn=1;
if ($pn<1) $pn=1;
$sql="select * from wz_detail where verity<>1 order by id desc";
$result=mysql_query($sql);
$rstotal=mysql_num_rows($result);
$pagetotal=ceil($rstotal/100);
if ($pn>$pagetotal) $pn=$pagetotal;
$pagesize=100;
$ii=1;
$rsstart=$pagesize*($pn-1)+1;
$rscount=1;
while (($r=mysql_fetch_array($result)) && ($ii<=100)) {
$result1=mysql_query("select * from wz_fenlei where classid=".$r["classid"]);
if ($result1) {
$rr=mysql_fetch_array($result1);
$classname=$rr["classname"];
}
else $classname="";
$classid=0;
for ($i=0;$i<=count($leibie);$i++) {
if ($leibie[$i]["name"]==$classname) {
$classid=$leibie[$i]["id"];
}
}
if ($rscount>=$rsstart) {
echo "<tr><FORM action=verity.php method=get onsubmit='return check(this)' name='form".$r["id"]."'><td nowrap>".$r["id"]."<input name='id' type='hidden' value='".$r["id"]."'></td><input name='action' type='hidden' value='modify'>";
echo "<td width='150'><a href='".$r["url"]."' target='_target'>".$r["title"]."</a></td>";
echo "<td><input style='border-width:0px 0px 1px 0px;border-color:black;width:300px' value='".htmlspecialchars($r["url"])."'></td>";
echo "<td nowrap width=\"150\">".$classname."</td>";
echo "<td nowrap width=\"120\"><A href='#' onclick=\"javascript:return editrow('listtb',$ii,'".$r["id"]."','".$r["title"]."','".$r["url"]."','".$classid."'); return false;\">编辑</a> - <A href=\"verity.php?action=verity&verityid=".$r["id"]."\" onclick='return confirm(\"确定审核通过所选网址?\")'>通过</A> - <A href=\"verity.php?action=delete&deleteid=".$r["id"]."\" onclick='return confirm(\"确定删除?\")'>删除</A></td></FORM></tr>";
$ii++;
}
$rscount++;
}
?>
</tr>
</table>
<br>
<?php
echo "共".$rstotal."个网址,分".$pagetotal."页显示,当前第".$pn."页 ";
$np=$pn+1;
$pp=$pn-1;
if ($pn==1 && $pagetotal>1) {
echo "<a href='verity.php?pn=".$np."'>下页</a> <a href='verity.php?pn=".$pagetotal."'>末页</a>";
echo "<Script Language='JavaScript'>\n";
echo "function gonewpn(x) {\n";
echo "window.location.href='verity.php?pn='+x;\n";
echo "}\n";
echo "</Script>\n";
echo " 转到<select id='newpn' onchange='gonewpn(this.value)'>";
for ($m=1;$m<=$pagetotal;$m++) {
if ($m==$pn)
echo "<option value='$m' selected>$m</option>\n";
else
echo "<option value='$m'>$m</option>\n";
}
echo "</select>页\n";
}
elseif ($pn==$pagetotal && $pagetotal>1) {
echo "<a href='verity.php?pn=1'>首页</a> <a href='verity.php?pn=".$pp."'>上页</a>";
echo "<Script Language='JavaScript'>\n";
echo "function gonewpn(x) {\n";
echo "window.location.href='verity.php?pn='+x;\n";
echo "}\n";
echo "</Script>\n";
echo " 转到<select id='newpn' onchange='gonewpn(this.value)'>";
for ($m=1;$m<=$pagetotal;$m++) {
if ($m==$pn)
echo "<option value='$m' selected>$m</option>\n";
else
echo "<option value='$m'>$m</option>\n";
}
echo "</select>页\n";
}
elseif ($pn!=$pagetotal && $pagetotal>1) {
echo "<a href='verity.php?pn=1'>首页</a> <a href='verity.php?pn=".$pp."'>上页</a>";
echo " <a href='verity.php?pn=".$np."'>下页</a> <a href='verity.php?pn=".$pagetotal."'>末页</a>";
echo "<Script Language='JavaScript'>\n";
echo "function gonewpn(x) {\n";
echo "window.location.href='verity.php?pn='+x;\n";
echo "}\n";
echo "</Script>\n";
echo " 转到<select id='newpn' onchange='gonewpn(this.value)'>";
for ($m=1;$m<=$pagetotal;$m++) {
if ($m==$pn)
echo "<option value='$m' selected>$m</option>\n";
else
echo "<option value='$m'>$m</option>\n";
}
echo "</select>页\n";
}
?>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -