General fixes

+Moved "isWinner()" method from Automation.php to Session.php, it's now
triggered when activating plus function or entering in
plus1.php/build.php
+General clean-up and better indentation
+The tournament square bonus is now displayed correctly
This commit is contained in:
iopietro
2018-05-22 00:33:09 +02:00
parent e1b0dcf46e
commit f0b9f32826
18 changed files with 239 additions and 267 deletions
+7 -15
View File
@@ -108,17 +108,6 @@ class Automation {
$this->artefactOfTheFool();
}
public function isWinner() {
global $database;
// check whether someone already built a level 100 Wonder of the World
$q = mysqli_fetch_array(mysqli_query($database->dblink,"SELECT Count(*) as Total FROM ".TB_PREFIX."fdata WHERE f99 = 100 and f99t = 40"), MYSQLI_ASSOC);
if($q['Total'] > 0)
{
header('Location: winner.php');
exit;
}
}
public function procResType($ref, $mode = 0) {
//Capital or only 1 village left = cannot be destroyed
return addslashes(empty($build = Building::procResType($ref)) && !$mode ? "Village can't be" : $build);
@@ -167,9 +156,10 @@ class Automation {
return $popTot;
}
function buildingPOP($f,$lvl){
function buildingPOP($f, $lvl){
$name = "bid".$f;
global $$name;
$popT = 0;
$dataarray = $$name;
@@ -179,9 +169,10 @@ class Automation {
return $popT;
}
function buildingCP($f,$lvl){
function buildingCP($f, $lvl){
$name = "bid".$f;
global $$name;
$popT = 0;
$dataarray = $$name;
@@ -293,7 +284,7 @@ class Automation {
}
private function clearDeleting() {
global $autoprefix, $units, $database;
global $autoprefix, $database;
if(file_exists($autoprefix."GameEngine/Prevention/cleardeleting.txt")) {
unlink($autoprefix."GameEngine/Prevention/cleardeleting.txt");
@@ -950,7 +941,7 @@ class Automation {
}
private function sendunitsComplete() {
global $bid19, $bid23, $bid34, $u99, $database, $battle, $technology, $logging, $generator, $units, $autoprefix;
global $bid19, $bid23, $bid34, $u99, $database, $battle, $technology, $logging, $units, $autoprefix;
if(file_exists($autoprefix."GameEngine/Prevention/sendunits.txt")) {
unlink($autoprefix."GameEngine/Prevention/sendunits.txt");
@@ -2689,6 +2680,7 @@ class Automation {
function DelVillage($wref){
global $database, $units;
$database->clearExpansionSlot($wref);
$wref = (int) $wref;
$q = "DELETE FROM ".TB_PREFIX."abdata where vref = $wref";
+6
View File
@@ -4997,6 +4997,12 @@ References: User ID/Message ID, Mode
else return ''; // all is good, no need to append additional alliance-related text
}
function isThereAWinner(){
$q = "SELECT Count(*) as Total FROM ".TB_PREFIX."fdata WHERE f99 = 100 and f99t = 40";
$result = mysqli_fetch_array(mysqli_query($this->dblink, $q), MYSQLI_ASSOC);
return $result['Total'] > 0;
}
/**
* Modify or delete a building being constructed/in queue
*
+26 -24
View File
@@ -36,17 +36,21 @@ class MyGenerator {
}
public function procDistanceTime($coor, $thiscoor, $ref, $mode, $vid = 0) {
global $bid28, $bid14, $building;
global $database, $bid28, $bid14, $village;
if($vid == 0) $vid = $village->wid;
$xdistance = ABS($thiscoor['x'] - $coor['x']);
if($xdistance > WORLD_MAX) {
$xdistance = (2 * WORLD_MAX + 1) - $xdistance;
}
$ydistance = ABS($thiscoor['y'] - $coor['y']);
if($ydistance > WORLD_MAX) {
$ydistance = (2 * WORLD_MAX + 1) - $ydistance;
}
$distance = SQRT(POW($xdistance,2)+POW($ydistance,2));
$distance = SQRT(POW($xdistance,2) + POW($ydistance,2));
if(!$mode){
if($ref == 1) $speed = 16;
else if($ref == 2) $speed = 12;
@@ -55,35 +59,33 @@ class MyGenerator {
else $speed = 1;
}else{
$speed = $ref;
if(($tSquareLevel = $building->getTypeLevel(14, $vid)) > 0 && $distance >= TS_THRESHOLD) {
if(($tSquareLevel = $database->getFieldLevelInVillage($vid, 14)) > 0 && $distance >= TS_THRESHOLD) {
$speed *= ($bid14[$tSquareLevel]['attri'] / 100) ;
}
}
if($speed != 0) return round(($distance / $speed) * 3600 / INCREASE_SPEED);
if($speed > 0) return round(($distance / $speed) * 3600 / INCREASE_SPEED);
else return round($distance * 3600 / INCREASE_SPEED);
}
public function getTimeFormat($time) {
$min = 0;
$hr = 0;
$days = 0;
while($time >= 60) :
$time -= 60;
$min += 1;
endwhile;
while ($min >= 60) :
$min -= 60;
$hr += 1;
endwhile;
if ($min < 10) {
$min = "0".$min;
}
if($time < 10) {
$time = "0".$time;
}
return $hr.":".$min.":".$time;
}
public function getTimeFormat($time) {
$min = $hr = $days = 0;
while($time >= 60){
$time -= 60;
$min += 1;
}
while($min >= 60){
$min -= 60;
$hr += 1;
}
if($min < 10) $min = "0" . $min;
if($time < 10) $time = "0" . $time;
return $hr . ":" . $min . ":" . $time;
}
public function procMtime($time, $pref = 3) {
/*
+4 -4
View File
@@ -1335,13 +1335,13 @@ define("CONF_SERV_WWSTATS_TOOLTIP","Enable (True) or disable (False) the display
define("CONF_SERV_NTRTIME","Nature Troops Regeneration Time");
define("CONF_SERV_NTRTIME_TOOLTIP","Time through which the nature troops will be restored in oases.");
define("CONF_SERV_OASIS_WOOD_PROD_MULT","Oasis Wood Production Multiplier");
define("CONF_SERV_OASIS_WOOD_PROD_MULT_TOOLTIP","Multiply the base oasis production (40) of wood");
define("CONF_SERV_OASIS_WOOD_PROD_MULT_TOOLTIP","The base wood oasis production");
define("CONF_SERV_OASIS_CLAY_PROD_MULT","Oasis Clay Production Multiplier");
define("CONF_SERV_OASIS_CLAY_PROD_MULT_TOOLTIP","Multiply the base oasis production (40) of clay");
define("CONF_SERV_OASIS_CLAY_PROD_MULT_TOOLTIP","The base clay oasis production");
define("CONF_SERV_OASIS_IRON_PROD_MULT","Oasis Iron Production Multiplier");
define("CONF_SERV_OASIS_IRON_PROD_MULT_TOOLTIP","Multiply the base oasis production (40) of iron");
define("CONF_SERV_OASIS_IRON_PROD_MULT_TOOLTIP","The base iron oasis production");
define("CONF_SERV_OASIS_CROP_PROD_MULT","Oasis Crop Production Multiplier");
define("CONF_SERV_OASIS_CROP_PROD_MULT_TOOLTIP","Multiply the base oasis production (40) of crop");
define("CONF_SERV_OASIS_CROP_PROD_MULT_TOOLTIP","The base crop oasis production");
define("CONF_SERV_MEDALINTERVAL","Medal Interval");
define("CONF_SERV_MEDALINTERVAL_TOOLTIP","The time interval for issuing medals for the top players and alliances. If this parameter is changed on the installed server, the time interval changes after the subsequent issuance of the medals.");
define("CONF_SERV_TOURNTHRES","Tourn Threshold");
+49 -48
View File
@@ -84,20 +84,18 @@ class Session {
$this->logged_in = $this->checkLogin();
if($this->logged_in && TRACK_USR) {
$database->updateActiveUser($this->username, $this->time);
}
if(isset($_SESSION['url'])) {
$this->referrer = $_SESSION['url'];
} else {
$this->referrer = "/";
}
if($this->logged_in && TRACK_USR) $database->updateActiveUser($this->username, $this->time);
if(isset($_SESSION['url'])) $this->referrer = $_SESSION['url'];
else $this->referrer = "/";
$this->url = $_SESSION['url'] = $_SERVER['PHP_SELF'];
$this->SurfControl();
}
public function Login($user) {
global $database, $generator, $logging;
$this->logged_in = true;
$_SESSION['sessid'] = $generator->generateRandID();
$_SESSION['username'] = $user;
@@ -113,19 +111,13 @@ class Session {
if ($dbarray['id'] > 1) {
if(!isset($_SESSION['wid'])) {
if($selected_village!='') {
$data = $database->getVillage($selected_village);
}else{
$data = $database->getVillage($userFields["id"]);
}
if(!empty($selected_village)) $data = $database->getVillage($selected_village);
else $data = $database->getVillage($userFields["id"]);
$_SESSION['wid'] = $data['wref'];
} else
if($_SESSION['wid'] == '') {
if($selected_village!='') {
$data = $database->getVillage($selected_village);
}else{
$data = $database->getVillage($userFields["id"]);
}
if(empty($_SESSION['wid'])) {
if(!empty($selected_village)) $data = $database->getVillage($selected_village);
else $data = $database->getVillage($userFields["id"]);
$_SESSION['wid'] = $data['wref'];
}
$this->PopulateVar();
@@ -159,15 +151,15 @@ class Session {
public function changeChecker() {
global $generator;
$this->checker = $_SESSION['checker'] = $generator->generateRandStr(3);
$this->mchecker = $_SESSION['mchecker'] = $generator->generateRandStr(5);
}
private function checkLogin(){
global $database;
$user = '';
$id = '';
$user = $id = '';
$admin = false;
$inAdmin = (strpos($_SERVER['REQUEST_URI'], '/Admin') !== false);
@@ -181,11 +173,13 @@ class Session {
}
if($user && ($admin || isset($_SESSION['sessid']))) {
$this->isWinner();
// check if this is not a support user, for who only messages and statistics are available
if ($user == 'Support') {
$req_file = basename($_SERVER['PHP_SELF']);
if (!in_array($req_file, ['nachrichten.php', 'logout.php', 'statistiken.php', 'rules.php', 'karte.php', 'karte2.php', 'spieler.php'])) {
header('Location:nachrichten.php');
header('Location: nachrichten.php');
exit;
}
}
@@ -195,16 +189,32 @@ class Session {
//update database
$database->updateActiveUser($user, $this->time);
return true;
} else {
return false;
}
}
else return false;
}
/***************************
Function to check Real Hero
Made by: Shadow and brainiacX
***************************/
/**
* Called when there's a player who built a WW to level 100
*
*/
function isWinner(){
global $database;
$requiredPage = basename($_SERVER['PHP_SELF']);
if($database->isThereAWinner() && (in_array($requiredPage, ['build.php', 'plus1.php']) ||
(in_array($requiredPage, ['plus.php']) && isset($_GET['id']) && !empty($_GET['id'] && $_GET['id'] >= 7))))
{
header('Location: winner.php');
exit;
}
}
/**
* Function to check Real Hero
* Made by: Shadow and brainiacX
*
*/
function CheckHeroReal () {
global $database,$link;
@@ -261,21 +271,13 @@ class Session {
$this->oldrank = $this->userarray['oldrank'];
$this->sharedForums = $database->getSharedForums($this->uid, $this->alliance);
$_SESSION['ok'] = $this->userarray['ok'];
if($this->userarray['b1'] > $this->time) {
$this->bonus1 = 1;
}
if($this->userarray['b2'] > $this->time) {
$this->bonus2 = 1;
}
if($this->userarray['b3'] > $this->time) {
$this->bonus3 = 1;
}
if($this->userarray['b4'] > $this->time) {
$this->bonus4 = 1;
}
if (!in_array($this->username, ['Support', 'Multihunter'])) {
$this->CheckHeroReal();
}
if($this->userarray['b1'] > $this->time) $this->bonus1 = 1;
if($this->userarray['b2'] > $this->time) $this->bonus2 = 1;
if($this->userarray['b3'] > $this->time) $this->bonus3 = 1;
if($this->userarray['b4'] > $this->time) $this->bonus4 = 1;
if (!in_array($this->username, ['Support', 'Multihunter'])) $this->CheckHeroReal();
}
/**
@@ -286,8 +288,7 @@ class Session {
public function populateAttacks(){
global $database, $village;
$troopsMovement = $database->getMovement(3, $village->wid, 0);
$troopsMovement = $database->getMovement(3, $village->wid, 0);
if(count($troopsMovement) > 0){
foreach($troopsMovement as $movement)
{
+25 -21
View File
@@ -23,48 +23,52 @@ class Units {
if (!isset($post['disabled'])) $post['disabled'] = '';
switch($post['c']) {
case "1":
if (isset($post['a'])&& $post['a']==533374){
$this->sendTroops($post);
}else{
case 1:
if (isset($post['a']) && $post['a'] == 533374) $this->sendTroops($post);
else
{
$post = $this->loadUnits($post);
return $post;
}
break;
case "2":
if (isset($post['a'])&& $post['a']==533374 && $post['disabled'] == ""){
$this->sendTroops($post);
}else{
case 2:
if (isset($post['a']) && $post['a'] == 533374 && empty($post['disabled'])) $this->sendTroops($post);
else
{
$post = $this->loadUnits($post);
return $post;
}
break;
case "3":
case 3:
if (isset($post['a']) && $post['a'] == 533374 && empty($post['disabled'])) $this->sendTroops($post);
else{
else
{
$post = $this->loadUnits($post);
return $post;
}
break;
case "4":
case 4:
if (isset($post['a']) && $post['a'] == 533374) $this->sendTroops($post);
else{
else
{
$post = $this->loadUnits($post);
return $post;
}
break;
case "5":
case 5:
if (isset($post['a']) && $post['a'] == "new") $this->Settlers($post);
else
{
$post = $this->loadUnits($post);
return $post;
}
break;
case "8":
case 8:
$this->sendTroopsBack($post);
break;
}
@@ -72,7 +76,7 @@ class Units {
}
private function loadUnits($post) {
global $database,$village,$session,$generator,$logging,$form;
global $database, $village, $session, $generator, $logging, $form;
// Search by town name
// Coordinates and look confirm name people
if(isset($post['x']) && isset($post['y']) && !empty($post['x']) && !empty($post['y'])) {
@@ -175,7 +179,7 @@ class Units {
$villageOwner = $database->getVillageField($id,'owner');
$userAccess = $database->getUserField($villageOwner,'access',0);
$userID = $database->getUserField($villageOwner,'id',0);
if($userAccess == 0 or ($userAccess == MULTIHUNTER && $userID == 5) or (!ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == ADMIN)){
if($userAccess == 0 || ($userAccess == MULTIHUNTER && $userID == 5) || (!ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == ADMIN)){
$form->addError("error","Player is Banned. You can't attack him");
//break;
}
@@ -200,7 +204,7 @@ class Units {
// We must return an array with $ post, which contains all the data more
// another variable that will define the flag is raised and is being sent and the type of shipping
$villageName = $database->getVillageField($id,'name');
$speed= 300;
$speed = 300;
$timetaken = $generator->procDistanceTime($coor, $village->coor, INCREASE_SPEED, 1);
array_push($post, "$id", "$villageName", "$villageOwner","$timetaken");
return $post;
@@ -213,7 +217,7 @@ class Units {
exit;
} else if (isset($id)) {
$villageName = $database->getOasisField($id,"name");
$speed= 300;
$speed = 300;
$timetaken = $generator->procDistanceTime($coor, $village->coor, INCREASE_SPEED, 1);
array_push($post, "$id", "$villageName", "2","$timetaken");
return $post;
@@ -239,7 +243,7 @@ class Units {
}
private function processReturnTroops($enforce) {
global $database, $generator;
global $database;
$to = $database->getVillage($enforce['from']);
$tribe = $database->getUserField($to['owner'], 'tribe', 0);
@@ -253,7 +257,7 @@ class Units {
}
private function sendTroops($post) {
global $form, $database, $village, $generator, $session;
global $form, $database, $village, $session;
$data = $database->getA2b( $post['timestamp_checksum'], $post['timestamp'] );
$Gtribe = ($session->tribe == 1) ? "" : $session->tribe - 1;
@@ -430,7 +434,7 @@ class Units {
}
private function sendTroopsBack($post) {
global $form, $database, $village, $generator, $session, $technology;
global $form, $database, $village, $session, $technology;
if ( $session->access != BANNED ) {
$enforce = $database->getEnforceArray( $post['ckey'], 0 );
$enforceoasis = $database->getOasisEnforceArray( $post['ckey'], 0 );
+4 -10
View File
@@ -23,25 +23,19 @@ if(isset($_GET['z'])) {
$y = $currentcoor['y'];
$x = $currentcoor['x'];
$bigmid = $_GET['z'];
}
else if(isset($_POST['xp']) && isset($_POST['yp'])){
}else if(isset($_POST['xp']) && isset($_POST['yp'])){
$x = $_POST['xp'];
$y = $_POST['yp'];
$bigmid = $generator->getBaseID($x,$y);
}
else {
}else{
$y = $village->coor['y'];
$x = $village->coor['x'];
$bigmid = $village->wid;
}
if(isset($_SESSION['troops_movement'])){
unset($_SESSION['troops_movement']);
}
if(isset($_SESSION['troops_movement'])) unset($_SESSION['troops_movement']);
if($session->plus){
$session->populateAttacks();
}
if($session->plus) $session->populateAttacks();
$xm7 = ($x-7) < -WORLD_MAX? $x+WORLD_MAX+WORLD_MAX-6 : $x-7;
$xm3 = ($x-3) < -WORLD_MAX? $x+WORLD_MAX+WORLD_MAX-2 : $x-3;
+4 -10
View File
@@ -20,25 +20,19 @@ if(isset($_GET['z'])){
$y = $currentcoor['y'];
$x = $currentcoor['x'];
$bigmid = $_GET['z'];
}
else if(isset($_POST['xp']) && isset($_POST['yp'])){
}else if(isset($_POST['xp']) && isset($_POST['yp'])){
$x = $_POST['xp'];
$y = $_POST['yp'];
$bigmid = $generator->getBaseID($x,$y);
}
else{
}else{
$y = $village->coor['y'];
$x = $village->coor['x'];
$bigmid = $village->wid;
}
if(isset($_SESSION['troops_movement'])){
unset($_SESSION['troops_movement']);
}
if(isset($_SESSION['troops_movement'])) unset($_SESSION['troops_movement']);
if($session->plus){
$session->populateAttacks();
}
if($session->plus) $session->populateAttacks();
$xm7 = ($x-7) < -WORLD_MAX? $x+WORLD_MAX+WORLD_MAX-6 : $x-7;
$xm6 = ($x-6) < -WORLD_MAX? $x+WORLD_MAX+WORLD_MAX-5 : $x-6;
-1
View File
@@ -68,7 +68,6 @@ if(isset($_GET['o'])){
else $disabled = "disabled=disabled";
}
$process = $units->procUnits($_POST);
$automation->isWinner();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+1 -4
View File
@@ -23,10 +23,7 @@ if(isset($_GET['newdid'])) {
header("Location: ".$_SERVER['PHP_SELF']);
exit;
}
else {
$building->procBuild($_GET);
}
$automation->isWinner();
else $building->procBuild($_GET);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-1
View File
@@ -29,7 +29,6 @@ if(isset($_GET['newdid'])) {
exit;
}
}
if(isset($_GET['s'])) $automation->isWinner();
if(isset($_GET['fid']) || isset($_GET['fid2'])){
$fid = preg_replace("/[^0-9]/","",!empty($_GET['fid']) ? $_GET['fid'] : $_GET['fid2']);
+7 -7
View File
@@ -275,7 +275,7 @@ if(isset($_GET['mode']) && $_GET['mode'] == 'troops' && isset($_GET['cancel']) &
exit();
}
}
if(isset($_GET['id'])) $automation->isWinner();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
@@ -295,13 +295,13 @@ if(isset($_GET['id'])) $automation->isWinner();
<link href="<?php echo GP_LOCATE; ?>lang/en/compact.css?f4b7i" rel="stylesheet" type="text/css" />
<?php
if($session->gpack == null || GP_ENABLE == false) {
echo "
<link href='".GP_LOCATE."travian.css?e21d2' rel='stylesheet' type='text/css' />
<link href='".GP_LOCATE."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
echo "
<link href='".GP_LOCATE."travian.css?e21d2' rel='stylesheet' type='text/css' />
<link href='".GP_LOCATE."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
} else {
echo "
<link href='".$session->gpack."travian.css?e21d2' rel='stylesheet' type='text/css' />
<link href='".$session->gpack."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
echo "
<link href='".$session->gpack."travian.css?e21d2' rel='stylesheet' type='text/css' />
<link href='".$session->gpack."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
}
?>
<script type="text/javascript">
-1
View File
@@ -24,7 +24,6 @@ if(isset($_GET['newdid'])) {
}
else $building->procBuild($_GET);
$automation->isWinner();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+51 -53
View File
@@ -18,63 +18,61 @@ use App\Utils\AccessLogger;
include_once( "GameEngine/Village.php" );
AccessLogger::logRequest();
$message->procMessage( $_POST );
if ( isset( $_GET['t'] ) && $_GET['t'] == 1 ) {
$automation->isWinner();
}
if ( isset( $_GET['newdid'] ) ) {
$_SESSION['wid'] = $_GET['newdid'];
if ( isset( $_GET['t'] ) ) {
header( "Location: " . $_SERVER['PHP_SELF'] . "?t=" . $_GET['t'] );
exit;
} else if ( $_GET['id'] != 0 ) {
header( "Location: " . $_SERVER['PHP_SELF'] . "?id=" . $_GET['id'] );
exit;
} else {
header( "Location: " . $_SERVER['PHP_SELF'] );
exit;
}
$message->procMessage($_POST);
if(isset($_GET['newdid'])){
$_SESSION['wid'] = $_GET['newdid'];
if(isset($_GET['t'])){
header("Location: ".$_SERVER['PHP_SELF']."?t=".$_GET['t']);
exit();
}else if($_GET['id'] != 0){
header("Location: ".$_SERVER['PHP_SELF']."?id=".$_GET['id']);
exit();
}else{
header("Location: ".$_SERVER['PHP_SELF']);
exit();
}
}
if ( isset( $_GET['delfriend'] ) && is_numeric( $_GET['delfriend'] ) ) {
$friend = $database->getUserField( $session->uid, "friend" . $_GET['delfriend'], 0 );
for ( $i = 0; $i <= 19; $i ++ ) {
$friend1 = $database->getUserField( $friend, "friend" . $i, 0 );
if ( $friend1 == $session->uid ) {
$database->deleteFriend( $friend, "friend" . $i );
}
$friendwait1 = $database->getUserField( $friend, "friend" . $i . "wait", 0 );
if ( $friendwait1 == $session->uid ) {
$database->deleteFriend( $friend, "friend" . $i . "wait" );
}
$database->checkFriends( $friend );
}
$database->deleteFriend( $session->uid, "friend" . $_GET['delfriend'] );
$database->deleteFriend( $session->uid, "friend" . $_GET['delfriend'] . "wait" );
$database->checkFriends( $session->uid );
header( "Location: " . $_SERVER['PHP_SELF'] . "?t=1" );
exit;
if(isset($_GET['delfriend']) && is_numeric($_GET['delfriend'])){
$friend = $database->getUserField($session->uid, "friend".$_GET['delfriend'], 0);
for($i = 0; $i <= 19; $i++){
$friend1 = $database->getUserField($friend, "friend".$i, 0);
if($friend1 == $session->uid){
$database->deleteFriend($friend, "friend".$i);
}
$friendwait1 = $database->getUserField($friend, "friend".$i."wait", 0);
if($friendwait1 == $session->uid){
$database->deleteFriend($friend, "friend".$i."wait");
}
$database->checkFriends($friend);
}
$database->deleteFriend($session->uid, "friend".$_GET['delfriend']);
$database->deleteFriend($session->uid, "friend".$_GET['delfriend']."wait");
$database->checkFriends($session->uid);
header("Location: ".$_SERVER['PHP_SELF']."?t=1");
exit();
}
if ( isset( $_GET['confirm'] ) && is_numeric( $_GET['confirm'] ) ) {
$myid = $database->getUserArray( $session->uid, 1 );
$wait = $database->getUserArray( $myid[ 'friend' . $_GET['confirm'] . 'wait' ], 1 );
$added = 0;
for ( $i = 0; $i < 20; $i ++ ) {
$user = $database->getUserField( $wait['id'], "friend" . $i, 0 );
if ( $user == $session->uid && $added == 0 ) {
$database->addFriend( $wait['id'], "friend" . $i . "wait", 0 );
$added = 1;
}
}
$database->addFriend( $session->uid, "friend" . $_GET['confirm'], $wait['id'] );
$database->addFriend( $session->uid, "friend" . $_GET['confirm'] . "wait", 0 );
header( "Location: " . $_SERVER['PHP_SELF'] . "?t=1" );
exit;
if(isset($_GET['confirm']) && is_numeric($_GET['confirm'])){
$myid = $database->getUserArray($session->uid, 1);
$wait = $database->getUserArray($myid['friend'.$_GET['confirm'].'wait'], 1);
$added = 0;
for($i = 0; $i < 20; $i++){
$user = $database->getUserField($wait['id'], "friend".$i, 0);
if($user == $session->uid && $added == 0){
$database->addFriend($wait['id'], "friend".$i."wait", 0);
$added = 1;
}
}
$database->addFriend($session->uid, "friend".$_GET['confirm'], $wait['id']);
$database->addFriend($session->uid, "friend".$_GET['confirm']."wait", 0);
header("Location: ".$_SERVER['PHP_SELF']."?t=1");
exit();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+43 -46
View File
@@ -23,10 +23,8 @@ if(isset($_GET['newdid'])) {
header("Location: ".$_SERVER['PHP_SELF']);
exit;
}
else {
$building->procBuild($_GET);
}
$automation->isWinner();
else $building->procBuild($_GET);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
@@ -94,63 +92,62 @@ $automation->isWinner();
<div id="mid">
<?php include("Templates/menu.tpl"); ?>
<?php
if(isset($_GET['id'])) {
$id = preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['id']);
} else {
$id = "";
if(isset($_GET['id'])){
$id = preg_replace("/[^a-zA-Z0-9_-]/", "", $_GET['id']);
}
else $id = "";
if(empty($id)) include ("Templates/Plus/1.tpl");
if($id == 1){
include ("Templates/Plus/3.tpl");
}
if ($id == "") {
include("Templates/Plus/1.tpl");
if($id == 2){
include ("Templates/Plus/2.tpl");
}
if ($id == 1) {
include("Templates/Plus/3.tpl");
if($id == 3){
include ("Templates/Plus/3.tpl");
}
if ($id == 2) {
include("Templates/Plus/2.tpl");
if($id == 4){
include ("Templates/Plus/4.tpl");
}
if ($id == 3) {
include("Templates/Plus/3.tpl");
if(isset($_GET['mail']) && $id == 5){
include ("Templates/Plus/invite.tpl");
}else if($id == 5){
include ("Templates/Plus/5.tpl");
}
if ($id == 4) {
include("Templates/Plus/4.tpl");
if($id == 7){
include ("Templates/Plus/7.tpl");
}
if (isset($_GET['mail']) && $id == 5){
include("Templates/Plus/invite.tpl");
}else if ($id == 5) {
include("Templates/Plus/5.tpl");
if($id == 8){
include ("Templates/Plus/8.tpl");
}
if ($id == 7) {
include("Templates/Plus/7.tpl");
if($id == 9){
include ("Templates/Plus/9.tpl");
}
if ($id == 8) {
include("Templates/Plus/8.tpl");
if($id == 10){
include ("Templates/Plus/10.tpl");
}
if ($id == 9) {
include("Templates/Plus/9.tpl");
if($id == 11){
include ("Templates/Plus/11.tpl");
}
if ($id == 10) {
include("Templates/Plus/10.tpl");
if($id == 12){
include ("Templates/Plus/12.tpl");
}
if ($id == 11) {
include("Templates/Plus/11.tpl");
if($id == 13){
include ("Templates/Plus/13.tpl");
}
if ($id == 12) {
include("Templates/Plus/12.tpl");
if($id == 14){
include ("Templates/Plus/14.tpl");
}
if ($id == 13) {
include("Templates/Plus/13.tpl");
if($id == 15){
include ("Templates/Plus/15.tpl");
}
if ($id == 14) {
include("Templates/Plus/14.tpl");
if($id > 15){
include ("Templates/Plus/3.tpl");
}
if ($id == 15) {
include("Templates/Plus/15.tpl");
}
if ($id > 15) {
include("Templates/Plus/3.tpl");
}
if(isset($_POST['mail'])) {
$mailer->sendInvite($_POST['mail'],$session->uid,$_POST['text']);
if(isset($_POST['mail'])){
$mailer->sendInvite($_POST['mail'], $session->uid, $_POST['text']);
}
?>
+9 -14
View File
@@ -19,26 +19,21 @@ AccessLogger::logRequest();
$profile->procProfile($_POST);
$profile->procSpecial($_GET);
if(isset($_GET['newdid'])) {
if(isset($_GET['newdid'])){
$_SESSION['wid'] = $_GET['newdid'];
if(isset($_GET['s'])){
header("Location: ".$_SERVER['PHP_SELF']."?s=".preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['s']));
exit;
header("Location: ".$_SERVER['PHP_SELF']."?s=".preg_replace("/[^a-zA-Z0-9_-]/", "", $_GET['s']));
exit();
}else if(isset($_GET['uid'])){
header("Location: ".$_SERVER['PHP_SELF']."?uid=".preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['uid']));
exit;
header("Location: ".$_SERVER['PHP_SELF']."?uid=".preg_replace("/[^a-zA-Z0-9_-]/", "", $_GET['uid']));
exit();
}else{
header("Location: ".$_SERVER['PHP_SELF']);
exit;
}
}
else {
$building->procBuild($_GET);
header("Location: ".$_SERVER['PHP_SELF']);
exit();
}
}
else $building->procBuild($_GET);
if(isset($_GET['s'])){
$automation->isWinner();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
+1 -4
View File
@@ -22,10 +22,7 @@ if(isset($_GET['newdid'])) {
header("Location: ".$_SERVER['PHP_SELF']);
exit;
}
else {
$building->procBuild($_GET);
}
$automation->isWinner();
else $building->procBuild($_GET);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
+2 -4
View File
@@ -23,10 +23,8 @@ if(isset($_GET['newdid'])) {
header("Location: ".$_SERVER['PHP_SELF']);
exit;
}
else {
$building->procBuild($_GET);
}
$automation->isWinner();
else $building->procBuild($_GET);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>