<?
include 'mysql.php';
Error_Reporting(0);

list($msec,$sec)=explode(chr(32),microtime());
$HeadTime=$sec+$msec;
$_title = 'Linewap2';
include 'include/header.php';
include 'include/ini.php';
$log = htmlspecialchars(stripslashes($log));
$pas = htmlspecialchars(stripslashes($pas));
/////////////////////////////////////////////////////
$text = @file("MySql/base123/reg/$log.dat");
if ($text!=""){
$udata = explode(":||:",$text[0]);
$login=trim($udata[0]);
$password=trim($udata[1]);}
////////////////////////////////////////////////////////
if (md5($pas)==$password && $log==$login && $log!=="" && md5($pas)!=="") {

$dir = opendir ("MySql/base123/ref");
echo "<b><small>Рейтинг рефералов</small></b><br/><br/>";

$dir = opendir ("MySql/base123/ref");
while ($file = readdir ($dir))
{if (( $file != ".") && ($file != ".."))
{$a[]=$file;}}
closedir ($dir);
$total = count($a);

if($total!=="0"){

for ($i = 0; $i < $total; $i++){
$tex = @file("MySql/base123/ref/$a[$i]");
$data = explode(":||:",$tex[0]);


$dat_kol[]=$data[0];
$dat_log[]=$data[1];
}


@arsort($dat_kol);



foreach($dat_kol as $k=>$v)
{


$dat_screen[]='<small><b><a href="search.php?nick='.$dat_log[$k].'&log='.$log.'&pas='.$pas.'&go=go">'.$dat_log[$k].'</a></b><br/>Привёл: '.$dat_kol[$k].' человек<br/></small>';


}



if($total<"10"){
$list=$total;}else{$list="10";}

for ($i = 0; $i < $list; $i++){
$i2=$i+1;
echo "<small>$i2.</small> $dat_screen[$i]";
}

echo"<br/><small>Рефералов: $total</small>";

}else{echo"<small>Героев нет.</small>";}

}else{echo"<small>Пароль или логин неверен!</small>";}

include_once"include/down.php";
?>
