more fixes

This commit is contained in:
unknown
2012-06-18 20:38:27 +03:00
parent 527316097b
commit 86dc4c1904
41 changed files with 2003 additions and 1399 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ $sessionaccess = $access['access'];
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
mysql_query("DELETE FROM ".TB_PREFIX."allimedal WHERE id = ".$delete."");
mysql_query("UPDATE ".TB_PREFIX."allimedal set del = 1 WHERE id = ".$delete."");
header("Location: ../../../Admin/admin.php?p=alliance&aid=".$aid."");
?>
+1 -1
View File
@@ -24,7 +24,7 @@ $sessionaccess = $access['access'];
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
mysql_query("DELETE FROM ".TB_PREFIX."allimedal WHERE allyid = ".$aid."");
mysql_query("UPDATE ".TB_PREFIX."allimedal set del = 1 WHERE allyid = ".$aid."");
header("Location: ../../../Admin/admin.php?p=alliance&aid=".$aid."");
?>
+1 -1
View File
@@ -23,7 +23,7 @@ $sessionaccess = $access['access'];
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
mysql_query("DELETE FROM ".TB_PREFIX."allimedal WHERE week = ".$deleteweek."");
mysql_query("UPDATE ".TB_PREFIX."allimedal set del = 1 WHERE week = ".$deleteweek."");
header("Location: ../../../Admin/admin.php?p=delallymedal");
?>
+1 -1
View File
@@ -23,7 +23,7 @@ $sessionaccess = $access['access'];
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
mysql_query("DELETE FROM ".TB_PREFIX."medal WHERE userid = ".$userid."");
mysql_query("UPDATE ".TB_PREFIX."medal set del = 1 WHERE userid = ".$userid."");
header("Location: ../../../Admin/admin.php?p=player&uid=".$userid."");
?>
+1 -1
View File
@@ -23,7 +23,7 @@ $sessionaccess = $access['access'];
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
mysql_query("DELETE FROM ".TB_PREFIX."medal WHERE week = ".$deleteweek."");
mysql_query("UPDATE ".TB_PREFIX."medal set del = 1 WHERE week = ".$deleteweek."");
header("Location: ../../../Admin/admin.php?p=delmedal");
?>
+2 -2
View File
@@ -19,7 +19,7 @@ if ($session->access < ADMIN) die("Access Denied: You are not Admin!");
$medalid = $_POST['medalid'];
$uid = $_POST['uid'];
mysql_query("DELETE FROM ".TB_PREFIX."medal WHERE id = ".$medalid."");
mysql_query("UPDATE ".TB_PREFIX."medal set del = 1 WHERE id = ".$medalid."");
$name = mysql_query("SELECT name FROM ".TB_PREFIX."users WHERE id= ".$uid."");
$name = mysql_result($name, 0);
@@ -28,7 +28,7 @@ mysql_query("Insert into ".TB_PREFIX."admin_log values (0,$admid,'Deleted medal
$deleteweek = $_POST['medalweek'];
mysql_query("DELETE FROM ".TB_PREFIX."medal WHERE week = ".$deleteweek."");
mysql_query("UPDATE ".TB_PREFIX."medal set del = 1 WHERE week = ".$deleteweek."");
header("Location: ../../../Admin/admin.php?p=player&uid=".$uid."");
?>
+57 -1
View File
@@ -143,7 +143,7 @@ class Automation {
return $popT;
}
public function Automation() {
public function Automation() {
$this->ClearUser();
$this->ClearInactive();
@@ -205,6 +205,7 @@ class Automation {
$this->updateGeneralAttack();
$this->checkInvitedPlayes();
$this->updateStore();
$this->procClimbers();
}
private function loyaltyRegeneration() {
@@ -3828,6 +3829,61 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
}
}
private function procClimbers() {
global $database, $ranking;
$users = "SELECT * FROM " . TB_PREFIX . "users WHERE tribe!=0 AND tribe!=4 AND tribe!=5";
$array = $database->query_return($users);
$ranking->procRankArray();
foreach($array as $session){
$oldrank = $ranking->searchRank($session['username'], "username");
$q = "SELECT * FROM ".TB_PREFIX."medal order by week DESC LIMIT 0, 1";
$result = mysql_query($q);
if(mysql_num_rows($result)) {
$row=mysql_fetch_assoc($result);
$week=($row['week']+1);
} else {
$week='1';
}
if($week > 1){
if($session['oldrank'] > $oldrank) {
$totalpoints = $session['oldrank'] - $oldrank;
$database->addclimberrankpop($session['id'], $totalpoints);
$database->updateoldrank($session['id'], $oldrank);
} else
if($session['oldrank'] < $oldrank) {
$totalpoints = $oldrank - $session['oldrank'];
$database->removeclimberrankpop($session['id'], $session['oldrank']);
$database->updateoldrank($session['id'], $oldrank);
}
}else{
$totalpoints = count($ranking->getRank()) - $oldrank;
$database->setclimberrankpop($session['id'], $totalpoints);
$database->updateoldrank($session['id'], $oldrank);
}
$database->updateoldrank($session['id'], $oldrank);
}
$countally = count($database->countAlli());
if($countally > 0){
for($i=1;$i<=$countally;$i++){
$memberlist = $database->getAllMember($i);
$oldrank = 0;
foreach($memberlist as $member) {
$oldrank += $database->getVSumField($member['id'],"pop");
}
$ally = $database->getAlliance($i);
if($ally['oldrank'] < $oldrank) {
$totalpoints = $oldrank - $ally['oldrank'];
$database->addclimberrankpopAlly($ally['id'], $totalpoints);
$database->updateoldrankAlly($ally['id'], $oldrank);
} else
if($ally['oldrank'] > $oldrank) {
$totalpoints = $ally['oldrank'] - $oldrank;
$database->removeclimberrankpopAlly($ally['id'], $totalpoints);
$database->updateoldrankAlly($ally['id'], $oldrank);
}
}
}
}
}
$automation = new Automation;
?>
+6 -2
View File
@@ -659,14 +659,14 @@ class MYSQL_DB {
}
function getProfileMedal($uid) {
$q = "SELECT id,categorie,plaats,week,img,points from " . TB_PREFIX . "medal where userid = $uid order by id desc";
$q = "SELECT id,categorie,plaats,week,img,points from " . TB_PREFIX . "medal where userid = $uid and del = 0 order by id desc";
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
}
function getProfileMedalAlly($uid) {
$q = "SELECT id,categorie,plaats,week,img,points from " . TB_PREFIX . "allimedal where allyid = $uid order by id desc";
$q = "SELECT id,categorie,plaats,week,img,points from " . TB_PREFIX . "allimedal where allyid = $uid and del = 0 order by id desc";
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
@@ -2584,6 +2584,10 @@ class MYSQL_DB {
$q = "UPDATE " . TB_PREFIX . "users set clp = clp - '$cp'' where id = $user";
return mysql_query($q, $this->connection);
}
function setclimberrankpop($user, $cp) {
$q = "UPDATE " . TB_PREFIX . "users set clp = '$cp' where id = $user";
return mysql_query($q, $this->connection);
}
function updateoldrank($user, $cp) {
$q = "UPDATE " . TB_PREFIX . "users set oldrank = '$cp' where id = $user";
return mysql_query($q, $this->connection);
+1 -28
View File
@@ -66,21 +66,6 @@
$this->getStart(1);
} else {
$this->getStart($this->searchRank($session->alliance, "id"));
$oldrank = $this->searchRank($session->alliance, "id");
$ally = $database->getAlliance($session->alliance);
if($ally['oldrank'] > $oldrank) {
$totalpoints = $ally['oldrank'] - $oldrank;
$database->addclimberrankpopAlly($ally['id'], $totalpoints);
$database->updateoldrankAlly($ally['id'], $oldrank);
} else
if($ally['oldrank'] < $oldrank) {
$totalpoints = $oldrank - $ally['oldrank'];
$database->removeclimberrankpopAlly($ally['id'], $totalpoints);
$database->updateoldrankAlly($ally['id'], $oldrank);
}
$database->updateoldrankAlly($ally['id'], $oldrank);
}
break;
case 41:
@@ -103,18 +88,6 @@
} else {
$this->procRankArray();
$this->getStart($this->searchRank($session->username, "username"));
$oldrank = $this->searchRank($session->username, "username");
if($session->oldrank > $oldrank) {
$totalpoints = $session->oldrank - $oldrank;
$database->addclimberrankpop($session->uid, $totalpoints);
$database->updateoldrank($session->uid, $oldrank);
} else
if($session->oldrank < $oldrank) {
$totalpoints = $oldrank - $session->oldrank;
$database->removeclimberrankpop($session->uid, $session->oldrank);
$database->updateoldrank($session->uid, $oldrank);
}
$database->updateoldrank($session->uid, $oldrank);
}
}
@@ -198,7 +171,7 @@
}
}
private function procRankArray() {
public function procRankArray() {
global $database, $multisort;
//$array = $database->getRanking();
$holder = array();
+2 -2
View File
@@ -27,12 +27,12 @@ include ("Database.php");
include ("Mailer.php");
include ("Form.php");
include ("Generator.php");
include ("Multisort.php");
include ("Ranking.php");
include ("Automation.php");
include ("Lang/" . LANG . ".php");
include ("Logging.php");
include ("Message.php");
include ("Multisort.php");
include ("Ranking.php");
include ("Alliance.php");
include ("Profile.php");
+2 -9
View File
@@ -161,20 +161,13 @@ class Units {
$form->addError("error","Player is under beginners protection. You can't attack him");
}
//check if banned:
//check if banned/admin:
$villageOwner = $database->getVillageField($id,'owner');
$userAccess = $database->getUserField($villageOwner,'access',0);
if($userAccess == '0'){
if($userAccess == '0' or $userAccess == '8' or $userAccess == '9'){
$form->addError("error","Player is Banned. You can't attack him");
//break;
}
//check if admin:
$villageOwner = $database->getVillageField($id,'owner');
$userAccess = $database->getUserField($villageOwner,'access',0);
if($userAccess == '9'){
$form->addError("error","Player is Admin. You can't attack him");
//break;
}
//check if attacking same village that units are in
if($id == $village->wid){