<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="conn.asp"-->
<!--#include file="md5.asp"-->
<!--#include file="common.asp"-->
<%
Const MustBe="<font color=red>*</font>"

dim SiteName
dim SiteURL
dim MasterName
dim Email
dim PageWidth
dim Unit

dim IsSort

dim PR
dim Alexa
dim GOOGLE
dim BaiDu

dim IsConfirm
dim IsVerify
dim IsActivation
dim SpecialNote
dim OrderBy
dim MaxPerPage
dim LogoWidth
dim LogoHeight

dim WordsCount
dim AltCount

dim RadEmail
dim RadQQ
dim RadMSN
dim RadTel
dim RadFax
dim RadMobileTel

dim IsUpload

sql="select * from setting"
set rs=conn.execute (sql)
if not rs.eof then
	SiteName=rs("SiteName")
	SiteURL=rs("SiteURL")
	MasterName=rs("MasterName")
	Email=rs("Email")
	
	PageWidth=rs("PageWidth")
	Unit=rs("Unit")
	
	IsSort=rs("IsSort")
	
	PR=rs("PR")
	Alexa=rs("Alexa")
	GOOGLE=rs("GOOGLE")
	BaiDu=rs("BaiDu")
	
	IsConfirm=rs("IsConfirm")
	IsVerify=rs("IsVerify")
	IsActivation=rs("IsActivation")
	SpecialNote=rs("SpecialNote")
	OrderBy=rs("OrderBy")
	MaxPerPage=rs("MaxPerPage")
	LogoWidth=rs("LogoWidth")
	LogoHeight=rs("LogoHeight")
	
	WordsCount=rs("WordsCount")
	AltCount=rs("AltCount")
	
	RadEmail=rs("RadEmail")
	RadQQ=rs("RadQQ")
	RadMSN=rs("RadMSN")
	RadTel=rs("RadTel")
	RadFax=rs("RadFax")
	RadMobileTel=rs("RadMobileTel")

	IsUploadLogo=rs("IsUploadLogo")
	
	rs.close
end if
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><%response.write SiteName&"-自助友情链接系统 V1.7 - Power By DATA100.NET"%></title>
<LINK href="css.css" type=text/css rel=stylesheet>
<script>
function CloseOpen(Num){
	var CurrObj=eval("Tab"+Num);
	if (CurrObj.style.display!="none"){
		CurrObj.style.display="none";
		window.event.srcElement.src="img/collapsed_yes.gif"
	} else {
		CurrObj.style.display="";
		window.event.srcElement.src="img/collapsed_no.gif"
	}
}

function submitform(Num){
	var CurrForm=eval("form"+Num);
	if (Num!=6)
		if (checkform(CurrForm)==false) return false;
	CurrForm.action="signup.asp";
	CurrForm.method="post";
	CurrForm.submit();
}

function checkform(CurrForm){
	for(i=0;i<CurrForm.elements.length;i++){
		if (CurrForm.elements[i].value=="" || CurrForm.elements[i].value=="http://"){
			if (CurrForm.elements[i].MustBe==3){
				alert("请添加必需信息。");
				CurrForm.elements[i].focus();
				return false;
			}
		}
	}
	if (CurrForm.passsword.value!=CurrForm.repasssword.value){
		alert("两次输入的密码不致。");
		CurrForm.repasssword.focus();
		return false;
	}
}

function openurl(){
	var width,height,left,top;
	width=500;
	height=200;
	left=screen.Width/2-width/2;
	top=(screen.Height-25)/2-height/2;
	window.open ('data100_net_uplogo.asp', 'uplogo', 'height='+height+', width='+width+', top='+top+', left='+left+', toolbar=no, menubar=no,scrollbars=no,resizable=no,location=no, statu s=no')	
}

</script>
</head>

<body>
<table  border="0" align="center" cellpadding="0" cellspacing="0" width="<%=PageWidth&Unit%>">
  <tr>
    <td>
<%
Call head()
Select case Request("step")
case ""
	Call signup()
case "1"
	Call checksignup()
case "2"
	Call intodb()
end Select
%>	
	</td>
  </tr>
</table>
<br>
<%sub head%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#698CC3">
  <tr>
	<td bgcolor="#FFFFFF">
	<table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>
	<table width="99%" height="30"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="698cc3" class="title">
	  <tr>
		<td><%response.write "&nbsp;<a class=""atitle"" href="""&SiteURL&""" target=_blank>"&SiteName&"</a>-<a class=""atitle"" href=""default.asp"">自助友情链接系统 V1.7</a>"%>
		</td>
		<td align="right">&nbsp;</td>
	  </tr>
	</table>
	<table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>
	<!--显示与隐藏的表格-->
	<table width="99%"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="d6e0ef" style="display:" id="Tab2">
	  <tr bgcolor="#FFFFFF">
		<td height="20">申请步骤: 注册账号-&gt;获得我站链接代码并在贵站添加我站链接代码</td>
	  </tr>
	  <tr align="center" bgcolor="#FFFFFF">
		<td height="20" align="left"><%
		
		if PR>0 then
			response.write "※ 友情链接交换,要求贵站<font color=cc0000>PR值≧"&PR&"</font>,否则不能通过自动检查.<br>"
		end if
		if Alexa>0 then
			response.write "※ 友情链接交换,要求贵站<font color=cc0000>Alexa排名"&Alexa&"</font>以上,否则不能通过自动检查.<br>"
		end if
		if GOOGLE>0 then
			response.write "※ 友情链接交换,要求贵站<font color=cc0000>GOOGLE收录"&GOOGLE&"</font>以上,否则不能通过自动检查.<br>"
		end if
		if BaiDu>0 then
			response.write "※ 友情链接交换,要求贵站<font color=cc0000>BaiDu收录"&BaiDu&"</font>以上,否则不能通过自动检查.<br>"
		end if
		
		response.write "※  如果您打算使用LOGO图片,请注意图片格式为 "&LogoWidth&"×"&LogoHeight&" 像素.<br>"
		if IsActivation=true then
			response.write "※  注意,申请成功后,需要从中贵站的链接入我站一次,进行<font color=cc0000>激活</font>才能显示.<br>"
		end if
		if IsVerify=true then
			response.write "※  所有申请的友情链接都要通过站长的<font color=cc0000>审核</font>才能显示.<br>"
		end if
		
		if SpecialNote<>"" then
			response.write replace(SpecialNote,chr(13),"<br>")&"<br>"
		end if
		%></td>
	  </tr>
	  <tr bgcolor="#FFFFFF">
		<td height="20">有任何问题,请联系站长:<a href="mailto:<%=Email%>"><%=MasterName%></a></td>
	  </tr>
	</table>
	  <!--显示与隐藏的表格-->
	<table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>
	</td>
  </tr>
</table>
<table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>
<br>
<%end sub%>		

<!--显示与隐藏的表格-->
<%sub signup %>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#698CC3">
<form id="form5" name="form5">
  <tr>
    <td bgcolor="#FFFFFF">
	<table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>
        <table width="99%" height="30"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="698cc3" class="title">
          <tr>
            <td>&nbsp;申请友情链接-第一步(注册账号)</td>
            <td align="right">&nbsp; </td>
          </tr>
        </table>
		<table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>
        <!--显示与隐藏的表格-->
        <table width="99%"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="d6e0ef" style="display:" id="Tab3">
          <tr bgcolor="#FFFFFF">
            <td width="35%" height="20">用户名<%=MustBe%>:</td>
            <td>
			<input name="username" type="text" id="username" size="50" maxlength="50" style="width:350px;" MustBe=3></td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td height="20">密码<%=MustBe%>:</td>
            <td>
			<input name="passsword" type="password" id="passsword" size="50" maxlength="20" style="width:350px;" MustBe=3></td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td height="20">确认密码<%=MustBe%>:</td>
            <td>
			<input name="repasssword" type="password" id="repasssword" size="50" maxlength="20" style="width:350px;" MustBe=3></td>
          </tr>
		  <%if RadEmail>1 then%>
          <tr bgcolor="#e9effe">
            <td height="20">电子邮箱<%if RadEmail>2 then response.write MustBe%>:</td>
            <td>
			<input name="email" type="text" id="email" size="50" maxlength="80" style="width:350px;" MustBe=<%=RadEmail%>>
          </tr>
		  <%end if%>
		  <%if RadQQ>1 then%>
          <tr bgcolor="#e9effe">
            <td height="20">QQ<%if RadQQ>2 then response.write MustBe%>:</td>
            <td>
			<input name="QQ" type="text" id="QQ" size="50" maxlength="80" style="width:350px;" MustBe=<%=RadQQ%>>
          </tr>
		  <%end if%>
		  <%if RadMSN>1 then%>
          <tr bgcolor="#e9effe">
            <td height="20">MSN<%if RadMSN>2 then response.write MustBe%>:</td>
            <td>
			<input name="MSN" type="text" id="MSN" size="50" maxlength="80" style="width:350px;" MustBe=<%=RadMSN%>>
          </tr>
		  <%end if%>
		  <%if RadTel>1 then%>
          <tr bgcolor="#e9effe">
            <td height="20">电话<%if RadTel>2 then response.write MustBe%>:</td>
            <td>
			<input name="TEL" type="text" id="TEL" size="50" maxlength="80" style="width:350px;" MustBe=<%=RadTel%>>
          </tr>
		  <%end if%>
		  <%if RadFax>1 then%>
          <tr bgcolor="#e9effe">
            <td height="20">传真<%if RadFax>2 then response.write MustBe%>:</td>
            <td>
			<input name="FAX" type="text" id="FAX" size="50" maxlength="80" style="width:350px;" MustBe=<%=RadFax%>>
          </tr>
		  <%end if%>
		  <%if RadMobileTel>1 then%>
          <tr bgcolor="#e9effe">
            <td height="20">手机<%if RadMobileTel>2 then response.write MustBe%>:</td>
            <td>
			<input name="MobileTel" type="text" id="MobileTel" size="50" maxlength="80" style="width:350px;" MustBe=<%=RadMobileTel%>>
          </tr>
		  <%end if%>
		<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
          <tr bgcolor="#FFFFFF">
            <td width="35%" height="20">贵网站名称<%=MustBe%>:</td>
            <td>
			<input name="Y_SiteName" type="text" id="Y_SiteName" maxlength="200" style="width:350px;" MustBe=3>
            <font color=cc0000>(少于<%=WordsCount%>字)</font></td>
          </tr>
		<%if IsSort=true then%>
		  <tr bgcolor=#FFFFFF>
			<td height="20">站点所属类别<%=MustBe%>:</td>
			<td>
			<select name="OwnerClass" id="OwnerClass" style="width:350px;" MustBe=3>
			<%
			sql="select * from linkclass "
			set rs=conn.execute (sql)
			if not rs.eof then
				while not rs.eof
			%>	
				<option value=<%=rs("ID")%>><%=rs("ClassName")%></option>
			<%
				rs.movenext
				wend
				rs.close
			end if
			%></select>
			</td>
		  </tr>	
		<%end if%>
          <tr bgcolor="#FFFFFF">
            <td height="20">LOGO图片地址:</td>
            <td>
			<input name="Y_Logo" type="text" id="Y_Logo" value="http://" maxlength="200" style="width:350px;" MustBe=2>
			<%if IsUploadLogo then%>
			<input type="button" name="uploadlogo" style="height:20px;" value="上传LOGO" onClick="openurl('upload')" MustBe=1>
			<%end if%>
			</td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td height="20">网站简介:</td>
            <td>
			<textarea name="Y_Alt" rows="5" id="Y_Alt" style="width:350px;" MustBe=2></textarea>
            <font color=cc0000>(少于<%=AltCount%>字)</font></td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td height="20">您希望我站链接到贵站哪个地址<%=MustBe%>:</td>
            <td>
			<input name="Y_SiteURL" type="text" id="Y_SiteURL" value="http://" maxlength="200" style="width:350px;" MustBe=3></td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td height="20">我站的链接代码在贵站哪个位置<%=MustBe%>:</td>
            <td><input name="Y_MyLink" type="text" id="Y_MyLink" value="http://"maxlength="200" style="width:350px;" MustBe=3></td>
          </tr>
		  <tr align="center" bgcolor="#FFFFFF">
            <td height="20" colspan="2">
			<input type="button" name="Submit" value=" 下一步 " onClick="submitform(5);">              
			&nbsp; 
			<input type="reset" name="Submit" value=" 重 设 ">
			<input name="step" type="hidden" id="step" value="1">
			</td>
		  </tr>
        </table>
        <!--显示与隐藏的表格-->
		<table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>
	  </td>
  </tr></form>
</table>
<br>
<%end sub%>

<%
sub checksignup
	dim username
	dim passsword
	dim repasssword
	dim userid
	
	dim Email
	dim QQ
	dim MSN
	dim Tel
	dim Fax
	dim MobileTel
	
	dim Y_SiteName
	dim Y_SiteURL
	dim Y_Logo
	dim Y_Alt
	dim Y_MyLink
	
	dim ClassName	
	
	username=trim(replace(request("username"),"'",""))
	passsword=trim(replace(request("passsword"),"'",""))
	repasssword=trim(replace(request("repasssword"),"'",""))

	if username="" or passsword="" or repasssword="" then
		Errmsg = Errmsg+"<li>请填写必需的信息。"
		Call ErrList(Errmsg)
		exit sub		
	elseif passsword <> repasssword then
		Errmsg = Errmsg+"<li>密码与确认密码不符。"
		Call ErrList(Errmsg)
		exit sub
	end if

	'sql="select * from link where username='"&username&"'"
	'rs.open sql,conn,1,3
	'if not rs.eof then
	'	Errmsg = Errmsg+"<li>这个用户名已经有人用了,请更换一个。"
	'	Call ErrList(Errmsg)
	'	exit sub		
	'end if
	'rs.close

	email=trim(replace(request("email"),"'",""))
	QQ=trim(replace(request("QQ"),"'",""))
	MSN=trim(replace(request("MSN"),"'",""))
	Tel=trim(replace(request("Tel"),"'",""))
	Fax=trim(replace(request("Fax"),"'",""))
	MobileTel=trim(replace(request("MobileTel"),"'",""))
	
	dim Rad
	Rad=0
	if RadEmail=3 and email="" then
		Rad=1
	end if
	
	if RadQQ=3 and QQ="" then
		Rad=1
	end if
	if RadMSN=3 and MSN="" then
		Rad=1
	end if
	if RadTel=3 and Tel="" then
		Rad=1
	end if
	if RadFax=3 and Fax="" then
		Rad=1
	end if
	if RadMobileTel=3 and MobileTel="" then
		Rad=1
	end if
	
	if Rad=1 then
		Errmsg = Errmsg+"<li>请填写必需信息。"
		Call ErrList(Errmsg)
		exit sub		
	end if
	
	Y_SiteName=trim(replace(request("Y_SiteName"),"'",""))
	Y_Logo=trim(replace(request("Y_Logo"),"'",""))
	Y_Alt=trim(replace(request("Y_Alt"),"'",""))
	Y_SiteURL=trim(replace(request("Y_SiteURL"),"'",""))
	Y_MyLink=trim(replace(request("Y_MyLink"),"'",""))

	if Y_SiteName="" or Y_SiteURL="" or lcase(Y_SiteURL)="http://" or Y_MyLink="" or lcase(Y_MyLink)="http://" then
		Errmsg = Errmsg+"<li>请填写必需信息。"
		Call ErrList(Errmsg)
		exit sub		
	end if

	if GetWordsCount(Y_SiteName)>WordsCount then
		Errmsg = Errmsg+"<li>您的站点的名称字数<"&GetWordsCount(Y_SiteName)&">大于系统规定字数<"&WordsCount&">。"
		Call ErrList(Errmsg)
		exit sub		
	end if
	
	if GetWordsCount(Y_Alt)>AltCount then
		Errmsg = Errmsg+"<li>您的站点的介绍字数<"&GetWordsCount(Y_Alt)&">大于系统规定字数<"&AltCount&">。"
		Call ErrList(Errmsg)
		exit sub		
	end if
	
	if lcase(Y_Logo)="http://" then
		Y_Logo=""
	end if
	
	'第一步,判断我站链接所在位置和申请的链接是否为同一域
	if left(Y_SiteURL,7)<>"http://" then
		Errmsg = Errmsg+"<li>请注意您的URL格式,应以http://开头。"
		Call ErrList(Errmsg)
		exit sub		
	end if
	
	Y_SiteURL_Arr=Split(Y_SiteURL,"/")
	Y_MyLink_Arr=Split(Y_MyLink,"/")
	
	if Y_SiteURL_Arr(2)<>Y_MyLink_Arr(2) then
		Errmsg = Errmsg+"<li>申请友情链接的域和我站链接代码不在同一个域内。"
		Call ErrList(Errmsg)
		exit sub		
	end if
	
	call getcode (username,email,passsword,repasssword,QQ,MSN,Tel,Fax,MobileTel,Y_SiteName,Y_SiteURL,Y_Logo,Y_Alt,Y_MyLink,OwnerClass)
end sub
%>

<%sub getcode(username,email,passsword,repasssword,QQ,MSN,Tel,Fax,MobileTel,Y_SiteName,Y_SiteURL,Y_Logo,Y_Alt,Y_MyLink,OwnerClass)%>
<%
dim L_SiteName
dim L_SiteURL
dim L_Logo
dim L_Alt
sql="select IsConfirm,SiteURL,L_SiteName,L_SiteURL,L_Logo,L_Alt,WordsCount,AltCount from setting"
set rs=conn.execute (sql)
if not rs.eof then
	IsConfirm=rs("IsConfirm")
	SiteURL=rs("SiteURL")
	L_SiteName=rs("L_SiteName")
	L_SiteURL=rs("L_SiteURL")
	L_Logo=rs("L_Logo")
	L_Alt=rs("L_Alt")
	
	WordsCount=rs("WordsCount")
	AltCount=rs("AltCount")
end if
link="http://"&request.ServerVariables("HTTP_HOST")&_
	replace(request.ServerVariables("URL"),"signup.asp","linkforward.asp")&_
	"?friendid="&(username)
	
wordlink="<a href="""&link&""" target=_blank title="""&L_Alt&""">"&L_SiteName&"</a>"
logolink="<a href="""&link&""" target=_blank><img border=0 src="""&L_Logo&""" alt="""&L_Alt&"""></a>"
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#698CC3">
  <tr>
    <td bgcolor="#FFFFFF">
	<table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>
        <table width="99%" height="30"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="698cc3" class="title">
          <tr>
            <td>&nbsp;申请友情链接-第二步(获得我站链接代码并在贵站添加我站链接代码)</td>
            <td align="right">&nbsp; </td>
          </tr>
        </table>
        <table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td></td>
          </tr>
        </table>
        <!--显示与隐藏的表格-->
        <table width="99%"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="d6e0ef" style="display:" id="Tab4">
          <tr bgcolor="#FFFFFF">
            <td width="50%" height="20"><strong>文字链接</strong>:</td>
            <td><strong>图片链接</strong>:</td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td height="20"><%=wordlink%></td>
            <td><%=logolink%></td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td height="20"><font color=red><strong>标准代码:</strong></font><br>
            <textarea cols="50" name="textarea2" rows="6"><%=wordlink%></textarea></td>
            <td><font color=red><strong>标准代码:</strong></font><br>
              <textarea cols="50" name="textarea" rows="6"><%=logolink%></textarea></td></tr>
          <tr bgcolor="#FFFFFF">
            <td height="20"><font color=red><strong>指导代码:</strong></font><br>
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td>网站名称:</td>
                <td><input name="L_SiteName" type="text" value="<%=L_SiteName%>" size="50" maxlength="80" readonly></td>
              </tr>
              <tr>
                <td>站点地址:</td>
                <td><input name="L_SiteURL" type="text" value="<%=link%>" size="50" maxlength="80" readonly></td>
              </tr>
              <tr>
                <td>站点说明:</td>
                <td><input name="L_Alt" type="text" value="<%=L_Alt%>" size="50" maxlength="80" readonly></td>
              </tr>
              <tr>
                <td>LOGO:</td>
                <td><input name="L_Logo" type="text" size="50" maxlength="80" readonly></td>
              </tr>
            </table>            </td>
            <td><font color=red><strong>指导代码:</strong></font><br>
              <table width="100%" border="0" cellspacing="0" cellpadding="0">

                <tr>
                  <td>网站名称:</td>
                  <td><input name="L_SiteName2" type="text" value="<%=L_SiteName%>" size="50" maxlength="80" readonly></td>
                </tr>
                <tr>
                  <td>站点地址:</td>
                  <td><input name="L_SiteURL2" type="text" value="<%=link%>" size="50" maxlength="80" readonly></td>
                </tr>
                <tr>
                  <td>站点说明:</td>
                  <td><input name="L_Alt2" type="text" value="<%=L_Alt%>" size="50" maxlength="80" readonly></td>
                </tr>
                <tr>
                  <td>LOGO:</td>
                  <td><input name="L_Logo2" type="text" value="<%=L_Logo%>" size="50" maxlength="80" readonly></td>
                </tr>
              </table></td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td height="20" colspan="2">※ 如果您的站点也使用类似的友情链接系统,可以按照指导代码添加链接</td>
          </tr>
	  </table>
        <!--显示与隐藏的表格-->
        <table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td></td>
          </tr>
      </table></td>
  </tr>
</table>
<br>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#698CC3">
  <tr>
    <td bgcolor="#FFFFFF"><table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td></td>
      </tr>
    </table>
        <table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td></td>
          </tr>
      </table>
      <!--显示与隐藏的表格-->
        <table width="99%"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="d6e0ef" style="display:" id="Tab4">
          <form name="form6">
					<tr bgcolor="#FFFFFF">
            <td>
						  <input type="hidden" name="username" value="<%=username%>" ID="username">
						  <input type="hidden" name="passsword" value="<%=passsword%>" ID="passsword">
						  <input type="hidden" name="repasssword" value="<%=repasssword%>" ID="repasssword">
						  <input type="hidden" name="email" value="<%=email%>" ID="email">
						  <input type="hidden" name="QQ" value="<%=QQ%>" ID="QQ">
						  <input type="hidden" name="MSN" value="<%=MSN%>" ID="MSN">
						  <input type="hidden" name="Tel" value="<%=Tel%>" ID="Tel">
						  <input type="hidden" name="Fax" value="<%=Fax%>" ID="Fax">
						  <input type="hidden" name="MobileTel" value="<%=MobileTel%>" ID="MobileTel">
						  <input type="hidden" name="Y_SiteName" value="<%=Y_SiteName%>" ID="Y_SiteName">
						  <input type="hidden" name="Y_SiteURL" value="<%=Y_SiteURL%>" ID="Y_SiteURL">
						  <input type="hidden" name="Y_Logo" value="<%=Y_Logo%>" ID="Y_Logo">
						  <input type="hidden" name="Y_Alt" value="<%=Y_Alt%>" ID="Hidden1">
						  <input type="hidden" name="Y_MyLink" value="<%=Y_MyLink%>" ID="Y_MyLink">
						  <input type="hidden" name="OwnerClass" value="<%=OwnerClass%>" ID="OwnerClass">
						  <input name="step" type="hidden" id="step" value="2">							
						<%
			
			if IsVerify=true then
				response.write "<li>系统已经开启<管理员手动审核>功能.<br>"
				response.write "&nbsp;&nbsp;&nbsp;&nbsp;请您尽快放好我站的链接代码,我们会在24小时内审核您的交换申请.<br>"
			end if
			if IsConfirm=true then
				response.write "<li>系统已经开启<自动检查贵站是否已经做好我站链接>功能.<br>"
				response.write "&nbsp;&nbsp;&nbsp;&nbsp;请您在点击下一步之前,在您的网站指定页面加上我站链接代码.<br>"
			end if
			if IsActivation=true then
				response.write "<li>系统已经开启<需要激活>功能.<br>"
				response.write "&nbsp;&nbsp;&nbsp;&nbsp;申请成功后,需要从中贵站的链接点入我站一次,进行激活才能显示."
			end if
			%>            </td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td height="20" align="center">
						<input type="button" name="Submit2" value=" 下一步" onClick="submitform(6);">
              &nbsp;
              <input type="button" name="Submit2" value=" 取消 " onClick="window.close()"></td>
          </tr>
					</form>
        </table>
      <!--显示与隐藏的表格-->
        <table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td></td>
          </tr>
      </table></td>
  </tr>
</table>
<br>
<%end sub%>
<br>

<%sub intodb
	username=trim(replace(request("username"),"'",""))
	passsword=trim(replace(request("passsword"),"'",""))
	repasssword=trim(replace(request("repasssword"),"'",""))

	email=trim(replace(request("email"),"'",""))
	QQ=trim(replace(request("QQ"),"'",""))
	MSN=trim(replace(request("MSN"),"'",""))
	Tel=trim(replace(request("Tel"),"'",""))
	Fax=trim(replace(request("Fax"),"'",""))
	MobileTel=trim(replace(request("MobileTel"),"'",""))

	Y_SiteName=trim(replace(request("Y_SiteName"),"'",""))
	Y_Logo=trim(replace(request("Y_Logo"),"'",""))
	Y_Alt=trim(replace(request("Y_Alt"),"'",""))
	Y_SiteURL=trim(replace(request("Y_SiteURL"),"'",""))
	Y_MyLink=trim(replace(request("Y_MyLink"),"'",""))

	'第一步,判断我站链接所在位置和申请的链接是否为同一域
	if left(Y_SiteURL,7)<>"http://" then
		Errmsg = Errmsg+"<li>请注意您的URL格式,应以http://开头。"
		Call ErrList(Errmsg)
		exit sub		
	end if
	
	Y_SiteURL_Arr=Split(Y_SiteURL,"/")
	Y_MyLink_Arr=Split(Y_MyLink,"/")
	
	if Y_SiteURL_Arr(2)<>Y_MyLink_Arr(2) then
		Errmsg = Errmsg+"<li>申请友情链接的域和我站链接代码不在同一个域内。"
		Call ErrList(Errmsg)
		exit sub		
	end if

	'第二步,判断我站链接所在网页页面的PR值
	if PR>0 then
		Y_MyLink_PR=getPR(Y_MyLink)
		if Y_MyLink_PR< PR then
			Errmsg = Errmsg+"<li>对不起,我站的链接代码所在页面PR值<"&Y_MyLink_PR&">不符合我站的要求<"&PR&">。"
			Call ErrList(Errmsg)
			exit sub		
		end if
	end if

	'第三步,判断我站链接所在网页的所属域名的Alexa排名
	if Alexa>0 then
		Y_MyLink_Alexa=getAlexa(Y_MyLink)
		if CDbl(Alexa)<CDbl(Y_MyLink_Alexa) then
			Errmsg = Errmsg+"<li>对不起,贵站的Alexa世界排名值<"&RW(Y_MyLink_Alexa)&">不符合我站的要求<"&Alexa&">。"
			Call ErrList(Errmsg)
			exit sub		
		end if
	end if

	Y_MyLinkArr=split(Y_MyLink,"/")
	Y_MyLink_Get=Y_MyLinkArr(2)
	'第四步,判断GOOGLE收录情况
	if GOOGLE>0 then
		Y_MyLink_GOOGLE=getGOOGLE(Y_MyLink_Get)
		if CDbl(Y_MyLink_GOOGLE)<CDbl(GOOGLE) then
			Errmsg = Errmsg+"<li>对不起,贵站的GLLGLE的收录数量<"&Y_MyLink_GOOGLE&">不符合我站的要求<"&GOOGLE&">。"
			Call ErrList(Errmsg)
			exit sub		
		end if
	end if
	
	'第五步,判断BaiDu收录情况
	if BaiDu>0 then
		Y_MyLink_BaiDu=getBaiDu(Y_MyLink_Get)	
		if CDbl(Y_MyLink_BaiDu)<CDbl(BaiDu) then
			Errmsg = Errmsg+"<li>对不起,贵站的BaiDu的收录数量<"&Y_MyLink_BaiDu&">不符合我站的要求<"&BaiDu&">。"
			Call ErrList(Errmsg)
			exit sub		
		end if
	end if
	
	if request("OwnerClass")<>"" then
		OwnerClass=request("OwnerClass")
	else
		OwnerClass=0
	end if
	
	'如果需要验证代码
	if IsConfirm=true then
		wstr=getHTTPPage(Y_MyLink,"gb2312")

		if not Instr(lcase(wstr),lcase("<a href=""http://"&request.ServerVariables("HTTP_HOST")&replace(request.ServerVariables("URL"),"signup.asp","linkforward.asp")))>0 then
			Errmsg = Errmsg+"<li>对不起,未在贵站的指定位置< "&server.HTMLEncode(Y_MyLink)&" >查找到我站的链接代码。"
			Call ErrList(Errmsg)
			exit sub		
		end if
	end if
	
	'如果不需要审核
	if IsVerify=false then IsVerify1=true:else IsVerify1=false:end if
	'如果不需要激活
	if IsActivation=false then goin=1:else goin=0:end if


	'如果一切合格,添加到友情链接数据库中
	sql="select top 1 * from link order by id"
	rs.open sql,conn,1,3
	rs.addnew
	rs("username")=username
	rs("passsword")=md5(passsword)
	
	if RadEmail=3 then
		rs("email")=email
	end if
	if RadQQ=3 then
		rs("QQ")=QQ
	end if
	if RadMSN=3 then
		rs("MSN")=MSN
	end if
	if RadTel=3 then
		rs("Tel")=Tel
	end if
	if RadFax=3 then
		rs("Fax")=Fax
	end if
	if RadMobileTel=3 then
		rs("MobileTel")=MobileTel
	end if
	
	rs("Y_SiteName")=Y_SiteName
	rs("OwnerClass")=OwnerClass
	rs("Y_SiteURL")=Y_SiteURL
	rs("Y_Logo")=Y_Logo
	rs("Y_Alt")=Y_Alt
	
	rs("Y_MyLink")=Y_MyLink
	rs("PR")=Y_MyLink_PR
	rs("PRDate")=now()
	rs("Alexa")=Y_MyLink_Alexa
	rs("AlexaDate")=now()
	rs("GOOGLE")=Y_MyLink_GOOGLE
	rs("GOOGLEDate")=now()
	rs("BaiDu")=Y_MyLink_BaiDu
	rs("BaiDuDate")=now()

	rs("IsVerify")=IsVerify1
	rs("goin")=goin

	rs("jointime")=now()
	rs.update
	
	call finished
end sub%>
							
<%sub finished%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#698CC3">
  <tr>
    <td bgcolor="#FFFFFF"><table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td></td>
      </tr>
    </table>
        <table width="99%" height="30"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="698cc3" class="title">
          <tr>
            <td>&nbsp;申请友情链接-第三步(结束)</td>
            <td align="right">&nbsp;</td>
          </tr>
        </table>
      <table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td></td>
          </tr>
        </table>
      <!--显示与隐藏的表格-->
        <table width="99%"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="d6e0ef" style="display:" id="Tab4">
            <tr bgcolor="#FFFFFF">
              <td>
<%
'输出成功信息
if IsVerify=true then
	response.write "<li>系统已经开启<管理员手动审核>功能.<br>"
	response.write "&nbsp;&nbsp;&nbsp;&nbsp;请您尽快放好我站的链接代码,我们会在24小时内审核您的交换申请.<br>"
end if
if IsActivation=true then
	response.write "<li>系统已经开启<需要激活>功能.<br>"
	response.write "&nbsp;&nbsp;&nbsp;&nbsp;申请成功后,需要从中贵站的链接点入我站一次,进行激活才能显示."
end if
%>						
							</td>
            </tr>
            <tr bgcolor="#FFFFFF">
              <td height="20" align="center">
							<input type="button" name="Submit2" value=" 查看链接" onClick="document.URL='default.asp'">
                &nbsp;
                <input type="button" name="Submit2" value=" 关闭窗口 " onClick="window.close()"></td>
            </tr>
        </table>
      <!--显示与隐藏的表格-->
        <table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td></td>
          </tr>
      </table></td>
  </tr>
</table>
<%end sub%>
</body>
</html>