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
| <?php
include('connect.php');
if(isset($_POST['submit']))
{
$password=($_POST['password']);
$password1=($_POST['password1']);
$avatar=$_FILES['avatar']['name'];
$avatar_tmp=$_FILES['avatar']['tmp_name'];
$errors=array();
$info=info_controleur($_SESSION['id']);
//recuperation de l'image
if(!empty($avatar))
{
$image=explode('.',$avatar);
$image_ext=end($image);
//extension volue
//strtolower pour le miniscule et le majuscule
if(in_array(strtolower($image_ext),array('jpg','jpeg','gif','png'))===false)
{
$errors[]="votre avatar doit être une image valide";
}
}
if(empty($errors))
{
modifier_profile_admin($password1,$avatar,$avatar_tmp);
die('vos informations ont été modifiées');
}
else
{
foreach($errors as $error)
{
echo $error ;
}
} }
?>
<!doctype html>
<html>
<head>
<title> modification du admin </title>
</head>
<body>
<form method="POST" action="" enctype="multipart/from-data" >
<label for="password">ancien mot passe</label>
<input name="password" type="text" placeholder="Ancien mot passe"/><br>
<label for="pass">Password</label>
<input name="password1" type="password" placeholder="nouveau mot passe"/> <br>
<p>AVATAR:</p>
<input type="file" name="avatar"/><br>
<input type="submit" name ="submit" value="modifier">
</body>
</html> |
Partager