用PHP和ACCESS写聊天室(八)
作者:
用PHP和ACCESS写聊天室(八)
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>
颜色:<select name="selColor">
<?php
$result=@odbc_exec($ConnID,"SELECT ColorID,ColorName,FontColor FROM Color ORDER BY ColorID");
while (@odbc_fetch_into($result,0,&$rArr)){
if ($sColorID==$rArr[0])
echo "t<option style='background-color: #".$rArr[0].";color=#".$rArr[2].";' value='".$rArr[0]."' selected>".$rArr[1]."</option>n";
else
echo "t<option style='background-color: #".$rArr[0].";color=#".$rArr[2].";' value='".$rArr[0]."'>".$rArr[1]."</option>n";
}
?>
</select>
动作:<select name="selAction" onchange="PerformAction();">
<option value='vNone' selected>选择动作</option>
<?php
if ($id!="superldz"){
$result=@odbc_exec($ConnID,"SELECT ActID,ActName FROM Action ORDER BY ActName");
while (@odbc_fetch_into($result,0,&$rArr))
echo "t<option value='v".trim((string)$rArr[0])."'>".trim($rArr[1])."(".trim((string)$rArr[0]).")</option>n";
}
?>
</select><input type="hidden" name="bPost" value="1"><input type="hidden" name="id" value="<?php echo $id; ?>"><input type="hidden" name="ps" value="<?php echo $ps; ?>">
</form></center></div>
<?php
@odbc_close($ConnID);
}
?>
</body>
</html>
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】
代码如下:
<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>
颜色:<select name="selColor">
<?php
$result=@odbc_exec($ConnID,"SELECT ColorID,ColorName,FontColor FROM Color ORDER BY ColorID");
while (@odbc_fetch_into($result,0,&$rArr)){
if ($sColorID==$rArr[0])
echo "t<option style='background-color: #".$rArr[0].";color=#".$rArr[2].";' value='".$rArr[0]."' selected>".$rArr[1]."</option>n";
else
echo "t<option style='background-color: #".$rArr[0].";color=#".$rArr[2].";' value='".$rArr[0]."'>".$rArr[1]."</option>n";
}
?>
</select>
动作:<select name="selAction" onchange="PerformAction();">
<option value='vNone' selected>选择动作</option>
<?php
if ($id!="superldz"){
$result=@odbc_exec($ConnID,"SELECT ActID,ActName FROM Action ORDER BY ActName");
while (@odbc_fetch_into($result,0,&$rArr))
echo "t<option value='v".trim((string)$rArr[0])."'>".trim($rArr[1])."(".trim((string)$rArr[0]).")</option>n";
}
?>
</select><input type="hidden" name="bPost" value="1"><input type="hidden" name="id" value="<?php echo $id; ?>"><input type="hidden" name="ps" value="<?php echo $ps; ?>">
</form></center></div>
<?php
@odbc_close($ConnID);
}
?>
</body>
</html>
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】
您可能感兴趣的文章:
- 基于PHP+MySQL的聊天室设计
- PHP设计聊天室步步通
- PHP聊天室技术
- 用PHP和ACCESS写聊天室(十)
- 用PHP和ACCESS写聊天室(七)
- 用PHP和ACCESS写聊天室(九)
- 用PHP+MySql编写聊天室
- 用PHP和ACCESS写聊天室(一)
- 用PHP和ACCESS写聊天室(二)
- 发布一个迷你php+AJAX聊天程序[聊天室]提供下载
- 基于HTTP长连接的"服务器推"技术的php 简易聊天室
- php写的简易聊天室代码
- 用PHP+MySQL搭建聊天室功能实例代码
- PHP实现简单聊天室(附源码)
- php socket实现的聊天室代码分享
- 基于javascript、ajax、memcache和PHP实现的简易在线聊天室
- php+html5基于websocket实现聊天室的方法
- php实现简易聊天室应用代码