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

发表于:2007-06-30来源:作者:点击数: 标签:
*************************表情设置************************** %‘’optionbq.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=Micros
*************************表情设置**************************
<%‘’optionbq.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">
</head>

<body>
<%
dim sc_bqq(100)
sc_name = session("ss_name")
set conn = server.createobject("adodb.connection")
conn.open "chat","chat","chat001"
select case request.form("b1")
    case "添加表情"
        if trim(request.form("t1")) <> "" then
            what = replace(trim(request.form("t1")),"<","<")
            sql1 = "select * from user_bq_table where (user_name=‘’所有人‘’ and user_bq=‘’" + what + "‘’) or (user_name=‘’" + sc_name +"‘’ and user_bq=‘’" + what + "‘’)"
            set rs1 = conn.execute(sql1)
            if rs1.eof then
                sql = "insert user_bq_table values(‘’" + sc_name +"‘’,‘’" + what + "‘’)"
                set rs2 = conn.execute(sql)
                sql = "select user_bq from user_bq_table where user_name=‘’所有人‘’ or user_name=‘’" + sc_name + "‘’"
                set rs3 = conn.execute(sql)
                for i = 1 to 100
                    sc_bqq(i) = ""
                next
                j = 0
                do while not rs3.eof
                    j = j + 1
                    sc_bqq(j) = rs3(0)
                    rs3.movenext
                loop
                session("ss_bq") = sc_bqq
                rs3.close
            else
                rs1.close
            end if
        end if
    case "确认删除"
        sql = "delete user_bq_table where user_name=‘’" + sc_name + "‘’ and user_bq=‘’" + request.form("d1") + "‘’"
        set rs2 = conn.execute(sql)
        sql = "select user_bq from user_bq_table where user_name=‘’所有人‘’ or user_name=‘’" + sc_name + "‘’"
        set rs3 = conn.execute(sql)
        for i = 1 to 100
            sc_bqq(i) = ""
        next
        j = 0
        if not rs3.eof then
            do while not rs3.eof
                j = j + 1
                sc_bqq(j) = rs3(0)
                rs3.movenext
            loop
            session("ss_bq") = sc_bqq
            rs3.close
        end if
end select
sql = "select user_bq from user_bq_table where user_name=‘’" + sc_name + "‘’"
set rs = conn.execute(sql)
%>

<form method="POST" action="optionbq.asp"
onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1">
  <p>您的新表情:<!--webbot bot="Validation" startspan B-Value-Required="TRUE"
  I-Maximum-Length="10" --><!--webbot bot="Validation" endspan --><input type="text"
  name="t1" size="13" maxlength="10">(不能超过5个字) <input type="submit"
  value="添加表情" name="B1"></p>
  <p><%if not rs.eof then%>将<select name="D1" size="1">
<%do while not rs.eof%>    <option value="<%response.write(rs(0))%>"><%response.write(rs(0))%></option>
<%
rs.movenext
loop
%>  </select>删除<input type="submit" value="确认删除" name="B1"
  onclick="document.forms[0].t1.value=‘’    ‘’"></p>
<%
rs.close
end if
conn.close
%>
</form>
</body>
</html>
****************************动作设置*****************************
<%‘’optionaclearcase/" target="_blank" >cction.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">
</head>

<body>
<%dim sc_acction(100,2)
for i = 1 to 100
    sc_acction(i,1) = ""
    sc_acction(i,2) = ""
next
set conn=server.createobject("adodb.connection")
conn.open "chat","chat","chat001"
sc_name = session("ss_name")
select case request.form("b1")
    case "添加"
        sql2 = "insert user_acction_table values(‘’" + sc_name +"‘’,‘’" + request.form("t1") + "‘’,‘’" + request.form("t2") + "‘’)"
        set rs2 = conn.execute(sql2)
        sql4 = "select acction_name,user_acction from user_acction_table where user_name=‘’所有人‘’ or user_name=‘’" + sc_name + "‘’"
        set rs=conn.execute(sql4)
        sc_i = 0
        do while not rs.eof
            sc_i = sc_i + 1
            sc_acction(sc_i,1) = rs(0)
            sc_acction(sc_i,2) = rs(1)
            rs.movenext
        loop
        rs.close
        session("ss_acction") = sc_acction
    case "删除"
        sql3 = "delete user_acction_table where user_name=‘’" + sc_name + "‘’ and acction_name=‘’" + request.form("d1") + "‘’"
        set rs3 = conn.execute(sql3)
        sql4 = "select acction_name,user_acction from user_acction_table where user_name=‘’所有人‘’ or user_name=‘’" + sc_name + "‘’"
        set rs=conn.execute(sql4)
        sc_i = 0
        do while not rs.eof
            sc_i = sc_i + 1
            sc_acction(sc_i,1) = rs(0)
            sc_acction(sc_i,2) = rs(1)
            rs.movenext
        loop
        rs.close
        session("ss_acction") = sc_acction
end select
for i = 1 to 100
    sc_acction(i,1) = ""
    sc_acction(i,2) = ""
next
sql1 = "select acction_name,user_acction from user_acction_table where user_name=‘’" + sc_name + "‘’"
set rs1 = conn.execute(sql1)
i = 0
if not rs1.eof then
    do while not rs1.eof
        i = i + 1
        sc_acction(i,1) = rs1(0)
        sc_acction(i,2) = rs1(1)
        rs1.movenext
    loop
    rs1.close
end if
%>

<p>你的动作列表:</p>

<table border="1" width="100%" cellspacing="0">
  <tr>
    <td width="20%">动作代码</td>
    <td width="80%">动作内容(#1代表自己,#2代表他人)</td>
  </tr>
<%for i = 1 to 100
if trim(sc_acction(i,1)) <> "" then
%>
  <tr>
    <td width="20%"><%response.write(sc_acction(i,1))%>
</td>
    <td width="80%"><%response.write(sc_acction(i,2))%>
</td>
  </tr>
<%
end if
next%>
</table>

<form method="POST" action="optionacction.asp"
onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1">
  <p>动作代码:<!--webbot bot="Validation" startspan B-Value-Required="TRUE"
  I-Minimum-Length="1" I-Maximum-Length="12" --><!--webbot bot="Validation" endspan --><input
  type="text" name="T1" size="20" maxlength="12">(不能超过5个字)</p>
  <p>动作内容:<input type="text" name="T2" size="59"></p>
  <p><input type="submit" value="添加" name="B1"></p>
  <p><%if trim(sc_acction(1,1)) <> "" then%>将<select name="D1" size="1">
<%for i = 1 to 100
if trim(sc_acction(i,1)) <> "" then
%>    <option value="<%response.write(sc_acction(i,1))%>"><%response.write(sc_acction(i,1))%></option>
<%
end if
next%>  </select>从动作列表中删除<input type="submit" value="删除" name="B1"
  onclick="document.forms[0].T1.value=‘’   ‘’"><%end if%></p>
</form>
<%conn.close%>
</body>
</html>
*************************进入/退出******************************
<%‘’optioninout.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">
<script language="JavaScript"><!--
function fun1()
{
var a="";
a = document.forms[0].T1.value;
return a;
}
function fun2()
{
var a="";
a = document.forms[0].T2.value;
return a;
}
function msg(tt)
{
alert(tt);
}
function formsubmit()
{
document.forms[0].submit();
}
// --></script>
<script language="VBScript"><!--
function dd()
    dim sc_1,sc_2
    sc_1 = fun1()
    sc_2 = fun2()
    sc_1 = trim(sc_1)
    sc_2 = trim(sc_2)
    if (sc_1 = "") or (sc_2 = "") then
        msg("请您填完整数据,不要有空格!")
    else
        formsubmit()
    end if
end function
--></script>
</head>

<body>
<%dim sc_in,sc_out,sc_user,sc_name
sc_name = session("ss_name")
if request.form("t1") <> "" then
    set conn=server.createobject("adodb.connection")
    conn.open "chat","chat","chat001"
    sql = "update user_hello_table set come_in=‘’" + trim(request.form("t1")) + "‘’,go_out=‘’" + trim(request.form("t2")) + "‘’ where user_name=‘’" + sc_name + "‘’"
    set rs = conn.execute(sql)
    conn.close
    sc_in = trim(request.form("t1"))
    sc_out = trim(request.form("t2"))
    application.lock
        sc_user = application("ap_user")
        for i = 1 to 30
            if sc_user(i,1) = sc_name then
                sc_user(i,2) = sc_in
                sc_user(i,3) = sc_out
                exit for
            end if
        next
        application("ap_user") = sc_user
    application.unlock
end if
sc_user = application("ap_user")
for i = 1 to 30
    if sc_user(i,1) = sc_name then
        sc_in = sc_user(i,2)
        sc_out = sc_user(i,3)
        exit for
    end if
next

%>

<form method="POST" action="optioninout.asp">
  <p>您的进入语:<input type="text" name="T1" size="35"
  value="<%response.write(trim(sc_in))%>"></p>
  <p>您的退出语:<input type="text" name="T2" size="35"
  value="<%response.write(trim(sc_out))%>"></p>
  <p><input type="button" value="修改" name="B1" onclick="dd()"></p>
</form>
</body>
</html>

原文转自:http://www.ltesting.net