聊天室php&mysql(三)

2016-02-19 09:33 5 1 收藏

下面是个超简单的聊天室php&mysql(三)教程,图老师小编精心挑选推荐,大家行行好,多给几个赞吧,小编吐血跪求~

【 tulaoshi.com - Web开发 】

第三个页面 name="frame3.php"


?
include "../signup/mysql.php";
//echo $userid;
//echo $private;
if($p)$p=1;
else $p=0;

if(($action="ok")and($p)){

$sql="select userid,id from chat_user_list where userid='$userid'";
$result=mysql_query($sql);
$roww=mysql_fetch_array($result);
$userrr=$roww["id"];





$sql="select userid,id from chat_user_list where id='$object'";
$result=mysql_query($sql);
if($row1=mysql_fetch_array($result))
$object=$row1["userid"];
else {
    $object="大家";
    $k=1;}      

$select="select row from user_message order by row DESC";
        $result=mysql_query($select)or die(" false fgfg");
        $rowlist=mysql_fetch_array($result)or die("false fgs");
        $max_row=$rowlist["row"];

$row=$max_row+1;
$time1=date("G:i");


$sql="INSERT INTO user_message (userid,object,message,status,action1,color,row,time1) values('$userid','$object','$message','$private','$action1','$color','$row','$time1')";

mysql_query($sql)or die(mysql_error());

if($k){$object="大家"; $private=0;}
else
$object=$row1["id"];
}

?
html
head
titleinput table/title
meta http-equiv="Content-Type" content="text/html; charset=gb2312"


SCRIPT LANGUAGE="JavaScript"
!--
function user(user){

document.form1.object.value=user;
}

function changnick(){
window.open("changnick.php?userid=?echo $userid ;?","changnick","toolbar=no,directories=no,menubar=no,width=800,height=570,width=340,height=220,status=0");
}

//--
/SCRIPT

/head

body bgcolor="#6699FF" text="#000000"

div id="Layer1" style="position:absolute; left:125px; top:4px; width:498px; height:79px; z-index:1"  
  form name="form1" method="post" align="center" action="? echo $PHP_SELF; ??action=ok"
    p font color="#6699ff"./font  
      input type="text" name="object" size="10" value="?echo $object?"
      input type="hidden" name="userid" value="?echo $userid ?"
      说  
      input type="hidden" name="p" value="1"
      input type="text" name="message" size="30"
      input type="submit" name="ok" value="发送"
    /p
    p font color="#6699FF"./font  
      select name="action1"
        option selected value="说"说话/option
        option value="悄悄地"悄悄/option
        option value="兴高采烈地"高兴 /option
        option value="微微笑着"微笑 /option
        option value="哈!哈!哈!地笑着"大笑叁声 /option
        option value="笑嘻嘻"嘻笑 /option
        option value="奸笑着"奸笑 /option
        option value="毛手毛脚地"毛手毛脚 /option
        option value="嘟着嘴"嘟嘴 /option
        option value="快要哭着"快要哭 /option
        option value="拳打脚踢地"拳打脚踢 /option
        option value="不怀好意地"不怀好意 /option
        option value="遗憾地"遗憾 /option
        option value="瞪大了眼睛,很讶异地"讶异 /option
        option value="幸福地"幸福 /option
        option value="翻箱倒柜地"翻箱倒柜 /option
        option value="悲伤地"悲伤 /option
        option value="淫淫笑着"淫淫笑 /option
        option value="流着口水"流口水 /option
        option value="正气凛然地"正气凛然 /option
        option value="生气地"生气 /option
        option value="大声地"大声 /option
        option value="傻乎乎地"傻乎乎 /option
        option value="一付很满足的样子"很满足 /option
        option value="手足无措地"手足无措 /option
        option value="很无辜地"无辜 /option
        option value="喃喃自语地"喃喃自语 /option
        option value="恶狠狠地瞪着眼"瞪眼 /option
        option value="快要吐地"想吐 /option
        option value="感到不舒服地"不舒服 /option
        option value="无精打采地"无精打采 /option
        option value="依依不舍地"依依不舍 /option
        option value="吐着白沫地"白沫 /option
        option value="掩饰不住狂喜的心情"狂喜 /option
        option value="笑呵呵一拱手"拱手 /option
        option value="很有礼貌地作了一揖"作揖 /option
        option value="咳!慨叹万千"慨叹 /option
        option value="深深地鞠躬"致歉 /option
        option value="望着窗外细雨淅淅,不由得双眼朦胧地"伤感 /option
        option value="含泪要哭"含泪 /option
        option value="想到伤心处,泪流如注"大哭 /option
        option value="抱头放声大哭"痛哭 /option
        option value="好怕怕呀..."害怕 /option
        option value="感到很是奇特"奇特 /option
        option value="眯着小眼睛道"眯眼 /option
        option value="咯咯一笑,很大方的"大方 /option
        option value="脸上泛起了红晕,"脸红 /option
        option value="气愤地嚷道"生气 /option
        option value="提高嗓门"大声 /option
        option value="运足气一声断喝"断喝 /option
        option value="一脸的迷茫"迷茫 /option
        option value="无奈地耸耸肩"耸肩 /option
        option value="使劲敲敲自己脑门"拍脑 /option
        option value="看着别人谈笑,无聊的很"无聊 /option
        option value="顾作沉思状"沉思 /option
        option value="一付无辜的样子"无辜 /option
        option value="不舒服地"不适 /option
      /select
      颜色  
      ?
      $blue="蓝"; $black="黑";$red="红";$yellow="黄";$zi="紫";$green="绿";$qing="青";
      if($color=="#0000FF")$color1=$blue;
      if($color=="#000000")$color1=$black;
      if($color=="#FF0000")$color1=$red;
      if($color=="#FFFF00")$color1=$yellow;
      if($color=="#800080")$color1=$zi;
      if($color=="#008000")$color1=$green;
      if($color=="#00CC00")$color1=$qing;
      ?
      select name="color"
      option selected value="?echo $color ;? "?echo $color1; ?/option
       option value="#0000FF"蓝/option
        option value="#000000"黑/option
        option value="#FF0000"红/option
        option value="#FFFF00"黄/option
        option value="#800080"紫/option
        option value="#008000"绿/option
        option value="#00CC00"青/option
      /select
      私聊  
      input type="checkbox" name="private" value="1" ? if ($private)echo "checked" ; ?
    /p
  /form
/div
div id="Layer2" style="position:absolute; left:34px; top:6px; width:85px; height:24px; z-index:2"  
  ?echo $userrr ;?
/div
div id="Layer3" style="position:absolute; left:68px; top:47px; width:79px; height:25px; z-index:3"动作表情/div
div id="Layer4" style="position:absolute; left:412px; top:49px; width:73px; height:24px; z-index:4"a href="javascript:changnick()"改名/a/div
div id="Layer5" style="position:absolute; left:508px; top:48px; width:80px; height:26px; z-index:5"a href="javascript:parent.window.close()"离开聊天室/a/div
div id="Layer6" style="position:absolute; left:116px; top:6px; width:32px; height:20px; z-index:6"对/div

div id="Layer7" style="position:absolute; left:108px; top:82px; width:427px; height:19px; z-index:7"  
  div align="center"font color="#FF0000"2001 @版权所有 a href="mailto:xiaoyanglg@263.net"FEIT男孩工作室/a/font/div
/div
/div
/body
/html

来源:http://www.tulaoshi.com/n/20160219/1591246.html

延伸阅读
标签: PHP
  第四个页面 name="index.php" <? include "../signup/mysql.php"; header("Expires: Sun, 28 Dec 1997 09:32:45 GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); header("Content-Type: text/html; charset=${Charset}&quo...
标签: PHP
  function prev_subj($id){     $DROOT=getenv('DOCUMENT_ROOT');     include("sql.php3");     $db=mysql_connect($sql['host'], $sql['user'] , $sql['passwd']);       $qstr="select id,aid from bbs_subj where id=...
标签: PHP
  echo "<br";     echo "<TABLE width=85% border=0 cellPadding=0 cellSpacing=1 align=center bgcolor='#6CA6CD'";       echo "<tr<td";       echo "<TABLE width=100% cellPadding=1 cellS...
标签: PHP
  function sdatetime($str){     $str=ereg_replace("-","/",$str);     $str=substr($str,5,strlen($str)-8);     return $str; } function reAnum($sid){ //羆莱絞计     $DROOT=getenv('DOCUMENT_ROOT');  &nbs...
标签: PHP
  //此为bbs.sql CREATE TABLE bbs_area (    id int(10) unsigned DEFAULT '0' NOT NULL auto_increment,    master varchar(150) NOT NULL,    banner varchar(150) NOT NULL,    body text NOT NULL,    email varchar(50),    lo...

经验教程

824

收藏

31

精华推荐

社区(php&&mysql)一

社区(php&&mysql)一

热情的爱巴马

社区(php&&mysql)五

社区(php&&mysql)五

天意透明

php&amp;java(三)

php&amp;java(三)

爱自己__爱家人

微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部