聊天室php&mysql(一)

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

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

【 tulaoshi.com - PHP 】

  //第一个页面  name="index1.php"


<?

include "../signup/mysql.php";
$time1=time();
//$userid=983530409;
echo $n;


if($n==1){
$userid=time();
$nick="g".$userid;
$last_time=$userid;
$sql="insert into chat_user (userid,id,last_time) values ('$userid','$nick','$last_time')";
mysql_query($sql)or die(mysql_error());

$sql="insert into chat_user_list (userid,id,last_time) values ('$userid','$nick','$last_time')";
mysql_query($sql)or die(mysql_error());


echo"<FONT SIZE=6 COLOR=#FF0066<BLOADING ........</B</FONT";
echo "<script language='JavaScript' window.open('index1.php?userid=".$userid."','chat','toolbar=no,directories=no,menubar=no,width=800,height=570,left=0,top=0,status=0');";

echo" window.close() </script";

}

if($n==983530409)
{

$sql="select userid,sex,passwd from user where id='$n'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
$nick=$row["userid"];
$passwd=$row["passwd"];
$sex=$row["sex"];

$sql="insert into chat_user (userid,passwd,sex,last_time,id)values('$n','$passwd','$sex','$time1','$nick')";
mysql_query($sql)or die(mysql_error());




echo"<FONT SIZE=6 COLOR=#FF0066<BLOADING ........</B</FONT";
echo "<script language='JavaScript' window.open('index1.php?userid=".$n."','chat','toolbar=no,directories=no,menubar=no,width=800,height=570,left=0,top=0,status=0');";

echo" window.close(); </script";
}


?
<html
<head
<title::: FEIT聊天室 :::</title
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"
<script language="JavaScript"
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// --
</script
</head
<frameset cols="*,132" frameborder="NO" border="0" framespacing="0" rows="*"  
  <frameset rows="*,111" frameborder="NO" border="0" framespacing="0" cols="*"  
    <frame name="top" src="http://img.jcwcn.com/attachment/portal"

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

经验教程

128

收藏

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