<?

if(isset($_COOKIE["usNick"]) && isset($_COOKIE["usPass"]))
{

$user=uc($_COOKIE["usNick"]);

require('config.php');
$sql = "SELECT * FROM tb_users WHERE username='$user'";
$result = mysql_query($sql);        
$row = mysql_fetch_array($result);
mysql_close($con);

$wask = uc($_COOKIE["usNick"]);

$wesk = $row['username'];

if("$wesk" != "$wask") {
echo "Не найден указанный логин.";
?>
<input type="button" value="Reload Page" onClick="window.location='./logout.php';">
<?
exit();
}

$wazk = uc($_COOKIE["usPass"]);

$wezk = $row['password'];

if("$wezk" != "$wazk") {
echo "Не верный пароль.";
?>
<input type="button" value="Reload Page" onClick="window.location='./logout.php';">
<?
exit();
}

echo"<span class=\"pathway\">";
require('config.php');
$sql = "SELECT * FROM tb_users WHERE username='$user'";
$result = mysql_query($sql);        
$row = mysql_fetch_array($result);
mysql_close($con);
$administrator = $row['user_status'];

echo"&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color:#fff\">Вы вошли как ".$row['username']."</span>";

if ($row['account'] ==""){
	echo"
			
			<span>(стандарт)</span>";
} else {
	echo"
		
			<span style=\"color:#ffd201;font-weight:bold;\">(premium)</span>";
}

		if($administrator == "admin") {

				echo "&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"wmeadm/\" target=\"_blank\">Админка</a>";
}

}
else
{

echo "Добро пожаловать Гость!";
}

?>

