<?php if (isset($_POST['username']) && isset($_POST['Password'])){ $username = preg_replace('#[^A-Za-z0-9]#i', '', $_POST['Username']); $Password = preg_replace('#[^A-Za-z0-9]#i', '', $_POST['Password']); $sql = mysql_query("SELECT id FROM users WHERE username='$Username' AND password='$Password' LIMIT 1"); $userCount = mysql_num_rows($sql); if ($userCount == 1) { while ($row = mysql_fetch_array($sql)){ $id = $row["id"]; } $_SESSION["id"] = $id; $_SESSION["Username"] = $Username; $_SESSION["Password"] = $Password; header("location: index.php"); exit(); } else { echo 'that infomation is'; exit(); } } ?> <div class="SignupFrom"> <h2>Login</h2> <form id="form" name="form" method="post" action="login.php"> <div class="control-group"><label class="control-label">Username</label> <div class="controls"><input type="text" name="Username" style="width:300px;" value="<? echo $Username; ?>"></div> <div class="control-group"><label class="control-label">Password</label> <div class="controls"><input type="Password" name="Password" style="width:300px;" value="<? echo $Password; ?>"></div> <div class="control-group"><div class="controls"><input type="submit" name="login" value="Login to your account" class="btn btn-primary"></div></div> </div> </form> </div> </div> <body> </body> </html>
<?php session_start(); include 'inc/scripts/connect.php'; $Username = $_SESSION["Username"]; if(!isset($_SESSION["Username"])){ header("location: index.php"); exit(); } else { echo "Hello Word"; } ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง