-
Notifications
You must be signed in to change notification settings - Fork 2
/
login_action.php
95 lines (53 loc) · 1.86 KB
/
login_action.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
session_start();
include('config.php');
if(isset($_POST['button']))
{
$fisrt_parm = $_POST['email'];
$password = md5($_POST['password']);
$full_name = "fullname";
$user_name= "username";
$user_type = "1";
$email_address= "example@gmail.com";
$facebook = "www.facebook.com";
$whatsapp = "www.webwhatsapp.com";
$bio = "tell use more about you";
$fallowers = 0;
$fallowing = 0;
$post_count = 0;
$image = "assets/images/default.png";
$user_id = 000000;
$sql_query = "SELECT User_ID, FULL_NAME, USER_NAME, USER_TYPE, EMAIL, IMAGE, FACEBOOK, WHATSAPP, BIO, FALLOWERS, FALLOWING, POSTS FROM USERS WHERE (USER_NAME = '$fisrt_parm' OR EMAIL = '$fisrt_parm') AND PASSWORD_S = '$password';";
$stmt = $conn->prepare($sql_query);
$stmt->execute();
$stmt->store_result();
if($stmt->num_rows() > 0)
{
$stmt->bind_result($user_id, $full_name, $user_name, $user_type, $email_address, $image, $facebook, $whatsapp, $bio, $fallowers, $fallowing, $post_count);
$stmt->fetch();
$_SESSION['id'] = $user_id;
$_SESSION['username'] = $user_name;
$_SESSION['fullname'] = $full_name;
$_SESSION['email'] = $email_address;
$_SESSION['usertype'] = $user_type;
$_SESSION['facebook'] = $facebook;
$_SESSION['whatsapp'] = $whatsapp;
$_SESSION['bio'] = $bio;
$_SESSION['fallowers'] = $fallowers;
$_SESSION['fallowing'] = $fallowing;
$_SESSION['postcount'] = $post_count;
$_SESSION['img_path'] = $image;
header("location: home.php");
}
else{
echo 'faild';
header('location: login.php?error_message=Email/Password Incorrect');
exit;
}
}
else{
echo 'fails';
header('location: login.php?error_message=Some Error Happend');
exit;
}
?>