mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-06 21:04:20 +00:00
fix special characters when send troops + add auto medals update system
This commit is contained in:
+45
-34
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user