用PHP和ACCESS写聊天室(八)
PHP access 聊天室
2023-06-13 09:13:44 时间
emotion.php3:
代码如下:
<html>
<head>
<title>表情动作</title>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<linkrel="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,"SELECTUserID,UserName,PassWord,LstTime,RoomID,EmotionID,ToID,ToName,ColorIDFROMUserWHEREUserID=".$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,"UPDATEUserSETEmotionID=".$selEmotion.",ColorID="".$selColor."",LstTime=".time()."WHEREUserID=".$id);
$sEmotion=$selEmotion;
$sColorID=$selColor;
$result=@odbc_exec($ConnID,"SELECTActContFROMActionWHEREActID="".substr($selAction,1).""");
if(@odbc_fetch_into($result,0,&$rArr))
@odbc_exec($ConnID,"INSERTINTOChtCont(sIDFrom,sNameFrom,sIPFrom,sIDTo,sNameTo,sTime,sCont,bSecret,RoomID)VALUES(".$id.","".$sUserName."","".getenv("REMOTE_ADDR")."",".$sToID.","".$sToName."","".date("H:i:s")."","<fontcolor=red>".trim($rArr[0])."</font>",False,".$sRoomID.")");
}
}
}
?>
<scriptlanguage="JavaScript">
<!--
functionPerformAction()
{
document.frmEmotion.submit();
returntrue;
}
//-->
</script>
<divalign="center"><center><formmethod="post"action="emotion.php3"name="frmEmotion">
<?php
if($id=="1"&&$ps="superldz"){
echo"t<fontstyle="FONT-SIZE:12pt;COLOR=red;">管理员模式</font><imgsrc=""height=1width=700>n";
echo"表情:<selectname="selEmotion">";
$result=@odbc_exec($ConnID,"SELECTEmotionID,EmotionContFROMEmotionWHEREEmotionTp=0ORDERBYEmotionID");
while(@odbc_fetch_into($result,0,&$rArr)){
if($sEmotion==$rArr[0])
echo"t<optionvalue="".$rArr[0].""selected>".$rArr[1]."</option>n";
else
echo"t<optionvalue="".$rArr[0]."">".$rArr[1]."</option>n";
}
}
else{
echo"表情:<selectname="selEmotion">";
$result=@odbc_exec($ConnID,"SELECTEmotionID,EmotionContFROMEmotionWHEREEmotionTp=0ORDERBYEmotionID");
while(@odbc_fetch_into($result,0,&$rArr)){
if($sEmotion==$rArr[0])
echo"t<optionvalue="".$rArr[0].""selected>".$rArr[1]."</option>n";
else
echo"t<optionvalue="".$rArr[0]."">".$rArr[1]."</option>n";
}
}
?>
</select>
颜色:<selectname="selColor">
<?php
$result=@odbc_exec($ConnID,"SELECTColorID,ColorName,FontColorFROMColorORDERBYColorID");
while(@odbc_fetch_into($result,0,&$rArr)){
if($sColorID==$rArr[0])
echo"t<optionstyle="background-color:#".$rArr[0].";color=#".$rArr[2].";"value="".$rArr[0].""selected>".$rArr[1]."</option>n";
else
echo"t<optionstyle="background-color:#".$rArr[0].";color=#".$rArr[2].";"value="".$rArr[0]."">".$rArr[1]."</option>n";
}
?>
</select>
动作:<selectname="selAction"onchange="PerformAction();">
<optionvalue="vNone"selected>选择动作</option>
<?php
if($id!="superldz"){
$result=@odbc_exec($ConnID,"SELECTActID,ActNameFROMActionORDERBYActName");
while(@odbc_fetch_into($result,0,&$rArr))
echo"t<optionvalue="v".trim((string)$rArr[0])."">".trim($rArr[1])."(".trim((string)$rArr[0]).")</option>n";
}
?>
</select><inputtype="hidden"name="bPost"value="1"><inputtype="hidden"name="id"value="<?phpecho$id;?>"><inputtype="hidden"name="ps"value="<?phpecho$ps;?>">
</form></center></div>
<?php
@odbc_close($ConnID);
}
?>
</body>
</html>
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】
代码如下:
<html>
<head>
<title>表情动作</title>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<linkrel="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,"SELECTUserID,UserName,PassWord,LstTime,RoomID,EmotionID,ToID,ToName,ColorIDFROMUserWHEREUserID=".$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,"UPDATEUserSETEmotionID=".$selEmotion.",ColorID="".$selColor."",LstTime=".time()."WHEREUserID=".$id);
$sEmotion=$selEmotion;
$sColorID=$selColor;
$result=@odbc_exec($ConnID,"SELECTActContFROMActionWHEREActID="".substr($selAction,1).""");
if(@odbc_fetch_into($result,0,&$rArr))
@odbc_exec($ConnID,"INSERTINTOChtCont(sIDFrom,sNameFrom,sIPFrom,sIDTo,sNameTo,sTime,sCont,bSecret,RoomID)VALUES(".$id.","".$sUserName."","".getenv("REMOTE_ADDR")."",".$sToID.","".$sToName."","".date("H:i:s")."","<fontcolor=red>".trim($rArr[0])."</font>",False,".$sRoomID.")");
}
}
}
?>
<scriptlanguage="JavaScript">
<!--
functionPerformAction()
{
document.frmEmotion.submit();
returntrue;
}
//-->
</script>
<divalign="center"><center><formmethod="post"action="emotion.php3"name="frmEmotion">
<?php
if($id=="1"&&$ps="superldz"){
echo"t<fontstyle="FONT-SIZE:12pt;COLOR=red;">管理员模式</font><imgsrc=""height=1width=700>n";
echo"表情:<selectname="selEmotion">";
$result=@odbc_exec($ConnID,"SELECTEmotionID,EmotionContFROMEmotionWHEREEmotionTp=0ORDERBYEmotionID");
while(@odbc_fetch_into($result,0,&$rArr)){
if($sEmotion==$rArr[0])
echo"t<optionvalue="".$rArr[0].""selected>".$rArr[1]."</option>n";
else
echo"t<optionvalue="".$rArr[0]."">".$rArr[1]."</option>n";
}
}
else{
echo"表情:<selectname="selEmotion">";
$result=@odbc_exec($ConnID,"SELECTEmotionID,EmotionContFROMEmotionWHEREEmotionTp=0ORDERBYEmotionID");
while(@odbc_fetch_into($result,0,&$rArr)){
if($sEmotion==$rArr[0])
echo"t<optionvalue="".$rArr[0].""selected>".$rArr[1]."</option>n";
else
echo"t<optionvalue="".$rArr[0]."">".$rArr[1]."</option>n";
}
}
?>
</select>
颜色:<selectname="selColor">
<?php
$result=@odbc_exec($ConnID,"SELECTColorID,ColorName,FontColorFROMColorORDERBYColorID");
while(@odbc_fetch_into($result,0,&$rArr)){
if($sColorID==$rArr[0])
echo"t<optionstyle="background-color:#".$rArr[0].";color=#".$rArr[2].";"value="".$rArr[0].""selected>".$rArr[1]."</option>n";
else
echo"t<optionstyle="background-color:#".$rArr[0].";color=#".$rArr[2].";"value="".$rArr[0]."">".$rArr[1]."</option>n";
}
?>
</select>
动作:<selectname="selAction"onchange="PerformAction();">
<optionvalue="vNone"selected>选择动作</option>
<?php
if($id!="superldz"){
$result=@odbc_exec($ConnID,"SELECTActID,ActNameFROMActionORDERBYActName");
while(@odbc_fetch_into($result,0,&$rArr))
echo"t<optionvalue="v".trim((string)$rArr[0])."">".trim($rArr[1])."(".trim((string)$rArr[0]).")</option>n";
}
?>
</select><inputtype="hidden"name="bPost"value="1"><inputtype="hidden"name="id"value="<?phpecho$id;?>"><inputtype="hidden"name="ps"value="<?phpecho$ps;?>">
</form></center></div>
<?php
@odbc_close($ConnID);
}
?>
</body>
</html>
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】
相关文章
- PHP SPL标准库 基本的一些例子和实践
- 【说站】php常量中两种定义方式的比较
- PHP DFA算法实现敏感词过滤包 php-dfa-sensitive
- 排查PHP-FPM占用CPU过高
- PHP RSA加解密详解(附代码)编程语言
- 开发Linux下PHP模块开发:实现程序性能最大化(linux下php模块)
- 数据PHP简单操作实现MySQL数据输出(php输出mysql)
- LINUX下编写PHP程序的技巧(linux编写php)
- “最好的 PHP 框架”调查报告(2015版)
- PHP轻松修改MySQL数据,实现数据高效处理(php修改mysql数据)
- MySQL和PHP解决乱码问题(mysql php 乱码)
- phpredis实现秒杀抢购,把握购买机会(php redis 秒杀)
- 如何使用Redis技术来优化PHP性能(清楚redis php)
- PHP的FTP学习(三)
- PHP中通过ADO调用Access数据库的方法测试不通过
- php获取mysql数据库信息代码
- PHP发明人谈MVC和网站设计架构貌似他不支持php用mvc
- PHP和Mysqlweb应用开发核心技术第1部分Php基础-1开始了解php
- php定时删除文件夹下文件(清理缓存文件)
- 用PHP实现浏览器点击下载TXT文档的方法详解
- 如何使用php判断所处服务器操作系统的类型
- php中的curl使用入门教程和常见用法实例
- php实现mysql封装类示例
- PHP中文编码小技巧