|
|
|
คิดฮอดครับ แวะมาทักทายแหล่งความรู้ Im Love Thaicreate |
|
|
|
|
|
|
|
แวะมาทักทายพี่ๆน้าๆทุกๆท่านครับ สบายดีครับ
Code Login(PHP)
<?php
require("connect/conndb.php");
if (!isset($_SESSION)) { //
session_start();
}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if(isset($_POST["Login"]))
{
$MM_redirectLoginSuccess = "main.php";
$MM_redirectLoginFailed = "logout.php";
$MM_redirectLoginSuccess_Admin = "./admin";
$MM_redirecttoReferrer = false;
$Admin_Username = mysqli_real_escape_string($conn,$_POST['Admin_Username']);
$Admin_Password = mysqli_real_escape_string($conn,$_POST['Admin_Password']);
$dolog = " SELECT * FROM admin WHERE Admin_Username = '".$Admin_Username."' AND Admin_Password = '".$Admin_Password."' ";
$sql_dolog = mysqli_query($conn,$dolog);
$NumLog = mysqli_num_rows($sql_dolog);
$row = mysqli_fetch_assoc($sql_dolog);
if($NumLog >'0')
{
if (PHP_VERSION >= 5.1)
{ //
session_regenerate_id(true);
}else{ session_regenerate_id();
}
$_SESSION['S_ID'] = $row['Admin_ID'];
$_SESSION['S_Admin_Name'] = $row['Admin_Name'];
$_SESSION['S_Admin_Username'] = $row['Admin_Username'];
$_SESSION['S_Admin_Password'] = $row['Admin_Password'];
$_SESSION['S_Admin_Type'] = $row['Admin_Type'];
$_SESSION['S_Admin_Status'] = $row['Admin_Status'];
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
if($_SESSION["S_Admin_Status"]=="1"){
header("Location: " . $MM_redirectLoginSuccess_Admin);
}
if($_SESSION["S_Admin_Status"]=="2"){
header("Location: " . $MM_redirectLoginSuccess);
}
}else{
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Modish - Open Source Admin Dashboard Template</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE-Edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Raleway:300,400,600,800" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700" rel="stylesheet">
<link rel="stylesheet" href="assets/css/bootstrap.css">
<link rel="stylesheet" href="assets/css/core.css">
<link rel="stylesheet" href="assets/css/components.css">
<link rel="stylesheet" href="assets/icons/fontawesome/styles.min.css">
<script type="text/javascript" src="lib/js/jquery.min.js"></script>
<script type="text/javascript" src="lib/js/tether.min.js"></script>
<script type="text/javascript" src="lib/js/bootstrap.min.js"></script>
<script type="text/javascript" src="assets/js/app.min.js"></script>
</head>
<body>
<div class="page-container">
<form name="log" method="post" action=""> <!-- PAGE CONTENT -->
<div class="content h-100">
<div class="row h-100">
<div class="col-lg-12">
<div class="login card auth-box mx-auto my-auto">
<div class="card-block text-center">
<div class="user-icon">
<i class="fa fa-user-circle"></i>
</div>
<h4 class="text-light">Login</h4>
<div class="user-details">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon" id="basic-addon1">
<i class="fa fa-user-o"></i>
</span>
<input type="text" name="Admin_Username" id="Admin_Username" class="form-control" placeholder="Username" aria-describedby="basic-addon1">
</div>
</div>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon" id="basic-addon1">
<i class="fa fa-key"></i>
</span>
<input type="password" id="Admin_Password" name="Admin_Password" class="form-control" placeholder="Password" aria-describedby="basic-addon1">
</div>
</div>
</div>
<button class=" btn btn-outline-info" type="submit" name="Login" id="Login">Login</button>
<div class="user-links">
<a href="#" class="pull-left">Forgot Password?</a>
<a href="#" class="pull-right">Register</a>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
<!-- /PAGE CONTENT -->
</div>
</body>
</html>
Tag : MySQL, HTML, HTML5, Web Services, XAMPP
|
|
|
|
|
|
Date :
2020-05-07 09:24:50 |
By :
Hararock |
View :
638 |
Reply :
0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|