国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

php簡單的在線聊天室程序

2024-05-04 23:06:15
字體:
來源:轉載
供稿:網友

php簡單的在線聊天室程序:index.php

  1. <html> 
  2. <head><Title> 
  3. 在線聊天 
  4. </title></head> 
  5. <!-- frames --> 
  6. <frameset  rows="70%,*" BORDER="0"> 
  7.     <frame name="top" src="_b.php" marginwidth="0" marginheight="0" scrolling="yes" FRAMEBORDER="NO" noresize> 
  8.     <frame name="bottom" src="_a.php" marginwidth="0" marginheight="0" scrolling="no" frameborder="no" noresize> 
  9. </frameset> 
  10. <body> 
  11. </body> 
  12. </html> 

_a.php

  1. <html> 
  2. <title> 
  3. 聊天室 
  4. </title> 
  5. <body TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 > 
  6. <?php 
  7. $person = @$_POST[person]; 
  8. $msg = @$_POST[message]; 
  9. if ($person!="" && $msg!=""){ 
  10. $handle = fopen("msg.txt","r"); 
  11. $tot = 0; 
  12. $oldmsg = array(); 
  13. while ($content = fgets($handle)){ 
  14.     $oldmsg[] = $content
  15.     ++$tot
  16. fclose($handle); 
  17. unlink("msg.txt"); 
  18. $fp = fopen("msg.txt","a+"); 
  19. $time = date("h:i"); 
  20. fwrite($fp,"<font color="blue">".$person."</font>&nbspin&nbsp<font color="red">".$time."</font>&nbsp&nbspsays that&nbsp&nbsp<b>".$msg."</b><br>"."n"); 
  21. for ($i =0;$i<$tot;++$i){ 
  22.     if ($i>50) break
  23.     fwrite($fp,$oldmsg[$i]); 
  24. ?> 
  25. <TABLE width="100%" border="0" cellspacing="0" cellpadding="0"
  26. <tr align="left" bgcolor="#666666"
  27. <td height="20"
  28. </td></tr> 
  29. <tr bgcolor="#FFCC66"
  30. <td width="1" height="4" ></td> 
  31. </tr> 
  32. </TABLE> 
  33. <table width="100%" border=0 cellspacing=0 cellpadding=0 bgcolor="#EFEFEF"
  34. <tr bgcolor="#666666"
  35. <td align="left"
  36. <table width="100%" height="500" boder=0 cellspacing=0 cellpadding=0 bgcolor="#EFEFEF"
  37. <tr align="left"
  38. <td valign="top"
  39. <font size="-1" color="#666666"
  40.  
  41. <table width = "100%" border = "0"
  42.     <tr> 
  43.     <form action="_a.php" method = "post"
  44.         <td align="left"
  45.         <font size="-1">昵稱:</font> 
  46.         <input type="text" name="person" size="12" maxlength="80" value="<?php echo $person;?>"
  47.         <br> 
  48.         <font size="-1"></font> 
  49.         <textarea type="textarea" name="message" rows="9" cols="150" size = 100></textarea> 
  50.         <input type="submit" value="發言"
  51.         </td> 
  52.     </form> 
  53.     </tr> 
  54. </table> 
  55. </font> 
  56. </td> 
  57. </tr> 
  58. </tr> 
  59. </table> 
  60. </td> 
  61. </tr> 
  62. </table> 
  63. </body> 
  64. </html> 

_b.php

  1. <html> 
  2.     <head> 
  3.         <title> 
  4.         聊天室 
  5.         </title> 
  6.     </head> 
  7.     <META HTTP-EQUIV=Refresh CONTENT="5; URL=_b.php"
  8.     <body bgcolor="#EFEFEF"
  9.     <?php 
  10.         $handle=fopen("msg.txt","r"); 
  11.         //$oldmsg = array(); 
  12.         while ($content = fgets($handle)){ 
  13.         //$oldmsg[] = $content; 
  14.         //++$tot; 
  15.             echo $content
  16.         } 
  17.     ?> 
  18.     </body> 
  19. </html>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 南涧| 五大连池市| 孟州市| 宝山区| 百色市| 湘西| 车致| 且末县| 扶余县| 松溪县| 固安县| 大化| 健康| 西城区| 旬阳县| 无为县| 阿城市| 噶尔县| 松溪县| 沈丘县| 泸水县| 通化市| 兴仁县| 宜君县| 广灵县| 淳安县| 如皋市| 洪泽县| 天津市| 台安县| 东阿县| 齐齐哈尔市| 兴隆县| 临潭县| 灌阳县| 西宁市| 洱源县| 同心县| 安新县| 邯郸县| 汤阴县|