<!--#include file="mdb.asp"-->
<!--#include file="config.asp"-->
<!--#include file="chklogin.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>收藏夹</title>
<style type="text/css">
<!--
a {
	font-size: 12px;
	color: #6A6A6A;
}
a:visited {
	color: #4F4F4F;
	text-decoration: none;
}
a:active {
	color: #F97C00;
	text-decoration: none;
}
a:link {
	color: #4F4F4F;
	text-decoration: none;
}
a:hover {
	text-decoration: none;
	color: #F97C00;
}
body,td,th {
	font-size: 12px;
	color: #4F4F4F;
}
.greenborder {border:1px solid #7EC8EA;}
.greenborder1 {border-right:1px solid #7EC8EA; background-color:#EFF8FC}
.inp {width:154px;border:1px solid #7f9db9;color:#052A5C}
.inp1 {width:66px;border:1px solid #7f9db9;color:#052A5C;font-size:9px;height:15px;margin-right:2px}
.slct {width:158px}
.sub {width:36px}
body {
	margin-top: 0px;
}
.style1 {font-weight: bold}
-->
</style>
<script>
function addurlcheck()
{
    var form = document.addurlForm;
	if (form.title.value == "")
	{
		alert("网站名称不能为空!");
		form.title.focus();
		return false;
	}
	if (form.title.value.length > 20)
	{
		alert("网站名称最多为20个汉字!");
		form.title.focus();
		return false;
	}
	if (form.url.value == "")
	{
		alert("网址不能为空!");
		form.url.focus();
		return false;
	}
	if (form.url.value.length > 100)
	{
		alert("网址最长为100个字符!");
		form.url.focus();
		return false;
	}
	if (form.memo.value.length > 50)
	{
		alert("备注最多为50个汉字!");
		form.memo.focus();
		return false;
	}
	return true;
}
function upurlcheck()
{
    var form = document.upurlForm;
	if (form.title.value == "")
	{
		alert("网站名称不能为空!");
		form.title.focus();
		return false;
	}
	if (form.title.value.length > 20)
	{
		alert("网站名称最多为20个汉字!");
		form.title.focus();
		return false;
	}
	if (form.url.value == "")
	{
		alert("网址不能为空!");
		form.url.focus();
		return false;
	}
	if (form.url.value.length > 100)
	{
		alert("网址最长为100个字符!");
		form.url.focus();
		return false;
	}
	if (form.memo.value.length > 50)
	{
		alert("备注最多为50个汉字!");
		form.memo.focus();
		return false;
	}
	return true;
}
</script>
</head>

<body>
<%set rs=server.createobject("adodb.recordset")
set rss=server.createobject("adodb.recordset")
rs.open"select * from lg50_my_class where username='"&username&"'",conn,1,3
if rs.eof and rs.bof then
   Response.Write("<script language=javascript>alert('请先添加分类');this.location.href='class.asp?menu=addclass';</script>")
end if
rs.close
dim title,url,memo,urlid,classid
urlid=Request("urlid")
classid=Request("classid")
title=Trim(Request("title"))
url=Trim(Request("url"))
memo=Trim(Request("memo"))
select case Request("menu")
case "addurl"
addurl()
case "upurl"
upurl()
case "addchkurl"
addchkurl()
case "upchkurl"
upchkurl()
case "searchurl"
searchurl()
end select
sub addurl()
%>
<form action="?" method="post" name="addurlForm" onSubmit="return addurlcheck();">
  <table width="100%"  border="0" cellpadding="3" cellspacing="1" bgcolor="#62B0FF">
    <tr>
      <td width="7%" bgcolor="#BFDFFF">网站名：</td>
      <td width="93%" bgcolor="#FFFFFF"><input name="title" type="text" id="title">
        最多20个汉字&nbsp;&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#BFDFFF">网&nbsp;&nbsp;址：</td>
      <td bgcolor="#FFFFFF"><input name="url" type="text" id="url" value="http://"></td>
    </tr>
    <tr>
      <td bgcolor="#BFDFFF">分&nbsp;&nbsp;类：</td>
      <td bgcolor="#FFFFFF">
        <%rss.open "select * from lg50_my_class where username='"&username&"' order by id desc",conn,1,3%>
        <select name="classid">
          <%while not rss.eof%>
          <option value='<%=rss("id")%>' selected><%=rss("classname")%></option>
          <%rss.movenext
	  wend
	  rss.close%>
        </select>
      </td>
    </tr>
    <tr>
      <td bgcolor="#BFDFFF">备&nbsp;&nbsp;注：</td>
      <td bgcolor="#FFFFFF"><textarea name="memo" id="memo"></textarea></td>
    </tr>
    <tr>
      <td bgcolor="#BFDFFF">操&nbsp;&nbsp;作：</td>
      <td bgcolor="#FFFFFF"><input type="hidden" name="menu" value="addchkurl"><input type="submit" name="Submit2" value="提交">
          <input type="reset" name="Submit3" value="取消">
      </td>
    </tr>
  </table>
</form>
<%end sub
sub upurl()
rs.open "select * from lg50_my_url where id="&urlid,conn,1,3
%>
<form action="?" method="post" name="upurlForm" onSubmit="return upurlcheck();">
  <table width="100%"  border="0" cellpadding="3" cellspacing="1" bgcolor="#62B0FF">
    <tr>
      <td width="7%" bgcolor="#BFDFFF">网站名：</td>
      <td width="93%" bgcolor="#FFFFFF"><input name="title" type="text" id="title" value="<%=rs("name")%>">
        最多20个汉字&nbsp;&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#BFDFFF">网&nbsp;&nbsp;址：</td>
      <td bgcolor="#FFFFFF"><input name="url" type="text" id="url" value="<%=rs("url")%>"></td>
    </tr>
    <tr>
      <td bgcolor="#BFDFFF">分&nbsp;&nbsp;类：</td>
      <td bgcolor="#FFFFFF">
        <%rss.open "select * from lg50_my_class where username='"&username&"' order by id desc",conn,1,3%>
        <select name="classid">
          <%while not rss.eof
		  if rss("id")=rs("classid") then
		  %>
          <option value='<%=rss("id")%>' selected><%=rss("classname")%></option>
		  <%else%>
		  <option value='<%=rss("id")%>'><%=rss("classname")%></option>
          <%end if
		  rss.movenext
	  wend
	  rss.close%>
        </select>
      </td>
    </tr>
    <tr>
      <td bgcolor="#BFDFFF">备&nbsp;&nbsp;注：</td>
      <td bgcolor="#FFFFFF"><textarea name="memo" id="memo"><%=trim(rs("memo"))%></textarea></td>
    </tr>
    <tr>
      <td bgcolor="#BFDFFF">操&nbsp;&nbsp;作：</td>
      <td bgcolor="#FFFFFF"><input type="hidden" name="menu" value="upchkurl"><input type="hidden" name="urlid" value='<%=urlid%>'>
      <input type="submit" name="Submit22" value="提交">
          <input type="reset" name="Submit32" value="取消">
      </td>
    </tr>
  </table>
</form>
<%rs.close
end sub
sub addchkurl()
rs.open "select * from lg50_my_url",conn,1,3
rs.addnew
rs("username")=username
rs("name")=title
rs("classid")=classid
rs("url")=url
if memo="" then memo=" "
rs("memo")=memo
rs.update
rs.close
Response.Write("<script language=javascript>alert('网址添加成功');this.location.href='main.asp';</script>")
end sub
sub upchkurl()
rs.open "select * from lg50_my_url where id="&urlid,conn,1,3
rs("name")=title
rs("classid")=classid
rs("url")=url
if memo="" then memo=" "
rs("memo")=memo
rs.update
rs.close
Response.Write("<script language=javascript>alert('网址修改成功');this.location.href='main.asp';</script>")
end sub
sub searchurl()%>
<form action="?" method="post" name="addurlForm" onSubmit="return upurlcheck();">
  <table width="100%"  border="0" cellpadding="3" cellspacing="1" bgcolor="#62B0FF">
    <tr>
      <td width="7%" bgcolor="#BFDFFF">网站名：</td>
      <td width="93%" bgcolor="#FFFFFF"><input name="title" type="text" id="title" value="<%=title%>">
        最多20个汉字&nbsp;&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#BFDFFF">网&nbsp;&nbsp;址：</td>
      <td bgcolor="#FFFFFF"><input name="url" type="text" id="url" value="<%=url%>"></td>
    </tr>
    <tr>
      <td bgcolor="#BFDFFF">分&nbsp;&nbsp;类：</td>
      <td bgcolor="#FFFFFF">
        <%rss.open "select * from lg50_my_class where username='"&username&"' order by id desc",conn,1,3%>
        <select name="select">
          <%while not rss.eof%>
          <option value='<%=rss("id")%>'><%=rss("classname")%></option>
          <%
		  rss.movenext
	  wend
	  rss.close%>
        </select>
      </td>
    </tr>
    <tr>
      <td bgcolor="#BFDFFF">备&nbsp;&nbsp;注：</td>
      <td bgcolor="#FFFFFF"><textarea name="textarea" id="textarea"><%=trim(memo)%></textarea></td>
    </tr>
    <tr>
      <td bgcolor="#BFDFFF">操&nbsp;&nbsp;作：</td>
      <td bgcolor="#FFFFFF"><input type="hidden" name="menu" value="addchkurl">
          <input type="submit" name="Submit" value="提交">
          <input type="reset" name="Submit3" value="取消">
      </td>
    </tr>
  </table>
</form>
<%end sub%>
</body>
</html>

