-
Notifications
You must be signed in to change notification settings - Fork 0
/
signInProcess.php
58 lines (40 loc) · 1.27 KB
/
signInProcess.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
session_start();
require "connection.php";
$email = $_POST["e"];
$password = $_POST["p"];
$rememberme = $_POST["r"];
if(empty($email)){
echo("Please enter your Email");
}else if(strlen($email) > 100){
echo("Email must have less than 100 characters");
}else if(!filter_var($email,FILTER_VALIDATE_EMAIL)){
echo("Invalid Email");
}else if(empty($password)){
echo("Please enter your password");
}else if(strlen($password) < 5 || strlen($password) > 20){
echo("password must have between 5-20 characters");
}else{
$rs = Database::search("SELECT * FROM `user` WHERE `email`='".$email."'
AND `password`='".$password."'");
$n = $rs->num_rows;
if($n == 1){
$d = $rs->fetch_assoc();
$_SESSION["u"] = $d;
if($d["status"] == 0){
echo("You can't Signin to the eShop because the admin was blocked you.");
}else{
echo("success");
}
if($rememberme == "true"){
setcookie("email",$email, time() + (60 * 60 * 24 * 365));
setcookie("password",$password, time() + (60 * 60 * 24 * 365));
}else{
setcookie("email","",-1);
setcookie("password","",-1);
}
}else{
echo("Invalid Username or Password");
}
}
?>