Undefined index – PHP – Fórum – Programujte.com
 x   TIP: Přetáhni ikonu na hlavní panel pro připnutí webu

Undefined index – PHP – Fórum – Programujte.comUndefined index – PHP – Fórum – Programujte.com

 

Jozef
~ Anonymní uživatel
61 příspěvků
6. 9. 2016   #1
-
0
-

Ahojte, to som zase ja. Prerábam hru, ktorú vyvíjam (v mysql fungovala) do mysqli a sú s tým samé problémy. Stále mi skáče undefined index na batériu, no využívam totožné scripty ako vtedy. Vedel by mi niekto poradiť? Žiadne iné súbory nepoužívam iba tie, ohľadom ktorých dám sem kód.
update_stats.php  

<?php
if($user['fraction'] == 0){ 
$income = 2 * $unit['worker'];

$farming = 5 * pow($unit['farmer'],0.5);


$num1 = min($weapon['springfield'],$unit['rifleman']);
 
if($num1 == $weapon['springfield']){
    $attack1 = (50 * $weapon['springfield']) + (10 * $unit['rifleman'] );
}else{
     $attack1 = (10 * $unit['rifleman']);
}


$num2 = min($weapon['thompson'],$unit['soldier']);

if($num2 == $weapon['thompson']){
    $attack2 = (200 * $weapon['thompson']) + (14 * $unit['soldier']);
}else{
    $attack2 = (14 * $unit['soldier']);
}

$num3 = ($weapon['sherman']);

if($num3 == $weapon['sherman']){
    $attack3 = (1000 * $weapon['sherman']);
}

$num4 = ($weapon['hellcat']);

if($num4 == $weapon['hellcat']){
    $attack5 = (2000 * $weapon['hellcat']);
}
$num5 = ($weapon['pershing']);

if($num5 == $weapon['pershing']){
    $attack6 = (3000 * $weapon['pershing']);
}

$num6 = min($weapon['browning'],$unit['machinegunner']);

if($num6 == $weapon['browning']){
    $defense1 = (650 * $weapon['browning']) + (12 * $unit['machinegunner']);
}else{
    $defense1 = (12 * $unit['machinegunner']);
}

$num7 = min($weapon['m1garand'],$unit['rifleman']);

if($num7 == $weapon['m1garand']){
    $attack7 = (75 * $weapon['m1garand']) + (10 * $unit['rifleman'] );
}else{
     $attack7 = (10 * $unit['rifleman']);
}
$num8 = min($weapon['m1a1'],$unit['rifleman']);

if($num8 == $weapon['m1a1']){
    $attack8 = (100 * $weapon['m1a1']) + (10 * $unit['rifleman'] );
}else{
     $attack8 = (10 * $unit['rifleman']);
}
$num9 = ($weapon['howitzer']);

if($num9 == $weapon['howitzer']){
    $defense2 = (800 * $weapon['howitzer']);
}



$attack = $attack1 + $attack2 + $attack3 +  $attack5 + $attack6 + $attack7 + $attack8 + $stats['cattack'];
$defense = $defense1 + $defense2 +$stats['wdefense'];
if($unit['sergeant'] == 1) {
    $attack = (2 * $attack );
   }
   if($unit['gendef'] == 1) {
    $defense = (2 * $defense );
   }
$update_stats = mysqli_query($con,"UPDATE `stats` SET
							`income`='".$income."',`farming`='".$farming."',
							`attack`='".$attack."',`defense`='".$defense."'
							WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
              }
              
          
              
              
              
              
              
              
              
if($user['fraction'] == 1){  
$income = 2 * $unit['worker'];

$farming = 5 * pow($unit['farmer'],0.5);


$num1 = min($weapon['kar98'],$unit['schutze']);

if($num1 == $weapon['kar98']){
    $attack1 = (50 * $weapon['kar98']) + (10 * $unit['schutze'] );
}else{
     $attack1 = (10 * $unit['schutze']);
}


$num2 = min($weapon['gw43'],$unit['schutze']);

if($num2 == $weapon['gw43']){
    $attack2 = (75 * $weapon['gw43']) + (10 * $unit['schutze']);
}else{
    $attack2 = (10 * $unit['schutze']);
}

$num3 = ($weapon['tiger']);

if($num3 == $weapon['tiger']){
    $attack3 = (1000 * $weapon['tiger']);
}

$num4 = ($weapon['stugv']);

if($num4 == $weapon['stugv']){
    $attack5 = (2000 * $weapon['stugv']);
}
$num5 = ($weapon['tiger2']);

if($num5 == $weapon['tiger2']){
    $attack6 = (3000 * $weapon['tiger2']);
}

$num6 = min($weapon['mp40'],$unit['soldad']);

if($num6 == $weapon['mp40']){
    $attack7 = (100 * $weapon['mp40']) + (14 * $unit['soldad']);
}else{
    $attack7 = (14 * $unit['soldad']);
}

$num7 = min($weapon['mp44'],$unit['soldad']);

if($num7 == $weapon['mp44']){
    $attack8 = (150 * $weapon['mp44']) + (14 * $unit['soldad'] );
}else{
     $attack8 = (14 * $unit['soldad']);
}
$num8 = min($weapon['mg42'],$unit['maschinengewehr']);

if($num8 == $weapon['mg42']){
    $defense1 = (650 * $weapon['mg42']) + (12 * $unit['maschinengewehr'] );
}else{
     $defense1 = (12 * $unit['maschinengewehr']);
}
$num9 = ($weapon['panzerstellung']);

if($num9 == $weapon['panzerstellung']){
    $defense2 = (800 * $weapon['panzerstellung']);
}




$attack = $attack1 + $attack2 + $attack3 + $attack5 + $attack6 + $attack7 + $attack8 + $stats['cattack'];
$defense = $defense1 +  $defense2 + $stats['wdefense'];

if($unit['leutant'] == 1) {
    $attack = (2 * $attack );
   }
   if($unit['hauptmann'] == 1) {
    $defense = (2 * $defense );
   }
$update_stats = mysqli_query($con,("UPDATE `stats` SET
							`income`='".$income."',`farming`='".$farming."',
							`attack`='".$attack."',`defense`='".$defense."'
							WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
               }










if($user['fraction'] == 2){ 
$income = 2 * $unit['worker'];

$farming = 5 * pow($unit['farmer'],0.5);

$num1 = min($weapon['kar98'],$unit['strelec']);


if($num1 == $weapon['kar98']){
    $attack1 = (50 * $weapon['kar98']) + (10 * $unit['strelec'] );
}else{
     $attack1 = (10 * $unit['strelec']);
}


$num2 = min($weapon['puskavz24'],$unit['strelec']);

if($num2 == $weapon['puskavz24']){
    $attack2 = (75 * $weapon['puskavz24']) + (10 * $unit['strelec']);
}else{
    $attack2 = (10 * $unit['strelec']);
}

$num3 = ($weapon['lt38']);

if($num3 == $weapon['lt38']){
    $attack3 = (1500 * $weapon['lt38']);
}

$num4 = ($weapon['pak38']);

if($num4 == $weapon['pak38']){
    $defense1 = (300 * $weapon['pak38']);
}
$num5 = ($weapon['flak37']);

if($num5 == $weapon['flak37']){
    $defense2 = (500 * $weapon['flak37']);
}

$num6 = min($weapon['gulometvz24'],$unit['gulometcik']);

if($num6 == $weapon['gulometvz24']){
    $defense3 = (650 * $weapon['gulometvz24']) + (12 * $unit['gulometcik']);
}else{
    $defense3 = (12 * $unit['gulometcik']);
}

$num7 = min($weapon['pps43'],$unit['vojak']);

if($num7 == $weapon['pps43']){
    $attack4 = (100 * $weapon['pps43']) + (14 * $unit['vojak'] );
}else{
     $attack4 = (14 * $unit['vojak']);
}
$num8 = min($weapon['mp38'],$unit['vojak']);

if($num8 == $weapon['mp38']){
    $attack5 = (125 * $weapon['mp38']) + (14 * $unit['vojak'] );
}else{
     $attack5 = (15 * $unit['vojak']);
}
$num9 = ($weapon['grw']);

if($num9 == $weapon['grw']){
    $defense4 = (800 * $weapon['grw']);
}
$num10 = min($weapon['zk383'],$unit['vojak']);

if($num10 == $weapon['zk383']){
    $attack6 = (150 * $weapon['zk383']) + (14 * $unit['vojak'] );
} else{
     $attack6 = (15 * $unit['vojak']);
          }


$attack = $attack1 + $attack2 + $attack3 + $attack4 + $attack5 + $attack6 + $stats['cattack'];
$defense = $defense1 + $defense2 + $defense3 + $defense4 +$stats['wdefense'];
if($unit['serzant'] == 1) {
    $attack = (2 * $attack );
   }
   if($unit['generalobrany'] == 1) {
    $defense = (2 * $defense );
   }
$update_stats = mysqli_query($con,("UPDATE `stats` SET
							`income`='".$income."',`farming`='".$farming."',
							`attack`='".$attack."',`defense`='".$defense."'
							WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
              }
              
          
              
              
              
              
              
              
              
if($user['fraction'] == 3){  
$income = 2 * $unit['worker'];

$farming = 5 * pow($unit['farmer'],0.5);


$num1 = min($weapon['mosinnagant'],$unit['strelets']);

if($num1 == $weapon['mosinnagant']){
    $attack1 = (50 * $weapon['mosinnagant']) + (10 * $unit['strelets'] );
}else{
     $attack1 = (10 * $unit['strelets']);
}


$num2 = min($weapon['svt40'],$unit['strelets']);

if($num2 == $weapon['svt40']){
    $attack2 = (75 * $weapon['svt40']) + (10 * $unit['strelets']);
}else{
    $attack2 = (10 * $unit['strelets']);
}

$num3 = ($weapon['t34']);

if($num3 == $weapon['t34']){
    $attack3 = (1000 * $weapon['t34']);
}

$num4 = ($weapon['is2']);

if($num4 == $weapon['is2']){
    $attack4 = (2000 * $weapon['is2']);
}
$num5 = ($weapon['kv2']);

if($num5 == $weapon['kv2']){
    $attack5 = (3000 * $weapon['kv2']);
}

$num6 = min($weapon['pps41'],$unit['vojnik']);

if($num6 == $weapon['pps41']){
    $attack6 = (200 * $weapon['pps41']) + (14 * $unit['vojnik']);
}else{
    $attack6 = (14 * $unit['vojnik']);
}

$num7 = min($weapon['dp27'],$unit['pistoleti']);

if($num7 == $weapon['dp27']){
    $defense1 = (450 * $weapon['dp27']) + (12 * $unit['pistoleti'] );
}else{
     $defense1 = (12 * $unit['pistoleti']);
}
$num8 = min($weapon['maxim'],$unit['pistoleti']);

if($num8 == $weapon['maxim']){
    $defense2 = (650 * $weapon['maxim']) + (12 * $unit['pistoleti'] );
}else{
     $defense2 = (12 * $unit['pistoleti']);
}
$num9 = ($weapon['zis3']);

if($num9 == $weapon['zis3']){
    $defense3 = (500 * $weapon['zis3']);
}
$num10 = $weapon['$minometvz40'];

if($num10 == $weapon['$minometvz40']){
    $defense4 = (800 * $weapon['$minometvz40']);
}




$attack = $attack1 + $attack2 + $attack3 + $attack4 + $attack5 + $attack6 + $stats['cattack'];
$defense = $defense1 + $defense2 + $defense3 + $defense4 + $stats['wdefense'];

if($unit['sershant'] == 1) {
    $attack = (2 * $attack );
   }
   if($unit['obscht'] == 1) {
    $defense = (2 * $defense );
   }
$update_stats = mysqli_query($con,("UPDATE `stats` SET
							`income`='".$income."',`farming`='".$farming."',
							`attack`='".$attack."',`defense`='".$defense."'
							WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));

                          }






              if($user['fraction'] == 4){ 
$income = 2 * $unit['worker'];

$farming = 5 * pow($unit['farmer'],0.5);


$num1 = min($weapon['kar98'],$unit['tiratore']);

if($num1 == $weapon['kar98']){
    $attack1 = (50 * $weapon['kar98']) + (10 * $unit['tiratore'] );
}else{
     $attack1 = (10 * $unit['tiratore']);
}


$num2 = min($weapon['carcano'],$unit['tiratore']);

if($num2 == $weapon['carcano']){
    $attack2 = (75 * $weapon['carcano']) + (10 * $unit['tiratore']);
}else{
    $attack2 = (10 * $unit['tiratore']);
}

$num3 = ($weapon['p43']);

if($num3 == $weapon['p43']){
    $attack3 = (1500 * $weapon['p43']);
}

$num4 = ($weapon['carro']);

if($num4 == $weapon['carro']){
    $attack4 = (3000 * $weapon['carro']);
}
$num5 = ($weapon['skoda']);

if($num5 == $weapon['skoda']){
    $defense1 = (500 * $weapon['skoda']);
}

$num6 = min($weapon['breda'],$unit['artigliere']);

if($num6 == $weapon['breda']){
    $defense2 = (650 * $weapon['breda']) + (12 * $unit['artigliere']);
}else{
    $defense2 = (12 * $unit['artigliere']);
}

$num7 = min($weapon['fucile'],$unit['tiratore']);

if($num7 == $weapon['fucile']){
    $attack5 = (100 * $weapon['fucile']) + (10 * $unit['tiratore'] );
}else{
     $attack5 = (10 * $unit['tiratore']);
}
$num8 = min($weapon['ovp'],$unit['soldato']);

if($num8 == $weapon['ovp']){
    $attack6 = (150 * $weapon['ovp']) + (14 * $unit['soldato'] );
}else{
     $attack6 = (14 * $unit['soldato']);
}
$num9 = ($weapon['brixia']);

if($num9 == $weapon['brixia']){
    $defense3 = (800 * $weapon['brixia']);
}
$num10 = min($weapon['baretta'],$unit['soldato']);

if($num10 == $weapon['baretta']){
    $attack7 = (200 * $weapon['baretta']) + (14 * $unit['soldato'] );
}else{
     $attack7 = (14 * $unit['soldato']);
}
     


$attack = $attack1 + $attack2 + $attack3 + $attack4 + $attack5 + $attack6 + $attack7+ $stats['cattack'];
$defense = $defense1 + $defense2 + $defense3 + $stats['wdefense'];
if($unit['sergente'] == 1) {
    $attack = (2 * $attack );
   }
   if($unit['generale'] == 1) {
    $defense = (2 * $defense );
   }
$update_stats = mysqli_query($con,("UPDATE `stats` SET
							`income`='".$income."',`farming`='".$farming."',
							`attack`='".$attack."',`defense`='".$defense."'
							WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
              }
              
          
              
              
              
              
              
              
              
if($user['fraction'] == 5){  
$income = 2 * $unit['worker'];

$farming = 5 * pow($unit['farmer'],0.5);


$num1 = min($weapon['$enfield'],$unit['enfieldman']);

if($num1 == $weapon['$enfield']){
    $attack1 = (50 * $weapon['$enfield']) + (10 * $unit['enfieldman'] );
}else{
     $attack1 = (10 * $unit['enfieldman']);
}


$num2 = min($weapon['delisle'],$unit['enfieldman']);

if($num2 == $weapon['delisle']){
    $attack2 = (75 * $weapon['delisle']) + (10 * $unit['enfieldman']);
}else{
    $attack2 = (10 * $unit['enfieldman']);
}

$num3 = ($weapon['cromwell']);

if($num3 == $weapon['cromwell']){
    $attack3 = (1500 * $weapon['cromwell']);
}

$num4 = ($weapon['comet']);

if($num4 == $weapon['comet']){
    $attack4 = (3000 * $weapon['comet']);
}
$num5 = min($weapon['bar'],$unit['soldier']);

if($num5 == $weapon['bar']){
    $attack5 = (150 * $weapon['bar']) + (14 * $unit['soldier']);
}   else{
    $attack5 = (14 * $unit['soldier']);
    }
$num6 = min($weapon['sten'],$unit['soldier']);

if($num6 == $weapon['sten']){
    $attack6 = (200 * $weapon['sten']) + (14 * $unit['soldier']);
}else{
    $attack6 = (14 * $unit['soldier']);
}

$num7 = min($weapon['$bren'],$unit['gunner']);

if($num7 == $weapon['$bren']){
    $defense1 = (300 * $weapon['$bren']) + (12 * $unit['gunner'] );
}else{
     $defense1 = (12 * $unit['gunner']);
}
$num8 = min($weapon['vickers'],$unit['gunner']);

if($num8 == $weapon['vickers']){
    $defense2 = (450 * $weapon['vickers']) + (12 * $unit['gunner'] );
}else{
     $defense2 = (12 * $unit['gunner']);
       }
$num9 = min($weapon['lewis'],$unit['gunner']);

if($num9 == $weapon['lewis']){
    $defense3 = (600 * $weapon['lewis']) + (12 * $unit['gunner'] );
}else{
     $defense3 = (12 * $unit['gunner']);
      }



$attack = $attack1 + $attack2 + $attack3 + $attack4 + $attack5 + $attack6 + $stats['cattack'];
$defense = $defense1 +  $defense2 + $defense3 + $stats['wdefense'];

if($unit['sergeant'] == 1) {
    $attack = (2 * $attack );
   }
   if($unit['gendef'] == 1) {
    $defense = (2 * $defense );
   }
$update_stats = mysqli_query($con,("UPDATE `stats` SET
							`income`='".$income."',`farming`='".$farming."',
							`attack`='".$attack."',`defense`='".$defense."'
							WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
}            
?>

main.php (hlavné herné okno po prihlásení)  a v samotnom main.php mám problém s quest, ktorý je tiež undefined... už si neviem pomôcť a som zúfalý! :(

<?php

include ('game_header.php');
 include ('functions.php');
 session_start();

 include ('safe.php');  
?>
<style>.art-content .art-postcontent-0 .layout-item-0{border-top-width:1px;border-top-style:dotted;border-top-color:#707070;margin-top:10px;margin-bottom:10px}.art-content .art-postcontent-0 .layout-item-1{padding-right:10px;padding-left:10px}.ie7 .art-post .art-layout-cell{border:none!important;padding:0!important}.ie6 .art-post .art-layout-cell{border:none!important;padding:0!important}</style></head>
<body onload="startTime()">
<div id="art-main">
<header class="art-header">
<div class="art-shapes">
</div>
<h1 class="art-headline" data-left="66.04%">
<a href="#">Nation Wars</a>
</h1>
<h2 class="art-slogan" data-left="39.8%">Dobi svet a užívaj si slávu</h2>
</header>
<div class="art-sheet clearfix">
<div class="art-layout-wrapper">
<div class="art-content-layout">
<div class="art-content-layout-row">
<div class="art-layout-cell art-sidebar1"><div class="art-vmenublock clearfix">
<div class="art-vmenublockcontent">
<ul class="art-vmenu"><li><a href="main.php" class="active">Prehľad</a></li><li><a href="raid.php" class="">Operácie</a></li><li><a href="rankings.php" class="">Majori</a></li><li><a href="guilds.php" class="">Odboje</a></li><li><a href="map.php" class="">Mapa</a></li><li><a href="minigame.php" class="">Minihra</a></li><li><a href="guild.php" class="">Môj odboj</a></li><li><a href="room.php" class="">Chat</a></li><li><a href="mailbox.php" class="">Pošta<?php if($stats['new'] == 1){ ?><font color="#FF0000"> Nová!</font><?php } ?></a></li></ul>
</div>
</div></div>
<div class="art-layout-cell art-content"><article class="art-post art-article">
<div class="art-postmetadataheader">
<h2 class="art-postheader"><span class="art-postheadericon">Prehľad</span></h2>
</div>
<div class="art-postcontent art-postcontent-0 clearfix">
<?php 
 
 if(isset($_SESSION['uid'])){  

                           
 if($user['fraction'] == 0){            // USA
 
	if ($stats['quest'] == 1 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 4 && $stats['qok'] == 0 && $unit['worker'] >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 7 && $stats['qok'] == 0 && $unit['rifleman'] >= 5 && $weapon['springfield'] >= 5){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 8 && $stats['qok'] == 0 && $unit['machinegunner'] >= 5 && $weapon['browning'] >= 5){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 10 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 11 && $stats['qok'] == 0 && $unit['worker'] >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 12 && $stats['qok'] == 0 && $unit['rifleman'] >= 10 && $weapon['springfield'] >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 13 && $stats['qok'] == 0 && $unit['machinegunner'] >= 10 && $weapon['browning'] >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 14 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 15 && $stats['qok'] == 0 && $unit['worker'] >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 16 && $stats['qok'] == 0 && $unit['rifleman'] >= 20 && $weapon['springfield'] >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 17 && $stats['qok'] == 0 && $unit['machinegunner'] >= 20 && $weapon['browning'] >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 19 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 20 && $stats['qok'] == 0 && $unit['worker'] >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 21 && $stats['qok'] == 0 && $unit['rifleman'] >= 40 && $weapon['springfield'] >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 22 && $stats['qok'] == 0 && $unit['machinegunner'] >= 40 && $weapon['browning'] >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 23 && $stats['qok'] == 0 && $stats['cannon'] >= 1){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 24 && $stats['qok'] == 0 && $stats['wall'] >= 1){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 25 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 26 && $stats['qok'] == 0 && $unit['worker'] >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 27 && $stats['qok'] == 0 && $unit['rifleman'] >= 80 && $weapon['springfield'] >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 28 && $stats['qok'] == 0 && $unit['machinegunner'] >= 80 && $weapon['browning'] >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 30 && $stats['qok'] == 0 && $unit['rifleman'] >= 160 && $weapon['springfield'] >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 31 && $stats['qok'] == 0 && $unit['machinegunner'] >= 160 && $weapon['browning'] >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 32 && $stats['qok'] == 0 && $stats['floor'] >= 2){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
}?>
<?php
 if($user['fraction'] == 1){                // NEMECKO

	
	if ($stats['quest'] == 1 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 4 && $stats['qok'] == 0 && $unit['worker'] >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 7 && $stats['qok'] == 0 && $unit['schutze'] >= 5 && $weapon['kar98'] >= 5){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 8 && $stats['qok'] == 0 && $unit['maschinengewehr'] >= 5 && $weapon['mg42'] >= 5){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 10 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 11 && $stats['qok'] == 0 && $unit['worker'] >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 12 && $stats['qok'] == 0 && $unit['schutze'] >= 10 && $weapon['kar98'] >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 13 && $stats['qok'] == 0 && $unit['maschinengewehr'] >= 10 && $weapon['mg42'] >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 14 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 15 && $stats['qok'] == 0 && $unit['worker'] >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 16 && $stats['qok'] == 0 && $unit['schutze'] >= 20 && $weapon['kar98'] >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 17 && $stats['qok'] == 0 && $unit['maschinengewehr'] >= 20 && $weapon['mg42'] >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 19 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 20 && $stats['qok'] == 0 && $unit['worker'] >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 21 && $stats['qok'] == 0 && $unit['schutze'] >= 40 && $weapon['kar98'] >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 22 && $stats['qok'] == 0 && $unit['maschinengewehr'] >= 40 && $weapon['mg42'] >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 23 && $stats['qok'] == 0 && $stats['cannon'] >= 1){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 24 && $stats['qok'] == 0 && $stats['wall'] >= 1){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 25 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 26 && $stats['qok'] == 0 && $unit['worker'] >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 27 && $stats['qok'] == 0 && $unit['schutze'] >= 80 && $weapon['kar98'] >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 28 && $stats['qok'] == 0 && $unit['maschinengewehr'] >= 80 && $weapon['mg42'] >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 30 && $stats['qok'] == 0 && $unit['schutze'] >= 160 && $weapon['kar98'] >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 31 && $stats['qok'] == 0 && $unit['maschinengewehr'] >= 160 && $weapon['mg42'] >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 32 && $stats['qok'] == 0 && $stats['floor'] >= 2){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	}?>
<?php
 if($user['fraction'] == 2){                // SLOVENSKO

	if ($stats['quest'] == 1 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 4 && $stats['qok'] == 0 && $unit['worker'] >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 7 && $stats['qok'] == 0 && $unit['strelec'] >= 5 && $weapon['kar98'] >= 5){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 8 && $stats['qok'] == 0 && $unit['gulometcik'] >= 5 && $weapon['mg42'] >= 5){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 10 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 11 && $stats['qok'] == 0 && $unit['worker'] >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 12 && $stats['qok'] == 0 && $unit['strelec'] >= 10 && $weapon['kar98'] >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 13 && $stats['qok'] == 0 && $unit['gulometcik'] >= 10 && $weapon['mg42'] >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 14 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 15 && $stats['qok'] == 0 && $unit['worker'] >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 16 && $stats['qok'] == 0 && $unit['strelec'] >= 20 && $weapon['kar98'] >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 17 && $stats['qok'] == 0 && $unit['gulometcik'] >= 20 && $weapon['mg42'] >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 19 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 20 && $stats['qok'] == 0 && $unit['worker'] >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 21 && $stats['qok'] == 0 && $unit['strelec'] >= 40 && $weapon['kar98'] >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 22 && $stats['qok'] == 0 && $unit['gulometcik'] >= 40 && $weapon['mg42'] >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 23 && $stats['qok'] == 0 && $stats['cannon'] >= 1){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 24 && $stats['qok'] == 0 && $stats['wall'] >= 1){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 25 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 26 && $stats['qok'] == 0 && $unit['worker'] >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 27 && $stats['qok'] == 0 && $unit['strelec'] >= 80 && $weapon['kar98'] >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 28 && $stats['qok'] == 0 && $unit['gulometcik'] >= 80 && $weapon['mg42'] >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 30 && $stats['qok'] == 0 && $unit['strelec'] >= 160 && $weapon['kar98'] >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 31 && $stats['qok'] == 0 && $unit['gulometcik'] >= 160 && $weapon['mg42'] >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 32 && $stats['qok'] == 0 && $stats['floor'] >= 2){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
}?>
<?php
 if($user['fraction'] == 3){                // ZSSR

if ($stats['quest'] == 1 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 4 && $stats['qok'] == 0 && $unit['worker'] >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 7 && $stats['qok'] == 0 && $unit['strelets'] >= 5 && $weapon['mosinnagant'] >= 5){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 8 && $stats['qok'] == 0 && $unit['pistoleti'] >= 5 && $weapon['dp27'] >= 5){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 10 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 11 && $stats['qok'] == 0 && $unit['worker'] >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 12 && $stats['qok'] == 0 && $unit['strelets'] >= 10 && $weapon['mosinnagant'] >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 13 && $stats['qok'] == 0 && $unit['pistoleti'] >= 10 && $weapon['dp27'] >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 14 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 15 && $stats['qok'] == 0 && $unit['worker'] >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 16 && $stats['qok'] == 0 && $unit['strelets'] >= 20 && $weapon['mosinnagant'] >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 17 && $stats['qok'] == 0 && $unit['pistoleti'] >= 20 && $weapon['dp27'] >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 19 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 20 && $stats['qok'] == 0 && $unit['worker'] >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 21 && $stats['qok'] == 0 && $unit['strelets'] >= 40 && $weapon['mosinnagant'] >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 22 && $stats['qok'] == 0 && $unit['pistoleti'] >= 40 && $weapon['dp27'] >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 23 && $stats['qok'] == 0 && $stats['cannon'] >= 1){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 24 && $stats['qok'] == 0 && $stats['wall'] >= 1){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 25 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 26 && $stats['qok'] == 0 && $unit['worker'] >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 27 && $stats['qok'] == 0 && $unit['strelets'] >= 80 && $weapon['mosinnagant'] >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 28 && $stats['qok'] == 0 && $unit['pistoleti'] >= 80 && $weapon['dp27'] >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 30 && $stats['qok'] == 0 && $unit['strelets'] >= 160 && $weapon['mosinnagant'] >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 31 && $stats['qok'] == 0 && $unit['pistoleti'] >= 160 && $weapon['dp27'] >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 32 && $stats['qok'] == 0 && $stats['floor'] >= 2){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	}?>
<?php
 if($user['fraction'] == 4){                // TALIANSKO

	if ($stats['quest'] == 1 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 4 && $stats['qok'] == 0 && $unit['worker'] >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 7 && $stats['qok'] == 0 && $unit['tiratore'] >= 5 && $weapon['carcano'] >= 5){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 8 && $stats['qok'] == 0 && $unit['artigliere'] >= 5 && $weapon['breda'] >= 5){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 10 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 11 && $stats['qok'] == 0 && $unit['worker'] >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 12 && $stats['qok'] == 0 && $unit['tiratore'] >= 10 && $weapon['carcano'] >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 13 && $stats['qok'] == 0 && $unit['artigliere'] >= 10 && $weapon['breda'] >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 14 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 15 && $stats['qok'] == 0 && $unit['worker'] >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 16 && $stats['qok'] == 0 && $unit['tiratore'] >= 20 && $weapon['carcano'] >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 17 && $stats['qok'] == 0 && $unit['artigliere'] >= 20 && $weapon['breda'] >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 19 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 20 && $stats['qok'] == 0 && $unit['worker'] >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 21 && $stats['qok'] == 0 && $unit['tiratore'] >= 40 && $weapon['carcano'] >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 22 && $stats['qok'] == 0 && $unit['artigliere'] >= 40 && $weapon['breda'] >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 23 && $stats['qok'] == 0 && $stats['cannon'] >= 1){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 24 && $stats['qok'] == 0 && $stats['wall'] >= 1){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 25 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 26 && $stats['qok'] == 0 && $unit['worker'] >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 27 && $stats['qok'] == 0 && $unit['tiratore'] >= 80 && $weapon['carcano'] >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 28 && $stats['qok'] == 0 && $unit['artigliere'] >= 80 && $weapon['breda'] >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 30 && $stats['qok'] == 0 && $unit['tiratore'] >= 160 && $weapon['carcano'] >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 31 && $stats['qok'] == 0 && $unit['artigliere'] >= 160 && $weapon['breda'] >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 32 && $stats['qok'] == 0 && $stats['floor'] >= 2){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	}?>
<?php
 if($user['fraction'] == 5){                // BRITI

	if ($stats['quest'] == 1 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 4 && $stats['qok'] == 0 && $unit['worker'] >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 7 && $stats['qok'] == 0 && $unit['enfieldman'] >= 5 && $weapon['enfield'] >= 5){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 8 && $stats['qok'] == 0 && $unit['gunner'] >= 5 && $weapon['bren'] >= 5){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 10 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 11 && $stats['qok'] == 0 && $unit['worker'] >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 12 && $stats['qok'] == 0 && $unit['enfieldman'] >= 10 && $weapon['enfield'] >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 13 && $stats['qok'] == 0 && $unit['gunner'] >= 10 && $weapon['bren'] >= 10){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 14 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 15 && $stats['qok'] == 0 && $unit['worker'] >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 16 && $stats['qok'] == 0 && $unit['enfieldman'] >= 20 && $weapon['enfield'] >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 17 && $stats['qok'] == 0 && $unit['gunner'] >= 20 && $weapon['bren'] >= 20){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 19 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 20 && $stats['qok'] == 0 && $unit['worker'] >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 21 && $stats['qok'] == 0 && $unit['enfieldman'] >= 40 && $weapon['enfield'] >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 22 && $stats['qok'] == 0 && $unit['gunner'] >= 40 && $weapon['bren'] >= 40){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 23 && $stats['qok'] == 0 && $stats['cannon'] >= 1){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 24 && $stats['qok'] == 0 && $stats['wall'] >= 1){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 25 && $stats['qok'] == 0 && ($unit['farmer'] + $unit['tfarmer']) >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 26 && $stats['qok'] == 0 && $unit['worker'] >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 27 && $stats['qok'] == 0 && $unit['enfieldman'] >= 80 && $weapon['enfield'] >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 28 && $stats['qok'] == 0 && $unit['gunner'] >= 80 && $weapon['bren'] >= 80){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 30 && $stats['qok'] == 0 && $unit['enfieldman'] >= 160 && $weapon['enfield'] >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 31 && $stats['qok'] == 0 && $unit['gunner'] >= 160 && $weapon['bren'] >= 160){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	if ($stats['quest'] == 32 && $stats['qok'] == 0 && $stats['floor'] >= 2){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
	}
  

if(!isset($_SESSION['uid'])){
	if($_SERVER['QUERY_STRING'] != ""){
		$id_get = mysqli_query($con,"SELECT `id` FROM `user` WHERE `code`='".$_SERVER['QUERY_STRING']."'") or die(mysqli_error($con));
		$id = mysqli_fetch_assoc($id_get);
		if(mysqli_num_rows($id_get) == 0){
			echo "Nesprávny kód!";
		}else{
			$activated = mysqli_query($con,"UPDATE `user` SET `activated`='1' WHERE `id`='".$id['id']."'") or die(mysqli_error($con));
			echo "Účet bol aktivovaný!";
		}
	}else{
		echo "Musíš byť prihlásený!";
	}
}else{  


	$rp = 1;
	if(isset($_POST['farmer'])){
		if($stats['battery'] >= 5 && $timer['ftime'] == 0 && $unit['farmer'] > 0 | $unit['tfarmer'] > 0 | $unit['fisherman'] > 0){
			output("Farmári sa pustili do práce!");
			$rp = 0;
			$fzarobok = 0;
			$ftime = time();
			$working['fyes'] = $ftime;
			$working['fwork'] = $unit['farmer'];
			$working['tfwork'] = $unit['tfarmer'];
			$working['fishermanwork'] = $unit['fisherman'];
			$stats['battery'] -= 5;
			$stats['rank'] += 2;
			$timer['ftime'] = 1;
			$update_working = mysqli_query($con,"UPDATE `working` SET `fyes`='".$working['fyes']."',`fwork`='".$working['fwork']."',`tfwork`='".$working['tfwork']."',`fishermanwork`='".$working['fishermanwork']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
			$update_stats = mysqli_query($con,"UPDATE `stats` SET `battery`='".$stats['battery']."',`rank`='".$stats['rank']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
			$update_timer = mysqli_query($con,"UPDATE `timer` SET `ftime`='".$timer['ftime']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
			if ($stats['quest'] == 2 && $stats['qok'] == 0){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
		}elseif((time() - $working['fyes']) >= 300 && $timer['ftime'] == 1){
			$fzarobok = round(((10 * pow($working['fwork'],0.5)) + round(100 * pow($working['tfwork'],0.5)) + round(30 * pow($working['fishermanwork'],0.5))) / 100 * (100 + $guild['level']));
			output("Získal si ".$fzarobok." jedla!");
			$rp = 0;
			$ftime = 0;
			$working['fyes'] = $ftime;
			$working['fwork'] = 0;
			$working['tfwork'] = 0;
			$working['fishermanwork'] = 0;
			$stats['food'] += $fzarobok;
			$stats['rank'] += 1;
			$fzarobok = 0;
			$timer['ftime'] = 0;
			$update_working = mysqli_query($con,"UPDATE `working` SET `fyes`='".$working['fyes']."',`fwork`='".$working['fwork']."',`tfwork`='".$working['tfwork']."',`fishermanwork`='".$working['fishermanwork']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
			$update_stats = mysqli_query($con,"UPDATE `stats` SET `food`='".$stats['food']."',`rank`='".$stats['rank']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
			$update_timer = mysqli_query($con,"UPDATE `timer` SET `ftime`='".$timer['ftime']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
			if ($stats['quest'] == 3 && $stats['qok'] == 0){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
		}elseif($unit['farmer'] == 0 && $unit['tfarmer'] == 0 && $timer['ftime'] == 0){
			output("Nemáš žiadneho farmára!");
			$rp = 0;
		}elseif($stats['battery'] < 5 && $timer['ftime'] == 0){
			output("Nemáš dostatok baterky!");
			$rp = 0;
		}else{
			$zostava = (300 - (time() - $working['fyes']));
			output("Musíš počkať ".$zostava." sekúnd.");
			$rp = 0;
		}
	}
	if(isset($_POST['miner'])){
		if($stats['battery'] >= 5 && $timer['mtime'] == 0 && $unit['worker'] > 0){
			output("Baníci sa pustili do práce!");
			$rp = 0;
			$mzarobok = 0;
			$mtime = time();
			$working['myes'] = $mtime;
			$working['mwork'] = $unit['worker'];
			$stats['battery'] -= 5;
			$stats['rank'] += 2;
			$timer['mtime'] = 1;
			$update_working = mysqli_query($con,"UPDATE `working` SET `myes`='".$working['myes']."',`mwork`='".$working['mwork']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
			$update_stats = mysqli_query($con,"UPDATE `stats` SET `battery`='".$stats['battery']."',`rank`='".$stats['rank']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
			$update_timer = mysqli_query($con,"UPDATE `timer` SET `mtime`='".$timer['mtime']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
			if ($stats['quest'] == 5 && $stats['qok'] == 0){ $stats['qok'] = 1; $update_stats = mysqli_query($con,"UPDATE `stats` SET `qok`='".$stats['qok']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con)); }
		}elseif((time() - $working['myes']) >= 300 && $timer['mtime'] == 1){
			$mzarobok = round((100 * pow($working['mwork'],0.5)) / 100 * (100 + $guild['level']));
			output("Získal si".$mzarobok." zlata!");
			$rp = 0;
			$mtime = 0;
			$working['myes'] = $mtime;
			$working['mwork'] = 0;
			$stats['gold'] += $mzarobok;
			$stats['rank'] += 1;
			$mzarobok = 0;
			$timer['mtime'] = 0;
			$update_working = mysqli_query($con,"UPDATE `working` SET `myes`='".$working['myes']."',`mwork`='".$working['mwork']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
			$update_stats = mysqli_query($con,"UPDATE `stats` SET `gold`='".$stats['gold']."',`rank`='".$stats['rank']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
			$update_timer = mysqli_query($con,"UPDATE `timer` SET `mtime`='".$timer['mtime']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
			if ($stats['quest'
Nahlásit jako SPAM
IP: 84.16.53.–
Kit+15
Guru
6. 9. 2016   #2
-
0
-

#1 Jozef
Pokud máš problémy s ovladačem MySQLi, přejdi rovnou na PDO, se kterým se pracuje mnohem pohodlněji.

Nedefinovaný index znamená, že se v nějakém poli odkazuješ na něco, co tam není.

Nahlásit jako SPAM
IP: 194.228.13.–
Komentáře označují místa, kde programátor udělal chybu nebo něco nedodělal.
Jozef
~ Anonymní uživatel
61 příspěvků
6. 9. 2016   #3
-
0
-

#2 Kit
Len ja tomu nerozumiem, nemám to definované?  Malo by sa to odkázať na databázu, záložku stats a tam nájsť napríklad hodnotu battery pri ID prihlaseného hráča..  

Nahlásit jako SPAM
IP: 84.16.53.–
Kit+15
Guru
6. 9. 2016   #4
-
0
-

#3 Jozef
Ten zdroják se nedá číst - má příliš dlouhé řádky. Jak ti v tom mám najít chybu, když ji sám nevidíš a ani nejsi schopen opsat chybovou hlášku?

Nahlásit jako SPAM
IP: 2a00:1028:83a0:37a6:f0bc:...–
Komentáře označují místa, kde programátor udělal chybu nebo něco nedodělal.
Jozef
~ Anonymní uživatel
61 příspěvků
6. 9. 2016   #5
-
0
-

#4 Kit
Prišiel som na chybovú hlášku.. tie undefined indexy sú spôsobené chybou v safe.php
Undefined variable: _SESSION 
Ešte tu teda raz hodím ten script z safe.php viete mi poradiť?  


<?php  
include ('functions.php'); 
$stats_get = mysqli_query($con,"SELECT * FROM `stats` WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
$stats = mysqli_fetch_assoc($stats_get);

$unit_get = mysqli_query($con,"SELECT * FROM `unit` WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
$unit = mysqli_fetch_assoc($unit_get);

$user_get = mysqli_query($con,"SELECT * FROM `user` WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
$user = mysqli_fetch_assoc($user_get);

$weapon_get = mysqli_query($con,"SELECT * FROM `weapon` WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
$weapon = mysqli_fetch_assoc($weapon_get);

$working_get = mysqli_query($con,"SELECT * FROM `working` WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
$working = mysqli_fetch_assoc($working_get);

$timer_get = mysqli_query($con,"SELECT * FROM `timer` WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
$timer = mysqli_fetch_assoc($timer_get);

$daily_get = mysqli_query($con,"SELECT * FROM `daily` WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
$daily = mysqli_fetch_assoc($daily_get);

$ranking_get = mysqli_query($con,"SELECT * FROM `ranking` WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
$ranking = mysqli_fetch_assoc($ranking_get);

$id_get = mysqli_query($con,"SELECT MAX(`id`) FROM `ranking`") or die(mysqli_error($con));
$id = mysqli_fetch_assoc($id_get);

$chat_get = mysqli_query($con,"SELECT * FROM `chat`") or die(mysqli_error($con));
$chat = mysqli_fetch_assoc($chat_get);

$mailbox_get = mysqli_query($con,"SELECT * FROM `mailbox` WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
$mailbox = mysqli_fetch_assoc($mailbox_get);

$mayor_get = mysqli_query($con,"SELECT * FROM `stats` WHERE `id`='".$_SERVER['QUERY_STRING']."'") or die(mysqli_error($con));
$mayor = mysqli_fetch_assoc($mayor_get);

$guild_get = mysqli_query($con,"SELECT * FROM `guild` WHERE `id`='".$stats['guild']."'") or die(mysqli_error($con));
$guild = mysqli_fetch_assoc($guild_get);

$g_get = mysqli_query($con,"SELECT * FROM `guild` WHERE `id`='".$_SERVER['QUERY_STRING']."'") or die(mysqli_error($con));
$g = mysqli_fetch_assoc($g_get);

if(isset($_POST['attack1'])){
	$attacked_user_get = mysqli_query($con,"SELECT * FROM `user` WHERE `id`='".$_POST['attack1']."'") or die(mysqli_error($con));
	$attacked_user = mysqli_fetch_assoc($attacked_user_get);
}

$map_get = mysqli_query($con,"SELECT * FROM `map` WHERE `id`='1'") or die(mysql_error());
$map = mysqli_fetch_assoc($map_get);

?>
Nahlásit jako SPAM
IP: 84.16.53.–
Jozef
~ Anonymní uživatel
61 příspěvků
6. 9. 2016   #6
-
0
-

Upravil som to, no pri tom by som mal získať stats a nefunguje to... :( sakra..

Nahlásit jako SPAM
IP: 84.16.53.–
Kit+15
Guru
6. 9. 2016   #7
-
0
-

#5 Jozef
Zřejmě nemáš nastartované sessions.

Proč tam těch SELECTů máš tolik, když to můžeš udělat jedním?

Nahlásit jako SPAM
IP: 2a00:1028:83a0:37a6:f0bc:...–
Komentáře označují místa, kde programátor udělal chybu nebo něco nedodělal.
Jozef
~ Anonymní uživatel
61 příspěvků
6. 9. 2016   #8
-
0
-

#7 Kit
už som to opravil.. len tam mám stále undefined indexy... battery a floor a ostatné, ktoré tam potrebuje.. nevedel by si mi nato mrknúť cez temviewer prosím? Ak by si si našiel chvíľku. Jedným? To som nikdy neskúšal.. Som začiatočník.

Nahlásit jako SPAM
IP: 84.16.53.–
peter
~ Anonymní uživatel
3981 příspěvků
6. 9. 2016   #9
-
0
-

Kdyby se mne nekdo ptal, tak budu tvrdit, ze jsem prispevek #1 nevidel :)
Treba jako BRITI, v kazdem radku je stejny sql dotaz. V kazdem radku musi byt splneno qok=0. $stats['quest'] se da napsat jako switch. Cele by se to zjednodusilo asi na 1/10 kodu :)
 

$update = false;
if($stats['qok'] == 0 && $user['fraction'] == 5){  // BRITI // nema smysl porovnavat brity, kdyz mas qok=1 a tim odpadne fura porovnavani, rychlejsi program
switch ($stats['quest']) {
case 1: $update = (bool)($unit['farmer'] + $unit['tfarmer']) >= 10); break;
case 2: $update = (bool)($unit['worker'] >= 10); break;
}
if ($update) {$stats['qok'] = 1; ...}
}


2. chybove hlasky se daji zobrazit povolenim error_reporting, priklady viz php.net. Osobne pouzivam nastaveni e_ALL. V chybove hlasce je cislo radku, kde nastal problem.
Pokud mas zastaraly php kod nebo znalosti nekde ze skoly, tam pouzivali nastaveni php pro deti. Na teto urovni nelze provozovat servery, takze admini pouzivaji nastaveni, kde je treba hlidat definovani promennych a podobne. Nelze pracovat s $_SESSION['neco'], kdyz nemas zapnute session_start() a nemas 'neco' ulozene. Cili, kdyz neexistuje, tak to nelze porovnavat s jinym cislem. Takovy program je pak snadne hacknout :)

Nahlásit jako SPAM
IP: 2001:718:2601:26c:a508:42...–
peter
~ Anonymní uživatel
3981 příspěvků
6. 9. 2016   #10
-
0
-

3. Nenabizel bych pristup Teamviewerem cizi osobe :) Muze ti tam nasadit program, ktery ti vyrabuje pc a jeste z nej udela spam robota :)

4. Ty tam muzes pridat kod, ktery overi, zda tam neco je a kdyz ne, tak tam neco da. 

$keys = array('battery','floor'); // seznam vsech sloupcu
foreach ($keys as $key) {!isset($_SESSION[$key]) {$_SESSION[$key]='';}}
Nahlásit jako SPAM
IP: 2001:718:2601:26c:a508:42...–
peter
~ Anonymní uživatel
3981 příspěvků
6. 9. 2016   #11
-
0
-

3b. Nehlede na moznost nahrat vir, ktery vykrade prihlasovaci udaje k bankovnimu uctu pro e-banku a jine krasne veci :) Fakt mne udivuje naivni pristup uzivatelu :)

Nahlásit jako SPAM
IP: 2001:718:2601:26c:a508:42...–
Kit+15
Guru
6. 9. 2016   #12
-
0
-

#8 Jozef
Nebudu se někomu zadarmo hrabat v počítači. Mohu jen poradit.

Psal jsem, že MySQLi nepoužívám a ani používat nebudu. Nehodlám se již zabývat historickými ovladači.

Na špagety nejsem zvědav, protože se v nich dá nasekat spousta chyb, které se obtížně hledají. Programuji objektově.

Z toho, co vidím, je spousta SELECTů zcela zbytečných a zdržujících Mají smysl pouze při zobrazování hodnot. Při modifikaci dat (UPDATE) smysl zpravidla nemají.

Nahlásit jako SPAM
IP: 2a00:1028:83a0:37a6:f0bc:...–
Komentáře označují místa, kde programátor udělal chybu nebo něco nedodělal.
Kit+15
Guru
6. 9. 2016   #13
-
0
-

#8 Jozef
Když se dívám na práci s $user['fraction'], tak tohle vůbec nepatří do aplikace, ale do databáze. Budeš pak moct přidávat další státy a schopnosti, aniž bys modifikoval aplikaci. Můžeš tak mít jednu aplikaci pro více světů s rozdímými vlastnostmi. Navíc se ti brutálně zjednoduší algoritmy.

Nahlásit jako SPAM
IP: 194.228.13.–
Komentáře označují místa, kde programátor udělal chybu nebo něco nedodělal.
peter
~ Anonymní uživatel
3981 příspěvků
6. 9. 2016   #14
-
0
-

5. Jo, k tem selectum... 

$user_get = mysqli_query($con,"SELECT * FROM `user` WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
$user = mysqli_fetch_assoc($user_get);

$weapon_get = mysqli_query($con,"SELECT * FROM `weapon` WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
$weapon = mysqli_fetch_assoc($weapon_get);

Hele, tak sql jsou tabulky a on umi propojit tabulky a vyrobit jedinou. Dotaz by mel jit zapsat viceradkove. A tusim neni treba uvadet pripojeni $con, pokud nepracujes s vice nez jednim pripojenim. Hlavne si ty dotazy muzes seskladat do pole a pak to cyklem vytahnout. Nemusis pokazde psat formuli mysqli_query, kdyz nepotrebujes data z predchoziho dotazu.

$query = "
SELECT 
  a.`id` AS `user_id`,
  a.`name` AS `user_name`,
  b.`name` AS `weapon_name`
FROM
  `user` a
  LEFT JOIN `weapon` b ON b.`id`=a.`id` -- pripojis dalsi tabulku podle idcek
WHERE
  a.`id`='".$_SESSION['uid']
;
$result = mysqli_query($query) or die(mysqli_error());
$data = mysqli_fetch_assoc($result);
var_dump($data);
Nahlásit jako SPAM
IP: 2001:718:2601:26c:a508:42...–
peter
~ Anonymní uživatel
3981 příspěvků
6. 9. 2016   #15
-
0
-

ups, samozrejme u dotazu na konci uzavrit ten apostrof :) Ale stejne to tak nepisu, pouzivam nahrazovani neco jako str_replace, takze pak apostrof nezapominam
a.`id`='".$_SESSION['uid']."'
";
a.`id`='{1}'
";

Nahlásit jako SPAM
IP: 2001:718:2601:26c:a508:42...–
Kit+15
Guru
6. 9. 2016   #16
-
0
-

#15 peter
Nejlépe je ty apostrofy tam vůbec nedávat a místo toho používat prepared statements. I ty SQL dotazy pak vypadají mnohem lépe.

Nahlásit jako SPAM
IP: 194.228.13.–
Komentáře označují místa, kde programátor udělal chybu nebo něco nedodělal.
peter
~ Anonymní uživatel
3981 příspěvků
7. 9. 2016   #17
-
0
-

Peter tve poznamky o Prepared statement a PDO ignoruje, protoze to nema poradny manual a neumi to pak pouzit tak, jak potrebuje :)

Nahlásit jako SPAM
IP: 2001:718:2601:26c:a178:53...–
peter
~ Anonymní uživatel
3981 příspěvků
7. 9. 2016   #18
-
0
-

On totiz casto nema jednoduche dotazy typu dopln 2-3 promenne, ale musi dotazy skladat na zaklade nekolika podminek, kde se tam treba 3 radky nevyskytuji a nebo jsou v jinem poradi.

Nahlásit jako SPAM
IP: 2001:718:2601:26c:a178:53...–
Zjistit počet nových příspěvků

Přidej příspěvek

Toto téma je starší jak čtvrt roku – přidej svůj příspěvek jen tehdy, máš-li k tématu opravdu co říct!

Ano, opravdu chci reagovat → zobrazí formulář pro přidání příspěvku

×Vložení zdrojáku

×Vložení obrázku

Vložit URL obrázku Vybrat obrázek na disku
Vlož URL adresu obrázku:
Klikni a vyber obrázek z počítače:

×Vložení videa

Aktuálně jsou podporována videa ze serverů YouTube, Vimeo a Dailymotion.
×
 
Podporujeme Gravatara.
Zadej URL adresu Avatara (40 x 40 px) nebo emailovou adresu pro použití Gravatara.
Email nikam neukládáme, po získání Gravatara je zahozen.
-
Pravidla pro psaní příspěvků, používej diakritiku. ENTER pro nový odstavec, SHIFT + ENTER pro nový řádek.
Sledovat nové příspěvky (pouze pro přihlášené)
Sleduj vlákno a v případě přidání nového příspěvku o tom budeš vědět mezi prvními.
Reaguješ na příspěvek:

Uživatelé prohlížející si toto vlákno

Uživatelé on-line: 0 registrovaných, 4 hosté

 

Hostujeme u Českého hostingu       ISSN 1801-1586       ⇡ Nahoru Webtea.cz logo © 20032024 Programujte.com
Zasadilo a pěstuje Webtea.cz, šéfredaktor Lukáš Churý