Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <nav class="navbar navbar-inverse">
- <div class="container-fluid">
- <a class="navbar-brand" href="index.php">E-Sport STI <span class="glyphicon glyphicon-headphones"></span></a>
- <ul class="nav navbar-nav">
- <li class="active"> <a href="index.php">Accueil</a> </li>
- <li> <a href="liste.php">Liste</a> </li>
- <li> <a href="rechercher.php">Recherche</a> </li>
- </ul>
- <?php
- if (isset($_SESSION["pseudo"])) {
- echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" class="navbar-form navbar-right inline-form">';
- ?>
- <div class="form-group">
- <div class="swagggg input-sm form-control "> Bonjour, <?php echo $_SESSION["pseudo"] ?></div>
- <button type="submit" class="btn btn-danger btn-sm" name="deco"><span class="glyphicon glyphicon-chevron-left"></span>Déconnexion</button>
- </div>
- </form>
- <?php
- }
- elseif (!isset($_POST['uservalid'])) {
- if ((!empty($_GET['error'])) AND (($_GET['error']=="wrong-password")))
- {
- echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" class="navbar-form navbar-right inline-form">';
- ?>
- <div class="form-group has-error has-feedback">
- <label class="control-label" for="idError">Nom d'utilisateur ou mdp incorrect</label>
- <input type="text" class="input-sm form-control" id="idError" name="user" placeholder="Nom d'utilisateur">
- <span class="glyphicon glyphicon-remove form-control-feedback"></span>
- </div>
- <div class="form-group has-error has-feedback">
- <input type="password" class="input-sm form-control" id="idError" name="password" placeholder="Mot de passe">
- <span class="glyphicon glyphicon-remove form-control-feedback"></span>
- </div>
- <button type="submit" class="btn btn-danger btn-sm" name="uservalid">Connexion <span class="glyphicon glyphicon-chevron-right"></span> </button>
- <?php }
- elseif ((!empty($_GET['error'])) AND (($_GET['error']=="missing-field")))
- {
- echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" class="navbar-form navbar-right inline-form">';
- ?>
- <div class="form-group has-warning has-feedback">
- <label class="control-label" for="idWarning">Veuillez remplir tous les champs</label>
- <input type="text" class="input-sm form-control" id="idWarning" name="user" placeholder="Nom d'utilisateur">
- <span class="glyphicon glyphicon-warning-sign form-control-feedback"></span>
- </div>
- <div class="form-group has-warning has-feedback">
- <input type="password" class="input-sm form-control" id="idWarning" name="password" placeholder="Mot de passe">
- <span class="glyphicon glyphicon-warning-sign form-control-feedback"></span>
- </div>
- <button type="submit" class="btn btn-danger btn-sm" name="uservalid">Connexion <span class="glyphicon glyphicon-chevron-right"></span> </button>
- <?php }
- else
- {
- echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" class="navbar-form navbar-right inline-form">';
- ?>
- <div class="form-group">
- <input type="text" class="input-sm form-control" name="user" placeholder="Nom d'utilisateur">
- </div>
- <div class="form-group">
- <input type="password" class="input-sm form-control" name="password" placeholder="Mot de passe">
- </div>
- <button type="submit" class="btn btn-danger btn-sm" name="uservalid">Connexion <span class="glyphicon glyphicon-chevron-right"></span> </button>
- <?php }
- echo '</form>'; } ?>
- <?php
- if (!isset($_SESSION["pseudo"]) AND (isset($_POST['uservalid']))) {
- $pass_hache = sha1($_POST['password']);
- $req = $bdd->prepare('SELECT id FROM admin WHERE user = :user AND password = :password');
- $req->execute(array(
- 'user' => $_POST["user"],
- 'password' => $pass_hache));
- $resultat = $req->fetch();
- if ($resultat)
- {
- $_SESSION['id'] = $resultat['id'];
- $_SESSION['pseudo'] = $_POST["user"];
- header("Refresh:0");
- }
- elseif ((empty($_POST["user"]) OR (empty($_POST["password"]))) OR (empty($_POST["user"]) AND (empty($_POST["password"]))))
- {
- header('Location: '.$_SERVER['PHP_SELF'].'?error=missing-field');
- }
- elseif (!$resultat) {
- header('Location: '.$_SERVER['PHP_SELF'].'?error=wrong-password');
- }
- }
- if (isset($_POST["deco"])) {
- session_destroy();
- header("Refresh:0");
- }
- ?>
- </div>
- </nav>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement