-
Notifications
You must be signed in to change notification settings - Fork 0
/
connexion.php
154 lines (129 loc) · 4.83 KB
/
connexion.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login</title>
<link rel="stylesheet" type="text/css" href="styles/connexionStyle.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script type="text/javascript" src="script.js"></script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.1/css/all.css">
<link rel="icon" href="https://assets.stickpng.com/thumbs/5841c704a6515b1e0ad75aab.png" type="image/png">
<style>
* {
box-sizing: border-box;
}
/* Create two equal columns that floats next to each other */
.column {
float: left;
width: 60%;
padding: 30px;
/* Should be removed. Only for demonstration */
}
.column1 {
float: left;
width: 30%;
padding: 10px;
/* Should be removed. Only for demonstration */
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
.loginBox {
background-image: url(https://cdn.dribbble.com/users/2054184/screenshots/6335402/framesequence-dog.gif);
background-position-x: -100px;
box-shadow:
0 2.8px 2.2px rgba(0, 0, 0, 0.034),
0 6.7px 5.3px rgba(0, 0, 0, 0.048),
0 12.5px 10px rgba(0, 0, 0, 0.96),
0 22.3px 17.9px rgba(0, 0, 0, 0.072),
0 41.8px 33.4px rgba(0, 0, 0, 0.086),
0 100px 80px rgba(0, 0, 0, 0.12);
}
@media only screen and (max-width: 600px) {
.column1 {
float: left;
width: 0%;
padding: 0px;
/* Should be removed. Only for demonstration */
}
}
.pp {
position: fixed;
left: 0;
font-size: 13px;
bottom: 0;
width: 100%;
color: e1e1e1;
text-align: center;
color: #a1a1a1;
}
</style>
</head>
<body>
<?php
require("DB/connexion.php");
session_start();
$co = connexionBdd();
$message = "";
if (isset($_POST["submit"])) {
$pseudo = $_POST["pseudo"];
$password = hash('sha256', $_POST["password"]);
$query = $co->prepare("SELECT * FROM utilisateurs WHERE pseudo=:pseudo and mot_de_passe=:password");
$query->bindParam(":pseudo", $pseudo);
$query->bindParam(":password", $password);
$query->execute();
$result = $query->fetchAll();
$rows = $query->rowCount();
if ($rows == 1) {
$_SESSION["pseudo"] = $pseudo;
$_SESSION["id"] = $result[0]["id"];
$_SESSION["bio"] = $result[0]["bio"];
$_SESSION["name"] = $result[0]["name"];
$_SESSION["weblink"] = $result[0]["weblink"];
$_SESSION["pseudo_id"] = $result[0]["id"];
$_SESSION["pseudo_role"] = $result[0]["role"];
$_SESSION["pseudo_email"] = $result[0]["email"];
$_SESSION["pseudo_avatar"] = $result[0]["avatar"];
$_SESSION["collage"] = $result[0]["collage"];
$_SESSION["education"] = $result[0]["education"];
header("Location: accueil.php");
} else {
$message = "Username and Password incorrect";
}
}
?>
<div class="wrapper" style="background: linear-gradient(rgba(18, 18, 18, 0.9), rgba(18, 18, 18, 0.9)), url(https://image.freepik.com/free-vector/space-seamless-pattern-stars-moon-planets-galaxy-seamless-doodle-universe-background-galaxy-space-astronomy-doodle-universe_80590-8737.jpg);">
<div class="loginBox">
<h1>Welcome Back</h1>
<div class="row">
<div class="column">
<form action="" method="post">
<p>Username</p>
<input type="text" name="pseudo" placeholder="Enter your username" required>
<p>Password</p>
<input type="password" name="password" placeholder="Enter your password" required>
<input type="submit" name="submit" value="Login">
</form>
</div>
<div class="column1">
<!--Nothing-->
</div>
</div>
<p><a href="inscription.php" style="text-decoration: none; text-align: center; font-size: 16px;">You do not have an account?</a></p>
<h5 style="color: #F52936;"><?php echo $message; ?></h5>
</div>
</div>
<p class="pp">Designed and Developed By Prashant Kumar</p>
</body>
<script>
if (window.history.replaceState) {
window.history.replaceState(null, null, window.location.href);
}
</script>
</html>