-
Notifications
You must be signed in to change notification settings - Fork 147
/
register.php
50 lines (42 loc) · 1.24 KB
/
register.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
<?php
include 'connect.php';
if(isset($_POST['signUp'])){
$Name=$_POST['Name'];
$username=$_POST['username'];
$email=$_POST['email'];
$password=$_POST['password'];
$password=md5($password);
$checkEmail="SELECT * From users where email='$email'";
$result=$conn->query($checkEmail);
if($result->num_rows>0){
echo "Email Address Already Exists !";
}
else{
$insertQuery="INSERT INTO users(firstName,lastName,email,password)
VALUES ('$Name','$usename','$email','$password')";
if($conn->query($insertQuery)==TRUE){
header("location: index.php");
}
else{
echo "Error:".$conn->error;
}
}
}
if(isset($_POST['signIn'])){
$email=$_POST['email'];
$password=$_POST['password'];
$password=md5($password) ;
$sql="SELECT * FROM users WHERE email='$email' and password='$password'";
$result=$conn->query($sql);
if($result->num_rows>0){
session_start();
$row=$result->fetch_assoc();
$_SESSION['email']=$row['email'];
header("Location:http://127.0.0.1:5500/prj/index%20(3).html");
exit();
}
else{
echo "Not Found, Incorrect Email or Password";
}
}
?>