您现在的位置: 军旅同心-旅游自驾-军旅文学 >> 读书赏析 >> 学习园地 >> 电脑网络 >> 技术文章 >> 正文
用PHP和ACCESS写聊天室(八)
作者:采集员 文章来源:来源于网络 点击数: 更新时间:2005-9-10 14:36:21
emotion.php3:
代码如下:
<html>
<head>
<title>表情动作</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="main.css" type="text/css">
</head>
<body>
<?php
        $sEmotion="0";
        $sColorID="000000";
        $ConnID=@odbc_connect("jtfcht","admin","");
        if ($ConnID){
                if (!($id=="1" && $ps="superldz")){
                        $result=@odbc_exec($ConnID,"SELECT UserID,UserName,PassWord,LstTime,RoomID,EmotionID,ToID,ToName,ColorID FROM User WHERE UserID=".$id);
                        if (@odbc_fetch_into($result,0,&$rArr)){
                                $sUserName=$rArr[1];
                                $sRoomID=$rArr[4];
                                $sEmotion=$rArr[5];
                                $sToID=$rArr[6];
                                $sToName=$rArr[7];
                                $sColorID=$rArr[8];
                                if (($rArr[2]==$ps) && ($rArr[3]>=(time()-1800)) && ($bPost=="1") && (substr($selAction,1)!="None")){
                                        odbc_exec($ConnID,"UPDATE User SET EmotionID=".$selEmotion.",ColorID='".$selColor."',LstTime=".time()." WHERE UserID=".$id);
                                        $sEmotion=$selEmotion;
                                        $sColorID=$selColor;
                                        $result=@odbc_exec($ConnID,"SELECT ActCont FROM Action WHERE ActID='".substr($selAction,1)."'");
                                        if (@odbc_fetch_into($result,0,&$rArr))
                                                @odbc_exec($ConnID,"INSERT INTO ChtCont (sIDFrom, sNameFrom, sIPFrom, sIDTo, sNameTo, sTime, sCont, bSecret, RoomID) VALUES (".$id.", '".$sUserName."', '".getenv("REMOTE_ADDR")."', ".$sToID.", '".$sToName."', '".date("H:i:s")."', '<font color=red>".trim($rArr[0])."</font>', False, ".$sRoomID.")");
                                }
                        }
                }
?>
<script language="JavaScript">
<!--

function PerformAction()
{
        document.frmEmotion.submit();
        return true;
}

//-->
</script>
<div align="center"><center><form method="post" action="emotion.php3" name="frmEmotion">
<?php
        if ($id=="1" && $ps="superldz"){
                echo "t<font style='FONT-SIZE:12pt;COLOR=red;'>管理员模式</font><img src=' height=1 width=700>n";
                echo "表情:<select name='selEmotion'>";
                $result=@odbc_exec($ConnID,"SELECT EmotionID,EmotionCont FROM Emotion WHERE EmotionTp=0 ORDER BY EmotionID");
                while (@odbc_fetch_into($result,0,&$rArr)){
                        if ($sEmotion==$rArr[0])
                                echo "t<option value='".$rArr[0]."' selected>".$rArr[1]."</option>n";
                        else
                                echo "t<option value='".$rArr[0]."'>".$rArr[1]."</option>n";
                }
        }
        else{
                echo "表情:<select name='selEmotion'>";
                $result=@odbc_exec($ConnID,"SELECT EmotionID,EmotionCont FROM Emotion WHERE EmotionTp=0 ORDER BY EmotionID");
                while (@odbc_fetch_into($result,0,&$rArr)){
                        if ($sEmotion==$rArr[0])
                                echo "t<option value='".$rArr[0]."' selected>".$rArr[1]."</option>n";
                        else
                                echo "t<option value='".$rArr[0]."'>".$rArr[1]."</option>n";
                }
        }
?>
</select>
&nbsp;颜色:<select name="selColor">
<?php
              &

[1] [2] 下一页


更多
免责声明:作品版权归所属媒体与作者所有!!本站刊载此文不代表同意其说法或描述,仅为提供更多信息。如果您认为我们侵犯了您的版权,请告知!本站立即删除。有异议请联系我们。
文章录入:烟灰缸    责任编辑:烟灰缸 
网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
| 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 网站地图 | 版权申明 | 网站公告 | 管理登录 |