View file index.php

File size: 5.46Kb
<?
header("Cache-Control: no-store, no-cache, must-revalidate");
$ver = empty($ver) || ($ver!='wml' && !file_exists('css/'.$ver.'.css')) ? 'xhtml' : $ver;
if ($ver=="wml") header ("Content-type:text/vnd.wap.wml; charset=utf-8");
else header("Content-Type:text/html; charset=UTF-8");

$inv = intval($inv);
 if(!empty($inv))
 $inv_url = '&amp;inv='.$inv;

$ref=rand(10000,1000000);

require("inc.php");
$link = connect_db();

$setting = @mysql_query ("Select * from setting where klu4='1'");
$set = mysql_fetch_array ($setting);

for ($n = 0; $n <= 22; $n++){
$room = "room".$n;
$tm = time()-300;
$r = @mysql_query ("Select id from $room WHERE id > '".$tm."' group by usid order by id desc");
$asnum = mysql_affected_rows();
@$kol = $kol + $asnum;
}

if ($ver=="wml"){
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">\n";
echo "<wml>\n";
echo "<head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>\n";
echo "<card id=\"index\" title=\"Лучший чат\">\n";
echo "<p align=\"center\" mode=\"wrap\">\n";
} else {
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/$ver.css\"/>";
echo "<title>Лучший чат</title>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/></head><body>";
echo "<div align=\"center\" mode=\"wrap\">";
}
echo "<img src=\"logo.gif\" alt=\"logo\"/><br/>\n";

$chl = "человек";
if ((($kol%10==2)||($kol%10==3)||($kol%10==4))&&($kol/10)!=1)$chl = "человека";
if ($ver=="wml"){
echo "<small>В чате: <a href=\"online.php?ver=".$ver.$inv_url."\">".$kol."</a>&nbsp;".$chl."</small><br/>";
} else {
echo "<small><div class=\"d1\">В чате: <a href=\"online.php?ver=".$ver.$inv_url."\">".$kol."</a>&nbsp;".$chl."</div></small><br/>\n";
}

$ms = mysql_query ('SELECT b.`id`, b.`user` FROM `golos` a JOIN `users` b ON b.`id` = a.`user` GROUP BY a.`user` ORDER BY COUNT( a.`who` ) DESC LIMIT 1');
 if(mysql_num_rows($ms)){
 list($best_id, $best_nick) = mysql_fetch_array($ms);
 echo '<img src="fr.php?usid='.$best_id.'" alt="'.$best_nick.'" width="75" height="75" /><br />';
 echo $best_nick.'<br />';
 }

echo $divide;
echo "<small>Добро пожаловать!</small><br/>";
echo $divide;
 if ($ver!="wml") echo "<form method=\"POST\" action=\"enter.php?ref=$ref&amp;ver=".$ver."\" name=\"auth\">\n";
echo "<small><b>Ник или ID:</b></small><br/>\n";
echo "<input name=\"us\" maxlength=\"20\" title=\"nick\"/><br/>\n";
echo "<small>Транслитировать:<a href=\"trunhelp.php?ver=".$ver.$inv_url."\">(?)</a></small><br/>\n";
echo "<select name=\"trun\">\n";
echo "<option value=\"0\">Нет</option>\n";
echo "<option value=\"1\">Да</option>\n";
echo "</select><br/>\n";
echo "<small><b>Пароль:</b></small><br/>\n";
echo "<input type=\"password\" name=\"ps\" maxlength=\"20\" title=\"password\"/><br/>\n";
echo "<small>";
if ($ver=="wml"){
echo "[ <anchor title=\"go\">Вход<go href=\"enter.php?ref=$ref&amp;ver=".$ver."\" method=\"post\">";
echo "<postfield name=\"us\" value=\"$(us)\"/>";
echo "<postfield name=\"ps\" value=\"$(ps)\"/>";
echo "<postfield name=\"trun\" value=\"$(trun)\"/>\n";
echo "</go></anchor> |";
}else {
echo "[<input type=\"submit\" value=\"Вход\" name=\"enter\">| ";
}
echo "<a href=\"reg.php?mod=reghelp&amp;ver=".$ver.$inv_url."\">Регистрация</a>]<br/>";
 if($ver != 'wml') echo '</form>';
echo "[<a href=\"ustav.php?ver=".$ver.$inv_url."\">Правила чата</a>]<br/>";
echo $divide;
echo "[<a href=\"lost_pass.php?ver=".$ver.$inv_url."\">Забыл пароль?</a>]<br/>";
echo $divide;
echo "</small>";

$num = mysql_fetch_array(mysql_query("select count(id) as num from users"));
$usersm=mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM users where sex='М'"));
$usersj=mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM users where sex='Ж'"));
echo "<small>Регистраций: ".$num[0]."</small><br/>\n";
echo "<small><small>Парней: ".$usersm[0]."</small></small><br/>\n";
echo "<small><small>Девушек: ".$usersj[0]."</small></small><br/>\n";
echo "<small>\n";
echo $divide;
echo "</small>\n";
if ($ver=="wml"){
if($set["link1"]!="") echo "<small><a href=\"http://".$set["link1"]."?ver=".$ver.$inv_url."\">".$set["link1_name"]."</a></small><br/>\n";
if($set["link2"]!="") echo "<small><a href=\"http://".$set["link2"]."?ver=".$ver.$inv_url."\">".$set["link2_name"]."</a></small><br/>\n";
if($set["link3"]!="") echo "<small><a href=\"http://".$set["link3"]."?ver=".$ver.$inv_url."\">".$set["link3_name"]."</a></small><br/>\n";
}else {
if($set["link1"]!="") {echo "<div class=\"d1\"><a href=\"http://".$set["link1"]."?ver=".$ver.$inv_url."\">".$set["link1_name"]."</a></div>\n";}
if($set["link2"]!="") {echo "<div class=\"d1\"><a href=\"http://".$set["link2"]."?ver=".$ver.$inv_url."\">".$set["link2_name"]."</a></div>\n";}
if($set["link3"]!="") {echo "<div class=\"d1\"><a href=\"http://".$set["link3"]."?ver=".$ver.$inv_url."\">".$set["link3_name"]."</a></div>\n";}
}
echo "<small>\n";
echo $divide;
echo "&#169; Powered By KoT<br/>";
echo "</small>\n";
if ($ver=="wml")echo "</p></card></wml>";
else echo "</div></body></html>";
mysql_close ($link);
?>