Add files via upload

pull/8/head
SuperDev 3 years ago committed by GitHub
parent 45db4642ab
commit a2476a8195
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,38 @@
/* (A) WHOLE PAGE */
html, body { font-family: arial, sans-serif; }
/* (B) LOGIN FORM */
#login-form {
padding: 20px;
background: #f2f2f2;
max-width: 320px;
margin: 0 auto;
}
#login-form h1 {
font-size: 1.5em;
margin: 0;
color: #9b9b8d;
}
#login-form label, #login-form input {
box-sizing: border-box;
display: block;
width: 100%;
margin-top: 10px;
}
#login-form input { padding: 10px; }
#login-form input[type=submit] {
background: #ad4343;
color: #fff;
border: 0;
cursor: pointer;
}
/* (C) INVALID LOGIN */
#bad-login {
padding : 10px;
margin-bottom: 10px;
background: #ffe7e7;
border: 1px solid #ff3e3e;
color: #c10000;
font-weight: bold;
}

@ -0,0 +1,40 @@
<?php
session_start();
// Generate random 6 character string
$captcha_code = substr(str_shuffle('01234567890123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'), 0, 6);
// Update the session variable
$_SESSION['captcha'] = $captcha_code;
// Create the image canvas - width: 150px; height: 50px;
$final_image = imagecreate(150, 50);
// Background color (RGBA)
$rgba = [241, 245, 248, 0];
// Set the background color
$image_bg_color = imagecolorallocatealpha($final_image, 241, 245, 248, 0);
// Convert the captcha text to an array
$captcha_code_chars = str_split($captcha_code);
// Iterate the above array
for($i = 0; $i < count($captcha_code_chars); $i++) {
// Create the character image canvas
$char_small = imagecreate(130, 16);
$char_large = imagecreate(130, 16);
// Character background color
$char_bg_color = imagecolorallocate($char_small, 241, 245, 248);
// Character color
$char_color = imagecolorallocate($char_small, rand(80,180), rand(80,180), rand(80, 180));
// Draw the character on the canvas
imagestring($char_small, 1, 1, 0, $captcha_code_chars[$i], $char_color);
// Copy the image and enlarge it
imagecopyresampled($char_large, $char_small, 0, 0, 0, 0, rand(250, 400), 16, 84, 8);
// Rotate the character image
$char_large = imagerotate($char_large, rand(-6,6), 0);
// Add the character image to the main canvas
imagecopymerge($final_image, $char_large, 20 + (20 * $i), 15, 0, 0, imagesx($char_large), imagesy($char_large), 70);
// Destroy temporary canvases
imagedestroy($char_small);
imagedestroy($char_large);
}
// Output the created image
header('Content-type: image/png');
imagepng($final_image);
imagedestroy($final_image);
?>

@ -0,0 +1,37 @@
<?php
// Get Configuration
require '../system/config.php';
// Get Dashboard URL
$url = $file_url_destination."/admin/dashboard";
// (A) START SESSION
session_start();
// (B) HANDLE LOGIN
if (isset($_POST["user"]) && !isset($_SESSION["user"])) {
// (B1) USERS & PASSWORDS - SET YOUR OWN !
$users = [
email => password // USER AND PASSWORD PULLED FROM CONFIGURATION FILE
];
// (B2) CHECK & VERIFY
if (isset($users[$_POST["user"]])) {
// check captcha
if ($_SESSION['captcha'] !== $_POST['captcha']) {
header("Location: ?capfail");
exit(0);
}
// end captcha
if ($users[$_POST["user"]] == $_POST["password"]) {
$_SESSION["user"] = $_POST["user"];
}
}
// (B3) FAILED LOGIN FLAG
if (!isset($_SESSION["user"])) { $failed = true; }
}
// (C) REDIRECT USER TO DASHBOARD IF SIGNED IN
if (isset($_SESSION["user"])) {
header("Location: dashboard"); // REDIRECT TO DASHBOARD
exit();
}

@ -1 +1,119 @@
<?php
// (A) LOGIN CHECKS
require "check.php";
?>
<head>
<title>Login</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--===============================================================================================-->
<link rel="icon" type="image/png" href="images/icons/favicon.ico"/>
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="fonts/font-awesome-4.7.0/css/font-awesome.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="fonts/Linearicons-Free-v1.0.0/icon-font.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="vendor/animate/animate.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="vendor/css-hamburgers/hamburgers.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="vendor/animsition/css/animsition.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="vendor/daterangepicker/daterangepicker.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="css/util.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
<!--===============================================================================================-->
</head>
<body>
<div class="limiter">
<div class="container-login100">
<div class="wrap-login100 p-l-55 p-r-55 p-t-65 p-b-50">
<form class="login100-form validate-form" method="post" target="_self">
<span class="login100-form-title p-b-33">
Admin Login
</span>
<!-- inv credentials -->
<?php if (isset($failed)) { ?>
<div class="alert alert-danger shadow" data-dismiss="alert" role="alert" style="border-left:#721C24 5px solid; border-radius: 0px">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
</button>
<div class="row">
<svg width="1.25em" height="1.25em" viewBox="0 0 16 16" class="m-1 bi bi-exclamation-circle-fill" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8 4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0 0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/>
</svg>
<p style="font-size:18px" class="mb-0 font-weight-light"><b class="mr-1">Invalid Credentials</b>
</div>
</div>
<?php } ?>
<!-- invalid captcha -->
<?php if (isset($_GET["capfail"])) { ?>
<div class="alert alert-danger shadow" data-dismiss="alert" role="alert" style="border-left:#721C24 5px solid; border-radius: 0px">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
</button>
<div class="row">
<svg width="1.25em" height="1.25em" viewBox="0 0 16 16" class="m-1 bi bi-exclamation-circle-fill" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8 4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0 0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/>
</svg>
<p style="font-size:18px" class="mb-0 font-weight-light"><b class="mr-1">Invalid Captcha</b>
</div>
</div>
<?php } ?>
<div class="wrap-input100 validate-input" data-validate = "Valid email is required">
<input class="input100" type="email" id="user" name="user" placeholder="Email">
<span class="focus-input100-1"></span>
<span class="focus-input100-2"></span>
</div>
<div class="wrap-input100 rs1 validate-input" data-validate="Password is required">
<input class="input100" type="password" id="password" name="password" placeholder="Password">
<div class="captcha wrap-input100">
<img src="captcha.php" width="150" height="50">
<input type="text" id="captcha" name="captcha" placeholder="Enter captcha code" title="Please enter the captcha code!" required>
</div>
<span class="focus-input100-1"></span>
<span class="focus-input100-2"></span>
<span class="focus-input100-3"></span>
</div>
<div class="container-login100-form-btn m-t-20">
<button class="login100-form-btn">
Sign in
</button>
</div>
</form>
</div>
</div>
</div>
<!--===============================================================================================-->
<script src="vendor/jquery/jquery-3.2.1.min.js"></script>
<!--===============================================================================================-->
<script src="vendor/animsition/js/animsition.min.js"></script>
<!--===============================================================================================-->
<script src="vendor/bootstrap/js/popper.js"></script>
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
<!--===============================================================================================-->
<script src="vendor/select2/select2.min.js"></script>
<!--===============================================================================================-->
<script src="vendor/daterangepicker/moment.min.js"></script>
<script src="vendor/daterangepicker/daterangepicker.js"></script>
<!--===============================================================================================-->
<script src="vendor/countdowntime/countdowntime.js"></script>
<!--===============================================================================================-->
<script src="js/main.js"></script>
</body>
</html>

@ -0,0 +1,12 @@
<?php
// (A) START SESSION
session_start();
// (B) LOGOUT REQUEST
if (isset($_POST["logout"])) { unset($_SESSION["user"]); }
// (C) REDIRECT TO LOGIN PAGE IF NOT LOGGED IN
if (!isset($_SESSION["user"])) {
header("Location: ../");
exit();
}
Loading…
Cancel
Save