blogartisanal/user/profile2.php

116 lines
2.1 KiB
PHP

<?php session_start(); ?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<center>
<section>
<?php
require_once('config.php');
require_once('verifications.php');
$page_name='Profile Modification';
include_once('top.php');
//récupération du formulaire
$email=formulaires($_POST['email']);
$pass_enc=formulaires($_POST['pass_enc']);
$new_pass=formulaires($_POST['new_pass']);
$new_pass2=formulaires($_POST['new_pass2']);
if(!$email)
{
?>
E-mail inexisant.<br /><a href='profile.php' onClick='history.back()'>Back</a>
</section>
</center>
</body>
</html>
<?php
include_once('bottom.php');
return FALSE;
}
if(isset($pass_enc))
{
if(!$new_pass || !$new_pass2 || strlen($new_pass) < 5)
{
?>
Your password or its confirmation is inexistant or your password is less than 5 characters<br /><a href="profile.php" onClick="history.back()">Back</a>
</section>
</center>
</body>
</html>
<?php
include_once('bottom.php');
return FALSE;
}
if($new_pass!=$new_pass2)
{
?>
Passwords don't match !<br /><a href="profile.php" onClick="history.back()">Back</a>
</section>
</center>
</body>
</html>
<?php
include_once('bottom.php');
return FALSE;
}
$pass_enc=md5($pass_enc);
$reponse_pass=$dbh->query("SELECT pass FROM user WHERE pass='$pass_enc' AND session='$session'") or die ('error : '.mysql_error()); //verification si mot de passe valide
$count_pass=$reponse_pass->rowCount();
if($count_pass == 0)
{
?>
The old password is not correct.<br /><a href="profile.php" onClick="history.back()">Back</a>
</section>
</center>
</body>
</html>
<?php
include_once('bottom.php');
return FALSE;
}
$new_pass=md5($new_pass);
$dbh->query("UPDATE user SET pass='$new_pass' WHERE session='$session'") or die ('error : '.mysql_error());
}
$dbh->query("UPDATE user SET email='$email' WHERE session='$session'") or die ('error : '.mysql_error());
echo"<div align=center>Your profile settings have been saved.<br /><a href='profile.php' onClick='history.back()'>Back</a></div>";
include_once('bottom.php');
?>
</section>
</center>
</body>
</html>