Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tutorat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ZHANG David
tutorat
Commits
a0acb370
Commit
a0acb370
authored
4 months ago
by
ZHANG David
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
b9111033
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
code/index.php
+134
-0
134 additions, 0 deletions
code/index.php
with
134 additions
and
0 deletions
code/index.php
0 → 100644
+
134
−
0
View file @
a0acb370
<?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"
>
⚠
<?=
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>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment