<?php $conn=mysql_connect("localhost","dbuser","dbpass"); $select_db=mysql_select_db("dbname",$conn); $username_log=$_POST['username_log']; $password_log=$_POST['password_log']; // คำสั่ง SQL และสั่งให้ทำงาน $sql = "SELECT * FROM users where userid='$username_log' and user_pass='$password_log'"; //เช็คค่าข้อมูลที่ส่งมาจากฟอร์ม $result= mysql_query($sql); // หาจำนวนเรกคอร์ดข้อมูล $num_rows = mysql_num_rows($result); if($num_rows==1){ $_SESSION['username']=$username_log; header("location:dindex.php"); //ไปไปตามหน้าที่คุณต้องการ }else { $code_error="<BR><FONT COLOR=\"red\">กรุณาปิด Website แล้วเปิดไหม่ด้วยครับ เนื่องจาก User ท่านผิด</FONT>"; session_register("code_error"); header("location:dlogin.php"); //ไม่ถูกต้องให้กับไปหน้าเดิม } ?>
action.php $hostname = "localhost"; //ชื่อโฮสต์ $user = ""; //ชื่อผู้ใช้ $password = ""; //รหัสผ่าน $dbname = ""; //ชื่อฐานข้อมูล $tblname = ""; //ชื่อตาราง // เริ่มติดต่อฐานข้อมูล mysql_connect($hostname, $user, $password) or die("ติดต่อฐานข้อมูลไม่ได้"); // เลือกฐานข้อมูล mysql_select_db($dbname) or die("เลือกฐานข้อมูลไม่ได้"); // คำสั่ง SQL และสั่งให้ทำงาน $sql = "select * from $tblname where userid='$username_log' and user_pass='$password_log'"; //เช็คค่าข้อมูลที่ส่งมาจากฟอร์ม $dbquery = mysql_db_query($dbname, $sql); // หาจำนวนเรกคอร์ดข้อมูล $num_rows = mysql_num_rows($dbquery); if($num_rows==1){ session_register("username_log"); header("location:dindex.php"); //ไปไปตามหน้าที่คุณต้องการ }else { $code_error="<BR><FONT COLOR=\"red\">กรุณาปิด Website แล้วเปิดไหม่ด้วยครับ เนื่องจาก User ท่านผิด</FONT>"; session_register("code_error"); header("location:dlogin.php"); //ไม่ถูกต้องให้กับไปหน้าเดิม } ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง