?? umod_deal.asp
字號:
<!--插入html頭部分以及數據庫接口-->
<!--#include file="in_conn.asp"-->
<!--#include file="inc/md5.asp"-->
<!--#include file="UpLoadClass.asp"-->
<body>
<!--插入網站置頂-->
<% if u_name="" then
Response.Redirect "log_err.asp"
else
%>
<!--#include file="in_topmb.asp"-->
<% end if %>
<%
Server.ScriptTimeOut=5000
dim request2
'建立上傳對象
set request2=New UpLoadClass
'使用手動方式保存
request2.AutoSave=2
request2.SavePath="face/upface/"
'打開對象
request2.open()
'判斷用戶名格式的函數
FUNCTION userstr(stru)
dim i,aa
dim istr
For i=1 To Len(stru)
istr=mid(stru,i,1)
aa=ASC(istr)
If aa>31 AND aa<48 Then
userstr=False
Exit For
Elseif aa>57 AND aa<65 Then
userstr=False
Exit For
Elseif aa>90 AND aa<95 Then
userstr=False
Exit For
Elseif aa>95 AND aa<97 Then
userstr=False
Exit For
Else
userstr=True
End if
Next
END FUNCTION
'判斷郵件格式是否正確
Function isEmail(strng)
Dim regEx,regVal
Set regEx=New RegExp
regEx.Pattern="^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$"
regEx.IgnoreCase=True
isEmail=regEx.Test(strng)
End Function
dim vname,vopwd,vpwd,vrepwd,vemail,vhome,vnowdo,vcontact,vface,vsign,vmsn,vhp
dim vsex,vqq,vhometel,vmob,vy,vm,vd,vfacew,vfaceh
dim vbirth,vdate
'獲得表單傳值
vname=trim(Request2.Form("txtname"))
vpwd=trim(Request2.Form("txtpwd"))
vrepwd=trim(Request2.Form("txtrepwd"))
vopwd=trim(Request2.Form("txtopwd"))
vemail=trim(Request2.Form("txtemail"))
vhome=trim(Request2.Form("txthome"))
vnowdo=trim(Request2.Form("txtdo"))
vcontact=trim(Request2.Form("txtcontact"))
vsign=trim(Request2.Form("txtsign"))
vmsn=trim(Request2.Form("txtmsn"))
vhp=trim(Request2.Form("txthp"))
if Request2.Form("radsex")="gg" then
vsex=1
else
vsex=0
end if
vqq=trim(Request2.Form("txtqq"))
vhometel=trim(Request2.Form("txthometel"))
vmob=trim(Request2.Form("txtmobile"))
vy=Request2.Form("syear")
vm=Request2.Form("smonth")
vd=Request2.Form("sday")
vdate=now()
'檢查正確性
If userstr(vname)=False or vname="" or vname<>u_name Then
Response.Redirect "resp.asp?cmd=uname_err"
ElseIf isEmail(vemail)=False or vemail="" Then
Response.Redirect "resp.asp?cmd=uemail_err"
ElseIF vmsn<>"" AND isEmail(vmsn)=False Then
Response.Redirect "resp.asp?cmd=uemail_err"
ElseIf vpwd<>"" Then
if Len(vpwd)<6 OR Len(vpwd)>14 then
Response.Redirect "resp.asp?cmd=upwd_len"
elseif vpwd<>vrepwd then
Response.Redirect "resp.asp?cmd=urepwd_err"
end if
ElseIf vcontact<>"" And Len(vcontact)>150 Then
Response.Redirect "resp.asp?cmd=ucontact_len"
ElseIf vsign<>"" And Len(vsign)>255 Then
Response.Redirect "resp.asp?cmd=usign_len"
ElseIf vqq<>"" And isnumeric(vqq)=False Then
Response.Redirect "resp.asp?cmd=uqq_num"
End If
'判斷頭像
IF Request2.Form("radface")="up" AND Request2.Form("strFace_Name")<>"" THEN
Request2.MaxSize=102400
if Request2.Save("strFace",0) then
'如果上傳成功
vface=Request2.SavePath&Request2.Form("strFace")
vfacew=Request2.Form("strFace_Width")
vfaceh=Request2.Form("strFace_Height")
if isNumeric(vfacew) then
'如果圖片寬高不符界限,則
If vfacew>150 or vfaceh>150 Then
if vfacew>vfaceh then
vfaceh=Cint(150 / vfacew * vfaceh)
vfacew=150
else
vfacew=Cint(150 / vfaceh * vfacew)
vfaceh=150
end if
End If
else
vfacew=150
vfaceh=150
end if
else
'如果上傳失敗
Response.Redirect "resp.asp?cmd=uface_up"
end if
ElseIF Request2.Form("radface")="sel" Then
vface="face/"&Request2.Form("sface")&".gif"
vfacew=42
vfaceh=85
Else
vface=""
END IF
vy=Request2.Form("syear")
vm=Request2.Form("smonth")
vd=Request2.Form("sday")
if isDate(vy&"-"&vm&"-"&vd) then
vbirth=CDate(vy&"-"&vm&"-"&vd)
else
Response.Redirect "resp.asp?cmd=ubirth_day"
end if
set request2=Nothing
'開始修改數據
sqlstr="SELECT * FROM tblmates WHERE ID="&u_ID
rs.open sqlstr,conn,1,2
'是否修改密碼
if vpwd<>"" then
'判斷舊密碼是否正確
vopwd=md5(vopwd,32)
if vopwd<>rs("pwd") then
Response.Redirect "resp.asp?cmd=uopwd_err"
else
vpwd=md5(vpwd,32)
rs("pwd")=vpwd
end if
end if
rs("sex")=CBool(vsex)
rs("email")=vemail
rs("qq")=CStr(vqq)
rs("home")=vhome
rs("hometel")=CStr(vhometel)
rs("mobile")=CStr(vmob)
rs("nowdo")=vnowdo
rs("contact")=vcontact
rs("birthday")=vbirth
rs("birthm")=vm
rs("moddate")=vdate
rs("signline")=vsign
rs("msn")=vmsn
rs("hp")=vhp
IF vface<>"" THEN
'判斷原來的頭像
if Left(rs("faceurl"),12)="face/upface/" then
dim fpath
dim fso1
fpath=server.MapPath(rs("faceurl"))
set fso1=Server.CreateObject("Scripting.FileSystemObject")
if fso1.FileExists(fpath) then
fso1.DeleteFile fpath,True
end if
set fso1=nothing
end if
rs("faceurl")=vface
rs("facew")=vfacew
rs("faceh")=vfaceh
END IF
rs.update
rs.close
'刪除以更新在線資料
sqlstr="DELETE FROM tblonline WHERE o_name='"&u_name&"'"
conn.Execute sqlstr
Response.Redirect "rego.asp?cmd=mod_ok"
%>
<!--插入網站置底-->
<!--#include file="in_bottom.asp"-->
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -