<?php
$login_failed = false;
// Static username and password
$static_username = 'admin@admin.com';
$static_password = 'admin1234';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$username = $_POST["username"];
$password = $_POST["password"];
// Check if provided credentials match static credentials
if ($username === $static_username && $password === $static_password) {
// Password is correct, so start a new session
session_start();
// Store data in session variables
$_SESSION["loggedin"] = true;
$_SESSION["username"] = $username; // Replace with user's ID if needed
// Redirect user to welcome page
header("Location: ./webpages-list.php");
exit();
} else {
$login_failed = true;
}
}
?>
<?php
// Include coredb.php for database connection
require_once('config/core.php');
// Create database connection
$conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Fetch favicon from site_settings table
$favicon_url = ""; // Default value
$sql = "SELECT favicon FROM site_settings LIMIT 1";
$result = $conn->query($sql);
if ($result && $result->num_rows > 0) {
$row = $result->fetch_assoc();
$favicon_url = $row['favicon'];
}
// Fetch metatitle, metadescription, metakeyword
$sql = "SELECT title, meta_description, meta_keyword FROM webpages WHERE webpage_name = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("s", $webpage_name);
$webpage_name = "login"; // Replace "your_webpage_name" with the actual webpage name
$stmt->execute();
$stmt->bind_result($title, $meta_description, $meta_keyword);
$stmt->fetch();
$stmt->close();
// metatitle, metadescription, metakeyword End
// Close the database connection
$conn->close();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Character set configuration -->
<meta charset="utf-8">
<title><?php echo htmlspecialchars($title); ?></title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="icon" type="image/x-icon" href="<?php echo htmlspecialchars($favicon_url); ?>">
<meta name="robots" content="index, follow" />
<meta name="description" content="<?php echo htmlspecialchars($meta_description); ?>">
<meta name="keywords" content="<?php echo htmlspecialchars($meta_keyword); ?>">
<!-- Bootstrap CSS -->
<link href="assets/css/bootstrap.min.css" rel="stylesheet">
<!-- custom CSS -->
<link href="assets/css/custom.css" rel="stylesheet">
<!-- Font Awesome icon -->
<link href="assets/fontawesome/css/fontawesome.css" rel="stylesheet" />
<!-- DataTables Bootstrap CSS -->
<link href="assets/css/dataTables.bootstrap5.min.css" rel="stylesheet">
<!-- Roboto font -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="bg-light">
<section class="p-0 d-flex align-items-center position-relative overflow-hidden">
<!-- container-fluid Begin -->
<div class="container-fluid">
<!-- Row Begin -->
<div class="row">
<!-- left Begin-->
<div class="col-12 col-lg-6 d-md-flex align-items-center justify-content-center bg-linear-gradient vh-lg-100">
<div class="p-3 p-lg-5">
<!-- Title -->
<div class="text-center">
<h1 class="h2 fw-bold text-white">Instant Background Remover</h1>
<p class="mb-2 pt-2 fw-light text-white">Remove the background from your picture and download instantly.</p>
</div>
<!-- SVG Image -->
<img src="assets/images/login.png" class="img-fluid mx-auto d-block" title="login" alt="sign-in">
</div>
</div>
<!-- left End-->
<!-- Right Begin-->
<div class="col-12 col-lg-6 m-auto">
<div class="row my-5">
<div class="col-sm-10 col-xl-8 m-auto">
<a class="btn btn-primary btn-sm mb-3" href="../index.php">Back to home</a>
<!-- Title -->
<h2 class="font-bold">Nice to see you! </h2>
<p class="lead"> Please log in with your account.</p>
<!-- Form START -->
<form method="post" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
<div class="mb-3">
<label for="username" class="form-label">Email</label>
<input type="email" name="username" class="form-control" required>
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" id="password" name="password" class="form-control" required>
<span toggle="#password" class="fa fa-fw fa-eye field-icon toggle-password"></span>
</div>
<div class="text-center">
<input type="submit" class="btn btn-primary w-100" value="Login Now">
</div>
</form>
<!-- Form END -->
<?php if ($login_failed) : ?>
<script>
alert("Invalid credentials!");
</script>
<?php endif; ?>
</div>
</div>
<!-- Row END -->
</div>
<!-- Right End-->
</div>
<!-- Row END -->
</div>
<!-- container-fluid End -->
</section>
<script src="../assets/js/jquery-3.5.1.min.js"></script>
<script>
$(".toggle-password").click(function() {
$(this).toggleClass("fa-eye fa-eye-slash");
var input = $($(this).attr("toggle"));
if (input.attr("type") == "password") {
input.attr("type", "text");
} else {
input.attr("type", "password");
}
});
</script>
</body>
</html>