欢迎来到福编程网,本站提供各种互联网专业知识!

用PHP和ACCESS写聊天室(八)

发布时间:2006-10-09 作者: 来源:转载
emotion.php3:代码如下:表情动作颜色:动作:选择动作
emotion.php3:

代码如下:

表情动作

$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")."', '".trim($rArr[0])."', False, ".$sRoomID.")");

}

}

}

?>

if ($id=="1" && $ps="superldz"){

echo "t管理员模式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 "tn";

else

echo "tn";

}

}

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 "tn";

else

echo "tn";

}

}

?>

颜色:<select name="selColor">

$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 "tn";

else

echo "tn";

}

?>

动作:<select name="selAction" onchange="PerformAction();">

if ($id!="superldz"){

$result=@odbc_exec($ConnID,"SELECT ActID,ActName FROM Action ORDER BY ActName");

while (@odbc_fetch_into($result,0,&$rArr))

echo "tn";

}

?>

@odbc_close($ConnID);

}

?>

【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】

相关推荐