/
profile.php
79 lines (71 loc) · 2.45 KB
/
profile.php
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
<?php
require_once 'db.inc.php';
include 'user.inc.php';
// Redirection si pas connecté
if (empty($_SESSION["user_session"])){
header("Location:index.php");
}
// récupperation de l'identifiant de la session
$user_id = $_SESSION["user_session"];
$action = isset($_GET["action"])?$_GET["action"]:"";
switch ($action){
case 'modifier':
if (!empty($_GET["id"])){
$out = user_update($user_id, $db_connexion);
}
// fonction modification ajout de nouvelles données sur le profil
break;
case 'image': // fonction d'upload d'image
if (!empty($_GET["id"])){
user_image_upload($user_id, $db_connexion);
$out = '';
}
break;
default:
// Récupperation de profil de l'utiisateur en cours
try{
$stmt = $db_connexion->prepare("SELECT * FROM users where id_user=:user");
$stmt->bindparam(":user", $user_id);
$stmt->execute();
$user = $stmt->fetch();
}catch(PDOException $e){
echo $e->getMessage();
}
$out = '';
$out .= "Votre pseudo : ".$user["user_name"]."<br/>";
$out .= "Votre email : ".$user["user_email"]."<br/>";
$out .= "Vous êtes membre depuis : ".$user["date_created"]."<br/>";
$out .= "Dernière connexion : ".$user["last_login"]."<br/>" ;
break;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Bienvenu à la page sécurisée <?php print $user["user_name"] ?></title>
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div class="container">
<div class="header">
<div class="right"><a href="logout.php?logout=true"> Déconnexion </a></div>
</div>
<div class="row">
<div class="col-md-3">
<ul>
<li><a href="profile.php?action=modifier&id=<?php echo $user_id ?>">Compléter votre profil</a></li>
<li><a href="profile.php?action=image&id=<?php echo $user_id ?>">Télécharger une image</a></li>
</ul>
</div>
<div class="col-md-9">
<p>Bienvenu sur Votre profil</p>
<?php
echo $out;
?>
</div>
</div>
</div>
</body>
</html>