init
This commit is contained in:
93
.hta_slug/login.php
Normal file
93
.hta_slug/login.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
// require_once('/var/www/html/.htac_header.php');
|
||||
if($_SESSION['log_status'] == 1){
|
||||
echo '<script>window.location.href = "/cleads";</script>';
|
||||
// exit();
|
||||
}
|
||||
if ($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['pass']) && isset($_POST['email'])) {
|
||||
try {
|
||||
$password = md5($_POST['pass']);
|
||||
$email = $_POST['email'];
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$stmt = $conn->prepare("SELECT * FROM users WHERE email = :email AND pass = :pass");
|
||||
$stmt->bindParam(':email', $email);
|
||||
$stmt->bindParam(':pass', $password);
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
// var_dump($rows);
|
||||
$num_rows = $stmt->rowCount();
|
||||
if ($num_rows == 1) {
|
||||
foreach($rows as $row){
|
||||
$_SESSION["loggedin"] = true;
|
||||
$_SESSION["log_status"] = 1;
|
||||
$_SESSION["user_type"] = $row['type'];
|
||||
$_SESSION["access"] = $row['access'];
|
||||
$_SESSION["name"] = $row['name'];
|
||||
$_SESSION["email"] = $row['email'];
|
||||
echo '<script>window.location.href = "/cleads";</script>';
|
||||
// echo $_SESSION["loggedin"].$_SESSION["log_status"].$_SESSION["access"].$_SESSION["name"].$_SESSION["email"];
|
||||
}
|
||||
} else{
|
||||
echo "<p class='text-danger'>Credentials did not match</p>";
|
||||
}
|
||||
|
||||
// else echo "credentials did not match";+
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="container-fluid" style="background-image: url('/assets/login-back1.jpg'); background-position: center; background-size: cover; background-repeat: no-repeat; height: 100vh; width: 100%;">
|
||||
<div class="login-section-center flex flex-col">
|
||||
<div class="blur-background text-[#fff]" style="width: 100%;">
|
||||
<div class="text-[#fff] px-6 pt-6 pb-[50px]">
|
||||
<h3 class="text-3xl font-bold">Welcome Back</h3>
|
||||
<h2 class="">Enter your email and password to access your account</h2>
|
||||
</div>
|
||||
<form action="" method="post" class="space-y-4 rounded-md">
|
||||
<div class="">
|
||||
<label for="email">Email:</label>
|
||||
<input type="text" class="p-2 bg-transparent text-[#fff] border-[2px] border-[#fff] rounded-lg focus:outline-none w-full" name="email" placeholder="Email ID">
|
||||
</div>
|
||||
<div class="">
|
||||
<label for="password">Password:</label>
|
||||
<input type="password" class="p-2 bg-transparent text-[#fff] border-[2px] border-[#fff] rounded-lg focus:outline-none w-full" name="pass" placeholder="Password">
|
||||
</div>
|
||||
<div class="flex flex-row place-content-between font-extralight ">
|
||||
<div class="flex flex-row justify-center">
|
||||
<input type="checkbox" name="remem" id="remem" />
|
||||
<label for="remem">Remember me</label>
|
||||
</div>
|
||||
<a href="#">Forgot Password?</a>
|
||||
</div>
|
||||
<div class="flex flex-col bg-[#7875F4] rounded-lg p-2">
|
||||
<button type="submit" class="">Login</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.login-section-center{
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
position: absolute;
|
||||
background-color: transparent;
|
||||
|
||||
}
|
||||
.blur-background{
|
||||
backdrop-filter: blur(2px);
|
||||
background-color: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 20px;
|
||||
padding: 20px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user