当前位置: 移动技术网 > IT编程>开发语言>PHP > 聊天室php&mysql(一)

聊天室php&mysql(一)

2019年05月19日  | 移动技术网IT编程  | 我要评论
//第一个页面  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><b>loading ........</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><b>loading ........</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="index.php?userid=<? echo $userid?>" scrolling="auto">
    <frame name="bottom" scrolling="no" noresize src="frame3.php?userid=<? echo $userid ?>">
  </frameset>
  <frameset rows="*,110" frameborder="no" border="0" framespacing="0">  
    <frame name="right" scrolling="auto" noresize src="frame2.php?userid=<? echo $userid?>">
    <frame name="bottomframe" scrolling="no" noresize src="frame4.php">
  </frameset>
</frameset>
<noframes>  
<body bgcolor="#ffffff" text="#000000">
<p>很抱歉!这是一个分帧页面,但由于你的浏览器不支持,所以不能浏览! </p>
<p>sorry!this page uses frames,but your browser doesn't support them .</p>
</body>
</noframes>  
</html> 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网