Skip to content

Commit

Permalink
Version 3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jgogo01 committed Aug 22, 2022
1 parent 0985189 commit c3097c8
Show file tree
Hide file tree
Showing 8 changed files with 152 additions and 75 deletions.
5 changes: 4 additions & 1 deletion .htaccess
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
Options -Indexes
Options -Indexes
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
73 changes: 73 additions & 0 deletions css/login.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
@import url('https://fonts.googleapis.com/css2?family=Kanit&display=swap');
html,
body {

/* หากต้องการใส่รูปพื้นหลัง กรุณาแก้ตรงนี้
background: url(img/bg.jpg) no-repeat top center fixed;
color: #ffffff;
*/
/* และ Comment บรรทัดนี้*/
background-color: #f5f5f5;

font-family: 'Kanit' !important;

height: 100%;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}


body {
display: -ms-flexbox;
display: -webkit-box;
display: flex;
-ms-flex-align: center;
-ms-flex-pack: center;
-webkit-box-align: center;
align-items: center;
-webkit-box-pack: center;
justify-content: center;
padding-top: 40px;
padding-bottom: 40px;
/*background-color: #f5f5f5; */
}

.form-signin {
width: 100%;
max-width: 330px;
padding: 15px;
margin: 0 auto;
}
.form-signin .checkbox {
font-weight: 400;
}
.form-signin .form-control {
position: relative;
box-sizing: border-box;
height: auto;
padding: 10px;
font-size: 16px;
}
.form-signin .form-control:focus {
z-index: 2;
}
.form-signin input[type="email"] {
margin-bottom: -1px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-signin input[type="password"] {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}

a:hover{
text-decoration: none;
}

.custom-file-label{
font-weight: 400;
}
34 changes: 1 addition & 33 deletions download.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
</li>

<li class="nav-item">
<a data-toggle="modal" data-target="#login" >
<a href="login.php" >
<i class="fas fa-lock"></i>
<p>ล็อกอิน</p>
</a>
Expand Down Expand Up @@ -222,38 +222,6 @@
</body>
</html>

<!-- Modal Login -->
<div class="modal fade" id="login" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h3> ล็อกอินเข้าสู่ผู้ดูแลระบบ</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>

<div class="modal-body">

<form action="sql/index/checklogin.php" method="post">
<div class="mb-3">
<label class="form-label" for="username">ผู้ใช้</label>
<input class="form-control" type="text" name="username" placeholder="ชื่อผู้ใช้" required>
</div>
<div class="mb-3">
<label class="form-label" for="password">รหัสผ่าน</label>
<input class="form-control" type="password" name="password" placeholder="รหัสผ่าน" required>
</div>
<div class="text-center">
<button class="btn btn-primary" type="submit" name="login_user" >เข้าสู่ระบบ</button>
</div>
</form>
</div>

</div>
</div>
</div>
</div>

<!-- Script DataTable - User -->
<script>
Expand Down
36 changes: 1 addition & 35 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
</li>

<li class="nav-item">
<a data-toggle="modal" data-target="#login" >
<a href="login.php">
<i class="fas fa-lock"></i>
<p>ล็อกอิน</p>
</a>
Expand Down Expand Up @@ -433,40 +433,6 @@
</body>
</html>


<!-- Modal Login -->
<div class="modal fade" id="login" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h3> ล็อกอินเข้าสู่ผู้ดูแลระบบ</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>

<div class="modal-body">

<form action="sql/index/checklogin.php" method="post">
<div class="mb-3">
<label class="form-label" for="username">ผู้ใช้</label>
<input class="form-control" type="text" name="username" placeholder="ชื่อผู้ใช้" required>
</div>
<div class="mb-3">
<label class="form-label" for="password">รหัสผ่าน</label>
<input class="form-control" type="password" name="password" placeholder="รหัสผ่าน" required>
</div>
<div class="text-center">
<button class="btn btn-primary" type="submit" name="submit" id="submit" >เข้าสู่ระบบ</button>
</div>
</form>
</div>

</div>
</div>
</div>
</div>

<!-- Script Link Show User-->
<script>
function UserRow(id){
Expand Down
69 changes: 69 additions & 0 deletions login.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
</body>
</html>

<!DOCTYPE html>
<html lang="en">
<head>
<?php
session_start();
require('structure/head.php'); ?>
<link rel="stylesheet" type="text/css" href="css/login.css">
</head>
<body class="text-center">
<form class="form-signin">

<img class="mb-3" src="img/fav.ico" alt="" width="100" height="100">
<h2 class="h2 mb-1">ล็อกอินเข้าสู่ระบบ</h2>
<h3 class="h4 mb-3 op-7">ระบบพิมพ์เกียรติบัตรออนไลน์</h3>

<label for="username" class="sr-only">ชื่อผู้ใช้งาน</label>
<input type="text" id="username" name="username" class="form-control" placeholder="ชื่อผู้ใช้งาน" >

<label for="password" class="sr-only">รหัสผ่าน</label>
<input type="password" id="password" name="password" class="form-control" placeholder="รหัสผ่าน" >

<div id="div-msg" name="div-msg" style="display:none;" class="alert alert-warning alert-custom m-1" role="alert">
<div id="text-msg" class="alert-text"></div>
</div>


<button class="btn btn-primary btn-block mt-2" name="submit" id="submit" type="button" onclick="cklogin();">เข้าสู่ระบบ</button>
</div>

<h5 class="mt-4 text-primary"><a href="index.php"><i class="fas fa-home"></i> กลับสู่หน้าหลัก</a></h5>
<h5 class="mt-1">สงวนลิขสิทธิ์ &copy; <?=date('Y')+543?> <?= $nameschool_data ?></h5>

</form>

<!-- Script-->
<?php require('structure/script.php'); ?>
<script type="text/javascript">
function cklogin(){
var username = $("#username").val().trim();
var password = $("#password").val().trim();

if( username != "" && password != "" ){
$.ajax({
url:'sql/index/checklogin.php',
method:'POST',
data:{username:username,password:password},
success:function(response){
if(response == "S"){
location.replace("index.php");
}else{
$("#div-msg").show();
$("#text-msg").html(response);
}

}
});
}else{
$("#div-msg").show();
$("#text-msg").html("กรุณากรอกชื่อ และ รหัสผ่านให้ถูกต้อง");
}
}

</script>

</body>
</html>
6 changes: 2 additions & 4 deletions sql/index/checklogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@
if (mysqli_num_rows($result) == 1){

$_SESSION['username'] = $username;
Header("Location: ../../admin.php");
echo "S";

}

else{
$msg = "ชื่อผู้ใช้ หรือ รหัสผ่านไม่ถูกต้อง [ERR-CK-LOGIN]";
$_SESSION['msg_a'] = $msg;
header("Location: ../../index.php");
echo "ชื่อผู้ใช้ หรือ รหัสผ่านไม่ถูกต้อง [ERR-CK-LOGIN]";
}

}
Expand Down
2 changes: 1 addition & 1 deletion structure/footer.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<footer class="footer">
<div class="container-fluid">
<nav class="pull-left">
ระบบพิมพ์เกียรติบัตรออนไลน์ เวอร์ชัน <span class="badge badge-primary">3.1</span>
ระบบพิมพ์เกียรติบัตรออนไลน์ เวอร์ชัน <span class="badge badge-primary">3.2</span>
</nav>
<div class="copyright ml-auto text-center">
สงวนลิขสิทธิ์ &copy; <?php echo date('Y')+543 ?> <?= $nameschool_data ?>, <a href="https://www.themekita.com">ThemeKita</a>
Expand Down
2 changes: 1 addition & 1 deletion structure/numthai.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
function thainumDigit($num){
return str_replace(array( '0' , '1' , '2' , '3' , '4' , '5' , '6' ,'7' , '8' , '9' ),
array( "o" , "" , "" , "" , "" , "" , "" , "" , "" , "" ),
array( "" , "" , "" , "" , "" , "" , "" , "" , "" , "" ),
$num);
};
?>

0 comments on commit c3097c8

Please sign in to comment.