<!--#include file="conn/conn.asp"-->
<link rel="stylesheet" href="<%=HOPE_InstallDir%>blue/blue.css" type="text/css" />
<%
dim qs,errc,iii
qs=request.servervariables("query_string")
dim nothis(19)
nothis(0)="net user"
nothis(1)="xp_cmdshell"
nothis(2)="/add"
nothis(3)="exec%20master.dbo.xp_cmdshell"
nothis(4)="net localgroup administrators"
nothis(5)="select"
nothis(6)="count"
nothis(7)="asc"
nothis(8)="char"
nothis(9)="mid"
nothis(10)="'"
nothis(11)=":"
nothis(12)=""""
nothis(13)="insert"
nothis(14)="delete"
nothis(15)="drop"
nothis(16)="truncate"
nothis(17)="from"
nothis(18)="%"
nothis(19)="update"
errc=false
for iii= 0 to ubound(nothis)
if instr(qs,nothis(iii))<>0 then
errc=true
end if
next
if errc then
  response.Write("<script>alert('对不起，非法URL地址请求!');history.back(-1);</script>")
	 response.End()
end if
function dvHTMLEncode(fString)
if not isnull(fString) then
    fString = replace(fString, ">", "&gt;")
    fString = replace(fString, "<", "&lt;")
    fString = Replace(fString, CHR(32), "&nbsp;")
    fString = Replace(fString, CHR(9), "&nbsp;")
     fString = Replace(fString, CHR(39), "&#39;")
    fString = Replace(fString, CHR(13), "")
    fString = Replace(fString, CHR(10) & CHR(10), "</P><P> ")
    fString = Replace(fString, CHR(10), "<BR> ")

    dvHTMLEncode = fString
end if
end function
dim sql,rs,ID,LinkType
dim Action,FoundErr,ErrMsg
Action=request("Action")
'ID=Replace_Text(Request("ID"))
LinkType=request("LinkType")
strFileName="Friendshiplink.asp?LinkType=" &LinkType
%><style type="text/css">
<!--
body {
	background-color: #404348;
}
-->
</style>

<form method="post" name="msform"  action="" >
  <table width="697" border="0" align="center" cellpadding="0" cellspacing="0" background="images/addlinkbg.jpg">
    <tr>
      <td ><table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0"  >
        <tr>
          <td height="517" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr >
                <td height="106" colspan="2" align="center" >添加友情链接</td>
              </tr>
              <tr >
                <td width="248" height="25" align="right"><strong>链接类型：&nbsp;&nbsp;</strong></td>
                <td height="25"><input name="LinkType" type="radio" onclick="logoshow()" value="1" checked="checked" />
                  Logo链接&nbsp;&nbsp;&nbsp;&nbsp;
                  <input type="radio" onclick="wenzi()" name="LinkType" value="2" />
                  文字链接</td>
              </tr>
              <script language="VBScript" type="text/vbscript">
	sub wenzi()
	logoa.style.display="none"
	end sub
	sub logoshow()
	logoa.style.display=""
	end sub
	  </script>
              <tr class="tdbg">
                <td width="248" height="25" align="right" valign="middle"><strong>网站名称：&nbsp;&nbsp;</strong></td>
                <td height="25"><input name="SiteName" size="30"  maxlength="20" title="这里请输入您的网站名称，最多为20个汉字" />
                    <font color="#FF0000"> *</font></td>
              </tr>
              <tr class="tdbg">
                <td width="248" height="25" align="right"><strong>网站地址：&nbsp;&nbsp;</strong></td>
                <td height="25"><input name="SiteUrl" size="30"  maxlength="100" type="text"  value="http://" title="这里请输入您的网站地址，最多为50个字符，前面必须带http://" />
                    <font color="#FF0000">*</font></td>
              </tr>
              <tr class="tdbg" id="logoa">
                <td width="248" height="25" align="right"><strong>网站Logo：&nbsp;&nbsp;</strong></td>
                <td height="25"><input name="fujian" size="30"  maxlength="100" type="text"  value="http://" title="这里请输入您的网站imageurl地址，最多为50个字符，如果您在第一选项选择的是文字链接，这项就不必填" /></td>
              </tr>
              <tr class="tdbg">
                <td width="248" height="25" align="right"><strong>站长姓名：&nbsp;&nbsp;</strong></td>
                <td height="25"><input name="SiteAdmin" size="30"  maxlength="20" type="text"  title="这里请输入您的大名了，不然我知道您是谁啊。最多为20个字符" /></td>
              </tr>
              <tr class="tdbg">
                <td width="248" height="25" align="right"><strong>电子邮件：&nbsp;&nbsp;</strong></td>
                <td height="25"><input name="Email" size="30"  maxlength="30" type="text" title="这里请输入您的联系电子邮件，最多为30个字符" /></td>
              </tr>
              <tr class="tdbg">
                <td width="248" align="right"><strong>网站简介：&nbsp;&nbsp;</strong></td>
                <td valign="middle"><textarea name="SiteIntro" cols="40" rows="5" id="SiteIntro" title="这里请输入您的网站的简单介绍"></textarea></td>
              </tr>
              <tr class="tdbg">
                <td align="right"><strong>验证码：&nbsp;&nbsp;</strong></td>
                <td valign="middle"><input name="Verifycode" class="mailboxbig" id="Verifycode"   tabindex=3 onKeyUp="value=value.replace(/[^\d]/g,'') " size=17 maxlength="5" tonbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"   style="border-width:1px; border-style:solid; border-collapse:collapse; border-color:#979A9F;width:120;height:20; background-color: #ffffff">&nbsp;<img src="vCode.asp?" alt="图片看不清？点击重新得到验证码" align="absbottom" style="cursor:hand;" onclick="this.src+=Math.random()" /></td>
              </tr>
              <tr class="tdbg">
                <td height="40" colspan="2" align="center"><input name="Action" type="hidden" id="Action" value="SaveAdd" />
                    <input type="submit" value=" 添 加 " name="cmdOk" />
                  &nbsp;
                  <input type="reset" value=" 取 消 " name="cmdReset" />                </td>
              </tr>
          </table></td>
        </tr>
      </table></td>
    </tr>
  </table>
  <%
Action=request("Action")
if Action="SaveAdd" then
call SaveAdd()
end if

sub SaveAdd()



LinkType=request("LinkType")
	LinkSiteName=request("SiteName")
	LinkSiteUrl=request("SiteUrl")
	Linkimageurl=request("fujian")
	LinkSiteAdmin=request("SiteAdmin")
	LinkEmail=request("Email")
	LinkSitePassword=request("SitePassword")
	LinkSitePwdConfirm=request("SitePwdConfirm")
	LInkSiteIntro=request("SiteIntro")
	verifycodes=request("Verifycode")
	
	if issession=0 then 
 	    safecode=request.Cookies("safecode")
     else
 	   safecode=Session("SafeCode")
 	 end if
	 
			 

		
  if  cstr(verifycodes)<>cstr(safecode)   then
				  Response.Write "<script>alert('输入表的验证码错误！');history.back();</script>"
				  response.end()
	else
	if LinkSiteName="" or LinkSiteUrl="" then 
	Response.write "<script>alert('信息不能为空！请输入必填项！');location.href='Friendshiplink.asp';</script>"
	Response.End()
	end if 
	if LinkType="" then
		Response.write "<script>alert('链接类型不能为空！');location.href='Friendshiplink.asp';</script>"
		Response.End()
	else
		LinkType=Cint(LinkType)
		if LinkType=1 and (Linkimageurl="" or Linkimageurl="http://") then
			Response.write "<script>alert('网站LOGO不能为空！');location.href='Friendshiplink.asp';</script>"
			Response.End()
			
		end if
	end if
	

				
	
	sqlLink="select top 1 * from [Websen_link] where SiteName='" & dvHtmlEncode(LinkSiteName) & "' and SiteUrl='" & dvHtmlEncode(LinkSiteUrl) & "'"
		set rsLink=Server.CreateObject("Adodb.RecordSet")
		rsLink.open sqlLink,conn,1,3
		if not (rsLink.bof and rsLink.eof) then
			 response.Write "<script>alert('你要添加的网站已经存在！');location.href='Friendshiplink.asp'</script>"
		      response.End()
		else
			rsLink.Addnew
			rsLink("LinkType")=LinkType
			rsLink("SiteName")=dvHtmlEncode(LinkSiteName)
			rsLink("SiteUrl")=dvHtmlEncode(LinkSiteUrl)
			rsLink("imageurl")=dvHtmlEncode(Linkimageurl)
			rsLink("SiteAdmin")=dvHtmlEncode(LinkSiteAdmin)
			rsLink("Email")=dvHtmlEncode(LinkEmail)
			rsLink("SiteIntro")=dvHtmlEncode(LinkSiteIntro)
			rsLink("IsGood")="0"
			rsLink("IsOK")="0"
			rsLink.update
			rsLink.close
			set rsLink=nothing
			conn.close()
			Set conn=nothing
			Response.write "<script>alert('添加成功！');location.href='index.html';</script>"
			Response.end
         end if
		
		end if
end sub
%>

</form>
