聊天室php&mysql(二)

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

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

【 tulaoshi.com - PHP 】

  //第二页面 name="frame2.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}");



$current_time=time();
$delete_time=$current_time-40;
$sql="delete from chat_user where last_time<".$delete_time;
mysql_query($sql)or die(" false again");



$sql="update chat_user set last_time='$current_time' where userid='$userid'";
mysql_query($sql) or die("false");

$sql="select userid from chat_user";
$result=mysql_query($sql)or die("fallse");
$online=mysql_num_rows($result);
?

<html
<head
<titleuser list</title
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"
<meta http-equiv="Refresh" content="30; url=<? echo $PHP_SELF; ??userid=<?echo $userid?"

</head


<body bgcolor="#6699FF" text="#000000"
<div id="Layer1" style="position:absolute; left:9px; top:37px; width:94px; height:21px; z-index:1"  
  <div align="center"<font color="#FF9999"<b在线人数</b</font</div
</div
<div id="Layer2" style="position:absolute; left:14px; top:96px; width:105px; height:276px; z-index:2"  
  <p<i<font size="2" color="#FF9999"
   
   
  <?            
  $sql="select userid,id,sex from chat_user";
  $result=mysql_query($sql)or die("fallse");
  while($row=mysql_fetch_array($result)){

      $user=$row['userid'];
      $user="<a href='".$PHP_SELF."?userid=".$userid."' onCLick=parent.bottom.user('".$row["id"]."')".$row["id"];
      echo $user."</a(".$row["sex"].")<br";
  }
  ?
     
    </font</i</p
  <p&nbsp;</p
</div
<div id="Layer3" style="position:absolute; left:20px; top:62px; width:74px; height:11px; z-index:3"  
  <div align="center"<font size="2" color="#FF9999"(<?echo $online ;?人)</font</div
</div
<p&nbsp;</p
<p&nbsp;</p
</body
</html
 

来源:http://www.tulaoshi.com/n/20160129/1493616.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 sdatetime($str){     $str=ereg_replace("-","/",$str);     $str=substr($str,5,strlen($str)-8);     return $str; } function reAnum($sid){ //羆莱絞计     $DROOT=getenv('DOCUMENT_ROOT');  &nbs...
标签: Web开发
例子1:创建和使用你自己的JAVA类 创建你自己的JAVA类非常容易。新建一个phptest.java文件,将它放置在你的java.class.path目录下,文件内容如下: public class phptest{ /** * A sample of a class that can work with PHP * NB: The whole class must be public to work,   * and of course the methods you wish to call *...
标签: PHP
  现在我们终于有了写新文件所需的所有东西了: <?php // 打开文件,并且将文件长度截为0 $open_file = fopen("messages.html", "w"); // 写入文件的头信息 fputs($open_file, $header); // 新的一行 // (使用stripSlashes,因为我们不想让所有的转义字符出现在消息文件中) fputs($open_file, stripslashes(...
标签: 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...

经验教程

44

收藏

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