php include_once _cfg init_common php include_once _cfg FILE_NAME page

  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
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
include_once('_cfg/init_common.php');
//include_once('_cfg/'.FILE_NAME.'.page.php');
$Application->load('sendmail', 'class');
$_loader->addGet('confirmation', 'confirm');
$_loader->addPost('name,password,confirmation,email,code', 'register');
$_loader->process();
$Application->jump(HTTP_ROOT.'back.php?return=1');
/*
function show()
{
global $messenger;
showFile(TPL_PATH.LANG.'/global-empty.tpl', array(
'szTemplate' => TPL_PATH.LANG.'/'.FILE_NAME.'.tpl',
'aMeta' => array(
'title' => PAGE_TITLE,
'description' => PAGE_DESCRIPTION,
'keyword' => PAGE_KEYWORD,
),
'aData' => array(
'szMsg' => $messenger->getMessage(),
),
));
$messenger->clearMessageBuffer();
global $Application;
$Application->output();
}*/
function register()
{
global $data,$messenger,$Application;
$aPost = $_POST;
//
$Application->load('botstop','class');
$botstop = new CBotstop();
if (!$botstop->check($aPost['code'])){
$messenger->setMessage(__USER_ERROR);
$Application->jump(HTTP_ROOT.'back.php?return=1');
}
if ($data->check(TYPE_USER_ACCOUNT, $aPost)){
if ($aPost['password'] === $aPost['confirmation']){
global $user;
$aData = $user->register($aPost['name'], $aPost['password'], $aPost);
if (!empty($aData['confirmation'])){
$messenger->setMessage(__USER_REGISTERED);
sendMail($aPost, $aData['confirmation']);
//
foreach ($aPost['purse'] as $szName=>$szNumber) {
if (!empty($szNumber) &&
strtoupper(substr($szName, 2, 1)) == strtoupper(substr($szNumber, 0, 1))
) {
$data->exec('once', 'insert', TYPE_WM_PURSE, array(
'name' => strtoupper($szName),
'number' => strtoupper($szNumber),
'user_id' => $aData['id'],
'datetime_add' => date('Y-m-d H:i:s'),
));
}
}
$Application->jump('login.php');
}
else{
$messenger->setMessage(__USER_EXISTS);
}
}
else{
$messenger->setMessage(__USER_WRONG_PASSWORD);
}
}
else{
$messenger->setMessage(__USER_ERROR);
}
$Application->jump(HTTP_ROOT.'back.php?return=1');
}
function sendMail($aData, $szConfirm)
{
// mail-
global $data,$Application;
$Application->load('data', 'cfg');
$aMail = $data->exec('get', 'select', '_email', array('name' => 'user_register'));
// sendmail
global $sendmail;
//
$sendmail->setTo($aData['email']);
$sendmail->setSubject($aMail['subject']);
$sendmail->setEncoding('u');
$aMail['content'] = str_replace(
array('{name}','{password}','{email}','{icq}','{confirmation}','{wmz}','{wmr}','{wmg}','{wmu}','{wmy}','{wme}','{wmb}'),
array($aData['name'], $aData['password'], $aData['email'], $aData['icq'], $szConfirm, @$aData['purse']['wmz'], @$aData['purse']['wmr'], @$aData['purse']['wmg'], @$aData['purse']['wmu'], @$aData['purse']['wmy'], @$aData['purse']['wme'], @$aData['purse']['wmb']),
$aMail['content']
);
$sendmail->setHeaders(array(
'From' => ADMIN_EMAIL_LABEL.' <'.ADMIN_EMAIL.'>',
'Reply-to' => ADMIN_EMAIL_LABEL.' <'.ADMIN_EMAIL.'>',
));
$sendmail->exec('plain',array(
'text' => '',
'content' => $aMail['content'],
));
$sendmail->send();
}
function confirm()
{
global $user,$messenger,$Application;
$bOk = $user->confirm($_GET['confirmation']);
if (!$bOk){
$messenger->setMessage(__USER_NOT_FOUND);
$Application->jump(HTTP_ROOT.'back.php?return=1');
}
else{
$messenger->setMessage(__USER_ACTIVATED);
$Application->jump('login.php');
}
}
?>