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
+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");