<!-- #Include File=Conn.asp -->
<!-- #Include File=inc/char.inc -->
<!-- #Include File=setup.asp -->
<!-- #Include File=email.asp -->
<!-- #Include File=top2.asp -->
<!-- #Include File=inc/prompt.inc -->
<%

dim homepgae,url,image,username,password,password2,e_mail,oicq,typeid,message,ErrMsg
dim mailbody
homepgae=cstr(trim(request("homepgae")))
url=cstr(trim(request("url")))
image=cstr(trim(request("image")))
username=cstr(trim(request("username")))
password=cstr(trim(request("password")))
password2=cstr(trim(request("password2")))
e_mail=cstr(trim(request("e_mail")))
oicq=cstr(trim(request("oicq")))
typeid=cstr(trim(request("typeid")))
message=cstr(trim(request("message")))

founderr=false


call chkinput ()

if founderr=true then 
	call error() 
else
	call saveuserinfo()
	topic="友情链接回复"
	call sendmail()
	if founderr=true then	
		call error()
	else
		call reginfo()
		'response.write mailbody	
	end if
	
end if



'-------------------------------------------------
sub chkinput()
	'--------------------------------------------chkpost
	if chkpost=false then
   		ErrMsg=ErrMsg+"<Br>"+"<li>您提交的数据不合法，请不要从外部提交发言。"
   		FoundErr=True
	end if

	'---------------------------------------------homepage
	if request("homepage")="" or strLength(request("homepage"))>40 then
	errmsg=errmsg+"<br>"+"<li>请输入您的网站名称(长度不能大于40)!"
	founderr=true
	else
	homepage=trim(request("homepage"))
	end if
	
	if Instr(request("homepage"),"=")>0 or Instr(request("homepage"),"%")>0 or Instr(request("homepage"),chr(32))>0 or Instr(request("homepage"),"?")>0 or Instr(request("homepage"),"&")>0 or Instr(request("homepage"),";")>0 or Instr(request("homepage"),",")>0 or Instr(request("homepage"),"'")>0 or Instr(request("homepage"),",")>0 or Instr(request("homepage"),chr(34))>0 or Instr(request("homepage"),"+") >0 then
	errmsg=errmsg+"<br>"+"<li>您的网站名称中含有非法字符!"
	founderr=true
	else
	homepage=trim(request("homepage"))
	end if
	
	
	'---------------------------------------------url
	if request("url")="" or strLength(request("url"))>30 or len(request("url"))<8  then
	errmsg=errmsg+"<br>"+"<li>请输入您的网址(长度不能大于30)!"
	founderr=true
	else
	url=trim(request("url"))
	end if
	
	if Instr(request("url"),"=")>0 or Instr(request("url"),"%")>0 or Instr(request("url"),chr(32))>0 or Instr(request("url"),"?")>0 or Instr(request("url"),"&")>0 or Instr(request("url"),";")>0 or Instr(request("url"),",")>0 or Instr(request("url"),"'")>0 or Instr(request("url"),",")>0 or Instr(request("url"),chr(34))>0 or Instr(request("url"),"+") >0 then
	errmsg=errmsg+"<br>"+"<li>您的网址中含有非法字符!"
	founderr=true
	else
	url=trim(request("url"))
	end if
	
	
	'---------------------------------------------image
	if strLength(request("image"))>30  then
	errmsg=errmsg+"<br>"+"<li>请重新输入您的图标地址(长度不能大于30)!"
	founderr=true
	else
	image=trim(request("image"))
	end if
	
	if Instr(request("image"),"=")>0 or Instr(request("image"),"%")>0 or Instr(request("image"),chr(32))>0 or Instr(request("image"),"?")>0 or Instr(request("image"),"&")>0 or Instr(request("image"),";")>0 or Instr(request("image"),",")>0 or Instr(request("image"),"'")>0 or Instr(request("image"),",")>0 or Instr(request("image"),chr(34))>0 or Instr(request("image"),"+") >0 then
	errmsg=errmsg+"<br>"+"<li>您的图标地址中含有非法字符!"
	founderr=true
	else
	image=trim(request("image"))
	end if
	
	if len(request("image"))<8 then
	image="none"
	end if



	'---------------------------------------------username
	if request("username")="" or strLength(request("username"))>20 then
	errmsg=errmsg+"<br>"+"<li>请输入您的用户名(长度不能大于20)!"
	founderr=true
	else
	username=trim(request("username"))
	end if
	
	if Instr(request("username"),"=")>0 or Instr(request("username"),"%")>0 or Instr(request("username"),chr(32))>0 or Instr(request("username"),"?")>0 or Instr(request("username"),"&")>0 or Instr(request("username"),";")>0 or Instr(request("username"),",")>0 or Instr(request("username"),"'")>0 or Instr(request("username"),",")>0 or Instr(request("username"),chr(34))>0 or Instr(request("username"),"+") >0 then
	errmsg=errmsg+"<br>"+"<li>您的用户名中含有非法字符!"
	founderr=true
	else
	username=trim(request("username"))
	end if
	
	
	'--------------------------------------password
	if request("password")="" or strLength(request("password"))>12 then
	errmsg=errmsg+"<br>"+"<li>请输入您的密码(长度不能大于12)!"
	founderr=true
	else
	password=request("password")
	end if
	
	
	
	'-----------------------------------------------mail
	if IsValidEmail(trim(request("e_mail")))=false then
	errmsg=errmsg+"<br>"+"<li>您的Email有错误!"
	founderr=true
	else
	useremail=trim(request("e_mail"))
	end if


	'-------------------------------------------oicq
	if request("oicq")<>"" then
		if not isnumeric(request("oicq")) or len(request("oicq"))>10 then
			errmsg=errmsg+"<br>"+"<li>Oicq号码只能是4-10位数字，您可以选择不输入!。"
			founderr=true
		else oicq=request("oicq")
		end if
	else 
		oicq=0
	end if
	
	'-------------------------------------------typeid
	if request("typeid")<>"" then
		if not isnumeric(request("typeid")) or len(request("typeid"))>10 then
			errmsg=errmsg+"<br>"+"<li>typeid只能是数字!。"
			founderr=true
		else typeid=request("typeid")
		end if
	else
		errmsg=errmsg+"<br>"+"<li>请输入您的网站分类!。"
		founderr=true
	end if
	
	'-------------------------------------------message
	if request("message")="" or strLength(request("message"))>100 then
	errmsg=errmsg+"<br>"+"<li>请输入您的网站说明(长度不能大于100)!"
	founderr=true
	else
	message=trim(request("message"))
	end if
	if Instr(request("message"),"=")>0 or Instr(request("message"),"%")>0 or Instr(request("message"),chr(32))>0 or Instr(request("message"),"?")>0 or Instr(request("message"),"&")>0 or Instr(request("message"),";")>0 or Instr(request("message"),chr(34))>0 or Instr(request("message"),"+") >0 then
	errmsg=errmsg+"<br>"+"<li>您的网站说明中含有非法字符!"
	founderr=true
	else
	message=trim(request("message"))
	end if
	
end sub



sub saveuserinfo()

	set rs=server.createobject("adodb.recordset")
	sql="select * from [link] where url='"&url&"'"
	rs.open sql,conn,1,3
	
		rs("homepage")=homepage
		rs("url")=url
		
		rs("image")=image		
		
		rs("username")=username	
		
		rs("password")=password      
		
		rs("e_mail")=e_mail 
		
		rs("oicq")=oicq
		
		rs("type")=typeid 
		
		rs("message")=message   	
						
		Rs("addtime")=now
		
		rs.update
		rs.close
		set rs=nothing		
end sub




sub sendmail()
dim err
err=false
on error resume next
	mailbody=mailbody &"尊敬的："&username&"您好!"& vbcrlf
	mailbody=mailbody &"" & vbcrlf 
	mailbody=mailbody &"  您在"&homename&"的链接信息更改成功。"& vbcrlf
	mailbody=mailbody &"" & vbcrlf 
	mailbody=mailbody &"您的用户名是:"&username& vbcrlf
	mailbody=mailbody &"密  码："&(password)& vbcrlf	
	mailbody=mailbody &"" & vbcrlf 
	mailbody=mailbody &"再次感谢您注册本系统！"& vbcrlf
	mailbody=mailbody &"" & vbcrlf 
	mailbody=mailbody &"链接服务由 "&homename&"提供("&homepage&")"&vbcrlf
	mailbody=mailbody &"" & vbcrlf 
	mailbody=mailbody &"" & vbcrlf 
	mailbody=mailbody &"--------------------------------------------"& vbcrlf
	mailbody=mailbody &"程序制做:迅捷网络(http://www.soonhost.com)"& vbcrlf
	mailbody=mailbody &"迅捷网络--域名注册，主机租用，网站建设，脚本开发"& vbcrlf
	mailbody=mailbody &"--------------------------------------------"& vbcrlf
	mailbody=mailbody &"" & vbcrlf 
	mailbody=mailbody &"" & vbcrlf
	mailbody=mailbody &"                          "&now& vbcrlf
	mailbody=mailbody &""
select case EmailFlag
case 0
sendmsg="系统未开启邮件功能，请记住您的注册信息。"
case 1
call jmail(e_mail)
case 2
call Cdonts(e_mail)
case else
sendmsg="系统未开启邮件功能，请记住您的注册信息"

end select
if SendMailed <> "OK" then
	sendmsg="由于系统错误，未能成功发送邮件。"
else
	if EmailFlag=o then 
	sendmsg="系统未开启邮件功能，请记住您的注册信息。"
	else
	sendmsg="您的注册信息已经发往您的邮箱，请注意查收。"
	end if
end if
end sub


'--------------------------------------reginfo()
sub reginfo()
call top2()
%>
<br><br><br>
<table border=1 cellpadding=5 cellspacing=0
width="501" align="center" bordercolor="#0099cc">
  <tr> 
    <td align=middle class=td
width=483 height="32" colspan="2"> 
      <p align="center"><b>更改成功</b></p>
    </td>
  </tr>
  <tr> 
    <td width=30% class=td1  align="right">网站名称：</td>
    <td class=td2 width=70%> 
      <input type=text name=homepage size=20 maxlength=20 value="<%=homepage%>" >
      <font color="#FF3333">*</font> 字母或数字</td>
  </tr>
  <tr> 
    <td width=30% class=td1  align="right">网站地址：</td>
    <td class=td2 width=70%> 
      <input type=text name=url size=30 maxlength=30  value="<%=url%>">
      <font color="#FF3333">*</font> </td>
  </tr>
  <tr> 
    <td width=30% class=td1  align="right">网站图标：</td>
    <td class=td2 width=70%> 
      <input type=text name=image size=40 maxlength=40  value="<% if image="none" then response.write "" else response.write image%>">
      88*31 </td>
  </tr>
  <tr> 
    <td width=30% class=td1  align="right" height="38">站长名称：</td>
    <td class=td2 width=70% height="38"> 
      <input type=text name=username size=20 maxlength=20 value="<%=username%>" >
      <font color="#FF3333">*</font> </td>
  </tr>
  <tr> 
    <td width=30% class=td1  align="right">站长密码：</td>
    <td class=td2 width=70%> 
      <input type="password" name="password" size="20" maxlength="20" value="<%=password%>">
      <font color="#FF3333">*</font> 字母或数字</td>
  </tr>
  <tr> 
    <td width=30% class=td1  align="right">站长信箱：</td>
    <td class=td2 width=70%> 
      <input type="text" name="e_mail" size="20" maxlength="20" value="<%=e_mail%>">
      <font color="#FF3333">*</font> </td>
  </tr>
  <tr> 
    <td width=30% class=td1  align="right">oicq：</td>
    <td class=td2 width=70%> 
      <input type="text" name="oicq" size="20" maxlength="20" value="<%if oicq=0 then response.write "" else response.write oicq %>">
    </td>
  </tr>
  <tr> 
    <td width=30% class=td1  align="right">网站说明：</td>
    <td class=td2 width=70%> 
      <textarea name="message" cols="40" wrap="VIRTUAL" rows="3"><%=message%></textarea>
      <font color="#FF3333">*</font> </td>
  </tr>
  <tr> 
    <td colspan="2" class=td  align="right"> 
      <div align="center"><a href="index.asp">登陆</a> </div>
    </td>
  </tr>
</table>
<!--#include file="foot.inc" -->
<%
end sub 
'====================================================
'程序制做:迅捷网络.          http://www.soonlink.com
'迅捷主机网 -- 域名注册、主机租用、网站建设、脚本开发
'网址：http://www.soonlink.com
'msn:soonlink@hotmail.com
'请保留以上版权信息，谢谢合作！
'====================================================  
%>