Clément Primot il y a 9 mois
Parent
révision
250712dc98
3 fichiers modifiés avec 108 ajouts et 2 suppressions
  1. +8
    -2
      inc/header.php
  2. +1
    -0
      my_sell.php
  3. +99
    -0
      register.php

+ 8
- 2
inc/header.php Voir le fichier

@@ -54,7 +54,13 @@ require_once('inc/core.php');
<?php if (isLogged()) { ?>
<div class="nav-scroller bg-white box-shadow">
<nav class="nav nav-underline">
<a class="nav-link active" href="#">Jean Michel</a>
<a class="nav-link active" href="profil.php">
<?php
$query = $mysql->query('SELECT prenom, name FROM users WHERE idusers = "'.$_SESSION['id'].'"');
$result = $query->fetch(PDO::FETCH_ASSOC);
echo $result['prenom'].' '.$result['name'];
?>
</a>
<a class="nav-link" href="my_sell.php">
Produits en vente
<span class="badge badge-pill bg-light align-text-bottom">
@@ -64,7 +70,7 @@ require_once('inc/core.php');
?>
</span>
</a>
<a class="nav-link" href="#">Mon profil</a>
<a class="nav-link" href="profil.php">Mon profil</a>
</nav>
</div>
<?php } ?>

+ 1
- 0
my_sell.php Voir le fichier

@@ -54,6 +54,7 @@ include('inc/header.php');
<?php
$reponse = $mysql->query('SELECT * FROM products WHERE idusers = "' . $_SESSION['id'] . '" ORDER BY date DESC');
if($reponse->fetchColumn() > 0) {
$reponse = $mysql->query('SELECT * FROM products WHERE idusers = "' . $_SESSION['id'] . '" ORDER BY date DESC');
while ($donnees = $reponse->fetch()) { ?>
<div class="media text-muted pt-3">
<img data-src="holder.js/32x32?theme=thumb&bg=e83e8c&fg=e83e8c&size=1" alt=""


+ 99
- 0
register.php Voir le fichier

@@ -0,0 +1,99 @@
<?php
include('inc/core.php');
if(isLogged()){
header('Location: index.php');
die('<a href="login.php">Cliquez ici si vous n\'êtes pas redirigé automatiquement');
}
if (isset($_POST['inputEmail']) && isset($_POST['inputPassword']) && isset($_POST['inputLastname']) && isset($_POST['inputFirstname'])) {
$login = filter_input(INPUT_POST, 'inputEmail');
$password = hash('sha256', filter_input(INPUT_POST, 'inputPassword'));

$Pdostatinscripton = $mysql->prepare('INSERT INTO users VALUES (NULL, :mail, :motdepasse, :nom, :prenom)');

$Pdostatinscripton->bindValue(':mail',$login, PDO::PARAM_STR);
$Pdostatinscripton->bindValue(':motdepasse', $password, PDO::PARAM_STR);
$Pdostatinscripton->bindValue(':nom',filter_input(INPUT_POST, 'inputLastname'), PDO::PARAM_STR);
$Pdostatinscripton->bindValue(':prenom',filter_input(INPUT_POST, 'inputFirstname'), PDO::PARAM_STR);

$insertIsOk = $Pdostatinscripton->execute();

if ($insertIsOk) // Inscription Ok !
{
$_SESSION['login'] = $login;
$_SESSION['id'] = $mysql->lastInsertId();
$_SESSION['password'] = $password;
$message = $_SESSION['message'] = 'Vous êtes désormais inscrit !';
$message_type = $_SESSION['message_type'] = 'success';
$message_redirect = true;
header('Location: index.php');
} else // Acces pas OK !
{
$message = 'Une erreur s\'est produite lors de votre inscription. Réessayez plus tard.';
$message_type = "danger";
}
$query->CloseCursor();

}
?>
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="img/favicon.ico">

<title>Le coin des g@mers - Identification</title>

<link rel="canonical" href="https://getbootstrap.com/docs/4.0/examples/sign-in/">

<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">

<!-- Custom styles for this template -->
<link href="css/login.css" rel="stylesheet">
</head>

<body class="text-center">

<form class="form-signin" method="post">
<img class="mb-4" src="https://getbootstrap.com/docs/4.0/assets/brand/bootstrap-solid.svg" alt="" width="72"
height="72">
<h1 class="h3 mb-3 font-weight-normal">Identification</h1>
<?php if (isset($message) or isset($_SESSION['message'])) { ?>
<div class="alert alert-<?php if (isset($message)) { echo $message_type; } else {echo $_SESSION['message_type'];} ?>" role="alert">
<?php
if (isset($message)) {
echo $message;
} else {
echo $_SESSION['message'];

if($message_redirect = true){ echo ' <a href="index.php">Il semble que vous n\'avez pas été redirigé. Cliquez ici pour retourner à l\'accueil.</a>'; }
unset($_SESSION['message']);
unset($_SESSION['message_type']);
}
?>
</div>
<?php } ?>
<label for="inputEmail" class="sr-only">Email</label>
<input type="email" id="inputEmail" name="inputEmail" class="form-control" placeholder="Email" required autofocus>

<label for="inputLastname" class="sr-only">Nom</label>
<input type="text" id="inputLastname" name="inputLastname" class="form-control" placeholder="Nom" required autofocus>

<label for="inputFirstname" class="sr-only">Prénom</label>
<input type="text" id="inputFirstname" name="inputFirstname" class="form-control" placeholder="Prénom" required autofocus>

<label for="inputPassword" class="sr-only">Mot de passe</label>
<input type="password" id="inputPassword" name="inputPassword" class="form-control" placeholder="Mot de passe"
required>

<button class="btn btn-lg btn-primary btn-block" type="submit">Connexion</button>
<br>
<a class="mt-5 mb-3" href="register.php">S'inscrire</a>
<p class="mt-5 mb-3 text-muted">&copy; 2020</p>
</form>

</body>
</html>

Chargement…
Annuler
Enregistrer