Deprecated: Function mysql() is deprecated in /home/u624273934/public_html/ecommerce/admin_area/login.php on line 39
Warning: mysql() expects parameter 1 to be string, object given in /home/u624273934/public_html/ecommerce/admin_area/login.php on line 39
Warning: mysql_result() expects at least 2 parameters, 1 given in /home/u624273934/public_html/ecommerce/admin_area/login.php on line 41
the code is this:
<?php
session_start();
?>
<!DOCTYPE>
<html>
<head>
<title>Login Form</title>
<link rel="stylesheet" href="styles/login_style.css" media="all" />
</head>
<body>
<div class="login">
<h2 style="color:white; text-align:center;"><?php echo @$_GET['not_admin']; ?></h2>
<h2 style="color:white; text-align:center;"><?php echo @$_GET['logged_out']; ?></h2>
<h1>Admin Login</h1>
<form method="post" action="login.php">
<input type="text" name="user_email" placeholder="Email" required="required" />
<input type="password" name="user_pass" placeholder="Password" required="required" />
<button type="submit" class="btn btn-primary btn-block btn-large" name="login">Login</button>
</form>
</div>
</body>
</html>
<?php
if(isset($_POST['login'])){
$user_email = $_POST['user_email'];
$user_pass = $_POST['user_pass'];
$sel_c = "select * from admins where user_pass='$user_pass' AND user_email='$user_email'";
$run_c = mysql($con, $sel_c);
$check_customer = mysql_result($run_c);
if($check_customer==0){
echo "<script>alert('Password or email is incorrect, plz try again!')</script>";
exit();
}
$ip = getIp();
$sel_cart = "select * from cart where ip_add='$ip'";
$run_cart = mysqli_query($con, $sel_cart);
$check_cart = mysqli_num_rows($run_cart);
if($check_customer>0 AND $check_cart==0){
$_SESSION['user_email']=$user_email;
echo "<script>alert('You logged in successfully, Thanks!')</script>";
echo "<script>window.open('customer/my_account.php','_self')</script>";
}
else {
$_SESSION['user_email']=$user_email;
echo "<script>alert('You logged in successfully, Thanks!')</script>";
echo "<script>window.open('checkout.php','_self')</script>";
}
}
?>