<?

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"
			<ul id=\"mainlevel-nav\">
				<li><a href=\"index.php\" class=\"mainlevel-nav\">Главная</a></li>
				<li><a href=\"work.php\" class=\"mainlevel-nav\">Работать</a></li>
				<li><a href=\"logout.php\" class=\"mainlevel-nav\">Выход</a></li>
				<li><a href=\"advertise.php\"
 class=\"mainlevel-nav\">Рекламодателю</a></li>
                                
		    <li><a href=\"contact.php\" class=\"mainlevel-nav\">Контакты</a></li></ul>";


}
else
{

echo "
			<ul id=\"mainlevel-nav\">
				<li><a href=\"index.php?r=".$elref."\" class=\"mainlevel-nav\">Главная</a></li>
				<li><a href=\"work.php?r=".$elref."\" class=\"mainlevel-nav\">Работать</a></li>
				<li><a href=\"register.php?r=".$elref."\" class=\"mainlevel-nav\">Регистрация</a></li>
				<li><a href=\"advertise.php?r=".$elref."\" class=\"mainlevel-nav\">Рекламодателю</a></li>
				<li><a href=\"contact.php?r=".$elref."\" class=\"mainlevel-nav\">Контакты</a></li>
				<li><a href=\"http://strategybux.org/forum/\" class=\"mainlevel-nav\">Форум</a></li></ul>";
}

?>
