<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="admin.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/function.asp"-->
<%
if request("action")=2 then
set rs=server.CreateObject("adodb.recordset")
rsq="select * from cw_chaxun"
rs.open rsq,conn,1,3
rs.addnew
rs("title")=request("title")
rs("tel")=request("tel")
rs("link")=request("link")
rs("ordnum")=request("ordnum")
rs("ispass")=request("ispass")
rs.update
rs.close
set rs=nothing
set conn=nothing
response.Write("<script>alert('添加成功，系统自动跳转！'); location.href='cw_chaxun.asp'</script>")
response.End()
end if

if request("action")=3 then
set rs=server.CreateObject("adodb.recordset")
rsq="select * from cw_chaxun where id="&request("id")&""
rs.open rsq,conn,1,3
rs("title")=request("title")
rs("tel")=request("tel")
rs("link")=request("link")
rs("ordnum")=request("ordnum")
rs("ispass")=request("ispass")
rs.update
rs.close
set rs=nothing
set conn=nothing
response.Write("<script>alert('修改成功，系统自动跳转！'); location.href='cw_chaxun.asp'</script>")
response.End()
end if

if request("action")=4 then
  conn.execute("delete from cw_chaxun where id="&request("id")&"")
  response.Write("<script>alert('删除成功，系统自动跳转！'); location.href='cw_chaxun.asp'</script>")
  response.End()
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>便民查询</title>
<link href="style/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="style/js.js"></script>
</head>

<body id="page">
<h2 class="title">便民查询</h2>
<table width="99%" border="0" align="center" class="line_table">
  <tr>
    <td height="20" >&nbsp;网站后台管理 &gt;&gt; <a href="cw_chaxun.asp">便民查询</a>&nbsp;&nbsp;&nbsp;&nbsp;【<a href="cw_chaxun.asp?add=1" style="color:#FF0000">添加便民查询</a>】</td>
  </tr>
</table>
	<%if request("add")="" then%>
	<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0"  bgcolor="#CCCCCC">
      <tr>
        <td width="6%" align="center" bgcolor="#F0F3F5">ID</td>
        <td width="20%" align="center" bgcolor="#F0F3F5">链接名称</td>
        <td width="34%" align="center" bgcolor="#F0F3F5">链接地址</td>
        <td width="22%" align="center" bgcolor="#F0F3F5">备注</td>
        <td width="18%" align="center" bgcolor="#F0F3F5">管理</td>
      </tr>
      <%
		set rs=server.createobject("adodb.recordset")
sql="select * from cw_chaxun order by ordnum asc,id asc"
rs.open sql,conn,1,1
if not rs.eof then
do while not rs.eof
		  %>
      <tr >
        <td align="center" bgcolor="#FFFFFF"><%=rs("id")%></td>
        <td bgcolor="#FFFFFF">&nbsp;&nbsp;<%=rs("title")%></td>
        <td bgcolor="#FFFFFF" ><a href="<%=rs("link")%>" target="_blank"><%=rs("link")%></a></td>
        <td align="center" bgcolor="#FFFFFF" ><%=rs("tel")%></td>
        <td align="center" bgcolor="#FFFFFF" ><a href="cw_chaxun.asp?add=2&amp;id=<%=rs("id")%>">编辑</a> | <a href="cw_chaxun.asp?id=<%=rs("id")%>&amp;action=4" onclick="return confirm('你确定要删除？')">删除</a></td>
      </tr>
      
      <%
		  rs.movenext
		  loop
		  end if 
		  rs.close
		  set rs=nothing
		  %>
    </table>
	<%end if%>
	<%if request("add")=1 then%>
      <table width="99%" border="0">
	  <form id="form1" name="form1" method="post" onsubmit="return check_chaxun(this)" action="cw_chaxun.asp?action=2">
        <tr>
          <td colspan="2" align="center"><h3>添加便民查询</h3></td>
          </tr>
        <tr>
          <td width="31%" align="right">服务名称：</td>
          <td width="69%"><input name="title" type="text" id="title" size="40" /></td>
        </tr>        
        <tr>
          <td align="right">查询链接：</td>
          <td><input name="link" type="text" id="link" size="40" /></td>
        </tr>
		<tr>
          <td align="right">查询备注：</td>
          <td><input name="tel" type="text" id="tel" size="40" /></td>
        </tr>
		<tr>
          <td align="right">前台显示：</td>
          <td><input name="ispass" type="radio" value="1" checked="checked" />
            是
            <input type="radio" name="ispass" value="0" />
            否</td>
        </tr>
        <tr>
          <td align="right">服务排序：</td>
          <td><input name="ordnum" type="text" id="ordnum" value="0" size="40" /></td>
        </tr>        
        <tr>
          <td>&nbsp;</td>
          <td><input name="Submit" type="submit" class="btn" onclick="checkform()" value="添加查询工具" /></td>
        </tr>
		</form>
    </table>
	<%end if%>
	<%if request("add")=2 then%>
	<%
	if request("id")="" then
	  response.Write("<script>alert('参数错误!'); history.back();</script>")
	end if
	set rs=server.CreateObject("adodb.recordset")
	sql="select * from cw_chaxun where id="&request("id")&""
	rs.open sql,conn,1,1
	if not rs.eof then
	%>
	<table width="99%" border="0">
	  <form id="form1" name="form1" method="post" action="cw_chaxun.asp?action=3" onsubmit="return check_chaxun(this)">
        <tr>
          <td colspan="2" align="center"><h3>修改查询工具</h3></td>
          </tr>
        <tr>
          <td width="31%" align="right">服务名称：</td>
          <td width="69%"><input name="title" type="text" id="title" value="<%=rs("title")%>" size="40" /></td>
        </tr>        
        <tr>
          <td align="right">查询链接：</td>
          <td><input name="link" type="text" id="link" value="<%=rs("link")%>" size="40" /></td>
        </tr>
		<tr>
          <td align="right">查询备注：</td>
          <td><input name="tel" type="text" id="tel" value="<%=rs("tel")%>" size="40" /></td>
        </tr>
		<tr>
          <td align="right">前台显示：</td>
          <td><input name="ispass" type="radio" value="1" <%if rs("ispass")=1 then%>checked="checked"<%end if%> />
            是
            <input type="radio" name="ispass" value="0"<%if rs("ispass")=0 then%>checked="checked"<%end if%> />
            否</td>
        </tr>
        <tr>
          <td align="right">服务排序：</td>
          <td><input name="ordnum" type="text" id="ordnum" value="<%=rs("ordnum")%>" size="40" /></td>
        </tr>        
        <tr>
          <td>&nbsp;</td>
          <td><input name="Submit" type="submit" class="btn"  onclick="checkform()" value="修改查询工具" />
            <input name="id" type="hidden" id="id" value="<%=rs("id")%>" /></td>
        </tr>
		</form>
    </table>
	<%
	end if
	rs.close
	set rs=nothing
	%>
	<%end if%>
<%call closes()%>
</body>
</html>
