<?php session_start(); require_once 'include/db_connect.php'; if(isset($_SESSION['id'])) { header('location: index.php'); } $errors = array(); if($_POST) { $username = $_POST['username']; $password = $_POST['password']; if(empty($username) || empty($password)) { if($username == "") { $errors[] = "Username is required"; } if($password == "") { $errors[] = "Password is required"; } } else { $sql = "SELECT * FROM asset_user WHERE username = '$username'"; $result = $connect->query($sql); if($result->num_rows == 1) { $password = $password; // exists $mainSql = "SELECT * FROM asset_user WHERE username = '$username' AND password = '$password'"; $mainResult = $connect->query($mainSql); if($mainResult->num_rows == 1) { $value = $mainResult->fetch_assoc(); $user_id = $value['id']; // set session $_SESSION['id'] = $user_id; $_SESSION['fname'] = $fname; $_SESSION['lname'] = $lname; $_SESSION['cid'] = $cid; $_SESSION['birthdate'] = $birthdate; header('location: dashboard.php'); } else{ $errors[] = "เลขที่บุคลากร /รหัสผ่าน ไม่ถูกต้องครับ!"; } // /else } else { $errors[] = "Username doesnot exists"; } // /else } // /else not empty username // password } // /if $_POST ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>ระบบบริหารบุคลากร โรงพยาบาลระแงะ</title> <!-- Tell the browser to be responsive to screen width --> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> <!-- Bootstrap 3.3.7 --> <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"> <!-- Font Awesome --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css"> <!-- Ionicons --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"> <!-- Theme style --> <link rel="stylesheet" href="dist/css/AdminLTE.min.css"> <!-- AdminLTE Skins. Choose a skin from the css/skins folder instead of downloading all of them to reduce the load. --> <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css"> <!-- iCheck --> <link rel="stylesheet" href="plugins/iCheck/flat/blue.css"> <!-- Morris chart --> <link rel="stylesheet" href="plugins/morris/morris.css"> <!-- jvectormap --> <link rel="stylesheet" href="plugins/jvectormap/jquery-jvectormap-1.2.2.css"> <!-- Date Picker --> <link rel="stylesheet" href="plugins/datepicker/datepicker3.css"> <!-- Daterange picker --> <link rel="stylesheet" href="plugins/daterangepicker/daterangepicker.css"> <!-- bootstrap wysihtml5 - text editor --> <link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css"> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body class="hold-transition login-page"> <div class="login-box"> <div class="login-logo"> <a href="index.php"><b>ระบบบริหารบุคลากร โรงพยาบาลระแงะ</a> </div> <!-- /.login-logo --> <div class="login-box-body"> <p class="login-box-msg">กรุณาลงชื่อเข้าใช้งาน</p> <div class="messages"> <?php if($errors) { foreach ($errors as $key => $value) { echo '<div class="alert alert-warning" role="alert"> <i class="glyphicon glyphicon-exclamation-sign"></i> '.$value.'</div>'; } } ?> </div> <form action="<?php echo $_SERVER["PHP_SELF"];?>" method="post" id="loginForm"> <div class="form-group has-feedback"> <input type="text" class="form-control" id="username" name="username" placeholder="รหัสบุคลากร" autocomplete="off"/> <span class="glyphicon glyphicon-envelope form-control-feedback"></span> </div> <div class="form-group has-feedback"> <input type="password" class="form-control" id="password" name="password" placeholder="Password" autocomplete="off" /> <span class="glyphicon glyphicon-lock form-control-feedback"></span> </div> <div class="row"> <!-- /.col --> <div class="col-xs-5"> <button type="submit" class="btn btn-primary btn-block btn-flat">เข้าใช้งานระบบ</button> </div> <!-- /.col --> </div> </form> <a href="#">ลืมรหัสผ่าน</a><br> </div> <!-- /.login-box-body --> </div> <!-- /.login-box --> <!-- jQuery 2.2.3 --> <script src="plugins/jQuery/jquery-2.2.3.min.js"></script> <!-- Bootstrap 3.3.7 --> <script src="bootstrap/js/bootstrap.min.js"></script> <!-- iCheck --> <script src="plugins/iCheck/icheck.min.js"></script> <script> $(function () { $('input').iCheck({ checkboxClass: 'icheckbox_square-blue', radioClass: 'iradio_square-blue', increaseArea: '20%' // optional }); }); </script> </body> </html>
<?php require_once('include/db_connect.php'); ?>
if(isset($_SESSION['id'])) { //header('location: index.php'); }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง