-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccount.php
More file actions
executable file
·51 lines (41 loc) · 1.07 KB
/
Copy pathaccount.php
File metadata and controls
executable file
·51 lines (41 loc) · 1.07 KB
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
<?php
/* include header */
include("header.php");
/* set page name */
$page = "account";
/* reset error vars */
$is_error = 0;
/* update account details */
if(isset($_POST['task']) && $_POST['task'] == "doupdate")
{
// check if email is filled
if(empty($_POST['email']))
{
$tpl->is_error = 1;
$tpl->message = "Please enter a valid email address.";
$is_error = 1;
}
// check if passwords match
if(!empty($_POST['pass']) && $_POST['pass'] != $_POST['pass2'])
{
$tpl->is_error = 1;
$tpl->error_message = "Your passwords do not match.";
$is_error = 1;
}
// no error?
if($is_error != 1)
{
// build query
$q = "UPDATE members SET user_email = '".$_POST['email']."' ";
if(!empty($_POST['pass'])){ $q .= ", user_password = '".sha1($_POST['pass'])."' "; }
$q .= "WHERE user_id = '".$user->user_info['user_id']."'";
// execute query
mysql_query($q);
// set success
$tpl->is_success = 1;
$tpl->message = "Details successfully updated.";
}
}
/* include footer */
include("footer.php");
?>