if($_SESSION['User']==TRUE) { //ก็ให้มันกลับไปหน้า index อย่างเดียวเลย }else{ //กรณีที่ไม่มีการ login ก็ให้มันแสดงหน้า login }
<?php require '../connect.php'; session_start(); if($_SESSION['userid']) { header("location: indexadmin.php"); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>login</title> <link rel="stylesheet" href="..\assets\css\bootstrap.min.css"> <style> *{ margin: 0; padding: 0; } label{ display: inline-block; width: 100px; margin-bottom: 10px: } h1{ text-align: center; } .content{ width:300px; margin: auto; } .login{ margin-top: 25%; } </style> </head> <body> <div class="header" style="background: #6396bc;width: 100%;height: 70px;top: 0;position: fixed;"> <div class="logo" style="float: left;margin-top: 10px;margin-left:10px;"> <img src="../img/logo.png" style="width:50px;height:50px;"> </div> </div> <br> <div class="content"> <div class="login"> <h1>ระบบจัดการ</h1> <br> <form action="check/checklogin.php" method="post"> <div class="row"> <label>ชื่อผู้ใช้ :</label> <div class="col-sm-8"> <input type="text" name="Username" class="form-control"><br> </div> </div> <div class="row"> <label>รหัสผ่าน :</label> <div class="col-sm-8"> <input type="password" name="Password" class="form-control"><br> </div> </div> <div class="row"> <label></label> <div class="col-sm-8"> <input type="submit" name="submit" value="เข้าสู่ระบบ" class="btn btn-warning" style="width:100%;"> </div> </div> </form> </div> </div> <script src="assets\js\bootstrap.min.js"></script> <script src="assets\jquery\jquery.js"></script> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง