$sql = "select * from .. student .. where .."; $result = mysql_fetch_array($sql); $sql = "select * from .. teacher .. where .."; $result = mysql_fetch_array($sql);
<?php session_start(); include_once('include/config.php'); $username = $_POST['txtUsername']; $password = md5($_POST['txtUserPassword']); if ($username == '') { echo "กรุณากรอก ชื่อผู้ใช้งาน"; } elseif ($password == '') { echo "กรุณากรอก รหัสผ่าน"; } else { $sql = mysql_query("SELECT * FROM student WHERE username = '$username' AND password = '$password'"); $num = mysql_num_rows($sql); if ($num <= 0) { echo "<meta http-equiv='refresh' content='1;URL=index.php'>"; }else { while ($user = mysql_fetch_array($sql)) { if ($user['status'] == 2) { $_SESSION['ses_id'] = session_id(); $_SESSION['username'] = $user['username']; $_SESSION['status'] = 2; echo "<meta http-equiv='refresh' content='1;URL=index_user.php'>"; } } } } ?>
<?php session_start(); include_once('include/config.php'); $username = $_POST['txtUsername']; $password = md5($_POST['txtUserPassword']); if ($username == '') { echo "กรุณากรอก ชื่อผู้ใช้งาน"; } elseif ($password == '') { echo "กรุณากรอก รหัสผ่าน"; } else { $sql = mysql_query("SELECT * FROM student WHERE username = '$username' AND password = '$password'"); $num = mysql_num_rows($sql); if ($num > 0) { //เปลี่ยนให้กระทำกับตาราง student ก่อน while ($user = mysql_fetch_array($sql)) { if ($user['status'] == 2) { $_SESSION['ses_id'] = session_id(); $_SESSION['username'] = $user['username']; $_SESSION['status'] = 2; echo "<meta http-equiv='refresh' content='1;URL=index_user.php'>"; } }else { // usernane นั้นๆ ค้นหาข้อมูลในตาราง student ไม่เจอ ก็ให้ไปค้นหาในตาราง teacher แทน $sql = mysql_query("SELECT * FROM teacher WHERE username = '$username' AND password = '$password'"); $num = mysql_num_rows($sql); $num = mysql_num_rows($sql); if ($num > 0) { //เปลี่ยนให้กระทำกับตาราง student ก่อน while ($user = mysql_fetch_array($sql)) { if ($user['status'] == 2) { $_SESSION['ses_id'] = session_id(); $_SESSION['username'] = $user['username']; $_SESSION['status'] = 2; echo "<meta http-equiv='refresh' content='1;URL=index_user.php'>"; }else{ echo "user นี้ไม่ใช่ครูหรือนักเรียนทั้งสองประเภท"; } } } } ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง