<? $txtUsername=$_POST['txtUsername']; $txtPassword=$_POST['txtPassword']; include ("dbcon.php"); $sql= "select * from users where user_Id= '$txtUsername' and user_Password= '$txtPassword' "; $result=$db->query($sql); $num=$result->fetchRow(); if($num<=0){ header("Location: LogInPage.php?error=1"); }else{ if($num['level']==0){ $user_status="User"; $level=1; }else{ $user_status="Administrator "; $level=2; } SetCookie("status",$user_status,time()+3600); SetCookie("id",$txtUsername,time()+3600); SetCookie("level",$level,time()+3600); session_start(); $_SESSION[sess_userid]=session_id(); $_SESSION['sess_username']= $txtUsername; header("Location: Index.php"); } ?>
<?php $txtUsername=$_COOKIE['id']; $status=$_COOKIE['status']; $level=$_COOKIE['level']; @ini_set('display_errors', '0'); session_start(); if ($_SESSION['sess_username'] <> $txtUsername) { echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=LogInPage.php\">"; //redirect ไปหน้าที่ต้องการ exit(); } ?>
<?php session_start(); unset($_SESSION['sess_userid']); unset($_SESSION['sess_username']); session_destroy(); header('Location: LogInPage.php'); ?>
SetCookie("testu","user", 0);
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง