PROJET-WEB_STRI1A/WEB/profil.php

79 lines
2.8 KiB
PHP
Raw Normal View History

2019-05-09 16:35:10 +02:00
<?php
require ('connectionBD.php');
include ('tableauBord.php');
if (!$_SESSION){
session_start();
}
if (!isset($_SESSION['mail'])){
header('Location: index.php');
exit();
}
$user = getUser($_SESSION['mail']);
if (!$user){
header('Location: profil.php?error=7');
exit();
}
function getUser($mail){
global $db;
$result = pg_query_params($db,"SELECT * FROM Utilisateur WHERE mail = $1;", array($mail));
return pg_fetch_array($result);
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css">
<title>Profil</title>
<script src="inscription.js"></script>
</head>
<body>
<div id="formulaire">
<h1>Profil</h1>
<form method="post" enctype="multipart/form-data" action="inscription.php">
<div class="line">
<label for="mail_field">Adresse mail : </label>
<input id="mail_field" class="form" type="email" maxlength="100" readonly value="<?php echo $user['mail']; ?>">
</div>
<div class="line">
<label for="login_field">Login : </label>
<input id="login_field" class="form" name="login_field" type="text" maxlength="50" value="<?php echo $user['login'];?>" required>
</div>
<div class="line">
<a href="changePass.php" title="Changer de mot de passe">Changer de mot de passe.</a>
</div>
<div class="line">
<label for="prenom_field">Prénom : </label>
<input id="prenom_field" class="form" name="prenom" type="text" maxlength="50" value="<?php echo $user['prenom'];?>" required>
</div>
<div class="line">
<label for="nom_field">Nom : </label>
<input id="nom_field" class="form" name="nom" type="text" maxlength="50" value="<?php echo $user['nom'];?>" required>
</div>
<div class="line">
<label for="dateN_field">Date de naissance : </label>
<input id="dateN_field" class="form" readonly="readonly" type="date" value="<?php echo $user['datenaissance'];?>" required>
</div>
<div class="line">
<label for="phone_field">Numéro de téléphone : </label>
<input id="phone_field" class="form" name="phone" type="tel" pattern="[0-9]{10}" maxlength="10" value="<?php echo $user['telephone'];?>" required>
</div>
<div class="line">
<label for="avatar">Image du Profil :</label>
<input type="file" id="avatar" class="form" name="avatar" accept="image/png">
</div>
<?php
printError();
?>
<input id="submit" class="button" type="submit" value="S'inscrire">
</form>
<p id="enregistrer">Si vous avez déjà un compte <a href="index.php" title="S'identifier">cliquez ici</a>.</p>
</div>
</body>
</html>