<? include "member/config.inc.php"; $db = mysql_connect($host,$username,$password) or die ("ไม่สามารถติดต่อ database ได้ในขณะนี้"); $sql = "select * from member where users = '$txtuser' and passwd = '$txtpass' "; $result = mysql_db_query($dbname,$sql) or die ("ไม่สามารถสั่งให้ database ทำงานได้ในขณะนี้"); $NRow = mysql_num_rows($result); $arr = mysql_fetch_row( $result ); </head> <body> if ($userchat = $arr[4]) { //ถ้าล็อกอินแล้ว ให้ชื่อuserในห้องแชท = ชื่อเล่น และแสดงห้องแชท include("chatroom/config.php"); echo"<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0' class='table' id='4'> <tr> <td width='10' height='10'><img src='images/table/left_u.jpg' width='10' height='10'></td> <td width='79' background='images/table/up.jpg'></td> <td width='10' height='10'><img src='images/table/right_u.jpg' width='10' height='10'></td> </tr> <tr> <td rowspan='2' background='images/table/left.jpg'></td> <td width='100%'><div align='center'><img src='images/betongcitychatroom.jpg' width='100%' height='50' /><br> </div></td> <td rowspan='2' background='images/table/right.jpg'></td> </tr> <tr> <td>"; if (empty($room[$roomname])) { $rooms=each($room); $roomname=$rooms[0]; } include("chatroom/chat.php"); echo "<td background='images/table/right.jpg'></td> </tr> <tr> <td width='10' height='10'><img src='images/table/left_d.jpg' width='10' height='10'></td> <td background='images/table/down.jpg'></td> <td width='10' height='10'><img src='images/table/right_d.jpg' width='10' height='10'></td> </tr> </table>"; } ?></td> <td width="185" vAlign="top"> </td> </tr> <tr> <td class="table" colspan="3" vAlign="top"><? include("frm/last.php");?></td> </tr> </table> <? if ($NRow <= 0) { //แสดงฟอร์มล็อกอิน echo "<form name='form1' method='post' action='' style='margin:0px;'> <table width='100%' border='0' cellpadding='0' cellspacing='0'> <tr> <td height='3' colspan='2'></td> </tr> <tr> <td width='24%'><div align='center' class='styleA1'>User: </div></td> <td width='76%'><input name='txtuser' type='text' id='txtuser' style='width:115px' autocomplete='off'></td> </tr> <tr> <td height='2' colspan='2'></td> </tr> <tr> <td><div align='center' class='styleA1'>Pass: </div></td> <td><input name='txtpass' type='password' id='txtpass' style='width:115px' autocomplete='off'></td> </tr> <tr> <td height='2' colspan='2'></td> </tr> <tr> <td> </td> <td><div align='left'> <input type='submit' name='Submit' value='ล็อกอิน' onClick='return check()'> <input type='reset' name='Submit2' value='ยกเลิก'> </div></td> </tr> </table> </form>"; }else{ //ล็อกอินสำเร็จให้แสดงข้อมูลข้างล่างนี้ [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[กำหนด SESSION ยังไงครับ ถ้าเคยล็อกอินแล้วให้แสดงตั้งแต่ข้างล่างนี้เป็นต้นไป]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] echo "<center><table width='100' border='0' cellpadding='0' cellspacing='0'> <tr> <td height='5'></td> </tr> <tr> <td><img src='../member/img/nopic.jpg' width='120' height='120'></td> </tr> <tr> <td height='5'></td> </tr> </table> <span class='styleA1'>$arr[4]</span><br> <a href='../member/edit.php' target='_parent'>แก้ไขข้อมูล</a> <a href='logout.php' target='_parent' class='styleLink'>ออกระบบ</a> </center>";//หลักล็อกอินแล้วให้แสดง รูปสมาชิก $arr4=ชื่อเล่น แก้ไขข้อมูล และออกระบบ session_start(); $_SESSION[id] = $arr[0]; //หลังล็อกอินแล้ว กำหนดให้ซีซั่นเก็บ id $_SESSION[users] = $arr[1]; //หลังล็อกอินแล้ว กำหนดให้ซีซั่นเก็บ username $_SESSION[passwd] = $arr[2]; //หลังล็อกอินแล้ว กำหนดให้ซีซั่นเก็บ password $arr = mysql_fetch_row($result); $userchat = $arr[4]; //หลังล็อกอินแล้ว กำหนดให้ชื่อ userในห้องแชท = ชื่อเล่น เพื่อวนให้ไปรันคำสั่งในบรรทัดที่14อีกครั้ง } </body> </html>
<? session_start(); include "connect.php"; if (trim($submit)!=""){ // ถ้ามีการกด submit $sql = "select * from member where users = '$txtuser' and passwd = '$txtpass' "; $re=mysql_query($sql) or die(error()); $num=mysql_num_rows($re); if($num>0){ session_start(); session_register('id'); $row=mysql_fetch_array($re); $_SESSION['id'] = $row['id']; $_SESSION['users'] = $row['users']; }else{ echo "password is incorrect"; } } if($_SESSION['id'] !=""){ // check SESSION งว่า ล้อกอินรึยัง echo "Hello ".$_SESSION['users']; // แสดงชื่อ exit; } ?> <form name='form1' method='post' action='' style='margin:0px;'> <table width='100%' border='0' cellpadding='0' cellspacing='0'> <tr> <td height='3' colspan='2'></td> </tr> <tr> <td width='24%'><div align='center' class='styleA1'>User: </div></td> <td width='76%'><input name='txtuser' type='text' id='txtuser' style='width:115px' autocomplete='off'></td> </tr> <tr> <td height='2' colspan='2'></td> </tr> <tr> <td><div align='center' class='styleA1'>Pass: </div></td> <td><input name='txtpass' type='password' id='txtpass' style='width:115px' autocomplete='off'></td> </tr> <tr> <td height='2' colspan='2'></td> </tr> <tr> <td> </td> <td><div align='left'> <input type='submit' name='Submit' value='ล็อกอิน' onClick='return check()'> <input type='reset' name='Submit2' value='ยกเลิก'> </div></td> </tr> </table> </form>
session_start(); session_destroy(); $_SESSION['users']="";
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง