<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <? require_once "../include/tdate.php"; if ($_POST[mes] <>"") { $hostname="localhost"; $user="root"; $password="123456"; $dbname="sahataweekit"; $connect=mysql_connect($hostname,$user,$password) or die("cannot connect"); $db=mysql_select_db($dbname)or die("cannot connect database!"); $sql="INSERT INTO chatroom ( mes,ipaddress)VALUES ('$_POST[mes]','$eIP');"; $dbquery=mysql_db_query($dbname,$sql); } ?> <html > <head> <META HTTP-EQUIV="REFRESH" CONTENT="15"> <? //ตรงนี้ค่ะที่ refresh ทุก 15 วินาที มันทำให้รำคาญมาก <title>:: MyChat ::</title> </head> <body bgcolor="#CCCCCC" background="cute-background-001.gif"> <table width="70%" border="0" cellspacing="0" cellpadding="0"> <tr> <th bgcolor="f2f2f2" scope="row"><form name="form2" method="post" action="<?=$PHP_SELF;?>"> <label> <div align="left"> <table width="97%" border="0" align="center" cellpadding="1" cellspacing="1"> <tr> <td> <? $hostname="localhost"; $user="root"; $password="123456"; $dbname="mychat";//ชื่อฐานข้อมูล $connect=mysql_connect($hostname,$user,$password) or die("cannot connect"); $db=mysql_select_db($dbname)or die("cannot connect database!"); $sql="select * from chatroom order by id DESC limit 0,6";//เรียกข้อมูล $dbquery=mysql_db_query($dbname,$sql); $row=mysql_num_rows($dbquery); while($result=mysql_fetch_array($dbquery)) { $a[] = $result[mes]; //เก็บช้อความ 10 อันดับล่าสุดลงตัวแปร $ip[] = $result[ipaddress]; } for($i=count($a)-1;$i>=0;$i--) { echo "<img src=../images/icon_emoticon.gif width=16 height=16>"; echo $a[$i]; echo "<hr>"; } ?> </td> </tr> </table> </div> </label> </form> </th> </tr> <tr> <th scope="row"><form name="form1" method="post" action=""> <table width="95%" border="0" cellspacing="0" cellpadding="0"> <tr bgcolor="#FFFFCC"> <td width="8%"><label><img src="lonely.jpg" width="70" height="70"> <div align="center"></div> <label> </label></td> <td width="92%"><strong><font size="2">เขียนข้อความที่นี่นะ</font></strong> <font size="2"> <input name="mes" type="text" id="mes2" value="" size="60"> <input name="Submit" type="submit" id="Submit" value="ส่งข้อความ"> <br> td> </tr> </table> </form> </th> </tr> </table> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง