设为首页
加入收藏
站内地图
旧版入口
当前位置:首页 > 站长学院 > 网络编程 > ASP

我自己写的聊天室源代码(十_1)

作者:佚名 出处:网络转载 时间:11-19 点击:

内容载入中...
教程中国版权声明: rosibo <%'************************刷新,上*****************************%>
<%'new.ASP%>
<HTML>

<head>
<meta http-equiv="Content-Type" content="text/HTML; charset=gb2312">
<title>刷新</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<meta name="Microsoft Theme" content="none, default">
<meta name="Microsoft Border" content="none">
<base target="contents">
<%if session("ss_nowflag") = 0 then%>
<script language="JavaScript"><!--
parent.location.href = "default.ASP"
//--></script>
<%end if%>
<%if trim(request.form("b1")) <> "" then%>
<script language="JavaScript"><!--
parent.midleft.document.forms[0].acction.value = "0"
//-->
</script>
<%end if%>
<script
language="JavaScript"><!--
function refr()
{
parent.bottom.location.href = "new.ASP";
return true;
}
function write1(text1)
{
parent.topleft.document.write("<br>" + text1);
parent.topleft.window.scrollTo(1,60000);
return true;
}
setTimeout("refr()",5000);
// --></script>
<%if request.form("b1") <> "" then
sc_www = cstr(request.form("who"))
%>
<script language="JavaScript"><!--
parent.midleft.location.href = "say.ASP?name=<%response.write(sc_www)%>";
// --></script>
<%end if%>
</head>

<body>
<%
dim sc_what,sc_color,sc_who1,sc_who2,sc_flag,sc_bq
dim sc_point,sc_usernum,sc_message,sc_user,sc_user1(30,8),sc_userout,sc_userout1(30,6)
dim sc_ff,sc_time,sc_time1,my_message,my_message1(50),my_point,my_usernum
if session("ss_nowflag") <> 0 then
'全局变量
    application.lock
        sc_point = application("ap_point")
        sc_message = application("ap_message")
        sc_usernum = application("ap_usernum")
        sc_user = application("ap_user")
        sc_userout = application("ap_userout")
        '用户在线检查
        for i = 1 to 30
            for j = 1 to 8
                sc_user1(i,j) = ""
            next
            for j = 1 to 6
                sc_userout1(i,j) = ""
            next
        next
        sc_ff = 0
        j=0
        sc_time = now
        for i = 1 to 30
            if trim(sc_user(i,1)) = trim(session("ss_name")) then
                sc_ff = 1
                sc_user(i,7) = cstr(now)
            end if
            if trim(sc_user(i,1)) <> "" then
                sc_time1 = cdate(sc_user(i,7))
                if datediff("s",sc_time1,sc_time) < 61 then
                    j = j + 1
                    for k = 1 to 8
                        sc_user1(j,k) = sc_user(i,k)
                    next
                else
                    '在线数量-1
                    sc_usernum = sc_usernum - 1
                    '配置离别用语
                    if sc_point > 50 then
                        sc_point = 1
                    end if
                    sc_message(sc_point,1) = sc_user(i,1)
                    sc_message(sc_point,2) = "所有人"
                    sc_message(sc_point,3) = sc_user(i,3)
                    sc_message(sc_point,4) = ""
                    sc_message(sc_point,5) = "8"
                    sc_message(sc_point,6) = "<font color='#FF0000'>"
                    sc_ttt = now
                    if hour(sc_ttt) < 10 then
                        sc_message(sc_point,7) = "0" + cstr(hour(sc_ttt)) + ":"
                    else
                        sc_message(sc_point,7) = "" + cstr(hour(sc_ttt)) + ":"
                    end if
                    if minute(sc_ttt) < 10 then
                        sc_message(sc_point,7) = sc_message(sc_point,7) + "0" + cstr(minute(sc_ttt)) + ":"
                    else
                        sc_message(sc_point,7) = sc_message(sc_point,7) + cstr(minute(sc_ttt)) + ":"
                    end if
                    if second(sc_ttt) < 10 then
                        sc_message(sc_point,7) = sc_message(sc_point,7) + "0" + cstr(second(sc_ttt))
                    else
                        sc_message(sc_point,7) = sc_message(sc_point,7) + cstr(second(sc_ttt))
                    end if
                    sc_point = sc_point + 1
                    if sc_point > 50 then
                        sc_point = 1
                    end if
                end if
            end if
        next
        j = 0
        for i = 1 to 30
            if trim(sc_userout(i,1)) <> "" then
                sc_time1 = cdate(sc_userout(i,5))
                if datediff("s",sc_time1,sc_time) < 1 then
                    j = j + 1
                    for k = 1 to 6
                        sc_userout1(j,k) = sc_userout(i,k)
                    next
                end if
            end if
        next
        sc_ssss = 0
        for i = 1 to 30
            if trim(session("ss_name")) = trim(sc_userout1(i,2)) then
                if sc_userout1(i,3) = "1" then
                    session("ss_nowflag") = 1
                    sc_ssss = 1
                    exit for
                end if
                if sc_userout1(i,3) = "2" then
                    session("ss_nowflag") = 2
                    sc_ssss = 1
                    exit for
                end if
                if sc_userout1(i,3) = "3" then
                    session("ss_nowflag") = 3
                    sc_ssss = 1
                    exit for
                end if
            end if
        next
        if sc_ssss = 0 then
            session("ss_nowflag") = 4
        end if
        application("ap_point") = sc_point
        application("ap_message") = sc_message
        application("ap_usernum") = sc_usernum
        application("ap_user") = sc_user1
        application("ap_userout") = sc_userout1
    application.unlock
    select case session("ss_nowflag")
        '4正常,1被踢,2禁止说话,3禁止浏览,0异常退出
        case 4
            select case request.form("b1")
                case "提交"
                    if trim(request.form("what1")) <> "" then
                        '内容/动作
                        sc_what = replace(trim(request.form("what1")),"<","<")
                        '颜色
                        sc_color = "<font color='" + trim(request.form("color")) + "'>"
                        session("ss_color") = trim(request.form("color"))
                        'sc_1 = session("ss_color")
                        '源
                        sc_who1 = session("ss_name")
                        '目的
                        sc_who2 = replace(trim(request.form("who")),"<","<")
                        session("ss_who") = sc_who2
                        '标志
                        if request.form("c1") = "ON" then
                            sc_flag = "5"
                            session("ss_qq") = "5"
                        else
                            sc_flag = "4"
                            session("ss_qq") = "4"
                        end if
                        sc_bq = replace(trim(request.form("bq")),"<","<")
                        session("ss_bq1") = sc_bq
                        if sc_ff = 1 then
                            application.lock
                                sc_message = application("ap_message")
                                sc_point = application("ap_point")
                                if sc_point > 50 then
                                    sc_point = 1
                                end if
                                if request.form("acction") = "0" then
                                    sc_message(sc_point,1) = sc_who1
                                    sc_message(sc_point,2) = sc_who2
                                    sc_message(sc_point,3) = sc_what
                                    sc_message(sc_point,4) = sc_bq
                                    sc_message(sc_point,5) = sc_flag
                                    sc_message(sc_point,6) = sc_color
                                    sc_ttt = now
                                    if hour(sc_ttt) < 10 then
                                        sc_message(sc_point,7) = "0" + cstr(hour(sc_ttt)) + ":"
                                    else
                                        sc_message(sc_point,7) = "" + cstr(hour(sc_ttt)) + ":"
                                    end if
                                    if minute(sc_ttt) < 10 then
                                        sc_message(sc_point,7) = sc_message(sc_point,7) + "0" + cstr(minute(sc_ttt)) + ":"
                                    else
                                        sc_message(sc_point,7) = sc_message(sc_point,7) + cstr(minute(sc_ttt)) + ":"
                                    end if
                                else
                                    sc_message(sc_point,1) = sc_who1
                                    sc_message(sc_point,2) = sc_who2
                                    sc_message(sc_point,3) = sc_what
                                    sc_message(sc_point,4) = sc_bq
                                    sc_message(sc_point,5) = "6"
                                    sc_message(sc_point,6) = sc_color
                                    sc_ttt = now
                                    if hour(sc_ttt) < 10 then
                                        sc_message(sc_point,7) = "0" + cstr(hour(sc_ttt)) + ":"
                                    else
                                        sc_message(sc_point,7) = "" + cstr(hour(sc_ttt)) + ":"
                                    end if
                                    if minute(sc_ttt) < 10 then
                                        sc_message(sc_point,7) = sc_message(sc_point,7) + "0" + cstr(minute(sc_ttt)) + ":"
                                    else
                                        sc_message(sc_point,7) = sc_message(sc_point,7) + cstr(minute(sc_ttt)) + ":"
                                    end if
                                end if
                                if second(sc_ttt) < 10 then
                                    sc_message(sc_point,7) = sc_message(sc_point,7) + "0" + cstr(second(sc_ttt))
                                else
                                    sc_message(sc_point,7) = sc_message(sc_point,7) + cstr(second(sc_ttt))
                                end if
                                sc_point = sc_point + 1
                                if sc_point > 50 then
                                    sc_point = 1
                                end if
                                application("ap_message") = sc_message
                                application("ap_point") = sc_point
                            application.unlock
                        else
                            session("ss_nowflag") = 0
                        end if
                        my_usernum = application("ap_usernum")
                    end if
                case "踢人"
                    if trim(request.form("who")) <> "所有人" then
                        if isnumeric(request.form("time1")) then
                            sc_who = session("ss_name")
                            sc_who1 = trim(request.form("who"))
                            sc_time = cstr(now)
                            sc_time1 = cstr(dateadd("n",cint(request.form("time1")),now))
                            sc_ss = "1"
                            sc_long = trim(cstr(request.form("time1")))
                            application.lock
                                sc_userout = application("ap_userout")
                                sc_point = application("ap_point")
                                sc_message = application("ap_message")
                                for i = 1 to 30
                                    if trim(sc_userout(i,1)) = "" then
                                        sc_userout(i,1) = sc_who
                                        sc_userout(i,2) = sc_who1
                                        sc_userout(i,3) = sc_ss
                                        sc_userout(i,4) = sc_time
                                        sc_userout(i,5) = sc_time1
                                        sc_userout(i,6) = sc_long
                                        if sc_point > 50 then
                                            sc_point = 1
                                        end if
                                        sc_message(sc_point,1) = sc_who
                                        sc_message(sc_point,2) = "所有人"
                                        sc_message(sc_point,3) = "<strong>" + sc_who + "</strong> 将 <strong>" + sc_who1 + "</strong> 踢出聊天室!"
                                        sc_message(sc_point,4) = ""
                                        sc_message(sc_point,5) = "1"
                                        sc_message(sc_point,6) = "<font color='#FF0000'>"
                                        sc_ttt = now
                                        if hour(sc_ttt) < 10 then
                                            sc_message(sc_point,7) = "0" + cstr(hour(sc_ttt)) + ":"
                                        else
                                            sc_message(sc_point,7) = "" + cstr(hour(sc_ttt)) + ":"
                                        end if
                                        if minute(sc_ttt) < 10 then
                                            sc_message(sc_point,7) = sc_message(sc_point,7) + "0" + cstr(minute(sc_ttt)) + ":"
                                        else
                                            sc_message(sc_point,7) = sc_message(sc_point,7) + cstr(minute(sc_ttt)) + ":"
                                        end if
                                        if second(sc_ttt) < 10 then
                                            sc_message(sc_point,7) = sc_message(sc_point,7) + "0" + cstr(second(sc_ttt))
                                        else
                                            sc_message(sc_point,7) = sc_message(sc_point,7) + cstr(second(sc_ttt))
                                        end if
                                        sc_point = sc_point + 1
                                        if sc_point > 50 then
                                            sc_point = 1
                                        end if
                                        exit for
                                    end if
                                next
                                application("ap_userout") = sc_userout
                                application("ap_point") = sc_point
                                application("ap_message") = sc_message
                            application.unlock
                        end if
                    end if
                case "封闭聊天"
                    if trim(request.form("who")) <> "所有人" then
                        if isnumeric(request.form("time1")) then
                            sc_who = session("ss_name")
                            sc_who1 = trim(request.form("who"))
                            sc_time = cstr(now)
                            sc_time1 = cstr(dateadd("n",cint(request.form("time1")),now))
                            sc_ss = "2"
                            sc_long = trim(cstr(request.form("time1")))
                            application.lock
                                sc_userout = application("ap_userout")
                                sc_point = application("ap_point")
                                sc_message = application("ap_message")
                                for i = 1 to 30
                                    if trim(sc_userout(i,1)) = "" then
                                        sc_userout(i,1) = sc_who
                                        sc_userout(i,2) = sc_who1
                                        sc_userout(i,3) = sc_ss
                                        sc_userout(i,4) = sc_time
                                        sc_userout(i,5) = sc_time1
                                        sc_userout(i,6) = sc_long
                                        if sc_point > 50 then
                                            sc_point = 1
                                        end if
                                        sc_message(sc_point,1) = sc_who
                                        sc_message(sc_point,2) = "所有人"
                                        sc_message(sc_point,3) = "<strong>" + sc_who + "</strong> 封闭了 <strong>" + sc_who1 + "</strong> 的聊天功能!"
                                        sc_message(sc_point,4) = ""
                                        sc_message(sc_point,5) = "2"
                                        sc_message(sc_point,6) = "<font color='#FF0000'>"
                                        sc_ttt = now
                                        if hour(sc_ttt) < 10 then
                                            sc_message(sc_point,7) = "0" + cstr(hour(sc_ttt)) + ":"
                                        else
                                            sc_message(sc_point,7) = "" + cstr(hour(sc_ttt)) + ":"
                                        end if
                                        if minute(sc_ttt) < 10 then
                                            sc_message(sc_point,7) = sc_message(sc_point,7) + "0" + cstr(minute(sc_ttt)) + ":"
                                        else
                                            sc_message(sc_point,7) = sc_message(sc_point,7) + cstr(minute(sc_ttt)) + ":"
                                        end if
                                        if second(sc_ttt) < 10 then
                                            sc_message(sc_point,7) = sc_message(sc_point,7) + "0" + cstr(second(sc_ttt))
                                        else
                                            sc_message(sc_point,7) = sc_message(sc_point,7) + cstr(second(sc_ttt))
                                        end if
                                        sc_point = sc_point + 1
                                        if sc_point > 50 then
                                            sc_point = 1
                                        end if
                                        exit for
                                    end if
                                next
                                application("ap_userout") = sc_userout
                                application("ap_point") = sc_point
                                application("ap_message") = sc_message
                            application.unlock
                        end if
                    end if
                case "封闭浏览"
收藏本文:
】【打印页面】【推荐给朋友】【关闭窗口

站长学院

推荐信息