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(); }
public function load() { parent::load(); if (isset($_GET['url']) && !empty($_GET['url'])) { $advID = base64_decode(mysql_real_escape_string(trim($_GET['url']))); if ($advID != "") { $m = new AdvertisingModel(); $url = $m->GoToBanner($advID); $m->dispose(); $this->redirect($url); } } }
public function load() { parent::load(); $this->pageIndex = isset($_GET['p']) && is_numeric($_GET['p']) ? intval($_GET['p']) : 0; $this->isAdmin = $this->data['player_type'] == PLAYERTYPE_ADMIN; if (!$this->isAdmin) { exit(0); } else { $m = new AdvertisingModel(); $rowsCount = $m->getAdvertisingCount(); $this->pageCount = 0 < $rowsCount ? ceil($rowsCount / $this->pageSize) : 1; if (isset($_GET['DAdv']) && !empty($_GET['DAdv'])) { $advID = mysql_real_escape_string(trim($_GET['DAdv'])); if ($advID != "") { $m->DeleteAdvertising($advID); $m->dispose(); $this->redirect("advertising.php"); } } else { if ($this->isPost()) { $post = array(); $type = isset($_POST['do']) && $_POST['do'] != "add" ? "edit" : "add"; $post['name'] = "SPSLink.NET"; $post['url'] = isset($_POST['url']) && $_POST['url'] != "" ? mysql_real_escape_string(trim($_POST['url'])) : "http://www.spslink.net"; $post['cat'] = isset($_POST['cat']) && $_POST['cat'] != "" ? mysql_real_escape_string(trim($_POST['cat'])) : "1"; $post['image'] = isset($_POST['image']) && $_POST['image'] != "" ? mysql_real_escape_string(trim($_POST['image'])) : "assets/default/img/characters.png"; $ext = strtolower(end(explode(".", mysql_real_escape_string(trim($post['image']))))); $post['type'] = $ext == "swf" ? "flash" : "image"; $post['ID'] = isset($_POST['ID']) && $_POST['ID'] != "" ? mysql_real_escape_string(trim($_POST['ID'])) : 0; $m->Advertising($post, $type); $m->dispose(); $this->redirect("advertising.php"); } else { $this->Advertisings = $m->GetAdvertisings($this->pageIndex, $this->pageSize); $m->dispose(); } } } }
function load() { parent::load(); $this->pageIndex = isset($_GET['p']) && is_numeric($_GET['p']) ? intval($_GET['p']) : 0; $this->isAdmin = $this->data['player_type'] == PLAYERTYPE_ADMIN; if (!$this->isAdmin) { exit(0); return null; } $m = new AdvertisingModel(); $rowsCount = $m->getAdvertisingCount(); $this->pageCount = 0 < $rowsCount ? ceil($rowsCount / $this->pageSize) : 1; if (isset($_GET['DAdv']) && !empty($_GET['DAdv'])) { $advID = mysql_real_escape_string(trim($_GET['DAdv'])); if ($advID != '') { $m->DeleteAdvertising($advID); $m->dispose(); $this->redirect('advertising.php'); return null; } } if ($this->isPost()) { $post = array(); $type = isset($_POST['do']) && $_POST['do'] != 'add' ? 'edit' : 'add'; $post['name'] = isset($_POST['name']) && $_POST['name'] != '' ? mysql_real_escape_string(trim($_POST['name'])) : 'SPSLink.NET'; $post['url'] = isset($_POST['url']) && $_POST['url'] != '' ? mysql_real_escape_string(trim($_POST['url'])) : 'http://www.spslink.net'; $post['cat'] = isset($_POST['cat']) && $_POST['cat'] != '' ? mysql_real_escape_string(trim($_POST['cat'])) : '1'; $post['image'] = isset($_POST['image']) && $_POST['image'] != '' ? mysql_real_escape_string(trim($_POST['image'])) : 'assets/default/img/characters.png'; $ext = strtolower(end(explode('.', mysql_real_escape_string(trim($post['image']))))); $post['type'] = $ext == 'swf' ? 'flash' : 'image'; $post['ID'] = isset($_POST['ID']) && $_POST['ID'] != '' ? mysql_real_escape_string(trim($_POST['ID'])) : 0; $m->Advertising($post, $type); $m->dispose(); $this->redirect('advertising.php'); return null; } $this->Advertisings = $m->GetAdvertisings($this->pageIndex, $this->pageSize); $m->dispose(); }
function load() { // run the queue job if (!$this->isCallback()) { $qj = new QueueJobModel(); $qj->processQueue(); } // change the selected village if (isset($_GET['vid']) && $this->globalModel->hasVillage($this->player->playerId, intval($_GET['vid']))) { $this->globalModel->setSelectedVillage($this->player->playerId, intval($_GET['vid'])); } // fetch the player/village data $this->data = $this->globalModel->getVillageData($this->player->playerId); if ($this->data == NULL) { $this->player->logout(); $this->redirect('index.php'); return; } $this->player->gameStatus = $this->data['gameStatus']; if ($this->isCallback()) { return; } // check for global message if ($this->checkForGlobalMessage && !$this->player->isSpy && $this->data['new_gnews'] == 1) { $this->redirect('shownew.php'); return; } // check for new village creation flag if ($this->checkForNewVillage && !$this->player->isSpy && intval($this->data['create_nvil']) == 1) { $this->redirect('shownvill.php'); return; } $bannerModel = new AdvertisingModel(); $this->banner = $bannerModel->GetBanner(2); // fetch the items in the queue $this->queueModel->fetchQueue($this->player->playerId); // fill the player custom links if (trim($this->data['custom_links']) != '') { $lnk_arr = explode("\n\n", $this->data['custom_links']); foreach ($lnk_arr as $lnk_str) { list($linkName, $linkHref, $linkSelfTarget) = explode("\n", $lnk_str); $this->playerLinks[] = array('linkName' => $linkName, 'linkHref' => $linkHref, 'linkSelfTarget' => $linkSelfTarget != '*'); } } // fill the player villages array $v_arr = explode("\n", $this->data['villages_data']); foreach ($v_arr as $v_str) { list($vid, $x, $y, $vname) = explode(' ', $v_str, 4); $this->playerVillages[$vid] = array($x, $y, $vname); } // fill the resources $wrapString = ''; $elapsedTimeInSeconds = $this->data['elapsedTimeInSeconds']; $r_arr = explode(',', $this->data['resources']); foreach ($r_arr as $r_str) { $r2 = explode(' ', $r_str); $prate = floor($r2[4] * (1 + $r2[5] / 100)) - ($r2[0] == 4 ? $this->data['crop_consumption'] : 0); $current_value = floor($r2[1] + $elapsedTimeInSeconds * ($prate / 3600)); if ($current_value > $r2[2]) { $current_value = $r2[2]; } $this->resources[$r2[0]] = array('current_value' => $current_value, 'store_max_limit' => $r2[2], 'store_init_limit' => $r2[3], 'prod_rate' => $r2[4], 'prod_rate_percentage' => $r2[5], 'calc_prod_rate' => $prate); $wrapString .= $this->resources[$r2[0]]['current_value'] . $this->resources[$r2[0]]['store_max_limit']; } $this->wrap = strlen($wrapString) > 40; // calc the cp list($this->cpValue, $this->cpRate) = explode(' ', $this->data['cp']); $this->cpValue += $elapsedTimeInSeconds * ($this->cpRate / 86400); }