fix special characters when send troops + add auto medals update system

This commit is contained in:
yi12345
2013-09-15 11:37:49 +02:00
parent f0024248d5
commit fdd9d3dc4d
6 changed files with 598 additions and 43 deletions
+510 -1
View File
@@ -210,7 +210,7 @@ class Automation {
$this->updateStore();
$this->CheckBan();
$this->regenerateOasisTroops();
$this->medals();
$this->artefactOfTheFool();
}
@@ -4419,6 +4419,515 @@ $wallimg = "<img src=\"".GP_LOCATE."img/g/g33Icon.gif\" height=\"20\" width=\"15
}
}
function medals(){
global $ranking,$database;
//we mogen de lintjes weggeven
$giveMedal = false;
$q = "SELECT * FROM ".TB_PREFIX."config";
$result = mysql_query($q);
if($result) {
$row=mysql_fetch_assoc($result);
$stime = strtotime(START_DATE)-strtotime(date('m/d/Y'))+strtotime(START_TIME);
if($row['lastgavemedal'] == 0 && $stime < time()){
$newtime = time()+MEDALINTERVAL;
$q = "UPDATE ".TB_PREFIX."config SET lastgavemedal=".$newtime;
$database->query($q);
$row['lastgavemedal'] = time()+MEDALINTERVAL;
}
$time = $row['lastgavemedal'] + MEDALINTERVAL;
if ($time < time()) $giveMedal = true;
}
if($giveMedal && MEDALINTERVAL > 0){
//bepaal welke week we zitten
$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';
}
//Do same for ally week
$q = "SELECT * FROM ".TB_PREFIX."allimedal order by week DESC LIMIT 0, 1";
$result = mysql_query($q);
if(mysql_num_rows($result)) {
$row=mysql_fetch_assoc($result);
$allyweek=($row['week']+1);
} else {
$allyweek='1';
}
//Aanvallers v/d Week
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY ap DESC, id DESC Limit 10");
$i=0;
while($row = mysql_fetch_array($result)){
$i++;
$img="t2_".($i)."";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '1', '".($i)."', '".$week."', '".$row['ap']."', '".$img."')";
$resul=mysql_query($quer);
}
//Verdediger v/d Week
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY dp DESC, id DESC Limit 10");
$i=0;
while($row = mysql_fetch_array($result)){
$i++;
$img="t3_".($i)."";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '2', '".($i)."', '".$week."', '".$row['dp']."', '".$img."')";
$resul=mysql_query($quer);
}
//Klimmers v/d Week
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY Rc DESC, id DESC Limit 10");
$i=0;
while($row = mysql_fetch_array($result)){
$i++;
$img="t1_".($i)."";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '3', '".($i)."', '".$week."', '".$row['Rc']."', '".$img."')";
$resul=mysql_query($quer);
}
//Rank climbers of the week
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY clp DESC Limit 10");
$i=0;
while($row = mysql_fetch_array($result)){
$i++;
$img="t6_".($i)."";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '10', '".($i)."', '".$week."', '".$row['clp']."', '".$img."')";
$resul=mysql_query($quer);
}
//Overvallers v/d Week
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY RR DESC, id DESC Limit 10");
$i=0;
while($row = mysql_fetch_array($result)){
$i++;
$img="t4_".($i)."";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '4', '".($i)."', '".$week."', '".$row['RR']."', '".$img."')";
$resul=mysql_query($quer);
}
//deel de bonus voor aanval+defence top 10 uit
//Pak de top10 aanvallers
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY ap DESC, id DESC Limit 10");
while($row = mysql_fetch_array($result)){
//Pak de top10 verdedigers
$result2 = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY dp DESC, id DESC Limit 10");
while($row2 = mysql_fetch_array($result2)){
if($row['id']==$row2['id']){
$query3="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 5";
$result3=mysql_query($query3);
$row3=mysql_fetch_row($result3);
//kijk welke kleur het lintje moet hebben
if($row3[0]<='2'){
$img="t22".$row3[0]."_1";
switch ($row3[0]) {
case "0":
$tekst="";
break;
case "1":
$tekst="twice ";
break;
case "2":
$tekst="three times ";
break;
}
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '5', '0', '".$week."', '".$tekst."', '".$img."')";
$resul=mysql_query($quer);
}
}
}
}
//je staat voor 3e / 5e / 10e keer in de top 3 aanvallers
//Pak de top10 aanvallers
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY ap DESC, id DESC Limit 10");
while($row = mysql_fetch_array($result)){
$query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 1 AND plaats<=3";
$result1=mysql_query($query1);
$row1=mysql_fetch_row($result1);
//2x in gestaan, dit is 3e dus lintje (brons)
if($row1[0]=='3'){
$img="t120_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '6', '0', '".$week."', 'Three', '".$img."')";
$resul=mysql_query($quer);
}
//4x in gestaan, dit is 5e dus lintje (zilver)
if($row1[0]=='5'){
$img="t121_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '6', '0', '".$week."', 'Five', '".$img."')";
$resul=mysql_query($quer);
}
//9x in gestaan, dit is 10e dus lintje (goud)
if($row1[0]=='10'){
$img="t122_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '6', '0', '".$week."', 'Ten', '".$img."')";
$resul=mysql_query($quer);
}
}
//je staat voor 3e / 5e / 10e keer in de top 10 aanvallers
//Pak de top10 aanvallers
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY ap DESC, id DESC Limit 10");
while($row = mysql_fetch_array($result)){
$query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 1 AND plaats<=10";
$result1=mysql_query($query1);
$row1=mysql_fetch_row($result1);
//2x in gestaan, dit is 3e dus lintje (brons)
if($row1[0]=='3'){
$img="t130_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '12', '0', '".$week."', 'Three', '".$img."')";
$resul=mysql_query($quer);
}
//4x in gestaan, dit is 5e dus lintje (zilver)
if($row1[0]=='5'){
$img="t131_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '12', '0', '".$week."', 'Five', '".$img."')";
$resul=mysql_query($quer);
}
//9x in gestaan, dit is 10e dus lintje (goud)
if($row1[0]=='10'){
$img="t132_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '12', '0', '".$week."', 'Ten', '".$img."')";
$resul=mysql_query($quer);
}
}
//je staat voor 3e / 5e / 10e keer in de top 3 verdedigers
//Pak de top10 verdedigers
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY dp DESC, id DESC Limit 10");
while($row = mysql_fetch_array($result)){
$query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 2 AND plaats<=3";
$result1=mysql_query($query1);
$row1=mysql_fetch_row($result1);
//2x in gestaan, dit is 3e dus lintje (brons)
if($row1[0]=='3'){
$img="t140_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '7', '0', '".$week."', 'Three', '".$img."')";
$resul=mysql_query($quer);
}
//4x in gestaan, dit is 5e dus lintje (zilver)
if($row1[0]=='5'){
$img="t141_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '7', '0', '".$week."', 'Five', '".$img."')";
$resul=mysql_query($quer);
}
//9x in gestaan, dit is 10e dus lintje (goud)
if($row1[0]=='10'){
$img="t142_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '7', '0', '".$week."', 'Ten', '".$img."')";
$resul=mysql_query($quer);
}
}
//je staat voor 3e / 5e / 10e keer in de top 3 verdedigers
//Pak de top10 verdedigers
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY dp DESC, id DESC Limit 10");
while($row = mysql_fetch_array($result)){
$query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 2 AND plaats<=10";
$result1=mysql_query($query1);
$row1=mysql_fetch_row($result1);
//2x in gestaan, dit is 3e dus lintje (brons)
if($row1[0]=='3'){
$img="t150_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '13', '0', '".$week."', 'Three', '".$img."')";
$resul=mysql_query($quer);
}
//4x in gestaan, dit is 5e dus lintje (zilver)
if($row1[0]=='5'){
$img="t151_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '13', '0', '".$week."', 'Five', '".$img."')";
$resul=mysql_query($quer);
}
//9x in gestaan, dit is 10e dus lintje (goud)
if($row1[0]=='10'){
$img="t152_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '13', '0', '".$week."', 'Ten', '".$img."')";
$resul=mysql_query($quer);
}
}
//je staat voor 3e / 5e / 10e keer in de top 3 klimmers
//Pak de top10 klimmers
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY Rc DESC, id DESC Limit 10");
while($row = mysql_fetch_array($result)){
$query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 3 AND plaats<=3";
$result1=mysql_query($query1);
$row1=mysql_fetch_row($result1);
//2x in gestaan, dit is 3e dus lintje (brons)
if($row1[0]=='3'){
$img="t100_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '8', '0', '".$week."', 'Three', '".$img."')";
$resul=mysql_query($quer);
}
//4x in gestaan, dit is 5e dus lintje (zilver)
if($row1[0]=='5'){
$img="t101_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '8', '0', '".$week."', 'Five', '".$img."')";
$resul=mysql_query($quer);
}
//9x in gestaan, dit is 10e dus lintje (goud)
if($row1[0]=='10'){
$img="t102_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '8', '0', '".$week."', 'Ten', '".$img."')";
$resul=mysql_query($quer);
}
}
//je staat voor 3e / 5e / 10e keer in de top 3 klimmers
//Pak de top10 klimmers
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY Rc DESC, id DESC Limit 10");
while($row = mysql_fetch_array($result)){
$query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 3 AND plaats<=10";
$result1=mysql_query($query1);
$row1=mysql_fetch_row($result1);
//2x in gestaan, dit is 3e dus lintje (brons)
if($row1[0]=='3'){
$img="t110_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '14', '0', '".$week."', 'Three', '".$img."')";
$resul=mysql_query($quer);
}
//4x in gestaan, dit is 5e dus lintje (zilver)
if($row1[0]=='5'){
$img="t111_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '14', '0', '".$week."', 'Five', '".$img."')";
$resul=mysql_query($quer);
}
//9x in gestaan, dit is 10e dus lintje (goud)
if($row1[0]=='10'){
$img="t112_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '14', '0', '".$week."', 'Ten', '".$img."')";
$resul=mysql_query($quer);
}
}
//je staat voor 3e / 5e / 10e keer in de top 3 klimmers
//Pak de top3 rank climbers
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY clp DESC, id DESC Limit 10");
while($row = mysql_fetch_array($result)){
$query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 10 AND plaats<=3";
$result1=mysql_query($query1);
$row1=mysql_fetch_row($result1);
//2x in gestaan, dit is 3e dus lintje (brons)
if($row1[0]=='3'){
$img="t200_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '11', '0', '".$week."', 'Three', '".$img."')";
$resul=mysql_query($quer);
}
//4x in gestaan, dit is 5e dus lintje (zilver)
if($row1[0]=='5'){
$img="t201_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '11', '0', '".$week."', 'Five', '".$img."')";
$resul=mysql_query($quer);
}
//9x in gestaan, dit is 10e dus lintje (goud)
if($row1[0]=='10'){
$img="t202_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '11', '0', '".$week."', 'Ten', '".$img."')";
$resul=mysql_query($quer);
}
}
//je staat voor 3e / 5e / 10e keer in de top 10klimmers
//Pak de top3 rank climbers
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY clp DESC, id DESC Limit 10");
while($row = mysql_fetch_array($result)){
$query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 10 AND plaats<=10";
$result1=mysql_query($query1);
$row1=mysql_fetch_row($result1);
//2x in gestaan, dit is 3e dus lintje (brons)
if($row1[0]=='3'){
$img="t210_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '16', '0', '".$week."', 'Three', '".$img."')";
$resul=mysql_query($quer);
}
//4x in gestaan, dit is 5e dus lintje (zilver)
if($row1[0]=='5'){
$img="t211_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '16', '0', '".$week."', 'Five', '".$img."')";
$resul=mysql_query($quer);
}
//9x in gestaan, dit is 10e dus lintje (goud)
if($row1[0]=='10'){
$img="t212_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '16', '0', '".$week."', 'Ten', '".$img."')";
$resul=mysql_query($quer);
}
}
//je staat voor 3e / 5e / 10e keer in de top 10 overvallers
//Pak de top10 overvallers
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY RR DESC, id DESC Limit 10");
while($row = mysql_fetch_array($result)){
$query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 4 AND plaats<=3";
$result1=mysql_query($query1);
$row1=mysql_fetch_row($result1);
//2x in gestaan, dit is 3e dus lintje (brons)
if($row1[0]=='3'){
$img="t160_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '9', '0', '".$week."', 'Three', '".$img."')";
$resul=mysql_query($quer);
}
//4x in gestaan, dit is 5e dus lintje (zilver)
if($row1[0]=='5'){
$img="t161_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '9', '0', '".$week."', 'Five', '".$img."')";
$resul=mysql_query($quer);
}
//9x in gestaan, dit is 10e dus lintje (goud)
if($row1[0]=='10'){
$img="t162_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '9', '0', '".$week."', 'Ten', '".$img."')";
$resul=mysql_query($quer);
}
}
//je staat voor 3e / 5e / 10e keer in de top 10 overvallers
//Pak de top10 overvallers
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY RR DESC, id DESC Limit 10");
while($row = mysql_fetch_array($result)){
$query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 4 AND plaats<=10";
$result1=mysql_query($query1);
$row1=mysql_fetch_row($result1);
//2x in gestaan, dit is 3e dus lintje (brons)
if($row1[0]=='3'){
$img="t170_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '15', '0', '".$week."', 'Three', '".$img."')";
$resul=mysql_query($quer);
}
//4x in gestaan, dit is 5e dus lintje (zilver)
if($row1[0]=='5'){
$img="t171_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '15', '0', '".$week."', 'Five', '".$img."')";
$resul=mysql_query($quer);
}
//9x in gestaan, dit is 10e dus lintje (goud)
if($row1[0]=='10'){
$img="t172_1";
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '15', '0', '".$week."', 'Ten', '".$img."')";
$resul=mysql_query($quer);
}
}
//Zet alle waardens weer op 0
$query="SELECT * FROM ".TB_PREFIX."users ORDER BY id+0 DESC";
$result=mysql_query($query);
for ($i=0; $row=mysql_fetch_row($result); $i++){
mysql_query("UPDATE ".TB_PREFIX."users SET ap=0, dp=0,Rc=0,clp=0, RR=0 WHERE id = ".$row[0]."");
}
//Start alliance Medals wooot
//Aanvallers v/d Week
$result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY ap DESC, id DESC Limit 10");
$i=0; while($row = mysql_fetch_array($result)){
$i++; $img="a2_".($i)."";
$quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '1', '".($i)."', '".$allyweek."', '".$row['ap']."', '".$img."')";
$resul=mysql_query($quer);
}
//Verdediger v/d Week
$result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY dp DESC Limit 10");
$i=0; while($row = mysql_fetch_array($result)){
$i++; $img="a3_".($i)."";
$quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '2', '".($i)."', '".$allyweek."', '".$row['dp']."', '".$img."')";
$resul=mysql_query($quer);
}
//Overvallers v/d Week
$result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY RR DESC, id DESC Limit 10");
$i=0; while($row = mysql_fetch_array($result)){
$i++; $img="a4_".($i)."";
$quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '4', '".($i)."', '".$allyweek."', '".$row['RR']."', '".$img."')";
$resul=mysql_query($quer);
}
//Rank climbers of the week
$result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY clp DESC Limit 10");
$i=0; while($row = mysql_fetch_array($result)){
$i++; $img="a1_".($i)."";
$quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '3', '".($i)."', '".$allyweek."', '".$row['clp']."', '".$img."')";
$resul=mysql_query($quer);
}
$result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY ap DESC, id DESC Limit 10");
while($row = mysql_fetch_array($result)){
//Pak de top10 verdedigers
$result2 = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY dp DESC, id DESC Limit 10");
while($row2 = mysql_fetch_array($result2)){
if($row['id']==$row2['id']){
$query3="SELECT count(*) FROM ".TB_PREFIX."allimedal WHERE allyid='".$row['id']."' AND categorie = 5";
$result3=mysql_query($query3);
$row3=mysql_fetch_row($result3);
//kijk welke kleur het lintje moet hebben
if($row3[0]<='2'){
$img="t22".$row3[0]."_1";
switch ($row3[0]) {
case "0":
$tekst="";
break;
case "1":
$tekst="twice ";
break;
case "2":
$tekst="three times ";
break;
}
$quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '5', '0', '".$allyweek."', '".$tekst."', '".$img."')";
$resul=mysql_query($quer);
}
}
}
}
$query="SELECT * FROM ".TB_PREFIX."alidata ORDER BY id+0 DESC";
$result=mysql_query($query);
for ($i=0; $row=mysql_fetch_row($result); $i++){
mysql_query("UPDATE ".TB_PREFIX."alidata SET ap=0, dp=0, RR=0, clp=0 WHERE id = ".$row[0]."");
}
$q = "UPDATE ".TB_PREFIX."config SET lastgavemedal=".$time;
$database->query($q);
}
}
private function artefactOfTheFool() {
global $database;
$time = time();
+45 -34
View File
@@ -118,44 +118,55 @@ class Units {
}
// Busqueda por coordenadas de pueblo
// Confirmamos y buscamos las coordenadas por coordenadas de pueblo
if(isset($post['x']) && isset($post['y']) && $post['x'] != "" && $post['y'] != "") {
$coor = array('x'=>$post['x'], 'y'=>$post['y']);
$id = $generator->getBaseID($coor['x'],$coor['y']);
if (!$database->getVillageState($id)){
$form->addError("error","Coordinates do not exist");
}
if ($session->tribe == 1){$Gtribe = "";}elseif ($session->tribe == 2){$Gtribe = "1";}elseif ($session->tribe == 3){$Gtribe = "2";}elseif ($session->tribe == 4){$Gtribe = "3";}elseif ($session->tribe == 5){$Gtribe = "4";}
for($i=1; $i<11; $i++)
{
if(isset($post['t'.$i]))
{
if(isset($post['x']) && isset($post['y']) && $post['x'] != "" && $post['y'] != "") {
$coor = array('x'=>$post['x'], 'y'=>$post['y']);
$id = $generator->getBaseID($coor['x'],$coor['y']);
if (!$database->getVillageState($id)){
$form->addError("error","Coordinates do not exist");
}
if ($session->tribe == 1){$Gtribe = "";}elseif ($session->tribe == 2){$Gtribe = "1";}elseif ($session->tribe == 3){$Gtribe = "2";}elseif ($session->tribe == 4){$Gtribe = "3";}elseif ($session->tribe == 5){$Gtribe = "4";}
for($i=1; $i<10; $i++)
{
if(isset($post['t'.$i]))
{
if ($post['t'.$i] > $village->unitarray['u'.$Gtribe.$i])
{
$form->addError("error","You can't send more units than you have");
break;
}
if ($post['t'.$i] > $village->unitarray['u'.$Gtribe.$i])
{
$form->addError("error","You can't send more units than you have");
break;
}
if($post['t'.$i]<0)
{
$form->addError("error","You can't send negative units.");
break;
}
if($post['t'.$i]<0)
{
$form->addError("error","You can't send negative units.");
break;
}
}
}
if ($post['t11'] > $village->unitarray['hero'])
{
$form->addError("error","You can't send more units than you have");
break;
}
if(preg_match('/[^0-9]/',$post['t'.$i]))
{
$form->addError("error","Special characters can't entered");
break;
}
}
}
if ($post['t11'] > $village->unitarray['hero'])
{
$form->addError("error","You can't send more units than you have");
break;
}
if($post['t11']<0)
{
$form->addError("error","You can't send negative units.");
break;
}
}
if($post['t11']<0)
{
$form->addError("error","You can't send negative units.");
break;
}
if(preg_match('/[^0-9]/',$post['t11']))
{
$form->addError("error","Special characters can't entered");
break;
}
}
if ($database->isVillageOases($id) == 0) {
if($database->hasBeginnerProtection($id)==1) {
$form->addError("error","Player is under beginners protection. You can't attack him");
+2
View File
@@ -123,6 +123,8 @@ define("AUTH_EMAIL",%ACTIVATE%);
define("PLUS_TIME",%PLUS_TIME%);
//+25% production lenght
define("PLUS_PRODUCTION",%PLUS_PRODUCTION%);
// ***** Medal Interval check
define("MEDALINTERVAL",%MEDALINTERVAL%);
// ***** Great Workshop
define("GREAT_WKS",%GREAT_WKS%);
// ***** Tourn threshold
+16
View File
@@ -425,6 +425,22 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%chat` (
--
-- --------------------------------------------------------
--
-- Table structure for table `%prefix%config`
--
CREATE TABLE IF NOT EXISTS `%PREFIX%config` (
`lastgavemedal` int(11) unsigned NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
INSERT INTO `%PREFIX%config` VALUES (0);
--
-- Dumping data for table `%prefix%config`
--
-- --------------------------------------------------------
--
+1
View File
@@ -91,6 +91,7 @@ class Process {
$text = preg_replace("'%GP_LOCATE%'", $_POST['gp_locate'], $text);
$text = preg_replace("'%PLUS_TIME%'", $_POST['plus_time'], $text);
$text = preg_replace("'%PLUS_PRODUCTION%'", $_POST['plus_production'], $text);
$text = preg_replace("'%MEDALINTERVAL%'", $_POST['medalinterval'], $text);
$text = preg_replace("'%GREAT_WKS%'", $_POST['great_wks'], $text);
$text = preg_replace("'%TS_THRESHOLD%'", $_POST['ts_threshold'], $text);
$text = preg_replace("'%WW%'", $_POST['ww'], $text);
+24 -8
View File
@@ -47,13 +47,16 @@ echo "<div class=\"headline\"><span class=\"f10 c5\">Error creating constant.php
</td></tr><tr></tr>
<td><span class="f9 c6">Beginners protection length:</span></td><td>
<select name="beginner">
<option value="0">None (0 hours)</option>
<option value="21600">6 hours</option>
<option value="7200">2 hours</option>
<option value="10800">3 hours</option>
<option value="18000">5 hours</option>
<option value="28800">8 hours</option>
<option value="36000">10 hours</option>
<option value="43200" selected="selected">12 hours</option>
<option value="86400">24 hours</option>
<option value="129600">36 hours</option>
<option value="172800">48 hours</option>
<option value="259200">72 hours</option>
<option value="86400">24 hours (1 day)</option>
<option value="172800">48 hours (2 days)</option>
<option value="259200">72 hours (3 days)</option>
<option value="432000">120 hours (5 days)</option>
</select>
</td></tr><tr></tr>
<td><span class="f9 c6">Plus account length:</span></td><td>
@@ -90,6 +93,19 @@ echo "<div class=\"headline\"><span class=\"f10 c5\">Error creating constant.php
<option value="86400">24 hours</option>
</select>
</td></tr><tr></tr>
<tr class="hover">
<td>Medals interval:</td>
<select name="medalinterval">
<option value="0">none</option>
<option value="(3600*24)">1 day</option>
<option value="(3600*24*2)">2 days</option>
<option value="(3600*24*3)">3 days</option>
<option value="(3600*24*4)">4 days</option>
<option value="(3600*24*5)">5 days</option>
<option value="(3600*24*6)">6 days</option>
<option value="(3600*24*7)" selected="selected">7 days</option>
</select>
</tr>
<td><span class="f9 c6">Storage Multipler:</span></td><td width="140"><input type="text" name="storage_multiplier" id="storage_multiplier" value="1"></td></tr><tr>
<td><span class="f9 c6">Tourn Threshold:</span></td><td width="140"><input type="text" name="ts_threshold" id="ts_threshold" value="20"></td></tr><tr>
<td><span class="f9 c6">Great Workshop:</span></td><td>
@@ -146,8 +162,8 @@ echo "<div class=\"headline\"><span class=\"f10 c5\">Error creating constant.php
<td><span class="f9 c6">DB name:</span></td><td><input type="text" name="sdb" id="sdb"></td></tr><tr>
<td><span class="f9 c6">Prefix:</span></td><td><input type="text" name="prefix" id="prefix" value="s1_" size="5"></td></tr>
<td><span class="f9 c6">Type:</span></td><td><select name="connectt">
<option value="0">MYSQL</option>
<option value="1" selected="selected">MYSQLi</option>
<option value="0" selected="selected">MYSQL</option>
<option value="1">MYSQLi</option>
</select></td></tr>
</table>
</p>