kodlar şu şekilde
<?php require_once('./config.php'); ?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="application-name" content="LD Talent Login Project">
<meta name="author" content="Ilori Stephen A">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Css Styles... -->
<link rel="stylesheet" href="./assets/css/bootstrap.min.css">
<link rel="stylesheet" href="./assets/css/style.css">
<!-- Script -->
<script src="./assets/js/jquery.js" charset="utf-8"></script>
<script src="./assets/js/bootstrap.min.js" charset="utf-8"></script>
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<div class="container">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav ml-auto">
<?php if (!isset($_SESSION['auth_status'])) : ?>
<h1 class="text-center display-4" style="margin-top: -60px;font-size: 2rem"><?=$_SESSION['name']?></h1>
<li class="nav-item">
<a class="nav-link <?php if (strtolower($active) === 'login') echo 'active'; ?>" href="<?php echo BASE_URL; ?>index.php">Login</a>
</li>
<li class="nav-item">
<a class="nav-link <?php if (strtolower($active) === 'register') echo 'active'; ?>" href="<?php echo BASE_URL; ?>register.php" tabindex="-1" aria-disabled="true">Register</a>
</li>
<?php elseif (isset($_SESSION['auth_status'])) : ?>
<li class="nav-item">
<a href="<?php echo BASE_URL; ?>dashboard.php" class="nav-link <?php if (strtolower($active) === 'dashboard') echo 'active'; ?>">Dashboard</a>
</li>
<?php endif; ?>
<?php if (isset($_SESSION['auth_status'])) : ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo BASE_URL; ?>logout.php">Logout</a>
</li>
<?php endif; ?>
</ul>
</div>
</div>
</nav><?php require_once('./controller/Login.php'); ?>
<?php
$Login = new Login();
$Response = [];
$active = $Login->active;
if (isset($_POST) && count($_POST) > 0) $Response = $Login->login($_POST);
?>
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Login | ThemeKit - Admin Template</title>
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="../favicon.ico" type="image/x-icon" />
<link href="https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,600,700,800" rel="stylesheet">
<link rel="stylesheet" href="../licence/node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="../licence/node_modules/@fortawesome/fontawesome-free/css/all.min.css">
<link rel="stylesheet" href="../licence/node_modules/ionicons/dist/css/ionicons.min.css">
<link rel="stylesheet" href="../licence/node_modules/icon-kit/dist/css/iconkit.min.css">
<link rel="stylesheet" href="../licence/node_modules/perfect-scrollbar/css/perfect-scrollbar.css">
<link rel="stylesheet" href="../licence/dist/css/theme.min.css">
<script src="../licence/src/js/vendor/modernizr-2.8.3.min.js"></script>
</head>
<body>
<!--[if lt IE 8]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div class="auth-wrapper">
<div class="container-fluid h-100">
<div class="row flex-row h-100 bg-white">
<div class="col-xl-8 col-lg-6 col-md-5 p-0 d-md-block d-lg-block d-sm-none d-none">
<div class="lavalite-bg" style="background-image: url('../licence/img/auth/login-bg.jpg')">
<div class="lavalite-overlay"></div>
</div>
</div>
<div class="col-xl-4 col-lg-6 col-md-7 my-auto p-0">
<div class="authentication-form mx-auto">
<div class="logo-centered">
<a href="../licence/index.php"><img src="../licence/src/img/brand.svg" alt=""></a>
</div>
<h3>Sign In to ThemeKit</h3>
<p>Happy to see you again!</p>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" class="form-signin">
<div class="form-group">
<input type="email" id="inputEmail" class="form-control" placeholder="Email address" name="email" required autofocus>
<i class="ik ik-user"></i>
</div>
<div class="form-group">
<input type="password" name="password" id="inputPassword" class="form-control" placeholder="Password" required>
<i class="ik ik-lock"></i>
</div>
<div class="row">
<div class="col text-left">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="item_checkbox" name="item_checkbox" value="option1">
<span class="custom-control-label"> Remember Me</span>
</label>
</div>
<div class="col text-right">
<a href="forgot-password.html">Forgot Password ?</a>
</div>
</div>
<div class="sign-btn text-center">
<button class="btn btn-theme" type="submit">Sign In</button>
</div>
</form>
<p>
</p>
<?php if (isset($Response['status']) && !$Response['status']) : ?>
<div class="alert alert-warning alert-dismissible fade show"" role="alert">
<span><B>Hata !</B> Kullanıcı adı veya Parola yanlış.</span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true" class="text-danger">×</span>
</button>
</div>
<?php endif; ?>
<div class="register">
<p>Don't have an account? <a href="register.html">Create an account</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script>window.jQuery || document.write('<script src="../src/js/vendor/jquery-3.3.1.min.js"><\/script>')</script>
<script src="../node_modules/popper.js/dist/umd/popper.min.js"></script>
<script src="../node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="../node_modules/perfect-scrollbar/dist/perfect-scrollbar.min.js"></script>
<script src="../node_modules/screenfull/dist/screenfull.js"></script>
<script src="../dist/js/theme.js"></script>
<!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
</body>
</html><?php require_once('./controller/Dashboard.php'); ?>
<?php
$Dashboard = new Dashboard();
$Response = [];
$active = $Dashboard->active;
$News = $Dashboard->getNews();
?>
<?php require('./nav.php'); ?>
<main role="main" class="container">
<div class="container">
<div class="row mt-5">
<div class="col-xs-12 col-sm-12 col-md-12 col-xl-12 col-lg-12">
<h2>News Hi, </h2>
<hr>
</div>
</div>
<div class="row">
<?php if ($News['status']) : ?>
<?php foreach ($News['data'] as $new) : ?>
<div class="col-xs-12 col-sm-12 col-md-12 col-xl-4 col-lg-4">
<div class="card shadow-lg p-3 mb-5 bg-white rounded">
<div class="news_title">
<h3><?php echo ucwords($new['title']); ?></h3>
</div>
<div class="news_body">
<p><?php echo $new['content']; ?> <a href="javascript:void(0)">Read More</a></p>
</div>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
</main>
</body>
</html><?php
require_once(__dir__ . '/Controller.php');
require_once('./Model/LoginModel.php');
class Login extends Controller {
public $active = 'login'; //for highlighting the active link...
private $loginModel;
/**
* @param null|void
* @return null|void
* @desc Checks if the user session is set and creates a new instance of the LoginModel...
**/
public function __construct()
{
if (isset($_SESSION['auth_status'])) header("Location: dashboard.php");
$this->loginModel = new LoginModel();
}
/**
* @param array
* @return array|boolean
* @desc Verifies and redirects a user by calling the login method on the LoginModel...
**/
public function login(array $data)
{
$email = stripcslashes(strip_tags($data['email']));
$password = stripcslashes(strip_tags($data['password']));
$EmailRecords = $this->loginModel->fetchEmail($email);
if (!$EmailRecords['status']) {
if (password_verify($password, $EmailRecords['data']['password'])) {
//check if the remember_me was selected...
$Response = array(
'status' => true
);
$_SESSION['data'] = $EmailRecords['data'];
$_SESSION['auth_status'] = true;
header("Location: dashboard.php");
}
$Response = array(
'status' => false,
);
return $Response;
}
$Response = array(
'status' => false,
);
return $Response;
}
}
?>login php şu şekilde.<?php
require_once(__dir__ . '/Controller.php');
require_once('./Model/LoginModel.php');
class Login extends Controller {
public $active = 'login'; //for highlighting the active link...
private $loginModel;
/**
* @param null|void
* @return null|void
* @desc Checks if the user session is set and creates a new instance of the LoginModel...
**/
public function __construct()
{
if (isset($_SESSION['auth_status'])) header("Location: dashboard.php");
$this->loginModel = new LoginModel();
}
/**
* @param array
* @return array|boolean
* @desc Verifies and redirects a user by calling the login method on the LoginModel...
**/
public function login(array $data)
{
$email = stripcslashes(strip_tags($data['email']));
$password = stripcslashes(strip_tags($data['password']));
$EmailRecords = $this->loginModel->fetchEmail($email);
if (!$EmailRecords['status']) {
if (password_verify($password, $EmailRecords['data']['password'])) {
//check if the remember_me was selected...
$Response = array(
'status' => true
);
$_SESSION['data'] = $EmailRecords['data'];
$_SESSION['auth_status'] = true;
header("Location: dashboard.php");
}
$Response = array(
'status' => false,
);
return $Response;
}
$Response = array(
'status' => false,
);
return $Response;
}
}
?>