请教,帮我解释一段ASP代码,请教,帮我解释一段ASP代码,请教,帮我解释一段ASP代码,<%@LANGUAGE=VBSCRIPT CODEPAGE=936%> <% session.Timeout=10 flag=false If Request.Form(Submit)=进入聊天室 Then UserName=Request.Form(UserName) If trim(UserName)= Then%> <script language=javascript> alert(请输入昵称!); </script> <%response.Redirect(index.asp) End If head=Request.Form(head) A_Username=split(Application(UserName),,) for i=0 to uBound(A_Username) If A_username(i)=username then%> <script language=javascript> alert(该用户昵称已经存在,请换一个吧!); </script> <%flag=true End if Next If flag=false Then application.Lock() application(UserName)=application(UserName)+,+UserName session(UserName)=UserName Application(head)=application(head)+,+head application.UnLock() response.Redirect(chatroom.asp) End if End if %> 其中 A_Username=split(Application(UserName),,) 和 application(UserName)=application(UserName)+,+UserName 如何解释,望详细搞知.
股票入门 我的第一次 你在做什么 往期内容 休闲牧场预告 设猫扑虎为首页|收藏猫扑虎
请教,帮我解释一段ASP代码
来源:网络收集 作者:解语人 时间:2008-4-28 12:44:53

<%@LANGUAGE=VBSCRIPT CODEPAGE=936%> <% session.Timeout=10 flag=false If Request.Form(Submit)=进入聊天室 Then UserName=Request.Form(UserName) If trim(UserName)= Then%> <script language=javascript> alert(请输入昵称!); </script> <%response.Redirect(index.asp) End If head=Request.Form(head) A_Username=split(Application(UserName),,) for i=0 to uBound(A_Username) If A_username(i)=username then%> <script language=javascript> alert(该用户昵称已经存在,请换一个吧!); </script> <%flag=true End if Next If flag=false Then application.Lock() application(UserName)=application(UserName)+,+UserName session(UserName)=UserName Application(head)=application(head)+,+head application.UnLock() response.Redirect(chatroom.asp) End if End if %> 其中 A_Username=split(Application(UserName),,) 和 application(UserName)=application(UserName)+,+UserName 如何解释,望详细搞知.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> //声明程序脚本语言为vbscript
<%
session.Timeout=10 //设置session超时时间为10分钟
flag=false //定义一个变量flag,并初始化为flase
If Request.Form("Submit")="进入聊天室" Then //如果参数Submit的值为“进入聊天室”
UserName=Request.Form("UserName") //把参数UserName的值赋给UserName
If trim(UserName)="" Then%> //如果UserName的值为空
<script language='javascript'> //执行javascript脚本。
alert('请输入昵称!'); //弹出对话框“请输入呢称”

</script>
<%response.Redirect("index.asp") //页面跳转到index.asp
End If
head=Request.Form("head") //把参数head的值赋给head
A_Username=split(Application("UserName"),",") //分割UserName的值,以,为标记分割。把结果给A_UserName(一数组)
for i=0 to uBound(A_Username) //循环,从0到数组元素的个数
If A_username(i)=username then%> //如果有一个元素值与username值相等
<script language="javascript">
alert("该用户昵称已经存在,请换一个吧!"); //弹出信息
</script>
<%flag=true //flag赋值为true
End if
Next //for...next
If flag=false Then //如果flag值为真
application.Lock() //锁定application
application("UserName")=application("UserName")+","+UserName //把UserName值一步步加到application("UserName")中
session("UserName")=UserName //把UserName值给session("UserName")=
Application("head")=application("head")+","+head //同上,把head值一步步给Application("head")=
application.UnLock() //解锁
response.Redirect("chatroom.asp") //页面跳转到chatroom.asp
End if //if结速
End if //if结速
%>

over!好累,为什么没分呢?给点分吧!
  • 上一篇文章:
  • 下一篇文章: