📄 chatrename.asp
字号:
<%@ LANGUAGE = VBScript.Encode codepage ="936" %>
<%
Response.Buffer = True
Response.Expires = 0
Response.CacheControl = "Private"
Sub Msg(v)
Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=gb2312'><meta http-equiv='pragma' content='no-cache'><body text=#000000>"
Response.Write "<script Language=JavaScript>"
Response.Write "alert('" & v & "');javascript:window.close();"
Response.Write "</script>"
Response.End
End Sub
newname=Request.Form("newname")
nickname=Session("hxf_u_nickname")
grade=Int(Session("hxf_u_grade"))
userip=Request.ServerVariables("REMOTE_ADDR")
hb=Int(Session("hxf_u_hb"))
changename=Int(Application("wsaxhxf_c_changename"))
if nickname="" or Session("hxf_u_inthechat")<>1 then Msg "您已经退出或者掉线,请重新登陆"
if newname="" then Msg "请填写您的新用户名"
namelen=0
for i=1 to len(newname)
zh=mid(newname,i,1)
zhasc=asc(zh)
if zhasc<0 then
namelen=namelen+2
else
namelen=namelen+1
if CStr(server.URLEncode(zh))<>CStr(zh) then Msg "新名字中含有非法字符!"
end if
next
if namelen>10 then Msg "新名字的长度大于 10 个字符,一个汉字等于 2 个字符!"
function chuser(u)
dim filter,xx,usernameenable,su
for i=1 to len(u)
su=mid(u,i,1)
xx=asc(su)
zhengchu = -1*xx \ 256
yushu = -1*xx mod 256
if (xx>122 or (xx>57 and xx<97) or (xx<-10241 and xx>-10247) or yushu=129 or yushu>192 or (yushu<2 and yushu>-1) or (((zhengchu>1 and zhengchu<8) or (zhengchu>79 and zhengchu<86)) and yushu<96 ) or (xx>-352 and xx<48) or (xx<-22016 and xx>-24321) or (xx<-32448)) then
chuser=true
exit function
end if
next
chuser=false
end function
If Chuser(newname) Then Msg "用户名中不能够带有任何特殊字符。只能够使用汉字或字母。"
if hb<changename then Msg "您的货币不足"&changename&"¥,不能改名"
n=Year(date())
y=Month(date())
r=Day(date())
s=Hour(time())
f=Minute(time())
m=Second(time())
if len(y)=1 then y="0" & y
if len(r)=1 then r="0" & r
if len(s)=1 then s="0" & s
if len(f)=1 then f="0" & f
if len(m)=1 then m="0" & m
sj=n & "-" & y & "-" & r & " " & s & ":" & f & ":" & m
Set conn=Server.CreateObject("ADODB.CONNECTION")
Set rs=Server.CreateObject("ADODB.RecordSet")
connstr=Application("wsaxhg_connstr")
conn.open connstr
sql="SELECT username FROM reginfo WHERE kill='0' AND username='" & newname & "'"
rs.open sql,conn,1,1
if Not(rs.Eof and rs.Bof) then
rs.close
conn.close
set rs=nothing
set conn=nothing
Msg "您要更改的用户名已经存在,请重新更换"
end if
rs.close
sql="SELECT hb FROM reginfo WHERE kill='0' AND username='" & nickname & "'"
rs.open sql,conn,1,3
rs("hb")=hb-changename
rs.Update
rs.close
sql="SELECT username FROM reginfo WHERE kill='0' AND username='" & nickname & "'"
rs.open sql,conn,1,3
rs("username")=newname
rs.Update
rs.close
set rs=nothing
sql = "INSERT INTO logs (type, logtime, name, ip, opertion) VALUES ('3', '" & sj & "', '" & nickname & "', '" & userip & "', '改名为 <font color=red>"&newname&"</font> 用去货币 <font color=red>"&changename&"¥</font>。')"
conn.Execute sql
conn.close
set conn=nothing
Response.Redirect "exitchat.asp"%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -