www.gusucode.com > 星云DJ舞曲 4.5a源码程序 > user/usersave.asp

    <!--#include file="connkkp.asp"-->
<%
function IsValidEmail(email)
'Check for valid syntax in an email address.
IsValidEmail = true
names = Split(email, "@")
if UBound(names) <> 1 then
   IsValidEmail = false
   exit function
end if
for each name in names
   if Len(name) <= 0 then
     IsValidEmail = false
     exit function
   end if
   for i = 1 to Len(name)
     c = Lcase(Mid(name, i, 1))
     if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then
       IsValidEmail = false
       exit function
     end if
   next
   if Left(name, 1) = "." or Right(name, 1) = "." then
      IsValidEmail = false
      exit function
   end if
next
if InStr(names(1), ".") <= 0 then
   IsValidEmail = false
   exit function
end if
i = Len(names(1)) - InStrRev(names(1), ".")
if i <> 2 and i <> 3 then
   IsValidEmail = false
   exit function
end if
if InStr(email, "..") > 0 then
   IsValidEmail = false
end if
end function
sub error()
%>
错误信息:<%=errmsg%>
<%
end sub
founderr=false
if isnull(session("DJUserPwd")) or session("DJUserPwd")="" or isnull(session("DJUser")) or session("DJUser")="" then
	errmsg=errmsg+"<br>"+"<li>你尚未登陆。"
	founderr=true
end if
if trim(request("password"))="" or Len(request("password"))>10 then
	errmsg=errmsg+"<br>"+"<li>请输入您的密码(长度不能大于10)。"
	founderr=true
else
	password=trim(request("password"))
end if
if request("sex")="" then
	errmsg=errmsg+"<br>"+"<li>请选择您的性别。"
	founderr=true
elseif request("sex")=0 or request("sex")=1 then
	sex=request("sex")
else
	errmsg=errmsg+"<br>"+"<li>您输入的字符非法。"
	founderr=true
end if
if password<>request("password2") then
	errmsg=errmsg+"<br>"+"<li>您输入的密码和确认密码不一致。"
	founderr=true
end if
if IsValidEmail(trim(request("Email")))=false then
	errmsg=errmsg+"<br>"+"<li>您的Email有错误。"
	founderr=true
else
	Email=trim(request("Email"))
end if
if request("UserWebName")="" and request("UserWebUrl")<>"" then
    errmsg=errmsg+"<br>"+"<li>如果您填写主页地址,那么主页名称也要填上!!!"
	founderr=true
end if
if request("UserWebName")<>"" and request("UserWebUrl")="" then
    errmsg=errmsg+"<br>"+"<li>如果您填写主页名称,那么主页地址也要填上!!!"
    founderr=true
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"),chr(9))>0 or Instr(request("UserName"),"")>0 or Instr(request("UserName"),"$")>0 or Instr(request("UserName"),"<")>0 or Instr(request("UserName"),">")>0 then
	errmsg=errmsg+"<br>"+"<li>用户名中含有非法字符,您只能使用英文字母和数字!!!"
	founderr=true
end if
if request("oicq")<>""then
if not isnumeric(request("oicq")) or len(request("oicq"))>20 then
			errmsg=errmsg+"<br>"+"<li>Oicq号码只能是4-20位数字,如果没有您可以选择不输入。"
			founderr=true
end if
else
end if
if Instr(request("UserWebName"),"=")>0 or Instr(request("UserWebName"),"%")>0 or Instr(request("UserWebName"),chr(32))>0 or Instr(request("UserWebName"),"?")>0 or Instr(request("UserWebName"),"&")>0 or Instr(request("UserWebName"),";")>0 or Instr(request("UserWebName"),",")>0 or Instr(request("UserWebName"),"'")>0 or Instr(request("UserWebName"),",")>0 or Instr(request("UserWebName"),chr(34))>0 or Instr(request("UserWebName"),chr(9))>0 or Instr(request("UserWebName"),"")>0 or Instr(request("UserWebName"),"$")>0 or Instr(request("UserWebName"),"<")>0 or Instr(request("UserWebName"),">")>0 then
	errmsg=errmsg+"<br>"+"<li>主页名称中含有非法字符,您只能使用汉字、英文字母和数字!!!"
	founderr=true
end if
if Instr(request("TrueName"),"=")>0 or Instr(request("TrueName"),"%")>0 or Instr(request("TrueName"),chr(32))>0 or Instr(request("TrueName"),"?")>0 or Instr(request("TrueName"),"&")>0 or Instr(request("TrueName"),";")>0 or Instr(request("TrueName"),",")>0 or Instr(request("TrueName"),"'")>0 or Instr(request("TrueName"),",")>0 or Instr(request("TrueName"),chr(34))>0 or Instr(request("TrueName"),chr(9))>0 or Instr(request("TrueName"),"")>0 or Instr(request("TrueName"),"$")>0 or Instr(request("TrueName"),"<")>0 or Instr(request("TrueName"),">")>0 then
	errmsg=errmsg+"<br>"+"<li>真实姓名中含有非法字符,您只能使用汉字、英文字母和数字!!!"
	founderr=true
end if
if Instr(request("ContactAddress"),"=")>0 or Instr(request("ContactAddress"),"%")>0 or Instr(request("ContactAddress"),chr(32))>0 or Instr(request("ContactAddress"),"?")>0 or Instr(request("ContactAddress"),"&")>0 or Instr(request("ContactAddress"),";")>0 or Instr(request("ContactAddress"),",")>0 or Instr(request("ContactAddress"),"'")>0 or Instr(request("ContactAddress"),",")>0 or Instr(request("ContactAddress"),chr(34))>0 or Instr(request("ContactAddress"),chr(9))>0 or Instr(request("ContactAddress"),"")>0 or Instr(request("ContactAddress"),"$")>0 or Instr(request("ContactAddress"),"<")>0 or Instr(request("ContactAddress"),">")>0 then
	errmsg=errmsg+"<br>"+"<li>联系地址中含有非法字符,您只能使用汉字、英文字母和数字!!!"
	founderr=true
end if
if Instr(request("MyIntro"),"=")>0 or Instr(request("MyIntro"),"%")>0 or Instr(request("MyIntro"),chr(32))>0 or Instr(request("MyIntro"),"?")>0 or Instr(request("MyIntro"),"&")>0 or Instr(request("MyIntro"),";")>0 or Instr(request("MyIntro"),",")>0 or Instr(request("MyIntro"),"'")>0 or Instr(request("MyIntro"),",")>0 or Instr(request("MyIntro"),chr(34))>0 or Instr(request("MyIntro"),chr(9))>0 or Instr(request("MyIntro"),"")>0 or Instr(request("MyIntro"),"$")>0 or Instr(request("MyIntro"),"<")>0 or Instr(request("MyIntro"),">")>0 then
	errmsg=errmsg+"<br>"+"<li>签名档中含有非法字符,您只能使用汉字、英文字母和数字!!!"
	founderr=true
end if
byear=request.form("byear")
bmonth=request.form("bmonth")
bday=request.form("bday")
if founderr=true then
	call error
else
	set rs=server.createobject("adodb.recordset")
	sql="select * from user where username='"&session("DJUser")&"' and password='"&session("DJUserPwd")&"'"
	rs.open sql,conn,1,3
	if rs.eof then
		errmsg="<br>"+"<li>对不起,你不是本站用户,请重新注册。"
		founderr=true
	else
		rs("username")=session("DJUser")
		rs("password")=password
		rs("email")=email
		rs("sex")=sex
		rs("UserPhoto")=request.form("UserPhoto")
		rs("User_Birthday")=byear & "-" & bmonth & "-" & bday 
		if request("MyIntro")<>"" then rs("sign")=trim(request("MyIntro"))
		if request("Tel")<>"" then rs("Tel")=trim(request("Tel"))
		if request("oicq")<>"" then rs("oicq")=trim(request("oicq"))
       	        if request("UserWebName")<>""  then rs("UserWebName")=trim(request("UserWebName"))
       	        if request("UserWebUrl")<>"" then rs("UserWebUrl")=trim(request("UserWebUrl"))
                if request("Address")<>"" then rs("Address")=trim(request("address"))
       	        if request("ContactAddress")<>"" then rs("ContactAddress")=trim(request("ContactAddress"))
       	        if request("TrueName")<>"" then rs("TrueName")=trim(request("TrueName"))
       	rs.update
		session("DJUserPwd")=password
	end if
	rs.close
	if founderr=true then
	call error
	else
%>
<div align="center">       
  <table border="1" cellpadding="1" cellspacing="0" width="229" bordercolor="#88B632">
    <tr> 
      <td colspan="2"  align="center" width="241"><span style="font-size: 9pt">
      修改成功</span></td>
    </tr>
    <tr> 
      <td width="74"  align="right"><span style="font-size: 9pt">登录帐号:</span></td>
      <td width="158" ><span style="font-size: 9pt">&nbsp;<%=session("DJUser")%></span></td>
    </tr>
    <tr> 
      <td width="74"  align="right"><span style="font-size: 9pt">电子信箱:</span></td>
      <td width="158" ><span style="font-size: 9pt">&nbsp;<%=email%></span></td>
    </tr>
    <tr> 
      <td width="74"  align="right"><span style="font-size: 9pt">您的性别:</span></td>
      <td width="158" ><span style="font-size: 9pt">&nbsp;<%if sex=1 then%>男<%else%>女<%end if%></span></td>
    </tr>
    <tr> 
      <td width="74"  align="right"><span style="font-size: 9pt">真实姓名:</span></td>
      <td width="158" ><span style="font-size: 9pt">&nbsp;<%if request("TrueName")="" then %>无<%else%><%=request("TrueName")%><%end if%></span></td>
    </tr>
    <tr> 
      <td width="74"  align="right"><span style="font-size: 9pt">联系电话:</span></td>
      <td width="158" ><span style="font-size: 9pt">&nbsp;<%if request("Tel")="" then%>无<%else%><%=request("Tel")%><%end if%></span></td>
    </tr>
    <tr> 
      <td width="74"  align="right"><span style="font-size: 9pt">详细地址:</span></td>
      <td width="158" ><span style="font-size: 9pt">&nbsp;<%if request("ContactAddress")="" then %>无<%else%><%=request("ContactAddress")%><%end if%></span></td>
    </tr>
    <tr> 
      <td width="74"  align="right"><span style="font-size: 9pt">OCIQ号码:</span></td>
      <td width="158" ><span style="font-size: 9pt">&nbsp;<%if request("oicq")="" then%>无<%else%><%=request("oicq")%><%end if%></span></td>
    </tr>
    <tr> 
      <td width="241"  align="center" colspan="2"> 
        <span style="font-size: 9pt"> 
        <INPUT type=button name=back value="修改成功" onclick="javascript:window.open('Usermodify.asp','_self','')" style="font-size: 9pt">
        </span>
      </td>
    </tr>
  </table>     
        </div>     
 </div>
<%
	end if
	set rs=nothing
end if
conn.close
set conn=nothing
%>