What's new

Skrypty & Kody Statystyki only rook

Status
Not open for further replies.

Faden

User
Joined
Sep 23, 2008
Messages
14
Reaction score
1
Cze??! :)
Mam ma?y problem, gdy? potrzebuje by ten skrypcik wyszukane informacje zapisywa? tylko je?eli posta? ma voc=0 (czyli rook)
To jest Skrypt na statystyki i jest napisany chyba strukturalnie i mi jako pocz?tkuj?cemu ci?zko cokolwiek tu zdzia?a?. Po prostu chce by by?y oddzielne staty main oraz rook. Tyle z mojej strony. Z g?ry dzi?kuje:>
PHP:
<h2><div class="cufon_t_h2">Statystyki Serwera</div></h2> 
<div id="topnews" class="pad1"> 
 
    <div class="mi-t"> 
        <div> 
            <div><img src="images/0.gif" alt=""/></div> 
        </div> 
    </div> 
    <div class="mi-m"> 
        <div class="mi-m1"> 
            <div class="mi-m2"> 
                <div class="news"> 

<?php
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
/* UPDATE
   STATS  */
if(isset($_GET['level'])){$set='level';}
elseif(isset($_GET['magic'])){$set='magic';}
elseif(isset($_GET['fist'])){$set='fist';}
elseif(isset($_GET['club'])){$set='club';}
elseif(isset($_GET['sword'])){$set='sword';}
elseif(isset($_GET['axe'])){$set='axe';}
elseif(isset($_GET['distance'])){$set='distance';}
elseif(isset($_GET['shield'])){$set='shield';}
elseif(isset($_GET['fishing'])){$set='fishing';}
elseif(isset($_GET['exp'])){$set='exp';}
elseif(isset($_GET['kills'])){$set='kills';}
else{$set = 'other';}

$file_ = "dbase/statistics2/".$set.".php";

include('config.php');

/*CHECK UPDATE*/
$time_check = filemtime($file_) + $rank_refresh;
if(time() >= $time_check){
//echo time()."-".$time_check;
    set_time_limit(3*60*60); // 3 hour should be enough
    //$file_ = "dbase/statistics2/".$skill.".php";
    if($set == "other"){
//begin
    $dir = opendir($todata."/data/players/");
    $sex[0] = 0;
    $sex[1] = 0;
    $voc[0] = 0;
    
    $pvoc[0] = 0;
  
    while(false !== ($file = readdir($dir))){
        if($file != '.' && $file != '..') {
            if($file[strlen($file)-1] == "l" && $file[strlen($file)-2] == "m" && $file[strlen($file)-3] == "x"){
                $xml = simplexml_load_file($todata."/data/players/".$file);
                $v = (int)$xml['voc'];
                $s = (int)$xml['sex'];
		if($xml['promoted'] == 0){
		    $voc[$v] += 1;
                } else {
		    $pvoc[$v] += 1;
                }
		$sex[$s] += 1;
            }
        }
    }
$current = "<?php";
$current .= "
\$statistics['other']['rook'] = '".$voc[0]."';


\$statistics['other']['prem_rook'] = '".$pvoc[0]."';


\$statistics['other']['male'] = '".$sex[1]."';
\$statistics['other']['female'] = '".$sex[0]."';
";

    $current .= "?>";
    file_put_contents($file_, $current);
    }
//end
    else {
//begin
$current = "<?php";
$showskill = $set;

$searched = "";
$skill_title = $showskill;
$searched = "";
switch($showskill)
{
case "level":
$searched = "level=\"";
break;
case "exp":
$searched = "exp=\"";
break;
case "kills":
$searched = "kills=\"";
break;
case "magic":
$searched = "maglevel=\"";
break;
case "fist":
$searched = "<skill skillid=\"0\" level=\"";
break;
case "club":
$searched = "<skill skillid=\"1\" level=\"";
break;
case "sword":
$searched = "<skill skillid=\"2\" level=\"";
break;
case "axe":
$searched = "<skill skillid=\"3\" level=\"";
break;
case "distance":
$searched = "<skill skillid=\"4\" level=\"";
break;
case "shield":
$searched = "<skill skillid=\"5\" level=\"";
break; 
case "fishing":
$searched = "<skill skillid=\"6\" level=\"";
break;

}
$players = $todata."/data/players/";
$i = 0;
$x = array();
$dir = @dir($players); 

if($dir === FALSE)
	{
	echo "<b>Niepoprawna ¶cie?ka do katalog?w, popraw to w configu!</b>";
	}
else
	{

	while($plik = $dir->read())
		{ 
		if(eregi(".xml$",$plik))
			{
			$file = file($players."/".$plik);
			$plik = explode(".",$plik);
			}
		for($i2 = 0; $file["$i2"]; $i2++)
			{
			$result = strstr($file[$i2], $searched);
                        //$result = strstr($searched, $file[$i2]);
			if($result)
				{
				$resultarray = explode("\"",$result);
				if($showskill == "level" || $showskill == "magic" || $showskill == "exp" || $showskill == "kills")
					{
					if($x[$i] = $resultarray[1]."---".$plik[0])
					break;
					}
				else if ($showskill == "fist" || $showskill == "club" || $showskill == "sword" || $showskill == "axe" || $showskill == "distance" || $showskill == "shield" || $showskill == "fishing")
					{
					if($x[$i] = $resultarray[3]."---".$plik[0])
					break;
					}
				}
			}
		$i++; 
		} 


	if($showskill == "level" || $showskill == "exp" || $showskill == "magic" || $showskill == "fist" || $showskill == "club" || $showskill == "sword"
	|| $showskill == "axe" || $showskill == "distance" || $showskill == "shield" || $showskill == "fishing" || $showskill == "kills")
		{

		SORT($x, 1);
		$i2 = 1;
		while($i >= 0 && $i2 <= $highscoreshow)
			{
			$result = explode("---", "$x[$i]");
			
			if($result[0] != "" && (strpos($result[1],"GM")) === FALSE && (strpos($result[1],"gm")) === FALSE && in_array($result[1],$hidden_chars) === FALSE) 
				{
				//echo "<tr><td><div class=txt>" . $i2 . ". </div></td><td width=250><div class=txt><a href=\"index.php?body=search&char=".$result['1']."\">".$result['1']."</a></div></td><td width=83><div class=txt>" .$result['0']. " </div></td></tr>\n";
$current .= "
\$statistics['".$showskill."'][".$i2."] = '".$result['1']."|".$result['0']."';";
				    $i2++;
				}
			$i--;
			
			} 

		}
	}
    $current .= "?>";
    file_put_contents($file_, $current);
//end
    }
}

include($file_);

echo "<table border='0' rules='all' width='400px'>
<tr>
<td  width='60px'>
<ul style='list-style-type:none; margin:0; padding:0; text-align:center;'>
<li> <b><u id='text_basic'>Wybierz Skill</u></b> </li><br>
				<li> <a href='index.php?subtopic=ranks2&level'><img src='images/level.png' class='tTip' title='Najlepszy Poziom'></a> </li>
				<li> <a href='index.php?subtopic=ranks2&magic'><img src='images/magic.png' class='tTip' title='Najlepszy Magiczny Poziom'></a> </li>
				<li> <a href='index.php?subtopic=ranks2&fist'><img src='images/fist.png' class='tTip' title='Najlepsza Walka Wr?cz'></a> </li>
				<li> <a href='index.php?subtopic=ranks2&club'><img src='images/club.png' class='tTip' title='Najlepsza Walka Obuchem'></a> </li>
				<li> <a href='index.php?subtopic=ranks2&sword'><img src='images/sword.png' class='tTip' title='Najlepsza Walka Mieczem'></a> </li>
				<li> <a href='index.php?subtopic=ranks2&axe'><img src='images/axe.png' class='tTip' title='Najlepsza Walka Toporem'></a> </li>
				<li> <a href='index.php?subtopic=ranks2&distance'><img src='images/dist.png' class='tTip' title='Najlepsza Walka Dystansowa'></a> </li>
				<li> <a href='index.php?subtopic=ranks2&shield'><img src='images/shield.png' class='tTip' title='Najlepsza Obrona'></a> </li>
				<li> <a href='index.php?subtopic=ranks2&kills'><img src='images/skull.png' class='tTip' title='Najlepsi ?owcy Dusz'></a> </li>
</ul>
</td>
<td valign='top' align='center'>";
if($set == "other"){
$sex_suma = (int)$statistics['other']['male'] + (int)$statistics['other']['female'];
$sex_male_per = round((int)$statistics['other']['male']/$sex_suma*100);
$sex_female_per = round((int)$statistics['other']['female']/$sex_suma*100);
echo "
<p style='font-weight:bold; font-size:25px; text-align:center; margin-top:20px; margin-bottom:40px;' id='text_basic'>Statystyki og?lne</p>
<p style='font-weight:bold; font-size:17px; text-align:center; margin-top:20px; margin-bottom:10px;' id='text_basic'>Statystyki p?ci</p>
<table width='270'>
<tr>
<td style='font-weight:bold; font-size:13px;' id='text_basic'>P?e?</td><td style='font-weight:bold; font-size:13px;' id='text_basic'>Procent</td><td style='font-weight:bold; font-size:13px;' id='text_basic'>Suma</td>
</tr>
<tr>
<td id='text_basic'>M??czyzna</td><td id='text_basic'>".$sex_male_per."%</td><td id='text_basic'>".$statistics['other']['male']."</td>
</tr>
<tr>
<td id='text_basic'>Kobieta</td><td id='text_basic'>".$sex_female_per."%</td><td id='text_basic'>".$statistics['other']['female']."</td>
</tr>
</table>
";
$voc_suma = (int)$statistics['other']['rook']+(int)$statistics['other']['prem_rook'];
$voc_rook_per = round((int)$statistics['other']['rook']/$voc_suma*100);
$voc_p_rook_per = round((int)$statistics['other']['prem_rook']/$voc_suma*100);
echo '
<p style="font-weight:bold; font-size:17px; text-align:center; margin-top:20px; margin-bottom:10px;" id="text_basic">Statystyki profesji</p>
<table width="270">
<tr>
<td style="font-weight:bold; font-size:13px;" id="text_basic">Profesja</td><td style="font-weight:bold; font-size:13px;" id="text_basic">Procent</td><td style="font-weight:bold; font-size:13px;" id="text_basic">Suma</td>
</tr>
<tr>
<td id="text_basic">Rook</td><td id="text_basic">'.$voc_rook_per.'%</td><td id="text_basic">'.$statistics['other']['rook'].'</td>
</tr>
<tr>
<td id="text_basic">Premium Rook</td><td id="text_basic">'.$voc_p_rook_per.'%</td><td id="text_basic">'.$statistics['other']['prem_rook'].'</td>
</tr>
</table>
';
} else {
$pages = ceil(count($statistics[$set])/$number_per_page);
$act_page = isset($_GET['page']) ? $_GET['page'] : 1;  

if($act_page <= $pages && $act_page >= 1){

echo "
<p style='font-weight:bold; font-size:25px; text-align:center;' id='text_basic'>Statystyki ".$set."</p>
<p style='margin-top:-10px; text-align:center; margin-bottom:20px;' id='text_basic'>
( ";
for($s=1;$s<=$pages;$s++){
if($act_page == $s){
echo '<b id="text_basic">'.$s.'</b> ';
} else {
echo '<a href="index.php?subtopic=ranks&'.$set.'&page='.$s.'">'.$s.'</a> ';
}
}
echo ")
</p>
<table width='270' style='margin-left:40px;'>
<tr>
<td style='font-weight:bold; font-size:13px;' id='text_basic'>#</td><td style='font-weight:bold; font-size:13px;' id='text_basic'>Nick</td><td style='font-weight:bold; font-size:13px;' id='text_basic'>Level</td>
</tr>";


$i = 1;
while($i <= $number_per_page){
$d = $i+(($act_page-1)*30);
if($statistics[$set][$d] == ""){
break;
}

$ex = explode("|",$statistics[$set][$d]);
echo "
<tr>
<td id='text_basic'>".$d."</td><td><d class='tTip' title='Przejd? do statystyk.' id='text_red'><a href='index.php?subtopic=character&char=".$ex[0]."'>".$ex[0]."</a></d></td><td id='text_basic'>".$ex[1]."</td>
</tr>
";
$i++;
}


echo "
</table>
";

} else {
echo "Nie ma takiej strony!";
}

}
echo "
</td>
";

echo '<br/><center><tr><td colspan="2" align="center"><p style="margin-top:10px;"><center id="text_basic">Last refresh:<br/>'.date("jS F Y H:i:s",filemtime($file_)).'</center></p></td></tr></table></center><br>';

}
?>
                </div> 
            </div> 
        </div> 
    </div> 
    <div class="mi-b"> 
        <div> 
            <div><img src="images/0.gif" alt=""/></div> 
        </div> 
    </div> 
 
</div>
 

Faden

User
Joined
Sep 23, 2008
Messages
14
Reaction score
1
Odp: Statystyki only rook

[MENTION=124997]Refresh[/MENTION] ,,,,,,,,,,,,,,,,,,,,
 

Atlas

Advanced User
Joined
May 29, 2008
Messages
340
Reaction score
19
Odp: Statystyki only rook

Musisz wpisa? takie zapytanie przed tym co chcesz aby by?o wy?wietlane

PHP:
<?php

if($voc == 0)
{
    //wy?wietla twoj? zawarto??
}
{
    //nic nie wy?wietla 
}

Mam nadziej? ?e zarysowa?em Ci co i jak :)
 
Status
Not open for further replies.
Top