-
Notifications
You must be signed in to change notification settings - Fork 0
/
changepass.php
57 lines (49 loc) · 1.17 KB
/
changepass.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
<?php
/*
- Khởi động session
*/
session_start();
/*
- Require các file cần thiết
*/
require_once 'configs/db.php';
require_once 'configs/connectdb.php';
require_once 'configs/site.php';
require_once 'functions/common.php';
require_once 'functions/user.php';
/*
- Kiểm tra đã đăng nhập hay chưa
*/
if(!isset($_SESSION['_user_']))
{
redirect('login.php');
}
if($_POST)
{
if(isset($_POST['user_id']) && $_POST['user_id'] != '')
{
$user_id = $_POST['user_id'];
}
if(isset($_POST['password']) && $_POST['password'] != '')
{
$password = $_POST['password'];
}
//Lấy user theo username
$user = get_user_by_id($user_id);
//Update thông tin lên cơ sở dữ liệu
$sql = "UPDATE user SET password = '" . $password . "' WHERE user_id = " . $user_id;
$query = mysql_query($sql);
$_SESSION['_user_']['password'] = $password;
}
/*
- Lưu tiêu đề
*/
$page_title = "Thành viên";
/*
- Require các file giao diện
*/
require_once 'template/header.tpl.php';
require_once 'template/user/sidebar.tpl.php';
require_once 'template/user/changepass.tpl.php';
require_once 'template/footer.tpl.php';
?>