Файл: vkollektive2014/users_hi.php
Строк: 147
<?
include 'connect.php';
include 'core/reg_head.php';
echo'<div class="div"><a href="/about_no_reg.php">Первый раз на vKollektive.net?</a></div>';
include 'core/page_ava.php';
#####
require('core/ip.php');
if(isset($_GET['out_yes'])){
$agent = check($agent);
$ip = check($ip);
mysql_query("UPDATE `users` SET
`ip` = '$ip',
`ua` = '$agent'
WHERE `id` = '$u[id]'");
unset ($_SESSION['login']);
unset ($_SESSION['pass']);
setcookie('clogin', '');
setcookie('cpass', '');
header('location: index.php');
exit;
}
if($_GET['out']==1){
require('head.php');
if(!$u['id']) {
echo '<div class="cred">Куда вам выходить вы и так не авторизированные!</div>';
require('foot.php');
exit;
}
echo '<div class="div">Вы уверены что хотите выйти с vKollektive.net?<br/>';
echo '<form action="?out_yes" method=post>';
echo '<input type=submit name="submit" value="Да" class="submit white"/></form>';
echo "<a href='/index.php'> Вернутся обратно!</a></div>";
echo '</div>';
include 'foot.php';
exit;
}
if($u['id']) { header('location: privet.php'); exit; }
if ($_SESSION['err'] == 1){
$kod = num($_GET['kod']);
if ($_SESSION['r'] == $kod ){
$_SESSION['err'] = 0;
}
}
if($_SESSION['err'] == 0) {
$id = isset($_GET['id']) ? num($_GET['id']) : NULL;
$login = isset($_GET['login']) ? check($_GET['login']) : NULL;
$pass = isset($_GET['p']) ? check($_GET['p']) : NULL;
if ($pass && ($login || $id)) {
$sql = $id ? "`id` = '$id'" : "`login` = '$login'";
$req = mysql_query("SELECT * FROM `users` WHERE $sql LIMIT 1");
if (mysql_num_rows($req)) {
$u = mysql_fetch_assoc($req);
if (md5(md5($pass)) == $u['pass']) {
// Установка данных COOKIE
if ($_GET['save'] == 1) {
$clogin = $u['login'];
$cpass = md5($pass);
setcookie("clogin", $clogin, time() + 3600 * 24 * 365);
setcookie("cpass", $cpass, time() + 3600 * 24 * 365);
}
// Установка данных сессии
$_SESSION['login'] = $u['login'];
$_SESSION['pass'] = md5(md5($pass));
$agent = check($agent);
$ip = check($ip);
mysql_query("UPDATE `users` SET
`ip` = '$ip',
`ua` = '$agent'
WHERE `id` = '$u[id]'");
header('Location: privet.php');
exit;
} else {
$_SESSION['err'] = 0;
header('Location: login.php');
exit;
}
} else {
$_SESSION['err'] = 1;
header('Location: login.php?err=1');
exit;
}
}
}
if($_GET['err']) {
echo '<div class = "div">Не правильно введен логин или пароль!</div>';
}
echo'<div class="div">';
echo '<form action="login.php" method=get>
Введите ваш логин:<br/>
<input type=text name=login maxlength=25 size="15"><br/>
Введите ваш пароль:<br/>
<input type=password name=p maxlength=25 size="15"><br/>';
echo '<input name="save" type="checkbox" value="1"/> Запомнить меня<br/>';
echo '<input type=submit value="Авторизация" size="15" class="submit white"/><br/></form></div>';
echo '<div class="div"><img src = "ico/reg.gif"> <a href="registration.php">Бесплатная регистрация </a>';
echo '</div>';
####
####
$q = mysql_query("select * from `users` ORDER BY `id` desc LIMIT 4;");
$post = mysql_fetch_array(mysql_query("select `login` from `users` where `id` = '$id[0]';"));
echo "<div class='menu2'><font color='white'>Сегодня к нам просиединились:</font></div>";
while ($post = mysql_fetch_array($q))
{
# echo"<br />";
echo "<div class='div'>";
echo page_ava($post['id'],70);
echo ''. ico($post['sex'], $post['admin'], $post['online']) .' ';
if ($post['anketa_name']!=NULL){echo '<a href = "/page.php?id='.$post['id'].'"> '.$post['login'].' </a></div>';}
else{
echo '<a href = "/page.php?id='.$post['id'].'"><font color="#8f8c85"> '.$post['login'].' </font></a>';
echo "</div>";
echo "</div>";
mysql_query("UPDATE `users` SET `online` = '".time()."', `location` = '".@$location."', `chat_location` = '".@$chat_location."' WHERE `id` = '".$u['id']."'");
if($u['online']){
$timeplus = time()-$u['online'];
if($timeplus < $system['online_time']){
mysql_query("UPDATE `users` SET `anketa_alltime` = '".($u['anketa_alltime'] + $timeplus)."' WHERE `id` = '".$u['id']."'");
} else {
mysql_query("UPDATE `users` SET `anketa_alltime` = '".($u['anketa_alltime'] + $system['online_time'])."' WHERE `id` = '".$u['id']."'");
}
}
if($user['rating']>=1000 && $user['rating']<=1999)echo "<img src='ico/b.png' alt='' class='icon'</a>n";
if($user['rating']>=2000 && $user['rating']<=2999)echo "<img src='ico/s.png' alt='' class='icon'</a>n";
if($user['rating']>=3000)echo "<img src='ico/z.png' alt='' class='icon'</a>n";
$vip = mysql_fetch_array(mysql_query("SELECT * FROM `vip_users` WHERE `id_user` = '".$user['id']."'"));
if((int)$vip['id'] > 0){ echo " <img src='/style/vip_icons/{$vip['icon']}.gif' />n"; }
if ($user['strana']==0)echo "n";
if ($user['strana']==1)echo "<img src='/style/strana/ru.png'>n";
if ($user['strana']==2)echo "<img src='/style/strana/ua.png'>n";
if ($user['strana']==3)echo "<img src='/style/strana/by.png'>n";
if ($user['strana']==4)echo "<img src='/style/strana/az.png'>n";
if ($user['strana']==5)echo "<img src='/style/strana/kz.png'>n";
if ($user['strana']==6)echo "<img src='/style/strana/uz.png'>n";
if ($user['strana']==7)echo "<img src='/style/strana/england.png'>n";
if ($user['strana']==8)echo "<img src='/style/strana/de.png'>n";
###
}
}
include 'core/reg_foot.php';
?>