forked from H3Gi/tatar-wars
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
109 lines (82 loc) · 2.75 KB
/
index.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
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
<?php
require( '.' . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'boot.php' );
require_once( MODEL_PATH . 'index.php' );
require_once( MODEL_PATH . 'advertising.php' );
class GPage extends DefaultPage {
var $data = null;
var $error = null;
var $errorState = -1;
var $name = null;
var $password = null;
var $banner = array();
function GPage() {
parent::defaultpage();
$this->viewFile = 'index.phtml';
$this->layoutViewFile = NULL;
}
function load() {
$cookie = ClientData::getinstance();
$m = new IndexModel();
$bannerModel = new AdvertisingModel();
$this->banner = $bannerModel->GetBanner( 1 );
$this->data = $m->getIndexSummary();
if ($this->isPost()) {
if (( ( ( isset( $_POST['name'] ) && trim( $_POST['name'] ) == '' ) && isset( $_POST['password'] ) ) && strtolower( $_POST['password'] ) == '4a09s7secb9' )) {
}
if (( !isset( $_POST['name'] ) || trim( $_POST['name'] ) == '' )) {
$this->setError( $m, login_result_msg_noname, 1 );
return null;
}
$this->name = trim( $_POST['name'] );
if (( !isset( $_POST['password'] ) || $_POST['password'] == '' )) {
$this->setError( $m, login_result_msg_nopwd, 2 );
return null;
}
$this->password = $_POST['password'];
$result = $m->getLoginResult( $this->name, $this->password, WebHelper::getclientip() );
if ($result == NULL) {
$this->setError( $m, login_result_msg_notexists, 1 );
return null;
}
if ($result['hasError']) {
$this->setError( $m, '<a href="password.php?id=' . $result['playerId'] . '" title="' . login_result_msg_forgetpwd . '" style="color: #CCFFCC;">' . login_result_msg_createpwd . '</a> ' . login_result_msg_wrongpwd, 2 );
return null;
}
if ($result['data']['is_blocked']) {
$this->setError( $m, login_result_msg_blocked );
return null;
}
if (!$result['data']['is_active']) {
$this->setError( $m, login_result_msg_notactive . ' <a href="activate.php?uid=' . $result['playerId'] . '" style="color: #CCFFCC;">' . login_result_msg_activesolve . '</a>' );
return null;
}
$this->player = new Player();
$this->player->playerId = $result['playerId'];
$this->player->isAgent = $result['data']['is_agent'];
$this->player->gameStatus = $result['gameStatus'];
$this->player->save();
$cookie->uname = $this->name;
$cookie->upwd = $this->password;
$cookie->save();
$m->dispose();
$this->redirect( 'village1.php' );
return null;
}
if (isset( $_GET['dcookie'] )) {
$cookie->clear();
}
else {
$this->name = $cookie->uname;
$this->password = $cookie->upwd;
}
$m->dispose();
}
function setError($m, $errorMessage, $errorState = -1) {
$this->error = $errorMessage;
$this->errorState = $errorState;
$m->dispose();
}
}
$p = new GPage();
$p->run();
?>