| Server IP : 109.234.162.214 / Your IP : 216.73.216.222 Web Server : Apache System : Linux servd162214.srv.odns.fr 4.18.0-372.26.1.lve.1.el8.x86_64 #1 SMP Fri Sep 16 14:08:19 EDT 2022 x86_64 User : carpe ( 1178) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/carpe/public_html/space/ |
Upload File : |
<?php
session_start();
include "database.php";
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Connexion</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
</head>
<style>
body{
margin:0;
padding:0;
background-color:#121214;
width:100%;
height:100vh;
color:white;
font-family: "Poppins", sans-serif;
font-weight: 400;
font-style: normal;
position:fixed;
}
#title{
font-size:6vw;
width:100%;
text-align:center;
margin:0;
padding:0;
}
#contain{
width:80%;
height:50%;
margin:50px;
display:flex;
justify-content:right;
align-items:center;
}
form{
width: 400px;
margin:auto;
}
#titres{
display:flex;
justify-content:center;
}
#titres h2{
margin:20px;
cursor:pointer;
transition:all .5s;
}
#titres h2:hover{
opacity:1;
transition:all .5s;
}
.el{
display:flex;
justify-content:space-between;
margin:20px;
}
.el2{
display:flex;
justify-content:center;
margin:20px;
}
#absolue{
position:absolute;
bottom:-40px;
left:0;
z-index:50;
font-size:4vw;
line-height:0.5;
}
form{
z-index:999;
}
/* Media Query pour les petits écrans (téléphones) */
@media only screen and (max-width: 600px) {
#contain{
margin:auto;
}
#title{
font-size:8vw;
}
#absolue{
font-size:4.5vw;
bottom:0;
text-align:right;
}
}
/* Media Query pour les écrans de taille moyenne (tablettes, etc.) */
@media only screen and (min-width: 601px) and (max-width: 1024px) {
#contain{
margin:0;
padding:0;
}
#title{
font-size:8vw;
}
#absolue{
font-size:4vw;
}
}
.hola{
opacity:0.6;
}
#ins{
display:none;
}
#con{
display:flex;
}
</style>
<body>
<h1 id=title>ET SI VOUS PARTICIPIEZ</h1>
<div id="contain">
<div>
<div id="titres">
<h2 id="boutton1">Connexion</h2>
<h2 id="boutton2" class="hola">Inscription</h2>
</div>
<div id="con">
<form method="POST" action="check.php">
<div class="el">
<label>Mail :</label>
<input type="mail" name="name">
</div>
<div class="el">
<label>Mot de passe :</label>
<input type="PASSWORD" name="mdp">
</div>
<div class="el2">
<input type="submit" name="send_con" value='Connexion'>
</div>
<?php
if(isset($_POST['send_con'])){
$error_msg="";
$sql_select = "SELECT * FROM clients";
$result_select = $mysqli->query($sql_select);
if(!empty($_POST['name']) AND !empty($_POST['mdp'])){
$nom = addslashes($_POST['name']);
$mdp = addslashes($_POST['mdp']);
$ind = 0;
while ($infos = $result_select->fetch_assoc()) {
if(strcasecmp($nom, $infos['mail']) == 0){
if(password_verify($mdp, $infos['mdp'])){
if($nom=="jules"){
echo "connexion";
$_SESSION['authenticated'] = true;
$_SESSION['admin'] = true;
$_SESSION['username'] = $nom;
header('Location: home3.php');
$errorMsg="";
}else{
$_SESSION['authenticated'] = true;
$_SESSION['username'] = $nom;
header('Location: home3.php');
$errorMsg="";
}
}else{
$error_msg="Mauvais Mot De Passe";
}
break;
}else{
$error_msg="L'utilisateur n'existe pas";
}
}
}else{
$error_msg ="Remplissez tous les champs !";
}
echo $error_msg;
}
?>
</form>
</div>
<div id="ins">
<form method="POST" action="check.php">
<div class="el">
<label>Nom :</label>
<input type="text" name="name">
</div>
<div class="el">
<label>Email :</label>
<input type="mail" name="mail">
</div>
<div class="el">
<label>Mot de passe :</label>
<input type="PASSWORD" name="mdp">
</div>
<div class="el2">
<input type="submit" name="send_ins" value='Inscription'>
</div>
<?php
if(isset($_POST['send_ins'])){
$error_msg="";
if(!empty($_POST['name']) AND !empty($_POST['mail']) AND !empty($_POST['mdp'])){
$sql_select = "SELECT * from clients";
$sql_result = $mysqli->query($sql_select);
$mail=addslashes($_POST['mail']);
$nom=addslashes($_POST['name']);
$mdp=addslashes($_POST['mdp']);
$hash = password_hash($mdp, PASSWORD_DEFAULT);
$index=0;
if (!filter_var($mail, FILTER_VALIDATE_EMAIL)) {
$error_msg= "Adresse email invalide!";
}else{
while($infos = $sql_result->fetch_assoc() ){
if(strcasecmp($mail, $infos['mail']) == 0){
$index++;
}
}
if($index>0){
$error_msg="Utilisateur Deja Pris !";
}else{
echo"effe";
$a = "INSERT INTO `clients`(`nom`, `mail`, `mdp`) VALUES ('$nom','$mail','$hash')";
$b = $mysqli->query($a);
$_SESSION['authenticated'] = true;
$_SESSION['username'] = $mail;
header('Location: home2.php');
$errorMsg="";
}
}
}else{
$error_msg="Remplissez tous les champs";
}
echo $error_msg;
}
?>
</form>
</div>
</div>
</div>
<div id="absolue">
<h2>A NOTRE</h2>
<h1>PROCHAIN VOYAGE ?</h1>
</div>
</body>
<script>
let boutton1=document.getElementById('boutton1');
let boutton2=document.getElementById('boutton2');
let con=document.getElementById('con');
let ins=document.getElementById('ins');
boutton2.addEventListener("click", function(){
boutton1.classList.add("hola");
boutton2.classList.remove("hola");
con.style.display="none";
ins.style.display ="flex";
window.location.href = "check2.php";
});
boutton1.addEventListener("click", function(){
boutton2.classList.add("hola");
boutton1.classList.remove("hola");
ins.style.display="none";
con.style.display ="flex";
});
</script>
</html>