<!--#include file="Inc/conn.asp"-->
<!--#include file="Inc.asp"--><!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><%=SiteTitle%>-链接申请</title>
<meta name="keywords" content="<%=Sitekeywords%>" />
<meta name="description" content="<%=Sitedescription%>" />
<style>
body {margin:0;padding:0;}
body,td {font-size:12px;}
</style>
</head>

<body>
<%
	if request("action") = "add" then
		call add()
	elseif request("action")="savenew" then
		call savenew()
	else
		call add()
	end if

sub add()
%>
<script language=javascript>
function CheckForm()
{
  if (document.myform.Title.value==""){
	alert("请填写网站名称！");
	document.myform.Title.focus();
	return false;
  }
  if (document.myform.LinkUrl.value==""){
	alert("请填写网址！");
	document.myform.LinkUrl.focus();
	return false;
  }
  if (document.myform.QQ.value==""){
	alert("请填写联系QQ！");
	document.myform.QQ.focus();
	return false;
  }
  var filter=/^\s*[0-9]{5,10}\s*$/;
  if (!filter.test(document.myform.QQ.value)) {
	alert("QQ填写不正确！");
	document.myform.QQ.focus();
	return false;
  }
}
</script>
<form onSubmit="return CheckForm();" id="myform" name="myform" method="post" action="?action=savenew">
  <table width="266" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-top:20px;">
    <tr>
      <td width="28%" height="30" align="right">网站名称：</td>
      <td width="72%" align="center"><input name="Title" type="text" id="Title" /></td>
    </tr>
    <tr>
      <td height="30" align="right">网站地址：</td>
      <td align="center"><input type="text" name="LinkUrl" id="LinkUrl" /></td>
    </tr>
    <tr>
      <td height="30" align="right">Logo地址：</td>
      <td align="center"><input type="text" name="LogoUrl" id="LogoUrl" /></td>
    </tr>
    <tr>
      <td height="30" align="right">站长QQ：</td>
      <td align="center"><input type="text" name="QQ" id="QQ" /></td>
    </tr>
    <tr>
      <td height="30">&nbsp;</td>
      <td align="left" style="padding-left:20px;"><input type="submit" name="button" id="button" value="申请" /></td>
    </tr>
  </table>
</form>
<%
End Sub

sub savenew()
	Title			=LoseHtml(trim(request.form("Title")))
	LinkUrl			=LoseHtml(trim(request.form("LinkUrl")))
	LogoUrl			=LoseHtml(trim(request.form("LogoUrl")))
	QQ				=LoseHtml(trim(request.form("qq")))
	
	if Title="" or LinkUrl="" or QQ="" then
		Call Alert ("请填写完整","-1")
	end if
	
	If session("linkposttime")<>"" then
		If DateDiff("s",session("linkposttime"),Now())<36 then
		Call Alert ("你提交的太快了,稍后再来申请","-1")
  		end if
	end if
	
	If Not Checkpost(True) Then Call Alert("禁止外部提交!","-1")
	set rs = server.CreateObject ("adodb.recordset")
	sql="select * from "&tbname&"_Link"
	rs.open sql,conn,1,3
		rs.AddNew
		rs("Title")				=Title
		rs("ClassID")			=1
		rs("LinkUrl")			=LinkUrl	
		rs("LogoUrl")			=LogoUrl
		rs("AddTime")			=Now()
		rs("LastTime")			=Now()+30
		rs("yn")				=0
		rs("Moneys")			=0
		rs("QQ")				=QQ
		rs("Num")				=Mydb("Select Max([Num]) From ["&tbname&"_Link]",1)(0)+1
		rs("IP")				= GetIP
		rs.update
		Session("linkposttime") =Now()
		Response.Write("<div style=""padding:50px 0;text-align:center;color:#ff0000;"">添加成功，等待审核！请在贵站加上本站链接。</div>")
	rs.close
	set rs=nothing
end sub
%>
</body>
</html>