<!--#include file="conn.asp" -->
<% adm_power_page="1" %>
<!--#include file="admin_dn.asp" -->
<% 
msg=""
num_Arrange="0123456789"


function Verification_num(num1,num2)
s=true
for i=1 to len(num2)
 if instr(num1,mid(num2,i,1))=0 then
  s=false
 end if
 next
 if not s then Verification_num="<li>排列只能为数字1234567890</li>"
end function

function Verification_url(url)
 if instr(url,"http://")=0 then
 Verification_url="<li>在网止中不存在http://</li>"
 end if
end function

function Verification_title(title)
 if title="" then Verification_title="<li>名称不能为空字符</li>"
end function

if Trim(Request.QueryString("w"))="add" then
 title=Trim(Request.Form("title"))
 url=lcase(Trim(Request.Form("url")))
 arrange=Request.Form("arrange")
 bak=Trim(Request.Form("bak"))
 msg=msg&verification_num(num_Arrange,arrange)
 msg=msg&Verification_url(url)
 msg=msg&Verification_title(title)
 msg=trim(msg)
 if msg="" then
 'sql="insert into link(title,url,bak,Arrange) values ('jfkdlf,fdfd,fdfd,33)"
 sql="insert into link (title,url,bak,Arrange) values  ('"&title&"','"&url&"','"&bak&"',"&arrange&")"
conn.execute(sql)
msg="新增成功......"
else
msg=" 新增失败产生以下错:<ul>"&msg&"</ul>"
end if

end if

if Trim(Request.QueryString("w"))="save" then
 if Request.Form("Operation")="del" then
  sql="delete from link where id="&request.form("id")
  conn.execute (sql)
else
 title=Trim(Request.Form("title"))
 url=lcase(Trim(Request.Form("url")))
 arrange=Request.Form("arrange")
 bak=Trim(Request.Form("bak"))
 msg=msg&verification_num(num_Arrange,arrange)
 msg=msg&Verification_url(url)
 msg=msg&Verification_title(title)
 msg=trim(msg)
 if msg="" then
 sql="update link set title='"&title&"',url='"&url&"',bak='"&bak&"',Arrange="&arrange&" where id="&request.form("id")
conn.execute(sql)
msg="新增成功......"
else
msg=" 修改失败产生以下错:<ul>"&msg&"</ul>"
end if
  end if
 end if
 %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>:::管理页面:::</title>
<link href="css.css" rel="stylesheet" type="text/css">
</head>

<body leftmargin="4" topmargin="4">
<p><a href="Recommend.asp" target="mainFrame">推荐用户列表</a> 管理</p>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr bgcolor="#000066"> 
    <td height="15"><a href="Recommend.asp" target="mainFrame"><font color="#FFFFFF">推荐用户列表</font></a></td>
  </tr>
  <tr> 
    <td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr bgcolor="#ECECFF"> 
          <td width="22%"> <div align="center"><strong>名　称</strong></div></td>
          <td width="18%"> <div align="center"><strong>网　址</strong></div></td>
          <td width="7%"> <div align="center"><strong>排列</strong></div></td>
          <td width="18%"> <div align="center"><strong>说　明</strong></div>
            <div align="center"></div></td>
          <td width="22%"> <div align="center"><strong>操作</strong></div></td>
          <td width="13%"> <div align="center"><strong>确定</strong></div></td>
        </tr>
      </table>
	  <% rs.open "select * from link order by id desc",conn,1,1
	  while not rs.eof %>
      <form name="form2" method="post" action="recommend.asp?w=save">
        <table width="100%" border="0" cellspacing="2" cellpadding="0">
          <tr bgcolor="#F7F7FF"> 
            <td width="22%" height="17"> 
              <div align="center"> 
                <input name="title" type="text" id="title" value="<%=rs("title")%>" size="15">
              </div></td>
            <td width="17%"> 
              <div align="center"> 
                <input name="url" type="text" id="url" value="<%=rs("url")%>" size="15">
              </div></td>
            <td width="8%"> 
              <div align="center"> 
                <input name="Arrange" type="text" id="Arrange" value="<%=rs("Arrange")%>" size="2">
              </div></td>
            <td width="19%"> 
              <div align="center"> 
                <input name="bak" type="text" id="bak" value="<%=rs("bak")%>" size="15">
              </div></td>
            <td width="22%"> 
              <div align="center">
                <input name="id" type="hidden" id="id" value="<%=rs("id")%>">
                <input name="Operation" type="radio" class="unnamed1" value="edit" checked>
                修改
                <input name="Operation" type="radio" class="unnamed1" value="del">
                册除</div></td>
            <td width="12%"> 
              <div align="center"> 
                <input type="submit" name="Submit2" value="确定">
              </div></td>
          </tr>
        </table>
      </form>
	  <% rs.movenext
	  wend
	  rs.close %>
      </td>
  </tr>
  <tr bgcolor="#000066"> 
    <td>&nbsp;</td>
  </tr>
</table>
<p>&nbsp;</p>
<form name="form1" method="post" action="recommend.asp?w=add">
  <table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr> 
      <td height="16" colspan="2" bgcolor="#000066"><a href="Recommend.asp" target="mainFrame"><font color="#FFFFFF">推荐用户</font></a><font color="#FFFFFF">新增</font></td>
    </tr>
    <tr bgcolor="#EEEEFF"> 
      <td width="18%" height="27"> <div align="center">名　称:</div></td>
      <td width="82%" bgcolor="#EEEEFF"> 
        <input name="title" type="text" id="title" size="15">
        显示的名字<font color="#FF0000"> *</font></td>
    </tr>
    <tr bgcolor="#EEEEFF">
      <td height="26" bgcolor="#EEEEFF"><div align="center">网　址:</div></td>
      <td><input name="url" type="text" id="url" value="http://">
        http://开头 <font color="#FF0000">*</font></td>
    </tr>
    <tr bgcolor="#EEEEFF"> 
      <td height="26"> <div align="center">排　列:</div></td>
      <td><input name="Arrange" type="text" id="Arrange" value="0" size="3">
        只能为数字 </td>
    </tr>
    <tr bgcolor="#EEEEFF"> 
      <td height="16"> <div align="center">说　明:</div></td>
      <td> <textarea name="bak" cols="40" rows="4" id="bak"></textarea></td>
    </tr>
    <tr> 
      <td height="16" bgcolor="#000066">&nbsp;</td>
      <td bgcolor="#000066"> <input type="submit" name="Submit" value="-确定新增-"></td>
    </tr>
  </table>
</form>
<p>&nbsp;</p>
<div align="center"> 
  <table width="50%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td><font color="#FF0000" size="2" ><%= msg %></font></td>
    </tr>
  </table>
  <p>&nbsp;</p>
  <p align="left">这里所加的推荐客户将会显示在首页的．部份客户的栏目里．</p>
</div>
</body>
</html>
