聊天室php&mysql(三)

2016-01-29 14:33 4 1 收藏

聊天室php&mysql(三),聊天室php&mysql(三)

【 tulaoshi.com - PHP 】

  第三个页面 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
    &

来源:https://www.tulaoshi.com/n/20160129/1493610.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
  大家好!好久没有看到大家了,上次写了用PHP的通过文件操作的聊天室,当然是漏洞百出的,而且每一次刷新屏幕都很糟糕的!我想了好久,是不是能有一种方法不要刷新,就能取得发言的信息了?多用一个框架就能实现这个效果了,即多用一个框架我们称为getmsg,我们让getmeg去取得信息而且保证每一次取得的信息是最新的,就是上次取得的发言...
标签: PHP
  function cook_cooloff(){     global $PHP_SELF,$aid,$pgno;     setcookie("OPEN_LIST",0,time()+ 31536000);     Header("Location:$PHP_SELF?aid=$aid&pgno=$pgno");     exit; } //=============================...
标签: PHP
  function post2() {     global $sid,$aid,$PHP_SELF;     global $banner,$body,$poster,$email,$type,$CHAR_GB;                 if(strlen($banner)==0 || strlen($body)==0 || strlen($poster)==0 || strlen($e...

经验教程

526

收藏

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