<? define("host", 'xxxxx'); define("username",'xxxxx'); define("password",'xxxxx); define("dbname", 'xxxxxx); class managedb { public $connect; function __construct(){ $connect = mysql_connect(host,username,password); mysql_select_db(dbname,$connect); if (!$connect) { echo "Error Connect"; } /* else{ echo "sucess connect"; } */ } public function closedb(){ mysql_close(); } }
<? session_start(); require_once 'ConnectDB.php'; class functions { function __construct() { $db = new managedb(); } public function login($username,$password){ if (isset($username)&&isset($password)) { $result = mysql_query("SELECT * FROM user WHERE username='".$username."'and password='".md5($password)."'"); $user_data = mysql_fetch_array($result); $numrow = mysql_num_rows($result); if($numrow == 1){ $_SESSION['login'] = true; $_SESSION['username'] = $user_data['username']; return true; } else{ return false; } } } }
<? require_once 'classes/functions.php'; if(!($_SESSION)){ header("Location:login.php"); } ?> <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="styles.css"> <meta charset="utf-8"> <title>Index</title> </head> <body> <div id="nav"> <div id="nav_wrapper"> <ul> <li><a href="info.php">Information</a></li><li> <a href="config.php">Configuration</a></li><li> <a href="<? session_destroy(); ?>">logout</a></li> </ul> </div> </div> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง