Project

General

Profile

« Previous | Next » 

Revision 275

Added by stefan almost 19 years ago

Replace 'admin' by 'wb' in all account pages. Moved print_success and print_error code to class.wb.php. Added correct parameters to these functions in account pages.

View differences:

email.php
1 1
<?php
2 2

  
3
// $Id: email.php,v 1.2 2005/03/28 11:58:03 rdjurovich Exp $
3
// $Id$
4 4

  
5 5
/*
6 6

  
......
28 28
}
29 29

  
30 30
// Get the values entered
31
$current_password = $admin->get_post('current_password');
32
$email = $admin->get_post('email');
31
$current_password = $wb->get_post('current_password');
32
$email = $wb->get_post('email');
33 33

  
34 34
// Create a javascript back link
35 35
$js_back = "javascript: history.go(-1);";
36 36

  
37 37
// Get existing password
38 38
$database = new database();
39
$query = "SELECT user_id FROM ".TABLE_PREFIX."users WHERE user_id = '".$admin->get_user_id()."' AND password = '".md5($current_password)."'";
39
$query = "SELECT user_id FROM ".TABLE_PREFIX."users WHERE user_id = '".$wb->get_user_id()."' AND password = '".md5($current_password)."'";
40 40
$results = $database->query($query);
41 41

  
42 42
// Validate values
43 43
if($results->numRows() == 0) {
44
	$admin->print_error($MESSAGE['PREFERENCES']['OLD_PASSWORD_INCORRECT'], $js_back);
44
	$wb->print_error($MESSAGE['PREFERENCES']['OLD_PASSWORD_INCORRECT'], $js_back, false);
45 45
}
46 46
// Validate values
47
if(!$admin->validate_email($email)) {
48
	$admin->print_error($MESSAGE['USERS']['INVALID_EMAIL'], $js_back);
47
if(!$wb->validate_email($email)) {
48
	$wb->print_error($MESSAGE['USERS']['INVALID_EMAIL'], $js_back, false);
49 49
}
50 50

  
51 51
// Update the database
52 52
$database = new database();
53
$query = "UPDATE ".TABLE_PREFIX."users SET email = '$email' WHERE user_id = '".$admin->get_user_id()."' AND password = '".md5($current_password)."'";
53
$query = "UPDATE ".TABLE_PREFIX."users SET email = '$email' WHERE user_id = '".$wb->get_user_id()."' AND password = '".md5($current_password)."'";
54 54
$database->query($query);
55 55
if($database->is_error()) {
56
	$admin->print_error($database->get_error);
56
	$wb->print_error($database->get_error,'index.php', false);
57 57
} else {
58
	$admin->print_success($MESSAGE['PREFERENCES']['EMAIL_UPDATED'], WB_URL.'/account/preferences'.PAGE_EXTENSION);
58
	$wb->print_success($MESSAGE['PREFERENCES']['EMAIL_UPDATED'], WB_URL.'/account/preferences'.PAGE_EXTENSION);
59 59
	$_SESSION['EMAIL'] = $email;
60 60
}
61 61

  

Also available in: Unified diff