-
Notifications
You must be signed in to change notification settings - Fork 4
/
login.php
48 lines (31 loc) · 1.04 KB
/
login.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
<?php
require 'vendor/autoload.php'; // Include the Predis library
// Create a Redis client
$redis = new Predis\Client();
// Get the form data
$Email = $_POST['Email'];
$password = $_POST['password'];
// Store the email and password data in Redis
$redis->set($Email, $password);
if(empty($_POST['Email']) || empty($_POST['password'])){
echo json_encode( array('message' => 'fill all the fields') );
exit();
}
//check if email matches with
$Email=$_POST['Email'];
$Password=$_POST['password'];
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "signup";
$conn = new mysqli($servername, $username, $password, $dbname);
//select email and password from the database
$select = mysqli_query($conn, "SELECT * FROM signup WHERE email = '".$_POST['Email']."' AND password = '".$_POST['password']."'");
if(mysqli_num_rows($select)) {
echo json_encode( array('success' => true) );
}
else{
echo json_encode( array('message' => 'invalid email or password') );
exit();
}
?>