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
|
<?php
session_start();
if(isset($_POST['connexion'])){
$FormValid = true;
if(empty($_POST['membre_pseudo']) || empty($_POST['membre_mdp'])){
$FormValid = false;
// si les champs pseudo & pass sont vide on renvoi une indication.
$Notification = array('Class'=>'Error','Content'=>'<p class="textewarning">'."Tous les champs doivent être rempli.".'</p>');
} else {
// Sinon, on traite les informations
$Pseudo=($_POST['membre_pseudo']);
$Password=($_POST['membre_mdp']);
if(strlen($Pseudo) < 3){
// si le pseudo contient moins de 3 caractères -> formulaire incorrect.
$FormValid = false;
$Notification = array('Class'=>'Error','Content'=>'<p class="textewarning">'."Le pseudo doit contenir plus de 3 caractères.".'</p>');
}
if(strlen($Pseudo) > 150){
// si le pseudo contient plus de 150 caractères -> formulaire incorrect.
$FormValid = false;
$Notification = array('Class'=>'Error','Content'=>'<p class="textewarning">'."Le pseudo doit contenir moins de 150 caractères.".'</p>');
}
if(strlen($Password) < 3){
// si le Password contient moins de 3 caractères -> formulaire incorrect.
$FormValid = false;
$Notification = array('Class'=>'Error','Content'=>'<p class="textewarning">'."Le Password doit contenir plus de 3 caractères.".'</p>');
}
if(strlen($Password) > 150){
// si le Password contient plus de 150 caractères -> formulaire incorrect.
$FormValid = false;
$Notification = array('Class'=>'Error','Content'=>'<p class="textewarning">'."Le Password doit contenir moins de 150 caractères.".'</p>');
}
// autres traitement de tes données..
if($FormValid){
// si les informations sont correct
require_once("connexioninscription.inc.php");
$req = $bdd->prepare('SELECT membre_id, membre_pseudo, membre_rang FROM membres WHERE membre_pseudo=:membre_pseudo AND membre_mdp=:membre_mdp AND membre_rang=:membre_rang');
$req->execute(array('membre_pseudo'=>$Pseudo,'membre_mdp'=>$Password));
$d = $req->fetch(PDO::FETCH_OBJ);
$req->closeCursor();
if ($d['membre_rang'] == 0) //Le membre est banni
{
echo '<p>'."Vous avez été banni, impossible de vous connecter sur ce forum".'</p>';
}
else //Sinon c'est ok, on se connecte
{
if($d!=1){
// si le résultat est différent de 1, on retourne une indocation.
$Notification = array('Class'=>'Error','Content'=>'<p class="texteerror">'."Les identifiants sont faux.".'</p>');
}
else
{
$_SESSION['membre_id'] = $d->membre_id;
$_SESSION['membre_pseudo']= $d->membre_pseudo;
$_SESSION['membre_rang']=$d->membre_rang;
}
} // end FormValid
} // end !empty membre_pseudo ou membre_mdp
} // end isset post connexion
}
?>
<!DOCTYPE HTML>
<html>
<head>
<link rel="shortcut icon" title="connexion" type="image/png" href="mafavicon.png" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="Connectez-vous."/>
<title>Connexion / Connectez-vous</title>
<link href="css1.css" rel="stylesheet" type="text/css">
<?php require_once("connexioninscription.inc.php"); ?>
<?php include("debut.php"); ?>
</head>
<body>
<div id="container">
<?php include("header.inc.php"); ?>
<?php include("menus.inc.php"); ?>
<div id="corpsconnexion">
<div id="retourselect">
<a href="connexion.php" title="recharger la page"><h1 class="titre1">Connexion</h1></a>
</div>
<div id="cadreformins">
<?php if(isset($Notification)){ echo $Notification['Content'];}?>
<?php
if(isset($_SESSION['membre_id']))
{
?>
<?php
echo '<p class="textevalide">'."Vous êtes connecté !".'</p>';
echo '<a href="voirprofil.php?action=consulter" title="consulter votre profil"><h1 class="titre1">'."Consulter votre profil".'</h1></a>';
echo '<a href="voirprofil.php?action=modifier" title="modifier votre profil"><h1 class="titre1">'."Modifier votre profil".'</h1></a>';
}
else
{
?>
<p class="texte3">Connectez-vous à Crobara2bal</p>
<form method="post" name="connexion" action="connexion.php" enctype="multipart/form-data">
<fieldset>
<div id="classinscr">
<p class="classinscr"><label>Nom d'utilisateur :
<input type="text" name="membre_pseudo" />
</label>
</p>
</div>
<div id="classinscr">
<p class="classinscr">
<label>Mot de passe :
<input type="password" name="membre_mdp" />
</label>
</p>
</div>
<p class="classinscr">
<label>
<input type="submit" name="connexion" value="connexion" />
</label>
</p>
</fieldset>
</form>
<?php
echo '<p class="textewarning">'."Vous n'êtes pas connécté.".'</p>';
}
?>
</div>
</div>
<?php include("footer.inc.php"); ?>
</div>
</body>
</html> |
Partager