Anonymní profil Arduino – Programujte.com
 x   TIP: Přetáhni ikonu na hlavní panel pro připnutí webu

Anonymní profil Arduino – Programujte.comAnonymní profil Arduino – Programujte.com

 

Příspěvky odeslané z IP adresy 84.16.53.–

Johny
Webové servery (Apache, IIS...), .htaccess › HTTPS na HTTP cez .htaccess…
5. 5. 2017   #215899

Ahojte, mám webhosting php5.sk a mám tam doménu tretieho radu. Je to freehosting a vyhovovalo mi to, spravil som si tam meteostanicu, kde mi Arduino (mikroprocesor) odosiela hodnoty z teplomerov do mysql databázy + sa mi to vykresľuje do grafov. Problém je v tom, že pred pár dňami dali na všetky freehostingy HTTPS protokol, ktorý Arduino nepozná, resp nemá naň napísanú knižnicu. Vedeli by ste mi poradiť ako to vypnúť? Písal som na support, že v čom je problém a odpoveď bola, že ho majú na všetky služby (stránky). Bez HTTP nie som schopný poslať hodnoty na web, dostávam error 302. Pri skúške prepísať to manuálne na HTTP v .htaccess dostávam odpoveď: too many redirects alebo error 500. 
Viete mi poradiť, ako to vyriešiť? Bol by som vám veľmi vďačný.

Martin
C / C++ › Funkcia for - oprava dvomi s…
4. 5. 2017   #215873

Ahoj, venujeme sa v škole téme inšpekcia kódu. Mám tento útržok kódu. Dá sa opraviť dvomi spôsobmi však? Tu je predpis: for (int y=1; y<4; y++){}
Môžem zmeniť y=0; alebo druhá možnosť y<5 v prípade, že nechám int y=1 správne? Bude kód fungovať rovnako?

Johny
PHP › Presmerovanie v prípade ručn…
16. 4. 2017   #215622

#2 Kit
čo by si mi teda odporúčil? Skúšal som v .htaccess presmerovanie cez HTTP 301, ale nefunguje to spoľahlivo. 

Johny
PHP › Presmerovanie v prípade ručn…
14. 4. 2017   #215596

Ahoj, chcem sa opýtať, či niečo podobné existuje, alebo sa využíva, prípadne mi tu viete napísať príklad? Mám stránku, kde je napríklad prihlásenie, alebo robí sa tam akcia a na všetko využívam metódu POST v formulároch, avšak samozrejme je možné za napríklad stránku index.php dopísať ? a aj nejaký link napr ?username= niečo.. dá sa nejako cez $_SERVER['QUERY_STRING']? a či to neovplyvní POST metódu, alebo je to viazané iba na GET, ak nieto niečo dopíše do linku.

Ďakujem za vaše odpovede

Anton
C / C++ › Čo má byť v zátvorkách? nejd…
10. 3. 2017   #215212

Ahoj hoši, viete mi pomôcť, ako skompilovať tento projekt? Projekt ma viacero súborov no ide mi o k.c a k.h a k.o Pri zadaní make k mi vyskočia chybové hlášky 

  1. k.c:15:6: error: conflicting types for ‘render’
    In file included from k.c:3:0:
    k.h:19:6: note: previous declaration of ‘render’ was here
    k.c:23:6: error: conflicting types for ‘is_move_possible’
    In file included from k.c:3:0:
    k.h:40:6: note: previous declaration of ‘is_move_possible’ was here
    k.c:26:6: error: conflicting types for ‘is_game_won’
    In file included from k.c:3:0:
    k.h:48:6: note: previous declaration of ‘is_game_won’ was here
    k.c: In function ‘is_game_won’:
    k.c:28:1: error: control reaches end of non-void function [-Werror=return-type]
    k.c: In function ‘is_move_possible’:
    k.c:25:1: error: control reaches end of non-void function [-Werror=return-type]
    k.c: In function ‘update’:
    k.c:22:1: error: control reaches end of non-void function [-Werror=return-type]
    cc1: all warnings being treated as errors

Problém je v súbore k.c ibaže neviem ako to skompilovať. Neviem čo má byť v zátvorkách, môžete mi to prosím zmeniť? Zvýrazním to tučným písmom to, čo treba zmeniť.
 

K.c

#include <stdio.h>
#include <stdlib.h>
#include "k.h"
void add_random_tile(struct game *game){
    int row, col;
    // find random, but empty tile
    do{
        row = rand() % 4;
        col = rand() % 4;
    }while(game->board[row][col] != ' ');
    // place to the random position 'A' or 'B' tile
    int tile = 'A' + (rand() % 2);
    game->board[row][col] = tile;
}
void render(struct game *game)
{

}
bool update(struct game *game, int dy, int dx)
{
     
}
bool is_move_possible(struct game *game){ 

}
bool is_game_won(struct game *game){

}

K.h

#include <stdbool.h>
struct game {
   
    char board[4][4];

    int score;
};

 void add_random_tile(struct game *game);

void render(const struct game game);

 bool update(struct game *game, int dy, int dx);

bool is_move_possible(const struct game game);

bool is_game_won(const struct game game);

Funkcia main bude obsiahnutá v súbore main.c

Makefile
 

#variables
CC = gcc
CFLAGS = -std=c11 -Wall -Werror
LDLIBS = -lm
OUTPUT = game

#targets
all: $(OUTPUT)

$(OUTPUT): hof.o k.o main.o
        $(CC) $(CFLAGS) hof.o k.o main.o $(LDLIBS) -o $(OUTPUT)

main.o: main.c
        $(CC) $(CFLAGS) main.c -c $(LDLIBS) -o main.o

k.o: k.c
        $(CC) $(CFLAGS) k.c -c $(LDLIBS) -o k.o

hof.o: hof.c
        $(CC) $(CFLAGS) hof.c -c $(LDLIBS) -o hof.o

clean:
        rm -rf $(OUTPUT)
        rm -rf hof.o
        rm -rf k.o
        rm -rf main.o
Martin
PHP › PHP script má závisieť od me…
9. 2. 2017   #214843

#8 gna
tak mi to prosím uprav :)

Martin
C / C++ › Nastavenia kompileru, etc.
9. 2. 2017   #214840

Musel som doinštalovať compiler ale bol to compiler nejakej tretej strany a už to funguje. Tento problém bol ale až pri troch IDE-čkach, ktoré som testoval. Nainštalované boli, tak tomu nechápem no som rád, že to už facha.

Martin
C / C++ › Nastavenia kompileru, etc.
8. 2. 2017   #214838

Ahoj, stiahol som si CodeLite, nakoľko budem programovať v škole v C jazyku. Doteraz sme programovali cez shell, kde bol kompilátor na internete, vramci školského servera. Ale samozrejme chcem nejaké offline riešenie, stiahol som si Codelite a je tu problém. Skúšal som mnoho možností nastavenia, je tam možnosť zvolenia kompilátora:
Zvolím si project template --> Executable pre Console:

  • gcc
  • g++
  • clang++
  • clang
  • MSVC
  • cobra
  • Cmake Executable

 Build i kompilácia sa vytvorí bez problému.
Keď si zvolím z vyššie menovaných, hodí ma to na výber troch položiek:

Je tu znova compiler: 

  • gnu c++
  • clang++
  • clang
  • gnu gcc
  • VC++
  • cobra

Debugger:

  • GNU gdb debugger
  • LLDB debugger

Build System:

  • Cmake
  • Default
  • GNU makefile onestep build
  • NMakefile for MSVC toolset 

Neviem čo zvoliť, poťukal som toho mnoho, ale so všetkými možnosťami, čo som skúšal mám túto skúsenosť: Dám urobiť build a spustiť a otvorí mi to iba príkazový riadok s hláškou, že kliknite na klávesu a program sa zavrie. Ale nad tým nevypíše hello world. Na hello world používam tento main.c súbor:

 Project je podpriečinkom workspacu. a project má ďalší priečinok src kde je tento main.c subor

#include <stdio.h>

int main(int argc, char **argv)
{
	printf("hello world\n");
	return 0;
}
Martin
PHP › PHP script má závisieť od me…
8. 2. 2017   #214836

#6 peter 

 <?php  
$summer1 = date(1.5);
$summer2 = date(30.9);
$winter1 = date(1.10);
$winter2 = date(30.4);
$today = date("j.n");
if($summer1 <= $today && $today <= $summer2){
echo 'Leto';
}
else{
echo 'Zima';
}
?>

Vypisuje mi to Leto.. ale prečo? :(

Martin
PHP › PHP script má závisieť od me…
8. 2. 2017   #214829

Mám error  Parse error: syntax error, unexpected '<'  Ako mám upraviť tú značku menší?

 <?php  
$summer1 = date(1.5);
$summer2 = date(30.9);
$winter1 = date(1.5);
$winter2 = date(30.4);
$today = date("j.n");
if($summer1 < $today < $summer2){
echo 'Leto';
}
else{
echo 'Zima';
}
?>
Martin
PHP › PHP script má závisieť od me…
7. 2. 2017   #214816

Ahoj, riešim predpoveď počasia v php scripte. Rôzne sú závislosti v zimnom období a iné v letnom. To znamená, že potrebujem 2 PHP scripty, jeden pre leto, druhý pre zimu. Neviem ale ako to urobiť. Môžete mi prosím napísať jednoducho pod čo dať script jeden a druhý? Potrebujem: ZIMA --> Október - Apríl a Leto --> Máj - September. Potrebujem to napríklad od 1.5 do 30.9. Do posledného dňa v mesiaci. Ďakujem za pomoc.

Martin
JavaScript, AJAX, jQuery › CanvasJs - dva grafy
7. 2. 2017   #214806

Opravil som to! Ďakujem za pomoc

Martin
JavaScript, AJAX, jQuery › CanvasJs - dva grafy
7. 2. 2017   #214805

 

#2 peter
http://arduino.php5.sk/vyvoj.php

Nefunguje to. Je to na tej stránke, píše chybu v console: Unexpected token... tieto grafy sú ''Trial'' môže byť problém, že môžem použiť maximálne 1 graf? Neviem už kde by mohla byť chyba. Nahral som na stránku .js súbor, takže si to môžeš mrknut

Martin
JavaScript, AJAX, jQuery › CanvasJs - dva grafy
7. 2. 2017   #214802

Ahojte, využil som z CanvasJs tento graf: http://canvasjs.com/editor/?id=http://canvasjs.com/example/gallery/line/site_traffic/

Mám vytvorené 2 JS súbory s rozdielnymi chartami, teda Chart1 a Chart2 a aj rôznymi Containermi chartDayPresContainer a chartDayTempContainer. V jednom charte vypisujem graf vývoja teplôt za deň a v druhom vypisujem vývoj tlaku počas dňa. Avšak tieto grafy sa vypisujú v HTML (PHP) cez div, kde jeho id je názov containera grafu. Ak mám includnutý jeden .js súbor a jeden graf vypisujem, ide to ok. Ak chcem vypísať 2 grafy a includujem 2 subory je problém a nejde to, vypíše vždy iba ten posledný.
Nič nehlási ani console v Chrome. Skúšal som ich dať na jeden .js súbor a taktiež problém. Skúšal som solutions priamo z ich stránky ale všetko doposiaľ bolo neúspešné. Vedel by mi niekto pomôcť? Skúšal som meniť chart a taktiež aj container presne tak, ako to majú na stránke.  Ešte .. vedel by mi tam niekto do toho .js kodu vpísať to, aby mi ten kód ukazoval aj čas, kedy bol ten výsledok zaznamenaný, example posielam ako obrázok?
vyvoj.php: 

</head>
<?php include("connect.php"); 
  $todaytemperaturesoutsideall = mysqli_query($con,"SELECT temperature, time FROM TempOutside WHERE date(time) = CURDATE() ORDER by time") or die(mysqli_error($con));         
    $todaytemperaturesoutsideallJs=array();                                                     
           while($row = mysqli_fetch_assoc($todaytemperaturesoutsideall)){
             $date = strtotime($row['time']);
	 $todaytemperaturesoutsideallJs[]='{ x: new Date('.date('Y,n,d,H,i', $date).'), y: '.round($row['temperature'],2).' }'; }
   $todaytemperatureslivingroomall = mysqli_query($con,"SELECT temperature, time FROM TempLivingRoom WHERE date(time) = CURDATE() ORDER by time") or die(mysqli_error($con));         
    $todaytemperatureslivingroomallJs=array();                                                     
           while($row = mysqli_fetch_assoc($todaytemperatureslivingroomall)){
             $date = strtotime($row['time']);
	 $todaytemperatureslivingroomallJs[]='{ x: new Date('.date('Y,n,d,H,i', $date).'), y: '.round($row['temperature'],2).' }'; }
   $todaytemperaturesbedroomall = mysqli_query($con,"SELECT temperature, time FROM TempBedRoom WHERE date(time) = CURDATE() ORDER by time") or die(mysqli_error($con));         
    $todaytemperaturesbedroomallJs=array();                                                     
           while($row = mysqli_fetch_assoc($todaytemperaturesbedroomall)){
             $date = strtotime($row['time']);
	 $todaytemperaturesbedroomallJs[]='{ x: new Date('.date('Y,n,d,H,i', $date).'), y: '.round($row['temperature'],2).' }'; }
   
   
   
   
    $todaypressureoutsideall = mysqli_query($con,"SELECT pressure, time FROM PressureOutside WHERE date(time) = CURDATE() ORDER by time") or die(mysqli_error($con));         
    $todaypressureoutsideallJs=array();                                                     
           while($row = mysqli_fetch_assoc($todaypressureoutsideall)){
             $date = strtotime($row['time']);
	 $todaypressureoutsideallJs[]='{ x: new Date('.date('Y,n,d,H,i', $date).'), y: '.round($row['pressure'],2).' }'; }
 
                                           

         

?>

<script>         
window.todaytemperaturesoutsideallJs = [<?= implode(',', $todaytemperaturesoutsideallJs) ?>];
window.todaytemperatureslivingroomallJs = [<?= implode(',', $todaytemperatureslivingroomallJs) ?>];
window.todaytemperaturesbedroomallJs = [<?= implode(',', $todaytemperaturesbedroomallJs) ?>];
window.todaypressureoutsideallJs = [<?= implode(',', $todaypressureoutsideallJs) ?>];
</script> 
<script src="js/vyvoj_teplot.js"></script>
<script src="js/vyvoj_tlaku.js"></script>
<script src="js/canvasjs.min.js"></script>
<script src="js/jquery.canvasjs.min.js"></script>
<body>
<ul class="topnav">
  <li><a href="index.php"><img src="img/gauge.png" alt="Aktuálne merania"></a></li>
  <li><a href="zaznamy.php"><img src="img/newspaper.png" alt="newspaper.png, 935B" title="Záznamy" height="64" width="64"></a></li>
  <li><a  href="rekordy.php"><img src="img/trophy.png" alt="trophy.png, 1,9kB" title="Rekordy" height="64" width="64"></a></li>
  <li><a class="active" href="vyvoj.php"><img src="img/chart.png" alt="chart.png, 1,2kB" title="Vývoj" height="64" width="64"></a></li>
  <li><a href="rele.php"><img src="img/switch.png" alt="switch.png, 1,9kB" title="Relé" height="64" width="64"></a></li>
   <li><a href="pristroje.php"><img src="img/settings.png" alt="settings.png, 1,5kB" title="Prístroje" height="64" width="64"></a></li>
    <li><a href="prognoza.php"><img src="img/sunny.png" alt="sunny.png, 1,2kB" title="Prognóza" height="64" width="64"></a></li>
   <li class=right><a href="kontakt.php"><img src="img/chat.png" alt="chat.png, 1,2kB" title="Kontakt" height="64" width="64"></a></li>
 </ul>                                          

   <div style="padding:0 16px;">

 <br>
<div id="chartDayTempContainer" style="height: 300px; width: 100%;"></div><br>
<div id="chartDayPresContainer" style="height: 300px; width: 100%;"></div>
  

</body>    
</html>


vyvoj_teplot.js:
 

window.onload = function () {
		var chart = new CanvasJS.Chart("chartDayTempContainer",
		{

			title:{
				text: "Vývoj teplôt chronologicky - Dnes",
				fontSize: 30
			},
                        animationEnabled: true,
			axisX:{
            
				gridColor: "Silver",
				tickColor: "silver",
        valueFormatString: "HH:mm"

			},                        
                        toolTip:{
                          shared:true
                        },
			
      theme: "theme2",
			axisY: {
				gridColor: "Silver",
				tickColor: "silver"
			},
			legend:{                               
				verticalAlign: "center",
				horizontalAlign: "right"
			},
			data: [
			{     
				type: "line",
				showInLegend: true,
				lineThickness: 2,
				name: "Von",
				markerType: "square",
				color: "red",
				dataPoints: window.todaytemperaturesoutsideallJs
			},
      {     
				type: "line",
				showInLegend: true,
				lineThickness: 2,
				name: "Obývačka",
				markerType: "square",
				color: "blue",
				dataPoints: window.todaytemperatureslivingroomallJs
			},
      {     
				type: "line",
				showInLegend: true,
				lineThickness: 2,
				name: "Spálňa",
				markerType: "square",
				color: "green",
				dataPoints: window.todaytemperaturesbedroomallJs
			},
			

			
			],
          legend:{
            cursor:"pointer",
            itemclick:function(e){
              if (typeof(e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
              	e.dataSeries.visible = false;
              }
              else{
                e.dataSeries.visible = true;
              }
              chart.render();
            }
          }
		});

chart.render(); 

  
}

vyvoj_tlaku.js:
 

window.onload = function () {
		var chart1 = new CanvasJS.Chart("chartDayPresContainer",
		{

			title:{
				text: "Vývoj tlaku chronologicky - Dnes",
				fontSize: 30
			},
                        animationEnabled: true,
			axisX:{
            
				gridColor: "Silver",
				tickColor: "silver",
        valueFormatString: "HH:mm"

			},                        
                        toolTip:{
                          shared:true
                        },
			
      theme: "theme2",
			axisY: {
				gridColor: "Silver",
				tickColor: "silver"
			},
			legend:{                               
				verticalAlign: "center",
				horizontalAlign: "right"
			},
			data: [
			{     
				type: "line",
				showInLegend: true,
				lineThickness: 2,
				name: "Von",
				markerType: "square",
				color: "red",
				dataPoints: window.todaypressureoutsideallJs
			},
     
			

			
			],
          legend:{
            cursor:"pointer",
            itemclick:function(e){
              if (typeof(e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
              	e.dataSeries.visible = false;
              }
              else{
                e.dataSeries.visible = true;
              }
              chart1.render();
            }
          }
		});

chart1.render(); 

  
}

Připojen obrázek.










Ďakujem.

Jozef
PHP › PHP switch s akciou
4. 2. 2017   #214786

#4 gna
neviem to, tak buď taký láskavý a urob mi to

Jozef
PHP › PHP switch s akciou
4. 2. 2017   #214784

#2 gna
Ano ale ako nakodujem akciu pre zmenu? Že ak kliknem nato, že sa stav prepne priamo v tom inpute?

Jozef
PHP › PHP switch s akciou
3. 2. 2017   #214777

JEDNÁ SA O SWITCH PREPÍNAČ v HTML, nie SWITCH funkcia.

Prosím o pomoc. Stiahol som si v HTML a CSS switch, ktorý je buď ON, alebo OFF. Následne s ním chcem meniť stav v .txt súbore na 0/1, bude sa s tým ovládať relé z internetu.
Stiahol som si tento switch - prepínač:
http://codepen.io/jarmie/pen/tFqJH

Chcem, aby sa mi pri spustení stránky zobrazil stav YES, ak je v .TXT súbore 1 a naopak, ak  je v tomto súbore 0 tak NO. Vedeli by ste mi pomôcť? Pri spustení je vždy stav akoby 0, začína na OFF.
Je to v podstate len label a má ON/OFF span, potreboval by som tam dosadiť tento kód:
 

<?php
                 
                 $check_stav = file_get_contents('readme.txt');
                 if ($check_stav == 1){ 
                  STAV 1 na prepínači
                 
                 
                 }
                 else{
                 
                 STAV 0 na prepínači
                 }
?>

A taktiež potrebujem aby sa pri zmene stavu zmenil aj ten stav. Ďakujem za pomoc, s php robím ešte iba mesiac

Martin
JavaScript, AJAX, jQuery › Javascript ukazuje ručičku i…
3. 2. 2017   #214760

Ešte mi poraďte, ako vložím PHP kód do toho kódu, potrebujem toto: 

<?php $temperatureLivingRoom = mysqli_query($con,"SELECT `temperature`, `time` FROM `TempLivingRoom` ORDER BY `time` DESC LIMIT 1") or die(mysqli_error($con));
 
            while($line = mysqli_fetch_assoc($temperatureLivingRoom)){
		
	echo  $line['temperature']; echo'  ';} ?>

Vložiť do:
 

function drawLivingRoomChart() {

  var LivingRoomData = google.visualization.arrayToDataTable([
    ['Label', 'Value'],
    ['Von', 10]
  ]);

  var LivingRoomOptions = {
    width: 200, height: 200,
    min: 10,
     greenFrom: 10, greenTo: 16.99,
        yellowFrom: 17, yellowTo: 23.99,
        redFrom: 24, redTo: 40,
      minorTicks: 20,
    majorTicks: ['10', '20', '30', '40'],max: 40
  };

  var LivingRoomChart = new 		google.visualization.Gauge(document.getElementById('LivingRoom_chart_div'));

  LivingRoomChart.draw(LivingRoomData, LivingRoomOptions);
}

Namiesto toho value 10. Ďakujem za pomoc.

Martin
JavaScript, AJAX, jQuery › Javascript ukazuje ručičku i…
3. 2. 2017   #214758

Ďakujem už to funguje

Martin
JavaScript, AJAX, jQuery › Javascript ukazuje ručičku i…
2. 2. 2017   #214755

Ahojte, mám taký problém. S Javascriptom som nikdy nerobil a hľadal som najjednoduchšie riešenie grafov typu gauge pre meteostanicu, kde budem dávať tú hodnotu value s PHP, bude to posledná hodnota v DB. Poďme ale k veci. Podľa tutoriálu som si vytvoril prvé 2 grafy, ten napravo momentálne nepotrebujem. Starosti mi robí prvý. Potrebujem hodnotu napríklad 30°C a túto hodnotu ukazuje na 20°C  a ak zadám do value 20°C tak mi túto hodnotu ukazuje na 0°C taktiež mám poposúvané yellow from to, red, green.. Vedel by mi niekto pomôcť? Bol by som vám veľmi vďačný:
HTML kód:  

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Arduino Meteostanica</title>
<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1','packages':['gauge']}]}"></script>
<script type="text/javascript" src="js/gauge.js"></script>
</head>

<body>   

       
<div id="Outside_chart_div" style="width: 200px; height: 200px; display: inline-block;"></div>
<div id="kmh_chart_div" style="width: 200px; height: 200px; display: inline-block;"></div>

<body>
<html>

JS kód:
 

function drawOutsideChart() {

  var OutsideData = google.visualization.arrayToDataTable([
    ['Label', 'Value'],
    ['Von', 20]
  ]);

  var OutsideOptions = {
    width: 200, height: 200,
     greenFrom: -40, greenTo: 15,
        yellowFrom: 16, yellowTo: 25,
        redFrom: 26, redTo: 40,
      minorTicks: 10,
    majorTicks: ['-40','-30','-20','-10','0', '10', '20', '30', '40'],max: 40
  };

  var OutsideChart = new 		google.visualization.Gauge(document.getElementById('Outside_chart_div'));

  OutsideChart.draw(OutsideData, OutsideOptions);
}

function drawKmhChart() {

  var kmhData = google.visualization.arrayToDataTable([
    ['Label', 'Value'],
    ['Km/h', 20]
  ]);

  var kmhOptions = {
    width: 200, height: 200,
    yellowFrom: 40, yellowTo: 60,
    minorTicks: 4, majorTicks: ['0', '20', '40', '60', '80', '100', '120', '140', '160', '180', '200', '220'],max: 220
  };

  var kmhChart = new 		google.visualization.Gauge(document.getElementById('kmh_chart_div'));

  kmhChart.draw(kmhData, kmhOptions);
}

google.setOnLoadCallback(drawOutsideChart);
google.setOnLoadCallback(drawKmhChart);

Zamerajte sa prosím iba na prvý graf Outside! 
Výsledok u mňa je takýto: 

Připojen obrázek.

Martin
PHP › .TXT súbor v PHP s fopen (w)
24. 1. 2017   #214622

   

<?php
                 
                 $homepage = file_get_contents('readme.txt');
                 if ($homepage == 1){ 
                 ?>
                	<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post">
                 <input type="submit" name="submit" value="Stav 0">
                 </form> <?php
                    if (isset($_POST['submit'])){
                     $subor = fopen('readme.txt', 'w');
                 fwrite($subor, 0);
                 fclose($subor);
                    }
                 
                 
                 }
                 else{
               ?>  	<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post">
                 <input type="submit" name="submit" value="Stav 1">
                 </form> <?php
                    if (isset($_POST['submit'])){
                     $subor = fopen('readme.txt', 'w');
                 fwrite($subor, 1);
                 fclose($subor);
                    }  
                 }
?>

Používam takýto kód.

Martin
PHP › .TXT súbor v PHP s fopen (w)
24. 1. 2017   #214621

Ide to, urobil som to cez file_get_contents. Avšak po kliknutí na tlačidlo sa PHP časť vykoná, ale bohužiaľ sa mi tlačidlo neprepne do druhej polohy (nezobrazí sa tlačidlo opačné, na opačný stav) ale až po opakovanom refreshi stránky. Vie mi niekto pomôcť?

Martin
PHP › .TXT súbor v PHP s fopen (w)
24. 1. 2017   #214620

Ahojte, potrebujem poradiť.  Mám .TXT súbor, kde bude buď 1, alebo 0, otvárať sa bude cez fopen s parametrom w, teda sa zmaže to, čo tam je a zapíše 0, resp. 1.
Chcem urobiť toto:
Ak súbor obsahuje 0, chcem aby sa mi vykreslilo tlačidlo, ktorým súbor otvorím a zapíšem 1.
Ak súbor obsahuje 1, chcem aby sa mi vykreslilo tlačidlo, ktorým súbor otvorím a zapíšem 0.

Budem s tým ovládať relé cez mikroprocesor. Potrebujem niečo ako strlen, ktorý prečíta čo je v súbore bez toho, aby ho otváral cez fopen, lebo by ho zmazal. Skúste mi poradiť, ako by to bolo najvhodnejšie. Musí to byť riešené takto, používam client mód pre mikroprocesor, ktorý vie len posielať requesty HTTP, neprijíma ich, nemám ako naň nasmerovať script keď to nie je server.

Mikropočítač si stiahne .txt súbor a prečíta, že obsahuje 1, tak prepne relé a tento súbor si stiahne raz za 5 sekúnd. Ak zistí, že bude 0 v .txt súbore, odpojí relé od prúdu a odpojí vetvu. Dúfam, že som to vysvetlil dosť dobre. Poprosím v procedurálnom kóde, prípadne ak je to možné tak by to mohlo byť cez AJAX, ale s tým nemám skúsenosti.

Súbor som nazval readme.txt a nachádza sa v root priečinku. Ďakujem vám veľmi pekne za pomoc, veľmi by ste mi uľahčili prácu. Pre ostatné relé si už urobím sám, potrebujem iba vzor.

Martin
PHP › Čas nesedí so zaznamom teploty
20. 1. 2017   #214585

Hľadám minimálnu teplotu dňa.

Martin
PHP › Čas nesedí so zaznamom teploty
20. 1. 2017   #214581

Problém stále pretrvavá. Stále mi píše prvý time, ako keby hľadalo MIN čas spoločne s MIN teplotou.. Nerozumiem tomu. Kód som upravil podľa vás.  

<?php $result = mysqli_query($con,"SELECT MIN(temperature) AS MinusTemperatureToday, time  FROM TempLivingRoom WHERE date(time) = CURDATE() ORDER BY MinusTemperatureToday LIMIT 1") or die(mysqli_error($con));
           
           
           while($row = mysqli_fetch_assoc($result)){
	echo round($row['MinusTemperatureToday'],2).'°C';?><br>
 <?php   	echo $row['time'];
}  

Připojen obrázek.

Připojen obrázek.

Martin
PHP › Čas nesedí so zaznamom teploty
20. 1. 2017   #214577

Ahoj, znovu rieším iný problém. Vypisujem najnižšiu, či najvyššiu teplotu dňa a chcem to aj s časom. Skúšal som to, teplotu vypíše ok, ale čas vypíše prvý v tom dni. Nevypíše mi čas z toho istého riadku. Vypíše mi čas prvý v tom dni. Napríklad 00:06:35 i keď najnižšia teplota bola nameraná o 01:18:33. 

<?php $result = mysqli_query($con,"SELECT MIN(temperature) AS MinusTemperatureToday, time FROM TempLivingRoom WHERE date(time) = CURDATE()") or die(mysqli_error($con));
           
           
           while($row = mysqli_fetch_array($result)){
	echo round($row['MinusTemperatureToday'],2).'°C';?><br>
 <?php echo '<h6>'. $row['time'].'</h6>';  
}  ?>

Ďakujem vám za pomoc. Neviem to vyriešiť.

Martin
PHP › Jak získať z databázy výsled…
20. 1. 2017   #214575

Už to mam.

Martin
PHP › Jak získať z databázy výsled…
20. 1. 2017   #214574

Ahojte, hľadal som na internete ale neviem to poriadne nájsť. Mám v DB tieto hodnoty: ID, temperature, time (timestamp), ktorý sa nastaví na aktuálny čas, kedy bol záznam vytvorený. Vedel by mi niekto poradiť, ako vypíšem z databázy hodnoty, ktoré boli namerané dnes? Ďakujem za pomoc. Ide mi o celý deň.

Martin
PHP › Priemer stĺpca z DB
18. 1. 2017   #214566

Ahoj, chcem urobiť priemer stĺpca temperature z tabuľky TempBedRoom. Problém je v tom, že temperature je typu float. Keď do sql query dám avg tak mi to hlási error Catchable fatal error: Object of class mysqli_result could not be converted to string

 <?php $result = mysqli_query($con,"SELECT AVG(temperature) AS AverageTemperature FROM TempBedRoom") or die(mysqli_error($con));
           echo $result;?>

Dík za pomoc.

Martin
PHP › Premenná do IMG, ktorý je v…
18. 1. 2017   #214564

Ahoj, potrebujem do Title obrázku dať premennú o koľko sú rozdielne posledné 2 teploty, teda premennú result. Neviem ako to dať do img, aby to fungovalo, lebo ten img je akoby text v pozícii čomu sa rovná premenná. Ďakujem za pomoc. Kde je chyba som vyznačil týmto symbolom -------

if($GLOBALS['highest_LivingRoom']<$GLOBALS['second_highest_LivingRoom']) {
  $result = abs($GLOBALS['highest_LivingRoom'] - $GLOBALS['second_highest_LivingRoom']);  
  $down = '<img src="img/down.png" alt="down.png, 1,3kB" title="Klesajúca tendencia o:"------$result------height="48" width="48">';
   
  echo $down; }
Meno
PHP › Dáta z formu ako POST na Fac…
6. 1. 2017   #214408

Ahoj, videl som mnoho takýchto automatizácii. Chcel by som urobiť form na stránke (mimo fb) kde by používateľ dal link na Youtube video + jeho popis do inputu pod tým. To by sa odoslalo a pridalo by sa automaticky na fb na stránke ako POST. Využívajú to napríklad stránky zaoberajúce sa článkami, ak moderátor napíše článok, tak sa to automaticky zdieľa na fb. Vedel by mi niekto poradiť ako nato? Dík.

Meno
C / C++ › scanf %d aj printf %d na char?
6. 1. 2017   #214406

Ahoj, učím sa C a pri jednom kvíze som narazil na toto.. Dá sa použiť scanf a printf na %d decimal pre char? Podľa kvízu ano.. čo mi to dá na výstupe v reále? Vypíše mi to char tak ako pri %c? 

Připojen obrázek.

Martin
PHP › č prepíše na ?
31. 12. 2016   #214323

Problém opravený, na všetky msg v db som dal zotriedenie utf8_bin namiesto 

latin1_swedish_ci
 

Martin
PHP › č prepíše na ?
31. 12. 2016   #214322

Update. Súbory som spojil do jedného. Teraz je problém taký, že ak napíšem č alebo čokoľvek s č tak mi vyhodí Incorrect string value: '\xC4\x8D' for column 'msg1' at row 1
MSG1 je správa, ktora sa zapíše do db, ktorú práve píšem. Vedel by mi niekto pomôcť? Ak píšem s š dž všetko ok.. stále toto iba pri č.. všetky súbory aj js majú UTF8 + skusil som aj mysqli set charset utf8 ale vysledok totožný..

Arduino
PHP › Výpis poslednej hodnoty + po…
26. 12. 2016   #214237

Ahoj, som v PHP úplný newbie. Mám databázu nastavenú v PHP, potreboval by som vypísať poslednú nameranú hodnotu: Napríklad 20°C a pod to namerané o: a čas z TimeStampu. Posielam aj screen, ako mám hodnoty uložené v databáze, chcel by som to vypísať ako posledný záznam databázy, stačí temperature ako teplota a ten čas pod to, alebo vedľa toho a taktiež porovnať túto hodnotu s predchádzajúcou nameranou, ak bude teplota stúpať, zobrazí sa tam obrázok, že má tendenciu stúpať od predposlednej hodnoty. Ďakujem za pomoc, veľmi mi tým pomôžete. Využívam MySQLi dopyty a PHP 5.6

Připojen obrázek.

Připojen obrázek.

Arduino
.NET › Arduino - zaslanie hodnôt na…
26. 12. 2016   #214235

#2 Matěj Andrle
Všetky Arduino otázky sú v tomto vlákne.

Jonny
.NET › Arduino - zaslanie hodnôt na…
24. 12. 2016   #214223

Ahoj, kúpil som si Arduino a chcem skúsiť jeden test. Mám 2 teplomery DS18B20 ale je tu problém, že hodnoty namerám a viem si ich normálne vypísať v serial monitore, potrebujem to poslať do mysql databázy. Súbor add.php na hostingu vykoná toto:  

<?php
   	include("connect.php");
   	


	$temp1=$_GET["temp1"];
        $temp2=$_GET["temp2"];

 $ins = mysqli_query($con,"INSERT INTO `TempLivingRoom` (`temperature`) VALUES ('".$temp1."')") or die (mysqli_error($con));
 $ins2 = mysqli_query($con,"INSERT INTO `TempOutside` (`temperature`) VALUES ('".$temp2."')") or die (mysqli_error($con));   	
   	

   	header("Location: index.php");
?>

Problémom ale je, že neviem ako takúto premennú zapísať v .ino súbore a následne to poslať. Mám takýto script pre jednu hodnotu, ale nefunguje to. Ak by niekto vedel helfnuť s urobením scriptu pre jednu hodnotu a príklad budem rád..
Potrebujem to na webclient.



#include <SPI.h>
#include <Ethernet.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 6
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
char server[] = "www.arduino.php5.sk";
IPAddress ip(192, 168, 1, 254);
EthernetClient client;
 int t = 0;  // TEMPERATURE VAR
 String data;
void setup() {
 Serial.begin(9600);
   sensors.begin();
 data = "1";
  t = (int) sensors.getTempCByIndex(0);
  
  while (!Serial) {
 }

  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Zlyhanie DHCP protokolu!");
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip);
  }
  // give the Ethernet shield a second to initialize:
  delay(1000);
  Serial.println("Priprájam...");

  // if you get a connection, report back via serial:
  if (client.connect(server, 80)) {
    Serial.println("Pripojené");
    // Make a HTTP request:
    client.println("GET /add.php HTTP/1.1");
    client.println("Host: www.arduino.php5.sk"); 
    client.print(data);
    client.println();
    client.println("Pripojenie uzavreté");
    client.println();
  } else {
    // if you didn't get a connection to the server:
    Serial.println("Pripojenie neúspešné");
  }
}

void loop() {
  sensors.requestTemperatures(); 
  
  
    t = (int) sensors.getTempCByIndex(0); // Send the command to get temperatures
    data = t + "temp1";
    delay(10000);
  // if there are incoming bytes available
  // from the server, read them and print them:
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  // if the server's disconnected, stop the client:
  if (!client.connected()) {
  
  Serial.println();
  delay(10000);
    Serial.println("Odpojené");
    client.stop();

    // do nothing forevermore:
    while (true);
  }
}
Jonny
PHP › Ako zapísať podmienky aby sa…
22. 12. 2016   #214183

Potrebujem sa poradiť, ako zapísať následovný príkaz, ktorý je napísaný čierno, ten funguje ok, ale potrebujem pod neho toto ako podmienku:

  1. if($user['fraction'] == 0  $attacked_user['fraction'] == 3 OR  $attacked_user['fraction'] == 5  echo nemôžeš zaútočiť na spojeneckú frakciu
  2. if($user['fraction'] == 3  $attacked_user['fraction'] == 0 OR  $attacked_user['fraction'] == 5  echo nemôžeš zaútočiť na spojeneckú frakciu
  3. if($user['fraction'] == 5  $attacked_user['fraction'] == 0 OR $attacked_user['fraction'] == 3  echo nemôžeš zaútočiť na spojeneckú frakciu
  4. if($user['fraction'] == 1  $attacked_user['fraction'] == 2 OR $attacked_user['fraction'] == 4  echo nemôžeš zaútočiť na spojeneckú frakciu
  5. if($user['fraction'] == 2  $attacked_user['fraction'] == 1 OR $attacked_user['fraction'] == 4  echo nemôžeš zaútočiť na spojeneckú frakciu
  6. if($user['fraction'] == 4  $attacked_user['fraction'] == 1 OR $attacked_user['fraction'] == 2  echo nemôžeš zaútočiť na spojeneckú frakciu

 Neviem ako to zapísať, user fraction predstavuje frakciu za akú hrá hráč v hre a attacked_user predstavuje frakciu, ktorú má hráč, na ktorého útočím, neviem ako to zapísať, lebo ak to zapisujem takýmto typom tak dostanem echo nemôžeš zaútočiť na spojeneckú frakciu, no i tak bojovníci začnú útok. Neviem ako to mám urobiť, aby sa nevykonala podmienka pod else... Ďakujem všetkým za pomoc

if(isset($_POST['attack2'])){
if($user['fraction'] == $attacked_user['fraction']){             
			echo("Nemôžeš zaútočiť na svoju frakciu!");                 
		}
    
		elseif($stats['battery'] >= 10 && $timer['atime'] == 0 && $stats['attack'] >= 10 && $_POST['attack1'] != "" && $_POST['attack1'] != $_SESSION['uid'] && is_numeric($_POST['attack1']) && $_POST['attack1'] <= $id['MAX(`id`)'] && $_POST['attack1'] > 0){
			echo("Bojovníci začali útok!");
			$azarobok1 = 0;
			$azarobok2 = 0;
			$atime = time();
			$working['ayes'] = $atime;
			$stats['battery'] -= 10;
			$stats['rank'] += 4;
			$timer['atime'] = 1;
			$info1 = mysqli_query($con,"SELECT `id` FROM `stats` WHERE `id`='".$_POST['attack1']."'") or die(mysqli_error($con));
			$info2 = mysqli_fetch_assoc($info1);
			$info3 = $info2['id'];
			$update_working = mysqli_query($con,"UPDATE `working` SET `ayes`='".$working['ayes']."' 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 `atime`='".$timer['atime']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
			$update_ranking = mysqli_query($con,"UPDATE `ranking` SET `number`='".$info3."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
		}elseif((time() - $working['ayes']) >= 600 && $timer['atime'] == 1){
			$info1 = mysqli_query($con,"SELECT `number` FROM `ranking` WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
			$info2 = mysqli_fetch_assoc($info1);
			$info3 = $info2['number'];
			$info4 = mysqli_query($con,"SELECT `defense`,`food`,`gold` FROM `stats` WHERE `id`='".$info3."'") or die(mysqli_error($con));
			$info5 = mysqli_fetch_assoc($info4);
			if($stats['attack'] > $info5['defense']){
				$azarobok1 = round($info5['food'] / 2);
				$azarobok2 = round($info5['gold'] / 2);
				echo("Získal si ".$azarobok1." jedla a ".$azarobok2." zlata!");
				$atime = 0;
				$working['ayes'] = $atime;
				$stats['food'] += $azarobok1;
				$stats['gold'] += $azarobok2;
				if($azarobok1 > 0){
					$stats['rank'] += 1;
				}
				if($azarobok2 > 0){
					$stats['rank'] += 1;
				}
				$info5['food'] -= $azarobok1;
				$info5['gold'] -= $azarobok2;
				$azarobok1 = 0;
				$azarobok2 = 0;
				$timer['atime'] = 0;
				$update_working = mysqli_query($con,"UPDATE `working` SET `ayes`='".$working['ayes']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
				$update_stats = mysqli_query($con,"UPDATE `stats` SET `food`='".$stats['food']."',`gold`='".$stats['gold']."',`rank`='".$stats['rank']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
				$update_stats = mysqli_query($con,"UPDATE `stats` SET `food`='".$info5['food']."',`gold`='".$info5['gold']."' WHERE `id`='".$info3."'") or die(mysqli_error($con));
				$update_timer = mysqli_query($con,"UPDATE `timer` SET `atime`='".$timer['atime']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
			}elseif($stats['attack'] <= $info5['defense']){
				echo("Bojovníci sa vzdali!");
				$atime = 0;
				$working['ayes'] = $atime;
				$timer['atime'] = 0;
				$update_working = mysqli_query($con,"UPDATE `working` SET `ayes`='".$working['ayes']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
				$update_timer = mysqli_query($con,"UPDATE `timer` SET `atime`='".$timer['atime']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysqli_error($con));
			}
		}elseif($timer['atime'] == 0){
			if($stats['attack'] == 0){
				echo("Nemáš žiaden útok!");
			}elseif($stats['battery'] < 10){
				echo("Nemáš dostatok baterky!");
			}elseif($_POST['attack1'] == "" | $_POST['attack1'] == $_SESSION['uid'] | !is_numeric($_POST['attack1']) | $_POST['attack1'] > $id['MAX(`id`)'] | $_POST['attack1'] <= 0){
				echo ("Toto nieje dobré ID majora!");
			}
		}else{
			$zostava = (600 - (time() - $working['ayes']));
			echo("Musíš počkať ".$zostava." sekúnd.");
		}
	} 
Martin
PHP › č prepíše na ?
18. 12. 2016   #214103

Ahojte, mám problém, mam chat v PHP, Mysql, ak napíšem č po odoslaní formulára ho zobrazí ako ? taktiež ak niečo napíšem v azbuke tak všetko prevedie na ???? používam utf-8 pre php a skúsil som nastaviť aj mysqli charset na utf8 a bezúspešne. Vedel by mi niekto poradiť? Zaujímavé že ak napíšem ž š alebo ľ tak problém nie je, iba s č a azbukou.

Martin
HTML / XHTML › Align right problém
17. 12. 2016   #214090

Vyriešené, stačil align element do img

Martin
HTML / XHTML › Align right problém
17. 12. 2016   #214089

Ahoj, mám takýto kód v HTML

<a href="?lang=sk"><img src="../images/lang/slovakia.png" alt="Slovakia flag.png, 5,5kB" title="Slovakia" height="32" width="32"></a>
       <a href="?lang=en"><img src="../images/lang/britain.png" alt="britain.png, 2,2kB" title="Britain" height="32" width="32"></a>
       <a href="?lang=de"><img src="../images/lang/germany.png" alt="germany.png, 3,5kB" title="Germany" height="32" width="32"></a>
       <a href="?lang=ru"><img src="../images/lang/russia.png" alt="russia.png, 4,6kB" title="Russia" height="32" width="32"></a>
       <a href="?lang=cz"><img src="../images/lang/czech.png" alt="czech.png, 2,0kB" title="Czech" height="32" width="32"></a>
       <a href="?lang=it"><img src="../images/lang/italy.png" alt="italy.png, 739B" title="Italy" height="32" width="32"></a>
      
      <div align=right> <a href="chat.php"><img src="images/chat_icon.png" alt="chat_icon.png, 4,7kB" title="Chat icon" height="32" width="32"></a>    <a href="minigame.php"><img src="images/rps.png" alt="rps.png, 49kB" title="Rps" height="32" width="32"></a></div>

div align=right mi urobí akoby <br> element a zbytočne mi urobí medzeru medzi vlajkami a týmto. Potrebujem, aby to bolo v jednom riadku, vlajky ako sú, to je ok, ale v tom istom riadku ale napravo s alignom, vedeli by ste mi niekto pomôcť ako nato? Ak použijem div align=right tak mi to skrátka vždy spadne o jeden riadok.

Martin
PHP › Ako odtestovať formulár?
17. 12. 2016   #214088

Ahojte, chcel by som nájsť nástroj alebo poprosiť niekoho skúseneho, či by skúsil for fun nejakým spôsobom obísť prihlásenie, alebo sa prihlásiť za neexistujúceho používateľa cez OR 1=1 myslím, že som to zabezpečil dostatočne, no chcem by som si byť 100% istý, ak by chcel niekto skúsiť a potom mi podať nejaké info čo a ako zlepšiť tak: lfs-league.php5.sk je tam aj kontaktný mail.

Martin
PHP › ako vypísať echo do HTML
11. 12. 2016   #214025

#4 z_moravec
Áno, mal si pravdu.. mal som $lang = array(); a $lang['SERVICE_ONLINE'] a $lang['SERVICE_OFFLINE'] som mal definované nad tým.. 

Martin
PHP › ako vypísať echo do HTML
11. 12. 2016   #214023

#1 Martin
Dostávam takúto output.. 
Illegal string offset 'SERVICE_ONLINE' in /www/sites/8/site22718/public_html/languages/lang.it.php on line 8 Warning: Illegal string offset 'SERVICE_OFFLINE' in /www/sites/8/site22718/public_html/languages/lang.it.php on line 9 Notice: Undefined index: SERVICE_ONLINE in /www/sites/8/site22718/public_html/status/index.php on line 4 Notice: Undefined index: SERVICE_OFFLINE in /www/sites/8/site22718/public_html/status/index.php on line 6 
Pritom mám nalinkovaný aj súbor s langs, 

Martin
PHP › ako vypísať echo do HTML
10. 12. 2016   #214019

Ahoj, potrebujem radu, mám script, ktorý mi vypisuje server status a dáva ho do tabuľky pod seba do riadkov pre jednotlivé služby, potreboval by som namiesto running napísať PHP script <?php echo $lang['ONLINE'] ;?>

pod lang online je preklad RUNNING pre viacero jazykov. Kód HTML je takýto: 

$online='<td style="background-color:#00FF00; padding:5px;">Running</td>'; 

Potrebujem teda nahradiť to running, skúšam všeliako a stále unexpected echo, neviem ako to zapísať.

Márťa
PHP › MySQLi 5 výsledkov vypísať d…
9. 12. 2016   #213996

Ďakujem pekne parameter limit.. nenapadlo ma to, budem si to pamätať veľmi ste mi pomohli pane.

Márťa
PHP › MySQLi 5 výsledkov vypísať d…
9. 12. 2016   #213994

Ahoj, potrebujem radu. Mám výpis najlepších hráčov servera, kde chcem zobraziť iba 5 výsledkov, neviem si to vhodne poupraviť, chcel by som to cez while alebo for to je jedno, keď som skúšal cez while tak mi vypísalo všetky ID-čka bez ostatných údajov, potrebujem vypísať iba 5 výsledkov. 

<table>
<thead><tr><th>Body</th><th>Frakcia</th><th>Major</th></tr>
<tbody> 


<?php
 	$mayors = mysqli_query($con,"SELECT `rank`,`id`,`food`,`gold` FROM `stats` WHERE `rank`>='0' ORDER BY `rank` DESC,`id` ASC") or die(mysqli_error($con));
		$rank = 1;
		while($line = mysqli_fetch_assoc($mayors)){
			echo "<tr>";
			echo "<td><i>" . $rank . ". (" . $line['rank'] . ")" . "</i></td>";
			$rank++; 
			$get_mayor = mysqli_query($con,"SELECT * FROM `user` WHERE `id`='".$line['id']."'") or die(mysqli_error($con));
			$mayor = mysqli_fetch_assoc($get_mayor);
			?><td><img src="images/fraction<?php echo $mayor['fraction']; ?>.png" style="width: 30px; height: 32px;"/></td><td><i><a  href="mayor.php?<?php echo $line['id']; ?>"><?php echo $mayor['username']; ?></a></i></td></td><?php
		
			echo "</tr>";
		}  ?> </tbody></table>

Ďakujem za pomoc!

PHP-čkar
Sítě › Virtuální simulace sítě
3. 12. 2016   #213880

Ja využívam Cisco Packet Tracer, ale nakonfigurovať si prvky môžeš aj klikaním na políčka.

PHP-čkar
PHP › Prechod zo sha1 na lepší alg…
3. 12. 2016   #213879

Ahojte, potreboval by som upraviť algoritmus. Doteraz som využíval sha1 na ukladanie hesla, jednoducho je sha1 pred heslom v registrácii a taktiež aj pri prihlásení a skrátka skúma, či sa to zhoduje, skúsil som sha512, nešlo mi to, po odoslaní formulára sa formulár nezobrazil. Pri crypt mi urobila iný hash aj pri tých istých heslách. Potreboval by som nejaký štandard, ktorý sa využíva, ktorý je silný a počíta sa pomalšie ako md5 atď.  
V registrácii:  

$ins3 = mysqli_query($con,"INSERT INTO `user` (`username`,`password`,`email`,`fraction`,`activated`,`code`) VALUES ('$username', '".sha1($password)."', '$email', '$frakcia', 0, '$code')") or die (mysqli_error($con));

Pri prihlásení:
 

 $login_check = mysqli_query($con,"SELECT `id` FROM `user` WHERE `username`='$username' AND `password`='".sha1($password)."'") or die (mysqli_error($con));

Ako vhodne by som to mal nahradiť? Nerobím s týmito vecami denne potreboval by som niečo ako password_hash a verify so saltom, ak by ste mi vedeli pomôcť, skúšal som príklady z php.net ale bezúspešne.

Martin
PHP › Náhrada eregi
1. 12. 2016   #213846

Ahojte, som začiatočník v PHP a skúšal som si pár vecí, napríklad príklad ochrany php scriptu, ktorý includujem, využil som toto  

If(eregi("://", 'game_header.php')){
Echo("Tvoj hack bol neúspešný :) "); 
} else {
Include('game_header.php'); }

Problém je, že mi píše deprecated pre túto funkciu. Našiel som na internete preg_match, ale nenašiel som príklad pre include stránky na takýto štýl, nakoľko je tam jemne upravená syntax tak by som bol vďačný za jeden príklad, ako to opraviť, aby to fičalo, ďakujem vám. 

Jošta
PHP › Upravte mi prosím PHP script…
17. 11. 2016   #213658

Ahoj, vedeli by ste mi upraviť tento script proti XSS a SQL Injection? Ďakujem!! 

<?php
include ('header.php');
      
include("functions.php");
session_start();?>
<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}.art-content .art-postcontent-0 .layout-item-2{border-right-style:dotted;border-right-width:1px;border-right-color:#707070;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>
<div id="art-main">
	<header class="art-header">
		<div class="art-shapes"></div>
		<h1 class="art-headline" data-left="66.04%">
			
		</h1>
		<h2 class="art-slogan" data-left="39.8%">Dobi svet a užívaj si slávu</h2>
	</header>
	<nav class="art-nav">
		<ul class="art-hmenu">
			<li>
				<a href="index.php">Novinky</a>
			</li>
			
			<li>
				<a href="cookies.php">Cookies</a>
			</li>
			<li>
				<a href="kontakt.php">Kontakt</a>
			</li>
		</ul>
	</nav>
	<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="index.php">Novinky</a>
									</li>
									>
									<li>
										<a href="cookies.php">Cookies</a>
									</li>
									<li>
										<a href="kontakt.php">Kontakt</a>
									</li>
								</ul>
							</div>
						</div>
					</div>
					<div class="art-layout-cell art-content">
						<article class="art-post art-article">
							<div class="art-postmetadataheader"></div>
							<div class="art-postcontent art-postcontent-0 clearfix">
								<div class="art-content-layout">
									<div class="art-content-layout-row">
										<div class="art-layout-cell layout-item-1" style="width:100%">
											<h3>Registrácia</h3>
											<p>Po registrácii je nutné e-mail 
												<b>
													<font color=red>overiť!</font>
												</b>
											</p>
											<p>
												<br>
												</p>
											</div>
										</div>
									</div>
									<div class="art-content-layout-br layout-item-0"></div>
									<div class="art-content-layout">
										<div class="art-content-layout-row">
											<div class="art-layout-cell layout-item-2" style="width:50%">
												<h3>Registrujte sa hneď!</h3>
												<p>Zvoľ si frakciu a ukáž hráčom, kto je tu pánom! Vyber si svoju frakciu, s ktorou dobiješ herný svet a budeš si užívať ovocie slávy!</p>
												<p>
													<br>
													</p>
												</div>
												<div class="art-layout-cell layout-item-1" style="width:50%">
													<h3>Analýza hráčov</h3>
													<p>
														<span style="font-weight:bold">Na serveri je registrovaných <?php include ('functions.php');
                            
                            $result = mysqli_query($con,"SELECT COUNT(*) AS total FROM `user` ") or die(mysqli_error()); $values = mysqli_fetch_assoc($result); $num_rows = $values['total']; 
echo $num_rows;
                            
                            ?> hráčov</span>
													</p>
												</div>
											</div>
										</div>
									</div>
								</article>
							</div>
							<div class="art-layout-cell art-sidebar2">
								<div class="art-block clearfix">
									<div class="art-blockheader">
										<h3 class="t">Registrácia</h3>
									</div>
									<div class="art-blockcontent">
										<?php
 
 if(isset($_SESSION['uid'])){  ?>
										<center>
											<h2> Ste už prihlásený! </h2>
											<br>
												<a href='main.php'>
													<button type="button"  class="xmiddle green button round">Späť do hry!</button>
												</a>
												<a href='logout.php'>
													<button type="button"  class="xmiddle red button round">Odhlásiť!</button>
												</a>
											</center>
											<?php  } else {

?>
											<form action="register.php" method="post">
												<input type="text" name="username" class="inputbox" alt="username" placeholder=Meno style="width:100%" />
												<input type="password" name="password" class="inputbox" size="18" alt="password" placeholder=Heslo style="width:100%" />
												<input id="modlgn_username" type="text" name="email" class="inputbox" alt="email" placeholder=E-mail style="width:100%" />
											</p>
											<script>
var vlajkaa = {
  "USA" : "images/fraction0.png",
  "Nemecko" : "images/fraction1.png",
  "Slovensko" : "images/fraction2.png",
  "ZSSR" : "images/fraction3.png",
   "Taliansko" : "images/fraction4.png",
  "Británia" : "images/fraction5.png"
};
var infoo = {
  "USA" : "Spojenci",
  "Nemecko" : "Osa",
  "Slovensko" : "Osa",
  "ZSSR" : "Spojenci",
  "Taliansko" : "Osa",
  "Británia" : "Spojenci"
};
</script>
Frakcia: 
											<select name="frakcia" onchange="document.getElementById('vlajka').src = vlajkaa[this.value]; document.getElementById('info').innerHTML = infoo[this.value];">
												<option value="USA">USA</option>
												<option value="Nemecko">Nemecko</option> >
												<option value="Slovensko">Slovensko</option>>
												<option value="ZSSR">ZSSR</option>
												<option value="Taliansko">Taliansko</option>
												<option value="Británia">Británia</option>
											</select>
											<br />
Vojnová politika:
											<b>
												<font id="info" style="color: #00cc66">Spojenci</font>
											</b>
											<img src="images/fraction0.png" id="vlajka" style="width: 64px; height: 69px;"/>
											<i></i>
											<br>
												<button type="submit" name="register" class="xmiddle green button round">Registrovať!</button>
												<ul>
													<li>
														<a href="index.php">Prihlásiť sa do účtu</a>
													</li>
												</ul>
											</form>
											<?php
function generate_code($length = 10) {
    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $charactersLength = strlen($characters);
    $randomCode = '';
    for ($i = 0; $i < $length; $i++) {
        $randomCode .= $characters[rand(0, $charactersLength - 1)];
    }
    return $randomCode;
}
  
?>
											<?php if(isset($_POST['register'])){
   $username = mysqli_real_escape_string($con, $_POST['username']);
    $password = mysqli_real_escape_string($con, $_POST['password']);
   $email= mysqli_real_escape_string($con, $_POST['email']);
  
  if($username == "" || $password == "" || $email == ""){
    echo "Na niečo si zabudol!";
  }elseif(strlen($username) > 20){
    echo "Tvoje meno je veľmi dlhé!";
  }elseif(strlen($email) > 100){
    echo "Tvoj e-mail je veľmi dlhý!";
  }else{
    $register1 = mysqli_query($con,"SELECT `id` FROM `user` WHERE `username`='$username'") or die(mysqli_error());
    $register2 = mysqli_query($con,"SELECT `id` FROM `user` WHERE `email`='$email'") or die(mysqli_error());
    if(mysqli_num_rows($register1) > 0){
      echo "Toto meno je už používané!";
    }elseif(mysqli_num_rows($register2) > 0){
      echo "Tento e-mail je už používaný!";
    }else{
      if($_POST['frakcia'] == "USA"){ $frakcia = 0; }
      elseif($_POST['frakcia'] == "Nemecko"){ $frakcia = 1; 
      }
     if($_POST['frakcia'] == "Slovensko"){ $frakcia = 2; }
     elseif($_POST['frakcia'] == "ZSSR"){ $frakcia = 3; 
      } 
      if($_POST['frakcia'] == "Taliansko"){ $frakcia = 4; }
     elseif($_POST['frakcia'] == "Británia"){ $frakcia = 5; 
      } 
      $code = generate_code();
      $ins1 = mysqli_query($con,"INSERT INTO `stats` (`gold`,`attack`,`defense`,`food`,`income`,`farming`,`battery`,`rank`,`floor`,`quest`,`qok`,`wall`,`cannon`,`ccost`,`cattack`,`wcost`,`wdefense`,`username`,`inv`,`new`,`guild`,`apotion`,`dpotion`) VALUES (100,0,0,200,0,0,100,0,1,1,0,0,0,1000,0,1250,0,'$username',0,0,0,0,0)") or die(mysqli_error($con));
      $ins2 = mysqli_query($con,"INSERT INTO `unit` (`worker`,`farmer`,`rifleman`,`machinegunner`,`tfarmer`,`dog`,`fisherman`,`soldier`,`sergeant`,`gendef`,`schutze`,`soldad`,`maschinengewehr`,`leutant`,`hauptmann`,`hund`,`strelec`,`gulometcik`,`vojak`,`serzant`,`generalobrany`,`pes`,`strelets`,`pistoleti`,`vojnik`,`sershant`,`obscht`,`kuce`,`tiratore`,`artigliere`,`soldato`,`sergente`,`generale`,`enfieldman`,`gunner`) VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)") or die (mysqli_error());
      $ins3 = mysqli_query($con,"INSERT INTO `user` (`username`,`password`,`email`,`fraction`,`activated`,`code`) VALUES ('$username', '".sha1($password)."', '$email', '$frakcia', 0, '$code')") or die (mysqli_error());
     $ins4 = mysqli_query($con,"INSERT INTO `weapon` (`springfield`,`m1garand`,`browning`,`pershing`,`hellcat`,`sherman`,`thompson`,`kar98`,`mp40`,`gw43`,`mp44`,`mg42`,`m1a1`,`tiger`,`stugv`,`tiger2`,`howitzer`,`panzerstellung`,`pps43`,`pps41`,`mp38`,`zk383`,`gulometvz24`,`puskavz24`,`pak38`,`flak37`,`grw`,`lt38`,`enfield`,`sten`,`bren`,`bar`,`delisle`,`lewis`,`vickers`,`cromwell`,`comet`,`carcano`,`skoda`,`brixia`,`breda`,`ovp`,`baretta`,`fucile`,`p43`,`carro`,`mosinnagant`,`minometvz40`,`maxim`,`kv2`,`dp27`,`zis3`,`t34`,`is2`,`svt40`) VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)") or die (mysqli_error());
     $ins5 = mysqli_query($con,"INSERT INTO `working` (`fyes`,`myes`,`bonus`,`ayes`,`fwork`,`mwork`,`tfwork`,`tyes`,`fishermanwork`,`adyes`,`ad2yes`) VALUES (0,0,0,0,0,0,0,0,0,0,0)") or die (mysqli_error());
      $ins6 = mysqli_query($con,"INSERT INTO `ranking` (`number`) VALUES (0)") or die (mysqli_error());
      $ins7 = mysqli_query($con,"INSERT INTO `timer` (`ftime`,`mtime`,`atime`,`adtime`,`ad2time`) VALUES (0,0,0,0,0)") or die (mysqli_error());
      $ins8 = mysqli_query($con,"INSERT INTO `daily` (`bonus`) VALUES (0)") or die (mysqli_error());
       
      echo "Si úspešne zaregistrovaný!";
      $t = file_get_contents("registracie.txt");
      $today = date("Y-m-d H:i:s");
      $t .= $today." Používateľ ".$username." "."sa zaregistroval!"."\r\n";
      file_put_contents("registracie.txt",$t);
      mail($email,"Nation Wars: Aktivačný Kód","Vítaj v hre Nation Wars!\r\n\r\nPrihlásovacie meno: ".$username."\r\n);
    }
  }
}}
?>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
					
				</div>
			</div>
		</body>
	</html>

A  tu dávam functions.php



 <?php
$con = mysqli_connect("","s","","");


// Check connection
if (mysqli_connect_errno())
  {
  echo "Problém s napojením na MySQL: " . mysqli_connect_error();
  }
?>

Udaje DB sú vymazane naschval.

Martin
PHP › FB registrace
30. 10. 2016   #213279

Email je podľa mňa jasný identifikátor, respektíve číslo profilu, :) Napr máš facebook.com/meno.priezvisko, ale niektorí majú profil ako facebook.com/12841991916 (a takéto číslo má každý profil) Jasne ho identifikuje (teda aj facebook.com/meno.priezvisko má ukrytý ten zoznam čísel)

Martin
PHP › Prihlásenie PIN-om
29. 10. 2016   #213256

Potrebujem to takto, ale mám problém, zle mi to overuje, prosím ťa Kit, nevedel by si to poupraviť, aby porovnal zadaný pin so statickým pinom? A následne v prípade, že je to OK, tak aby tam bolo location main.php, a ak je to zlé, tak to index.php dík.. neviem si s tým poradiť, robím prvý krát s PHP, vážne to potrebujem cez PHP, nebude to na mojom webserveri. 

Martin
PHP › Prihlásenie PIN-om
28. 10. 2016   #213254

Ahojte, mám takýto kód, no neviem ho zabezpečiť, stále mi píše undefined index pin a keď dávam najprv POST submit, tak to tiež nefunguje. Poraďte mi, ako to vhodne overovať a niečo mi tam vylepšite, som v PHP začiatočník a chcem to na Dashboard pre Arduino. PIN bude mať každý na svoj webserver iný, generovaný a zapísaný mnou.  

<!DOCTYPE html>
<html lang="sk">

<head>
	<meta charset="utf-8">
	<title>Arduino Login</title>

	<!-- Google Fonts -->
	<link href='https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700|Lato:400,100,300,700,900' rel='stylesheet' type='text/css'>

	<link rel="stylesheet" href="css/animate.css">
	<!-- Custom Stylesheet -->
	<link rel="stylesheet" href="css/style.css">

	<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
</head>

<body>
	<div class="container">
		<div class="top">
		
		</div>
		<div class="login-box animated fadeInUp">
			<div class="box-header">
				<h2>Prihlásenie</h2>
			</div>
      <form action='index.php' method="post">
		
			<br/>
			<input name="pin" type="text" placeholder="Váš PIN">
			<br/>
			<button type="submit">Prihlásiť</button>
			<br/>
		   </form>
		</div>
	</div>
</body>

<?php


$pin = '12345678';

if($_POST['pin'] == $pin){
 header("Location: main.php");
 $t = file_get_contents("prihlasenia.txt");
      $today = date("Y-m-d H:i:s");
      $t .= $today." Používateľ sa úspešne prihlásil!"."\r\n";
      file_put_contents("prihlasenia.txt",$t);
}else{

}
?>    

</html>

Potrebujem, aby to bolo bezpečné a na úrovni. Nechcem využívať databázu na login, chcem aby sa používateľ prihlasoval len pinom, ktorý bude v kóde. 

Martin
PHP › Zabezpečenie skriptu
7. 10. 2016   #212973

   

$login_check = mysqli_query($con,"SELECT `id` FROM `user` WHERE `username`='$username' AND `password`='".sha1($password)."'") or die (mysqli_error($con));

Tu už netreba pridať nič? 

Martin
PHP › Zabezpečenie skriptu
7. 10. 2016   #212971

Správne už rozumiem, je teraz skript zabezpečený dostatočne? nemalo by sa niečo pridať aj do query? 

Martin
PHP › Zabezpečenie skriptu
7. 10. 2016   #212968

#2 Kit
Ďakujem pekne, idem to hneď aplikovať. Do akých situácii sa podľa vás hodí Htmlspecialchars? a čo sql injection?

Martin
PHP › Zabezpečenie skriptu
6. 10. 2016   #212966

Ahoj, ako by ste vhodne zabezpečili tento PHP script napríklad pre SQL injection, alebo XSS, robí sa to aj s HTMLspecialchars? :) Ďakujem za odpovede, prípadne za korektne upravený zdroják.
 PHP kód:

 <?php  
include("functions.php");
session_start();

if(isset($_POST['odoslat'])){   

    $username = ($_POST['username']);
    $password = ($_POST['password']);
    $login_check = mysqli_query($con,"SELECT `id` FROM `user` WHERE `username`='$username' AND `password`='".sha1($password)."'") or die (mysqli_error($con));
    if(mysqli_num_rows($login_check) == 0){
      $echo = "Nesprávna kombinácia mena/hesla!";
    }else{
      $activated_check = mysqli_query($con,"SELECT `activated` FROM `user` WHERE `username`='$username' AND `password`='".sha1($password)."'") or die (mysqli_error($con));
      $activated = mysqli_fetch_assoc($activated_check);
      if($activated['activated'] == 0){
        $echo = "Tento účet ešte nebol aktivovaný!";
      }else{
        $get_id = mysqli_fetch_assoc($login_check);
        $_SESSION['uid'] = $get_id['id'];
        
       header("Location: main.php");
        $t = file_get_contents("prihlasenia.txt");
      $today = date("Y-m-d H:i:s");
      $t .= $today." Používateľ ".$username." "."sa prihlásil!"."\r\n";
      file_put_contents("prihlasenia.txt",$t);
      }       
    }
  }
  ?>

HTML kód:  

<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post" name="login" id="form-login">

<br />
<input  type="text" name="username"  alt="username" placeholder=Meno style="width:100%" />

<input type="password" name="password"  size="18" alt="password" placeholder=Heslo style="width:100%" />

<button type="submit" name="odoslat" class="xmiddle blue button round">Prihlásiť!</button>
</fieldset>
<ul>
<li>
<a href="register.php">Vytvoriť účet</a>
</li>
</ul>
</form> 
Jozef
CSS › Margin-top pri viac obrázkoc…
8. 9. 2016   #212634

Ahoj, robím prerábku webdizajnu z PSD do HTML + CSS. Mám problém. V rovnakom dive potrebujem dať viac obrázkov. IMG header.png má margin-top: 8px; , ale IMG cart.png musí mať 12px vedeli by ste mi poradiť, ako to mám nastaviť v CSS na samostatné IMG obrázky? Budem tam používať ešte zhruba 6 obrázkov v rovnakom dive. Momentálne je nastavené staticky pre IMG 8px, no pre cart.png potrebujem 12px. Ďakujem za každú pomoc.
HTML kód:  

<!DOCTYPE html>
<html>
<head>
<title>Flowers</title>
<link rel=stylesheet href=css/style.css media=all>
</head>

<body>

</body>
   <div id=header>
     <img src="message.png" alt="message.png, 145B" title="Správa" height="13" width="20">
   
   </div>
   <div id=underheader>
      <center> <a href=index.html><img src="header.png" alt="header.png, 35kB" title="Header" height="197" width="394">  </a></center>
        <img src="cart.png" alt="cart.png, 1,1kB" title="Cart" height="22" width="27">
   </div>
</html>

CSS kód: 

*
{
   margin: 0;
   padding: 0;
}
body
{
   width: 1080px;
   height: 2217px;
}
#header
{
   width: 1920px;
   height: 35px;
    background: rgb(88, 88, 90);
}
#underheader
{
   width: 1920px;
   height: 346px;
    background: white;
}
#underheader img
{
  margin-top: 8px;
}
Jozef
CSS › Margin-top pri viac obrázkoc…
8. 9. 2016   #212633

Ahoj, robím prerábku webdizajnu z PSD do HTML + CSS. Mám problém. V rovnakom dive potrebujem dať viac obrázkov. IMG header.png má margin-top: 8px; , ale IMG cart.png musí mať 12px vedeli by ste mi poradiť, ako to mám nastaviť v CSS na samostatné IMG obrázky? Budem tam používať ešte zhruba 6 obrázkov v rovnakom dive. Momentálne je nastavené staticky pre IMG 8px, no pre cart.png potrebujem 12px. Ďakujem za každú pomoc.
HTML kód:  

<!DOCTYPE html>
<html>
<head>
<title>Flowers</title>
<link rel=stylesheet href=css/style.css media=all>
</head>

<body>

</body>
   <div id=header>
     <img src="message.png" alt="message.png, 145B" title="Správa" height="13" width="20">
   
   </div>
   <div id=underheader>
      <center> <a href=index.html><img src="header.png" alt="header.png, 35kB" title="Header" height="197" width="394">  </a></center>
        <img src="cart.png" alt="cart.png, 1,1kB" title="Cart" height="22" width="27">
   </div>
</html>

CSS kód: 

*
{
   margin: 0;
   padding: 0;
}
body
{
   width: 1080px;
   height: 2217px;
}
#header
{
   width: 1920px;
   height: 35px;
    background: rgb(88, 88, 90);
}
#underheader
{
   width: 1920px;
   height: 346px;
    background: white;
}
#underheader img
{
  margin-top: 8px;
}
Jozef
PHP › Undefined index
6. 9. 2016   #212596

#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.

Jozef
PHP › Undefined index
6. 9. 2016   #212594

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

Jozef
PHP › Undefined index
6. 9. 2016   #212593

#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);

?>
Jozef
PHP › Undefined index
6. 9. 2016   #212591

#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..  

Jozef
PHP › Undefined index
6. 9. 2016   #212589

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'
Jozef
PHP › POST neberie údaje z formulára
5. 9. 2016   #212587

Vedel by si mi ju poradiť opraviť prosím?

Jozef
PHP › POST neberie údaje z formulára
5. 9. 2016   #212585

Už to ide.. mal som podmienku if activated = 0 tak napíše že účet nie je aktivovaný.. i keď mi to nevypísalo.. :) už to ide dik za ochotu

Jozef
PHP › POST neberie údaje z formulára
5. 9. 2016   #212584

#4 Kit
Chápem, no skusil som to dať preč a s formulárom sa nič nestane, stále sa iba refreshne.. v čom by mohol byť ešte problém? Lebo už fakt netuším

Jozef
PHP › POST neberie údaje z formulára
5. 9. 2016   #212582

#2 Kit
Áno, dal som to nad, no problém pretrváva, po kliknutí na prihlásiť mi var_dump vráti toto: string(0) ""

Jozef
PHP › POST neberie údaje z formulára
5. 9. 2016   #212580

Čauko, mám problém v PHP mám viacero súborov --> index.php cookies.php contact.php a v pravej strane sa zobrazí formulár, ak session ID nie je a ak je, tak sa zobrazí text: si príhlasený. Problém je, že formulár je includovaný cez php súbor, teda -----------       if session id then si prihláseny else include form.php form php obsahuje formulár + php funkciu no neviem správne asi nastaviť action a taktiež mi neberie žiadne údaje, ak to skúšam cez var_dump, tak string 0 .. Prosím o pomoc.. neviem si pomôcť  

FORM.php


<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post" name="login" id="form-login">

<br />
<input  type="text" name="username"  alt="username" placeholder=Meno style="width:100%" />

<input type="password" name="password"  size="18" alt="password" placeholder=Heslo style="width:100%" />

<button type="submit" name="odoslat" class="xmiddle blue button round">Prihlásiť!</button>
<ul>
<li>
<a href="register.php">Vytvoriť účet</a>
</li>
</ul>
</form> 
<?php  
include("functions.php");
var_dump($_POST['odoslat']);
if(isset($_POST['odoslat'])){

    $username = ($_POST['username']);
    $password = ($_POST['password']);
    $login_check = mysqli_query($con,"SELECT `id` FROM `user` WHERE `username`='$username' AND `password`='".sha1($password)."'") or die (mysqli_error($con));
    if(mysqli_num_rows($login_check) == 0){
      $echo = "Nesprávna kombinácia mena/hesla!";
    }else{
      $activated_check = mysqli_query($con,"SELECT `activated` FROM `user` WHERE `username`='$username' AND `password`='".sha1($password)."'") or die (mysqli_error($con));
      $activated = mysqli_fetch_assoc($activated_check);
      if($activated['activated'] == 0){
        $echo = "Tento účet ešte nebol aktivovaný!";
      }else{
        $get_id = mysqli_fetch_assoc($login_check);
        $_SESSION['uid'] = $get_id['id'];
       header("Location: main.php");
      }       
    }
  }

  ?>

Functions.php  



 <?php
$con = mysqli_connect("localhost","root","","nationwars");


// Check connection
if (mysqli_connect_errno())
  {
  echo "Problém s napojením na MySQL: " . mysqli_connect_error();
  }
?>

index.php  

 <?php 
  include ('header.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}.art-content .art-postcontent-0 .layout-item-2{border-right-style:dotted;border-right-width:1px;border-right-color:#707070;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>
<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>
<nav class="art-nav">
<ul class="art-hmenu"><li><a href="index.php" class="active">Novinky</a></li><li><a href="screenshoty.php">Screenshoty</a></li><li><a href="cookies.php">Cookies</a></li><li><a href="kontakt.php">Kontakt</a></li></ul>
</nav>
<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="index.php" class="active">Novinky</a></li><li><a href="screenshoty.php">Screenshoty</a></li><li><a href="cookies.php">Cookies</a></li><li><a href="kontakt.php">Kontakt</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">New Page</span></h2>
</div>
<div class="art-postcontent art-postcontent-0 clearfix"><div class="art-content-layout">
<div class="art-content-layout-row">
<div class="art-layout-cell layout-item-1" style="width:100%">
<h3>Novinky stránka</h3><p>4.8.2016 sme vydali novú aktualizáciu vzhľadu hry, je vytvorený nami, teda už nevyužívame templaty tretích strán, ako tomu bolo doteraz.&nbsp;</p><p><br></p>
</div>
</div>
</div>
<div class="art-content-layout-br layout-item-0">
</div><div class="art-content-layout">
<div class="art-content-layout-row">
<div class="art-layout-cell layout-item-2" style="width:50%">
<h3>Začnite</h3><p>Vyberte si jednu zo šiestich vojenských frakcií a dobývajte svet! Hra ponúka identické misie, ktorým museli čeliť spojenci, i mocnosti Osi počas druhej svetovej vojny. Každá frakcia ponúkne svoje najlepšie vybavenie jednotiek, či zbraní i vozidiel, ktoré boli reálne nasadené v bojoch!</p><p><br></p>
</div><div class="art-layout-cell layout-item-1" style="width:50%">
<h3>Analýza hráčov</h3><p><span style="font-weight:bold">Na serveri je registrovaných XX hráčov</span></p>
</div>
</div>
</div>
</div>
</article></div> <div class="art-layout-cell art-sidebar2"><div class="art-block clearfix">
<div class="art-blockheader">
<h3 class="t">Prihlásienie</h3>
</div>
<div class="art-blockcontent">
 <?php 
 include ('functions.php');
 session_start();
 
 if(isset($_SESSION['uid'])){  ?>
   <center> <h2> Ste už prihlásený! </h2> <br>
   <a href='main.php'><button type="button"  class="xmiddle green button round">Späť do hry!</button></a>
   <a href='logout.php'><button type="button"  class="xmiddle red button round">Odhlásiť!</button></a></center>                          
<?php  } else {

include ('form.php');  }
?>

</div>
</div></div>
</div>
</div>
</div><footer class="art-footer">
<p><a href="register.php">Registrácia</a>&nbsp;| <a href="blog%20posts/podmienky.php">Podmienky</a>&nbsp;| <a href="blog%20posts/prehlasenie.php">Prehlásenie o ochrane osobných údajov</a></p>
<p>Copyright © 2016 Nation Wars, Všetky práva vyhradené</p>
</footer>
</div>

</div>
</body></html>
Maximilián
PHP › Vlastná šifra ako zapísať
5. 9. 2016   #212573

#1 Maximilián

Chcel by som tým zaheslovať heslá

Maximilián
PHP › Vlastná šifra ako zapísať
5. 9. 2016   #212572

Príjemný dobrý deň, chcel by som si v intranetovom systéme urobiť takú vlastnú šifru. Chcel by som si definovať znaky pre heslá, od A po Z a každý znak napríklad a by malo kód 1, následne A by malo #1 atď, ako by som si to mal zapísať? Chcel by som to ako funkciu, ktorú by som mohol jednoducho zavolať. Vedeli by ste mi tu napísať nejaký vzor, ako by to bolo možné vytvoriť? Ďakujem vám veľmi pekne, som v PHP začiatočník a v tomto by ste mi veľmi pomohli! 

Lukáš
PHP › Ako chrániť proti XSS
5. 9. 2016   #212571

Ahojte, hľadal som na internete postupy, ako zabezpečiť stránku, či formuláre voči XSS útokom. Chcel by som vedieť, ako je to najlepšie, povedzme, že máme takýto formulár..
HTML: 

<form class="login-form" method="post" action="index.php">
      <input type="text" name="Username" placeholder="Meno"/>
      <input type="password" name="Password" placeholder="Heslo"/>
      <button type="submit" name="odoslat">PRIHLÁSIŤ</button>
    </form>

PHP:  

<?php 
include("functions.php");
session_start();
 if(isset($_POST['odoslat'])){
    $username = ($_POST['Username']);
    $password = ($_POST['Password']);
    $login_check = mysqli_query($con,"SELECT `UserID` FROM `Users` WHERE `Username`='$username' AND `Password`='".sha1($password)."'") or die (mysqli_error());
    if(mysqli_num_rows($login_check) == 0){ 
      $echo = "Nesprávna kombinácia mena/hesla!";  
    }else{ 
        $get_id = mysqli_fetch_assoc($login_check);
        $_SESSION['uid'] = $get_id['UserID'];
        $today = date("Y-m-d H:i:s");
        $t = file_get_contents("prihlasenia.txt");
      $t .= $today." Používateľ ".$username." "."sa prihlásil!"."\r\n";
      file_put_contents("prihlasenia.txt",$t);
       header("Location: system.php");           
      }       
    }
  ?>

Samozrejme, že k sha1 by sa mohol pridať ešte salt, no zaujíma ma tá bezpečnosť, našiel som niečo ako htmlspecialcharts, no i tam bolo povedané, že je slabé voči XSS, čo by som mal do scriptov doplniť? Vďaka.. prípadne, salt definovať v functions.php a ako ho potom priradiť k sha1? Pripočítať ho? vynásobiť? Čo je lepšie?

 
Marek
PHP › MySqli update problém
19. 8. 2016   #212393

   

 <form class="login-form" method="post" action='user.php?<?php echo $nick['UserID'];?>'>                        
      Nick:<input type="text" name="username" value=<?php echo $nick['Username']; ?>><br />  
      Email:<input type="text" name="email" placeholder="E-mail" value=<?php echo $nick['Email']; ?>>                           <br />
     Meno a priezvisko<input type="text" name="fullname" placeholder="Meno a Priezvisko" value=<?php echo $nick['Fullname']; ?>>                    <br />
     Dátum expirácie: <input type="datetime-local" value="2000-01-01T00:00:00" name='expdate' />
      <button type="submit" name="update">Upraviť</button>
    </form>
    
    
                       <?php
                               if(isset($_POST['update'])){
  $username = ($_POST['username']);
  $email = ($_POST['email']);
  $fullname = ($_POST['fullname']);
  $expdate = ($_POST['expdate']);
        if($username == "" || $email == "" || $fullname == ""){
    echo "Na niečo si zabudol!";
  }elseif(strlen($username) > 45){
    echo "Meno registrovaného používateľa je príliš dlhé!";
  }elseif(strlen($email) > 45){
    echo "E-mail registrovaného používateľa je veľmi dlhý!!";
  }elseif(strlen($fullname) > 45){
    echo "Meno a priezvisko používateľa sú veľmi dlhé, prosím skráťte ich!";
  }else{
    $register1 = mysqli_query($con,"SELECT `UserID` FROM `Users` WHERE `Username`='$username'") or die(mysqli_error());
    if(mysqli_num_rows($register1) > 0){
      echo "Toto meno je už používané!";  
    }else{ $nick_get = mysqli_query($con,"SELECT * FROM `Users` WHERE `UserID` = ".$_SERVER['QUERY_STRING']) or die(mysqli_error());

	$nick = mysqli_fetch_assoc($nick_get); 
              
	$ins = mysqli_query($con,"UPDATE `Users` SET
   				  `Username` = '".$username."', 
   				  `Email` = '".$email."',  
   				  `Fullname` = '".$fullname."',  
   				  `expdate` = '".$expdate."'  
   				  WHERE `UserID` = ".$nick['UserID']);

     	echo "Používateľ bol pozmenený!";  
                  }   }}?>

Nerozumiem tomu :) skús to pochopiť z tohto všetkého... :) 

Marek
PHP › MySqli update problém
19. 8. 2016   #212391

#6 Kit
Ono mi to vypíše že používateľ bol poznmenený, no nezmení sa to.. :( 

Marek
PHP › MySqli update problém
19. 8. 2016   #212389

#4 chita
Ďakujem ti. Chita a mohol by si mi pomôcť? Keď tak mailom ešte ohľadom niečoho :) 

Marek
PHP › MySqli update problém
19. 8. 2016   #212387

Nie, nefunguje to, stále totožná chyba.. :( 

Marek
PHP › MySqli update problém
19. 8. 2016   #212385

Ahoj, pracujem s MySQLi a potrebujem prepísať vo formulári pri úprave používateľa jeho meno, ktoré sa updatne do existujúceho záznamu do databázy... Skúste mi poradit.. Stále dostávam odpoveď z Mysqli, že " unexpected.. neviete mi s tým pomôcť? :( Neviem si už pomoct. Keď dám toto, dostanem takúto odpoveď: unexpected " a to je na konci Mysqli query...  nechápem tomu.. prosím upravte mi to, ak viete

 $nick_get = mysqli_query($con,"SELECT * FROM `Users` WHERE `UserID`='".$_SERVER['QUERY_STRING']."'") or die(mysqli_error());
$nick = mysqli_fetch_assoc($nick_get); 
              $ins = mysqli_query($con,"UPDATE `Users` SET
   `Username` = $username, 
   `Email` = $email,  
   `Fullname` = $fullname,  
   `expdate` = $expdate  
   WHERE `UserID` =  $nick['UserID']  ") 
     echo "Používateľ bol pozmenený!";  
Martin
PHP › Ako to zapísať v MySQLi
18. 8. 2016   #212376

#5 chita
Super kamo, ďakujem ti pekne funguje 

Martin
PHP › Ako to zapísať v MySQLi
18. 8. 2016   #212370

ID je v HTML napísané ako stĺpec... to nemá s PHP nič spoločné, je to iba HTML pomenovanie stĺpca v tabulke.

Martin
PHP › Ako to zapísať v MySQLi
18. 8. 2016   #212367
Martin
PHP › Ako to zapísať v MySQLi
18. 8. 2016   #212366

Ahoj, mám MySQLi, no neviem sa pohnúť ďalej.. Mám script, ktorý mi vypíše pod seba všetky ID, všetky usernames, heslá(kódované), aktivita konta a dátum. Potrebujem, aby boli ID-čka klikateľné, teda ak kliknem na ID 18, tak dostanem odkaz users.php?18 ibaže neviem ako to zapísať, ak by tu bol niekto ochotný, kto by mi to tu napísal, tak by som vám bol vďačný. Dodám aj script, ktorý mi vypíše všetky ID pod seba, ďakujem za pomoc, som v PHP začiatočník. 
 

Připojen obrázek.

Připojen obrázek.

Připojen obrázek.

?php 
    
 $query = mysqli_query($con,"SELECT * FROM `Users` WHERE `UserID` ") or die(mysqli_error());
 while($vypis= mysqli_fetch_array($query)){
 echo $vypis['UserID'].'</br>';
 }  ?>

 

 

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