<?php session_start(); ob_start(); include 'config.php'; //echo md5('s'); ?>
<!DOCTYPE html>
<html >
<head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Laughing Plants- Login</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link href='http://fonts.googleapis.com/css?family=Titillium+Web:400,300,600' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<link rel="stylesheet" href="css/main.css">
<link href="images/favicon.png" rel="icon" >
</head>
<body style="background: #210748;; background-size: cover;">
<h2 style="text-align: center; color:#fff;margin-top:6%">LAUGHING PLANTS</h2>
<div class="form">
<div id="signup">
<form action="" method="post" id="login-form">
<div class="field-wrap">
<input type="email" required name="full_user_email" placeholder="Email ID"/>
</div>
<div class="field-wrap">
<input type="password"required name="full_user_password" placeholder="Password" />
</div>
<button class="button button-block" type="submit" name="login_submit">Log In</button>
</form>
</div>
</div> <!-- /form -->
<script src='js/jquery.min.js'></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/index.js"></script>
<script src="js/jquery.validate.js"></script>
</body>
<script>
$('#login-form').validate();
</script>
</html>
<?php
include 'config.php';
if(isset($_POST['login_submit']))
{
$ad_email_address = htmlspecialchars(trim($_POST['full_user_email'])) ;
$ad_password = htmlspecialchars(trim($_POST['full_user_password']));
$ad_password = md5($ad_password);
$ad_status =1;
$check_login = $con->prepare("SELECT * FROM tbl_admin WHERE ad_email_address=:ad_email_address AND ad_password=:ad_password AND ad_status=:ad_status");
$check_login->bindParam(':ad_email_address', $ad_email_address);
$check_login->bindParam(':ad_password', $ad_password);
$check_login->bindParam(':ad_status', $ad_status);
$check_login->execute();
$num = $check_login->rowCount();
if($num)
{
$row = $check_login->fetch(PDO::FETCH_ASSOC);
if($row['ad_email_address']===$ad_email_address && $row['ad_password']===$ad_password)
{
$_SESSION["id"] = $row['id'];
$_SESSION["ad_email_address"] = $row['ad_email_address'];
$_SESSION["session"] = true;
header('Location: dashboard.php');
echo "<meta http-equiv='refresh' content='0;url=dashboard.php'>";
echo "<script>window.location='dashboard.php';</script>";
}
else
{
echo "<script> alert('Invalid login credentials');</script>";
}
}
else
{
echo "<script> alert('Invalid login credentials');</script>";
}
}
?>
|