Autor Zpráva
Watchick
Profil
Zdravím, mám problém s kódem
Uvedl jsem ho pro jistotu celý, aby to dávalo smysl...

Zkráceně...
Ze server každý den ráno aktualizuje data uzivatelu hry a nadém světě...
Script, data stáhne, vloží je do xxxxx_deufalut (xxxxx je napriklad s12-cz) poté projede xxxxxx_deufalut a vybere z ní pouze hráče, a uloží je do xxxxxx_hraci, to stejné s aliancemi...
Toto se provede v pořádku, pouze pokud je tabulka vyprázdněná, pokud prázdná není, a jsou tam již data například z minulého dne, tak se tam naimportuje pouze něco, a opravdu nevím proc, třeba jen 900 záznamů, místo 16 000 z tabulky xxxxx_deufalut...
Že by nějaká podmínka?
Já ji nenašel...
Kdyby někdo byl tak laskav a podíval se mi na to, byl bych mu zavázán

//edit: dodatek: jo a když na dannou stránku někdo přijde, tak se mu nabídnou servery, které ještě ten den nebyly aktualizovany..

Tabulka info, tam jsou data kdy a co bylo importovano, na prikladu se serverem s1 jsou ty ty 3 tabulky:
CREATE TABLE `info` (
  `id` int(11) NOT NULL auto_increment,
  `server` varchar(50) NOT NULL,
  `deufalut` int(11) NOT NULL,
  `hraci` int(11) NOT NULL,
  `aliance` int(11) NOT NULL,
  `celkem` int(11) NOT NULL,
  `date` varchar(50) NOT NULL,
  `time` varchar(50) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=11 ;

CREATE TABLE `s1-cz_aliance` (
  `id` int(11) NOT NULL auto_increment,
  `aid` int(11) NOT NULL,
  `nazev` varchar(100) NOT NULL,
  `clenu` int(10) unsigned zerofill NOT NULL,
  `bodu` int(10) unsigned zerofill NOT NULL,
  `misto` int(10) unsigned zerofill NOT NULL,
  `date` varchar(50) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `aid` (`aid`),
  KEY `date` (`date`),
  KEY `clenu` (`clenu`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=283 ;


CREATE TABLE `s1-cz_deufalut` (
  `id` int(9) unsigned NOT NULL default '0',
  `x` smallint(3) NOT NULL default '0',
  `y` smallint(3) NOT NULL default '0',
  `tid` tinyint(1) unsigned NOT NULL default '0',
  `vid` int(9) unsigned NOT NULL default '0',
  `village` varchar(20) collate utf8_czech_ci NOT NULL default '',
  `uid` int(9) NOT NULL default '0',
  `player` varchar(20) collate utf8_czech_ci NOT NULL default '',
  `aid` int(9) unsigned NOT NULL default '0',
  `alliance` varchar(8) collate utf8_czech_ci NOT NULL default '',
  `population` smallint(5) unsigned NOT NULL default '0',
  `date` varchar(50) collate utf8_czech_ci NOT NULL,
  UNIQUE KEY `id` (`id`),
  KEY `x` (`x`),
  KEY `y` (`y`),
  KEY `vid` (`vid`),
  KEY `uid` (`uid`),
  KEY `aid` (`aid`),
  KEY `date` (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;



CREATE TABLE `s1-cz_hraci` (
  `id` int(11) NOT NULL auto_increment,
  `uid` int(11) NOT NULL,
  `aid` int(11) NOT NULL,
  `nick` varchar(100) NOT NULL,
  `pop` int(10) unsigned zerofill NOT NULL,
  `misto` int(10) unsigned zerofill NOT NULL,
  `date` varchar(50) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `date` (`date`),
  KEY `uid` (`uid`),
  KEY `aid` (`aid`),
  KEY `nick` (`nick`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2331 ;








<?php
include "spojeni-mapy.php";
$adresy_k_loadu = array ("speed-cz","s1-cz","s2-cz","s3-cz","s4-cz","s5-cz","s6-cz","s7-cz","s8-cz","s9-cz","s10-cz","s11-cz","s12-cz","s13-cz","s14-cz","s15-cz","s16-cz");
$pocet_adres_k_loadu = 17;
if($_GET['part'] == ""){
foreach($adresy_k_loadu AS $forkey => $momentalist){
$poku1 = explode("-",$momentalist);
if (mysql_num_rows(mysql_query("SELECT * FROM info WHERE `server` = '".$momentalist."' AND `date`='". date("Y-m-d") ."'"))==0){
Echo "Server <b>" . $poku1[0] . "</b> V zemi <b>" . $poku1[1] . "</b> Zatím nebyl aktializován, <a href=\"?part=2&server_get=$momentalist&overeni=$forkey\">provést aktualizaci</a><br />";
$poku1 = "";
}else{
$ras22=mysql_query("SELECT time FROM `info` WHERE `server` = '".$momentalist."' AND `date`='". date("Y-m-d") ."' LIMIT 1");
if($ras2=mysql_fetch_array($ras22))$time_load = $ras2['time'];
Echo "Server <b>" . $poku1[0] . "</b> V zemi <b>" . $poku1[1] . "</b> Byl úspěšně aktualizován v ".date("G:i:s d.m.Y",$time_load)."<br />";
}
}
}elseif($_GET['part'] == 2){

if($_GET['server_get'] == $adresy_k_loadu[$_GET['overeni']]){
$zacatek = time();
$aktivnich_uploadu = 0;
FOR ($z=0;$z<1;$z++){

$pok1 = explode("-",$_GET['server_get']);
$loadurl = "http://" . $pok1[0] . ".*********." . $pok1[1] . "/map.sql";
$deufaluttable = $_GET['server_get'];


if (mysql_num_rows(mysql_query("SELECT * FROM info WHERE `date`='". date("Y-m-d") ."' AND server='$deufaluttable'"))!=1){
mysql_query("INSERT INTO info (server,`date`) VALUES('$deufaluttable','". date("Y-m-d") ."')");
}

if (mysql_num_rows(mysql_query("SELECT * FROM info WHERE `date`='". date("Y-m-d") ."' AND server='$deufaluttable'"))!=1){
mysql_query("UPDATE info SET celkem = '1' WHERE `date`='". date("Y-m-d") ."' AND server='$deufaluttable'");
mysql_query("UPDATE info SET time = '".time()."' WHERE `date`='". date("Y-m-d") ."' AND server='$deufaluttable'");

}

if (mysql_num_rows(mysql_query("SELECT * FROM info WHERE `date`='". date("Y-m-d") ."' AND celkem = '1' AND server='$deufaluttable'"))!=1){
$zacatek = time();
if (mysql_num_rows(mysql_query("SELECT * FROM info WHERE `date`='". date("Y-m-d") ."' AND deufalut = '1' AND server='$deufaluttable'"))!=1){
mysql_query("DELETE FROM `" . $deufaluttable . "_deufalut` WHERE `date`='". date("Y-m-d") ."'");
$html = file_get_contents($loadurl);
$radek = explode("\n",$html);
foreach ($radek as $temp) {
$temp = $temp . ">ßß×ß|Đ[@&#Đ]Đ[[sdfeterddg";
$temp = Str_Replace("INSERT INTO `x_world`","INSERT INTO `".$deufaluttable."_deufalut`",$temp);
$temp = Str_Replace(");>ßß×ß|Đ[@&#Đ]Đ[[sdfeterddg",",'". date("Y-m-d") ."');",$temp);
echo $temp; echo "<br>";
mysql_query($temp);
$o++;
}
}
mysql_query("UPDATE info SET deufalut = '1' WHERE `date`='". date("Y-m-d") ."' AND server='$deufaluttable'");
if (mysql_num_rows(mysql_query("SELECT * FROM info WHERE `date`='". date("Y-m-d") ."' AND deufalut='1' AND hraci = '1' AND aliance = '1' AND server='$deufaluttable'"))!=1){
mysql_query("UPDATE info SET celkem = '1' WHERE `date`='". date("Y-m-d") ."' AND server='$deufaluttable'");
mysql_query("UPDATE info SET time = '".time()."' WHERE `date`='". date("Y-m-d") ."' AND server='$deufaluttable'");
}




if (mysql_num_rows(mysql_query("SELECT * FROM info WHERE `date`='". date("Y-m-d") ."' AND hraci = '1' AND server='$deufaluttable'"))!=1){
mysql_query("DELETE FROM `" . $deufaluttable . "_hraci` WHERE `date`='". date("Y-m-d") ."'");

$co="SELECT uid,aid,player,population FROM `" . $deufaluttable . "_deufalut` WHERE `date`='". date("Y-m-d") ."'";
include "spojeni2-mapy.php";
while (list($uid,$aid,$player,$population) = mysql_fetch_array($navrat)){
if (mysql_num_rows(mysql_query("SELECT * FROM `" . $deufaluttable . "_hraci` WHERE `date`='". date("Y-m-d") ."' AND uid='$uid'"))!=1){
mysql_query("INSERT INTO `" . $deufaluttable . "_hraci` (uid,aid,nick,pop,date) VALUES ('$uid','$aid','$player','$population','". date("Y-m-d") ."')");
}
}
$misto = 1;
$co="SELECT id FROM `" . $deufaluttable . "_hraci` WHERE `date`='". date("Y-m-d") ."' ORDER BY pop DESC";
include "spojeni2-mapy.php";
while (list($idlist) = mysql_fetch_array($navrat)){
mysql_query("UPDATE `" . $deufaluttable . "_hraci` SET misto='$misto' WHERE id='$idlist' AND `date`='". date("Y-m-d") ."'");
$misto++;
}


mysql_query("UPDATE info SET hraci = '1' WHERE `date`='". date("Y-m-d") ."' AND server='$deufaluttable'");
if (mysql_num_row
Watchick
Profil
nevešlo se....
if (mysql_num_rows(mysql_query("SELECT * FROM info WHERE `date`='". date("Y-m-d") ."' AND deufalut='1' AND hraci = '1' AND aliance = '1' AND server='$deufaluttable'"))!=1){
mysql_query("UPDATE info SET celkem = '1' WHERE `date`='". date("Y-m-d") ."' AND server='$deufaluttable'");
mysql_query("UPDATE info SET time = '".time()."' WHERE `date`='". date("Y-m-d") ."' AND server='$deufaluttable'");

}



}

if (mysql_num_rows(mysql_query("SELECT * FROM info WHERE `date`='". date("Y-m-d") ."' AND aliance = '1' AND server='$deufaluttable'"))!=1){
mysql_query("DELETE FROM `" . $deufaluttable . "_aliance` WHERE `date`='". date("Y-m-d") ."'");

$co="SELECT aid,pop FROM `" . $deufaluttable . "_hraci` WHERE `date`='". date("Y-m-d") ."'";
include "spojeni2-mapy.php";
while (list($aid,$population) = mysql_fetch_array($navrat)){
if($aid != 0){
$ra22=mysql_query("SELECT alliance FROM `" . $deufaluttable . "_deufalut` WHERE aid='".$aid."' AND `date`='". date("Y-m-d") ."' LIMIT 1");
if($ra2=mysql_fetch_array($ra22))$nazev_ally = $ra2['alliance'];
if (mysql_num_rows(mysql_query("SELECT * FROM `" . $deufaluttable . "_aliance` WHERE `date`='". date("Y-m-d") ."' AND aid='$aid'"))!=1){
mysql_query("INSERT INTO `" . $deufaluttable . "_aliance` (aid,nazev,clenu,bodu,date) VALUES ('$aid','$nazev_ally','1','$population','". date("Y-m-d") ."')");
}else{
mysql_query("UPDATE `" . $deufaluttable . "_aliance` SET bodu = bodu + $population WHERE aid='$aid' AND `date`='". date("Y-m-d") ."' LIMIT 1");
mysql_query("UPDATE `" . $deufaluttable . "_aliance` SET clenu = clenu + 1 WHERE aid='$aid' AND `date`='". date("Y-m-d") ."' LIMIT 1");
}
}
}


$misto = 1;
$co="SELECT id FROM `" . $deufaluttable . "_aliance` WHERE `date`='". date("Y-m-d") ."' ORDER BY bodu DESC";
include "spojeni2-mapy.php";
while (list($idlist) = mysql_fetch_array($navrat)){
mysql_query("UPDATE `" . $deufaluttable . "_aliance` SET misto='$misto' WHERE id='$idlist' AND `date`='". date("Y-m-d") ."'");
$misto++;
}
mysql_query("UPDATE info SET aliance = '1' WHERE `date`='". date("Y-m-d") ."' AND server='$deufaluttable'");
if (mysql_num_rows(mysql_query("SELECT * FROM info WHERE `date`='". date("Y-m-d") ."' AND deufalut='1' AND hraci = '1' AND aliance = '1' AND server='$deufaluttable'"))!=1){
mysql_query("UPDATE info SET celkem = '1' WHERE `date`='". date("Y-m-d") ."' AND server='$deufaluttable'");
mysql_query("UPDATE info SET time = '".time()."' WHERE `date`='". date("Y-m-d") ."' AND server='$deufaluttable'");
}
}




if (mysql_num_rows(mysql_query("SELECT * FROM info WHERE `date`='". date("Y-m-d") ."' AND deufalut='1' AND hraci = '1' AND aliance = '1' AND server='$deufaluttable'"))!=1){
mysql_query("UPDATE info SET celkem = '1' WHERE `date`='". date("Y-m-d") ."' AND server='$deufaluttable'");
mysql_query("UPDATE info SET time = '".time()."' WHERE `date`='". date("Y-m-d") ."' AND server='$deufaluttable'");
}
if (mysql_num_rows(mysql_query("SELECT * FROM info WHERE `date`='". date("Y-m-d") ."' AND deufalut='1' AND hraci = '1' AND aliance = '1' AND server='$deufaluttable'"))!=1){
mysql_query("UPDATE info SET celkem = '1' WHERE `date`='". date("Y-m-d") ."' AND server='$deufaluttable'");
mysql_query("UPDATE info SET time = '".time()."' WHERE `date`='". date("Y-m-d") ."' AND server='$deufaluttable'");
}
$aktivnich_uploadu = 1;
$konec = time();
echo "Mapa byla úspěšně updatnuta!<br>Start: " . date("G:i:s",$zacatek) . ", <br>konec " . date("G:i:s",$konec) . "<br><br>Trvání: " . ($konec - $zacatek) . "sec<br><br>";
foreach($adresy_k_loadu AS $forkey => $momentalist){
$poku1 = explode("-",$momentalist);
if (mysql_num_rows(mysql_query("SELECT * FROM info WHERE `server` = '".$momentalist."' AND `date`='". date("Y-m-d") ."'"))==0){
Echo "Server <b>" . $poku1[0] . "</b> V zemi <b>" . $poku1[1] . "</b> Zatím nebyl aktializován, <a href=\"?part=2&server_get=$momentalist&overeni=$forkey\">provést aktualizaci</a><br />";
$poku1 = "";
}else{
$ras22=mysql_query("SELECT time FROM `info` WHERE `server` = '".$momentalist."' AND `date`='". date("Y-m-d") ."' LIMIT 1");
if($ras2=mysql_fetch_array($ras22))$time_load = $ras2['time'];
Echo "Server <b>" . $poku1[0] . "</b> V zemi <b>" . $poku1[1] . "</b> Byl úspěšně aktualizován v ".date("G:i:s d.m.Y",$time_load)."<br />";
}
}

}else{
echo "Tato mapa již byla updatnuta, ale můžete updatnout jinou!<br><br>";
foreach($adresy_k_loadu AS $forkey => $momentalist){
$poku1 = explode("-",$momentalist);
if (mysql_num_rows(mysql_query("SELECT * FROM info WHERE `server` = '".$momentalist."' AND `date`='". date("Y-m-d") ."'"))==0){
Echo "Server <b>" . $poku1[0] . "</b> V zemi <b>" . $poku1[1] . "</b> Zatím nebyl aktializován, <a href=\"?part=2&server_get=$momentalist&overeni=$forkey\">provést aktualizaci</a><br />";
$poku1 = "";
}else{
$ras22=mysql_query("SELECT time FROM `info` WHERE `server` = '".$momentalist."' AND `date`='". date("Y-m-d") ."' LIMIT 1");
if($ras2=mysql_fetch_array($ras22))$time_load = $ras2['time'];
Echo "Server <b>" . $poku1[0] . "</b> V zemi <b>" . $poku1[1] . "</b> Byl úspěšně aktualizován v ".date("G:i:s d.m.Y",$time_load)."<br />";
}
}
exit;
}



}

}else{
Header("Location: import.php");
exit;
}
}

?>

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm: