Viewing File: /home/webrbaew/candycleansestore.co/admin/login.php

<?php session_start(); ?>
<?php 
	include "database.php";
	if(isset($_SESSION['admin_id'])){
		echo '<script> window.location.href = "index.php"; </script>';
		header("location:index.php");
		exit();
	}
?>
<?php
	$error = "";
	if(isset($_POST['admin_login'])){
		$admin_email = $_POST['admin_email'];
		$admin_password = $_POST['admin_password'];
		$result = mysqli_query($con,"SELECT * FROM admin WHERE admin_email='$admin_email' AND admin_password='$admin_password'");
		if(mysqli_num_rows($result)>0){
			$row = mysqli_fetch_array($result);
			$_SESSION['admin_id']= $row['admin_id'];
			$_SESSION['role'] = $row['role'];
			$role = $_SESSION['role'] ;
			if($role=='Super Admin'){$role='super admin';}elseif($role=='User'){$role='user';}
			echo '<script> window.location.href = "index.php"; </script>';
			header("location:index.php"); exit();
		} else {
			$error = '<p style="padding-top:10px; color:red;font-weight:350;text-align:center"><b>Invalid Email or Password</b></p>';
		}
	}
	
	$res = mysqli_query($con, "SELECT * FROM system_configuration");
	$lang = mysqli_fetch_array($res);
?>
<!DOCTYPE html>
<html lang="en">

<head>
	<title><?php echo $lang['system_name']?></title>
    <?php include "includes/headerlinks.php";?>
	<link rel="icon" href="assets/images/favicon.png" sizes="32x32" />
    <style>
		.login-register {
			height: 100vh !important;
			background-attachment: fixed;
			background-repeat: no-repeat;
			background-size: cover;
			background-position-x: -18rem;
		}
		
		.login-register::before {
			content: "";
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
			background-color: rgba(0, 0, 0, 0.1);
		}
		
		
		@media only screen and (max-width: 600px) {
		  .login-box {
			height: 380px !important;
			position:relative;
			top:70px;
		  }
		}
	</style>
</head>

<body>
    <!-- ============================================================== -->
    <!-- Preloader - style you can find in spinners.css -->
    <!-- ============================================================== -->
    <div class="preloader">
        <svg class="circular" viewBox="25 25 50 50">
            <circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10" /> </svg>
    </div>
    <!-- ============================================================== -->
    <!-- Main wrapper - style you can find in pages.scss -->
    <!-- ============================================================== -->
    <section id="wrapper" class="login-register login-sidebar" style="background-image:url(assets/images/Candy_Cleanse_Taste_So_Good.webp);">
        <div class="login-box card">
            <div class="card-body">
                <form class="form-horizontal form-material" id="loginform1" method="post">
                    <a href="javascript:void(0)" class="text-center db"><img src="uploads/logo/<?php echo $lang['system_image']?>" alt="Home" style="width:60%;margin-top:0px"></a>
                    <?php echo $error;?>
					<div class="form-group m-t-40">
                        <div class="col-xs-12">
                            <input class="form-control" name="admin_email" type="email" required="" placeholder="Email">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-xs-12">
                            <input class="form-control" name="admin_password" type="password" required="" placeholder="Password">
                        </div>
                    </div>
                    <div class="form-group text-center m-t-20">
                        <div class="col-xs-12">
                            <button class="btn btn-info btn-lg btn-block text-uppercase waves-effect waves-light" name="admin_login" type="submit" style="background:#ff4e4e !important;border-color:#ff4e4e !important">Log In</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </section>
    <?php include "includes/footerlinks.php";?>
</body>

</html>
Back to Directory File Manager