php include_once _cfg init php include_once _cfg global cfg php _loade

 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
include_once('_cfg/init.php');
include_once('_cfg/global.cfg.php');
$_loader->addPost('purse', 'chgData');
$_loader->addPost('password,confirmation', 'chgPassword');
$_loader->setDefault('show');
$_loader->process();
$link = mysql_connect($CMYSQL_DATABASES['host'], $CMYSQL_DATABASES['login'], $CMYSQL_DATABASES['password'])
or die("Could not connect : " . mysql_error());
mysql_select_db($CMYSQL_DATABASES['db_name']) or die("Could not select database");
function show()
{
global $data,$user,$messenger;
$User = $user->getCurrent();
$aPurse = reformPurseData($user->getPurses());
showFile(TPL_PATH.'global.tpl', array(
'szTemplate' => TPL_PATH.FILE_NAME.'.tpl',
'aMeta' => array(
'title' => __PROFILE_TITLE,
),
'User' => $User,
'aData' => array(
'User' => $User,
'aPurse' => $aPurse,
'szMsg' => $messenger->getMessage(),
),
));
$messenger->clearMessageBuffer();
global $Application;
$Application->output();
}
function chgData()
{
global $user,$data,$messenger,$Application;
$aPost = $_POST;
$User = $user->getCurrent();
$aPurse = getPurseNames($user->getPurses());
// Создаю кошельки
foreach ($aPost['purse'] as $szName=>$szNumber) {
if (!empty($szNumber) &&
(strtoupper(substr($szName, 2, 1)) == strtoupper(substr($szNumber, 0, 1)) &&
!in_array(strtoupper($szName), $aPurse))
) {
mysql_query(INSERT INTO TYPE_WM_PURSE (name, number, user_id, datetime_add) VALUES (strtoupper($szName), $User['email'], $User['id'], date('Y-m-d H:i:s')));
mysql_close($link);
}
}
if (!empty($aPost['icq'])) {
$user->update(array('icq' => $aPost['icq']));
}
$messenger->setMessage(__USER_UPDATED);
$Application->jump(HTTP_ROOT.'back.php?return=1');
}
function chgPassword()
{
global $user,$messenger;
$User = $user->getCurrent();
$nError = $user->chgPassword($_POST['password'], $_POST['confirmation']);
switch ($nError)
{
//case 1: $messenger->setMessage('Ошибка! Введен не правильный пароль (старый).'); break;
//case 2: $messenger->setMessage('Ошибка! Старый и новый пароль совпадают. Пароль не был обновлен.'); break;
case 3: $messenger->setMessage(__USER_ERROR); break;
default: $messenger->setMessage(__USER_UPDATED);
}
global $Application;
$Application->jump(HTTP_ROOT.'back.php?return=1');
}
?>