-
Notifications
You must be signed in to change notification settings - Fork 1
/
avatar.php
86 lines (65 loc) · 1.72 KB
/
avatar.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
80
81
82
83
84
85
86
<?php
require_once("inc/init.inc.php");
//zone réservée aux traitements php
//dans les bonnes pratiques, on effectue les traitements php avant l'affichage du site
require_once("inc/haut_de_site.inc.php");
require_once("inc/menu.inc.php");
echo $msg; //affichage des messages (erreur, validation, etc.)
?>
<script >
<!--
function move_avatar($avatar)
{
<?php
$extension_upload = strtolower(substr( strrchr($avatar['name'], '.') ,1));
$name = time();
$namepicture = str_replace(' ','',$name).".".$extension_upload;
$name = "avatar/".str_replace(' ','',$name).".".$extension_upload;
move_uploaded_file($avatar['tmp_name'],$name);
return $namepicture;
?>
}
//-->
</script>
<?php
// on se connecte à MySQL
$db = mysql_connect('localhost', 'root', '');
// on sélectionne la base
mysql_select_db('maboutique',$db);
?>
<div id="menu">
<?php
/*AVATAR*/
$id_membre=$_SESSION["id_membre"];
$query1=mysql_query("SELECT * FROM membre WHERE id_membre like '$id_membre'");
$result1=mysql_fetch_array($query1);
//Vérification de l'avatar :
if ($result1["avatar"]=="")
{
?>
<form enctype="multipart/form-data" action="uploadpicture.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
Send this file :<br>
<input type="file" name="imgfile" /><br>
<input type="submit" value="Send file" />
</form>
<?php
}
else
{
?>
<img src="avatar/<?php echo $result1['avatar'];?>" width="120">
<?php
}
/*END AVATAR*/
echo '<br>';
?>
<a href="membres.php"><h3>Profile</h3></a>
<?php
echo '<br>';
?>
<a href="membres.php"><input type="image" id="bouton-submit" ></a>
</div>
<?php
require_once("inc/bas_de_site.inc.php");
?>