Skip to content
Snippets Groups Projects
Commit 4aa790df authored by BURCKEL Luc's avatar BURCKEL Luc
Browse files

TP2

parent 7624a667
No related merge requests found
<?php
session_start();
if(isset($_SESSION['login'])){
echo "<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>Document</title>
</head>
<body>
<footer>
<h1>Bienvenue</h1>
<a href='https://webetu.iutrs.unistra.fr/~luc.burckel/tp2/signout.php'><img src='https://image.flaticon.com/icons/png/512/59/59801.png' width='30' height='30' alt='déconection'></a>
</footer>
</body>
</html>";
}
else{
header("Location: https://webetu.iutrs.unistra.fr/~luc.burckel/tp2/signin.php");
}
?>
\ No newline at end of file
<?php
session_start();
if($_SERVER['REQUEST_METHOD']!='POST'){header("Location: https://webetu.iutrs.unistra.fr/~luc.burckel/tp2/signin.php");}
require('bdd.php');
if(array_key_exists($_POST['login'],$user) && $_POST['mdp']==$user[$_POST['login']]){
$_SESSION['login']=$_POST['login'];
header("Location: https://webetu.iutrs.unistra.fr/~luc.burckel/tp2/account.php");
}
else{
if(!array_key_exists($_POST['login'],$user)){
$_SESSION['speudo']="";
$message="L'identifient n'existe pas";
}
else{
$_SESSION['speudo']=$_POST['login'];//
$message="Le mot de passe n'est pas bon";
}
$_SESSION['message']=$message;
header("Location: https://webetu.iutrs.unistra.fr/~luc.burckel/tp2/signin.php");
}
?>
\ No newline at end of file
<?php
$user=array('lilian'=>'blond','luc'=>'lala','Max'=>'PossitifCovid');
?>
\ No newline at end of file
<?php session_start(); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<link href="style.css" rel="stylesheet">
<title>Document</title>
</head>
<body>
<header>
<form action="authenticate.php" method="POST">
<label>Login : </label><input type="text" name="login" value=<?php if(isset($_SESSION['speudo'])){if($_SESSION['speudo']!=""){echo $_SESSION['speudo'];}} ?>><br>
<label>Mot de passe : </label><input type="password" name="mdp"><br>
<input type="submit" id="button" value="Connextion">
</form>
</header>
<section>
<?php
if(isset($_SESSION['message'])){
if($_SESSION['message']!=""){
echo $_SESSION['message'];
}
}
?>
</section>
</body>
</html>
\ No newline at end of file
<?php
session_start();
session_destroy();
header("Location: https://webetu.iutrs.unistra.fr/~luc.burckel/tp2/signin.php");
\ No newline at end of file
body{
font-size: larger;
text-align: center;
display: flex;
justify-content: center;
flex-direction:column;
align-items: center;
}
header{
padding: 15px;
justify-content: center;
border: 3px solid black;
}
#button{
margin-top: 10px;
border-color: black;
font-weight: bold;
font-size: 105%;
font-family: 'Courier New', Courier, monospace;
background-color: cornflowerblue;
}
section{
color: crimson;
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment