Skip to content
Snippets Groups Projects
Commit a0acb370 authored by ZHANG David's avatar ZHANG David
Browse files

Upload New File

parent b9111033
No related branches found
No related tags found
No related merge requests found
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
include 'config.php';
session_start();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$email = $_POST['email'];
$password = $_POST['password'];
// Préparer la requête pour éviter les injections SQL
$stmt = $conn->prepare("SELECT id, first_name, last_name, email, role, specialty, password, status FROM User WHERE email = ?");
$stmt->bind_param("s", $email);
$stmt->execute();
$result = $stmt->get_result();
$user = $result->fetch_assoc();
if ($user && password_verify($password, $user['password'])) {
// Stocker les informations utilisateur dans la session
$_SESSION['user'] = [
'id' => $user['id'],
'first_name' => $user['first_name'],
'last_name' => $user['last_name'],
'email' => $user['email'],
'role' => $user['role'],
'specialty' => $user['specialty'],
'status' => $user['status']
];
header('Location: welcome.php');
exit;
} else {
// Email ou mot de passe invalide
$error = "Invalid email or password.";
}
$stmt->close();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome</title>
<link rel="stylesheet" href="style.css">
<style>
body {
background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
padding: 30px;
}
.container {
text-align: center;
background: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
max-width: 600px;
width: 90%;
}
h1 {
margin-top: 0;
color: #333;
}
p {
color: #555;
line-height: 1.6;
}
a {
text-decoration: none;
color: #007BFF;
margin: 10px;
}
a:hover {
text-decoration: underline;
}
img {
max-width: 100%;
height: auto;
border-radius: 8px;
margin-top: 20px;
}
</style>
</head>
<body>
<div class="animated slideInLeft" id="square">
<div class="animated bounceInUp" id="leftSquare">
<div class="animated bounceInUp" id="circle">
<img class="brand img-responsive" src="img/but.jpg" />
</div>
<h2 id="title">Bienvenue sur Tutorat R&T</h2>
<h3 id="subtitle">Le savoir est la seule richesse qui s’accroît quand on la partage.</h3>
</div>
<div class="animated bounceInDown" id="rightSquare">
<div id="container">
<h1 class="signup">Connexion</h1>
<form className="animated slideInLeft" method="post" action="">
<?php if (isset($error)): ?>
<p class="error">&#9888; <?= htmlspecialchars($error) ?></p>
<?php endif; ?>
<input class="optin" type="mail" name="email" id="email" placeholder="email" required/>
<input class="optin" type="password" name="password" id="password"placeholder="Mot de passe" required/>
<div></div>
<div id="button-container">
<button class="animated infinite pulse button btn btn-info" onclick="window.location.href='register.html'">S'incrire</a></button>
<button class="animated infinite pulse button btn btn-info" type="submit">Se connecter</button>
</div>
<h3 id="footer">En continuant, vous acceptez nos <span id=« terms »>termes et conditions.</span></h3>
</form>
</div>
</div>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment