-
Notifications
You must be signed in to change notification settings - Fork 3
/
modificaPassword.php
32 lines (30 loc) · 1.46 KB
/
modificaPassword.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
<?php
require_once __DIR__ . DIRECTORY_SEPARATOR . "toolkit.php";
require_once __DIR__ . DIRECTORY_SEPARATOR . "dbconn.php";
if (session_status() == PHP_SESSION_NONE){
session_start();
}
checkLoggedUser();
$dbAccess = new DBAccess();
$dbconn = $dbAccess->openDBConnection();
if ($dbconn == false){
die ("Errore nella connessione al database");
}else{
$logged = $dbAccess->checkLogin($_SESSION['username'], $_POST['MOldPass']);
if ($logged){
if ($_POST['MNewPass1'] == $_POST['MNewPass2']){
$dbAccess->editPassword($_SESSION['username'], $_POST['MNewPass1']);
$_SESSION['status']=0;
$_SESSION['statusmessage']=getMessage("17");
}else{
$_SESSION['status']=1;
$_SESSION['statusmessage']="<a href='#MNewPass1' title='" . getMessage("105") . "'>" . getMessage("224") . "</a>";
}
}else{
$_SESSION['status']=1;
$_SESSION['statusmessage']="<a href='#MOldPass' title='" . getMessage("113") . "'>" . getMessage("225") . "</a>";
}
$dbAccess->closeDBConnection();
header("Location: userpanel_account.php");
}
?>