init
This commit is contained in:
27
119/change-password.php
Normal file
27
119/change-password.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
if(isset($_POST['pass'])) {
|
||||
try {
|
||||
$pdo = new PDO("mysql:host=".MYSQL_HOST.";dbname=".MYSQL_DB, MYSQL_USER, MYSQL_PASS);
|
||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
$sql = "UPDATE `".SHOP_ID."_user` SET `pass`=? WHERE `email`=?";
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->execute([md5($_POST['pass']), $_SESSION['email']]);
|
||||
|
||||
echo "Password updated successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Error updating record: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<div style="margin-top: 50px;">
|
||||
<form style="max-width: 200px;" method="post">
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label id="pass">Enter New Password:</label>
|
||||
<input type="password" id="pass" name="pass" style="padding: 6px">
|
||||
<input type="submit" style="padding: 6px;margin-top: 6px;" name="submit" value="Save">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
Reference in New Issue
Block a user