Файл: public_html/settings.php
Строк: 220
<?
include './system/common.php';
include './system/functions.php';
include './system/user.php';
if(!$user) {
header('location: /');
exit;
}
if($user['save'] == 0) {
header('location: /save/');
exit;
}
switch($_GET['action']) {
default:
$title = 'Настройки';
include './system/h.php';
if (isset($_SESSION['passerr'])){
echo "".$_SESSION['passerr']."";
$_SESSION['passerr']=NULL;
}
if (isset($_SESSION['usname'])){
echo ''.$_SESSION['usname'].'';
$_SESSION['usname']=NULL;
}
if (isset($_SESSION['ussex'])){
echo ''.$_SESSION['ussex'].'';
$_SESSION['ussex']=NULL;
}
if (isset($_SESSION['usrace'])){
echo ''.$_SESSION['usrace'].'';
$_SESSION['usrace']=NULL;
}
if (isset($_SESSION['uspass'])){
echo ''.$_SESSION['uspass'].'';
$_SESSION['uspass']=NULL;
}
if (isset($_SESSION['usemail'])){
echo ''.$_SESSION['usemail'].'';
$_SESSION['usemail']=NULL;
}
$password = _string($_POST['password']);
if($password) {
if(!preg_match('/[a-z0-9]{2,20}/i', $password)) $errors[] = '<div class="error center"><center><img src="/images/icon/error.png" alt=""> Некорректный пароль персонажа!</div>';
if($errors) {
foreach($errors as $error) {
$_SESSION['namerr'] = ''.$error.'';
}
header('location: /settings/');
}else{
mysql_query('UPDATE `users` SET `password` = ''.$password.'' WHERE `id` = ''.$user['id'].''');
setCookie('password', $password, time() + 86400, '/');
$_SESSION['uspass'] = '<div class="ok center"><img src="/images/icon/ok.png" alt=""> Пароль персонажа был успешно изменён!</div>';
header('location: /settings/');
}
}
$log = mysql_num_rows( mysql_query('SELECT * FROM `log_login` WHERE `user` = ''.$user['id'].''') );
if($log ==0){ $cena='500';}
elseif($log == 1){ $cena='1000';}
elseif($log == 2){ $cena='2500';}
elseif($log == 3){ $cena='5000';}
elseif($log == 4){ $cena='10000';}
else{ $cena='50000';}
?>
<div class="block_zero">Ник: <span class="blue"><?=$user['login']?></span><br>
<img src="/images/icon/arrow.png" alt=""> <a href="/settings/name/">Изменить <img src="/images/icon/gold.png" alt=""><?=$cena?></a>
</div>
<div class="dot-line"></div>
<div class="block_zero">Сторона: <img src="/images/icon/race/<?=$user['r']?>.png" alt=""> <span class="blue"><?=($user['r'] == 0 ? 'Борея':'Асура')?></span><br>
<img src="/images/icon/arrow.png" alt=""> <a href="/settings/race/">Сменить сторону <img src="/images/icon/gold.png" alt="">1000</a>
</div><hr>
<img src="/images/icon/arrow.png" alt=""> <a href="/closemail.php/">Режим почты</a>
<div class="dot-line"></div>
<div class="block_zero">Пол: <span class="blue"><?=($user['sex'] == 0 ? 'Мужской':'Женский')?></span><br>
<img src="/images/icon/arrow.png" alt=""> <a href="/settings/sex/">Сменить пол</a>
</div>
<div class="dot-line"></div>
<img src="/images/icon/arrow.png" alt=""> <a href="/audio.php">Музыка в чате</a>
<div class="dot-line"></div>
<div class="block_zero">
<form action="/settings/" method="post">
<div>Новый пароль:<br>
<input class="text medium-text" name="password" maxlength="16" value="" type="text">
<br>
<span class="btn"><span class="end"><input class="label" name="send_message" value="Сменить" type="submit">Сменить</span></span>
</div>
</form>
</div><div class="dot-line"></div>
<img src="/images/icon/arrow.png" alt=""> <a href="log/">Журнал входов</a><div class="dot-line"></div>
<?
if(isset($_GET['ex_game'])) {
echo "Вы уверены что хотите покинуть игру?<br><a href='/?exit' class='button'>Да</a> <a href='/settings' class='button'>Нет</a>";
}else{
echo ' <a href="?ex_game">Выход</a><div class="dot-line"></a></div>';
}
?><br>
<?
if(isset($_GET['cl_exit'])) {
echo "Вы уверены что хотите покинуть клан ? <br><a href='/clan/?exit' class='button'> Да</a><a href='/settings'/ class='button'>Нет</a>";
}else{
echo '<img src="/images/icon/arrow.png" alt=""> <a href="?cl_exit">Выйти с клана</a>';
}
?>
<?
if($user['eread'] == 0){
?>
<div class="mini-line"></div>
<div class="block_zero"><img src="/images/icon/arrow.png" alt=""> <a href="/settings/email/">Укажите вашу почту</a></div>
</div>
<div class="mini-line"></div>
<?
}
?>
<?
include './system/f.php';
break;
case 'log':
$title = 'журнал входов';
include './system/h.php';
// время в прошлом склонении
function test($time_) {
if (time()-$time_<60) {
$vremya=time()-$time_;
return ' '.$vremya.'с назад';
}
elseif (time()-$time_>60 && time()-$time_<3600) {
$sec=(time()-$time_)%60;
$min=((time()-$time_)-$sec)/60;
return ' '.$min.'м '.$sec.'с назад';
}
elseif (time()-$time_>3600 && time()-$time_<3600*24) {
$min=((time()-$time_)/60)%60;
$hour=((time()-$time_)-((time()-$time_)%3600))/3600;
return ' '.$hour.'ч '.$min.'м назад';
}
elseif (time()-$time_>3600*24 && time()-$time_<3600*24*30) {
$hour=((((time()-$time_)-((time()-$time_)%3600))/3600)-((((time()-$time_)-((time()-$time_)%3600))/3600)%24))/24;
$den=((time()-$time_)-((time()-$time_)%(3600*24)))/(3600*24);
return ' '.$den.'дн '.$hour.'ч назад';
}
else {
return date('d.m.Y H:i:s', $time_);
}
}
//// вывод страниц зделан немного по красивей
function pages2($path) {
global $page, $pages;
echo'<center>';
if(($page - 1) > 0) {
echo ' <a class="btn22" href="'.$path.'page=1"><<</a> ';
}else{
echo '<<';
}
if($page - 1 > 0) {
echo ' <a class="btn22" href="'.$path.'page='.($page - 1).'"><</a> ';
} else{
echo ' < ';
}
if($page == $pages && $page - 4 > 0) {
echo ' <a class="btn22" href="'.$path.'page='.($page - 4).'">'.($page - 4).'</a> ';
}
if($page == $pages && $page - 3 > 0) {
echo ' <a class="btn22" href="'.$path.'page='.($page - 3).'">'.($page - 3).'</a> ';
}
if($page - 2 > 0) {
echo ' <a class="btn22" href="'.$path.'page='.($page - 2).'">'.($page - 2).'</a> ';
}
if($page - 1 > 0) {
echo ' <a class="btn22" href="'.$path.'page='.($page - 1).'">'.($page - 1).'</a> ';
}
echo $page;
if($page + 1 <= $pages) {
echo ' <a class="btn22" href="'.$path.'page='.($page + 1).'">'.($page + 1).'</a> ';
}
if($page + 2 <= $pages) {
echo ' <a class="btn22" href="'.$path.'page='.($page + 2).'">'.($page + 2).'</a> ';
}
if($page == 1 && $page + 3 <= $pages) {
echo ' <a class="btn22" href="'.$path.'page='.($page + 3).'">'.($page + 3).'</a> ';
}
if($page == 1 && $page + 4 <= $pages) {
echo ' <a class="btn22" href="'.$path.'page='.($page + 4).'">'.($page + 4).'</a> ';
}
if($page + 1 <= $pages) {
echo ' <a class="btn22" href="'.$path.'page='.($page + 1).'">></a> ';
}else{
echo ' > ';
}
if(($page + 1) <= $pages) {
echo ' <a class="btn22" href="'.$path.'page='.$pages.'">>></a> ';
}else{
echo ' >> ';
}
echo'</center>';
}
?>
<a class="btn22" style="width: 98%; height: 20px;" href="/settings/">Вернутся в Настройки</a>
<?
$max = 7;
$count = mysql_result(mysql_query('SELECT COUNT(*) FROM `auth` WHERE `user` = ''.$user['id'].'''),0);
$pages = ceil($count/$max);
$page = _string(_num($_GET['page']));
if($page > $pages) $page = $pages;
if($page < 1) $page = 1;
$start = $page * $max - $max;
if($count > 0) {
$q = mysql_query('SELECT * FROM `auth` WHERE `user` = ''.$user['id'].'' ORDER BY `time` DESC LIMIT '.$start.', '.$max.'');
while($row = mysql_fetch_array($q)) {
?>
<font color="SlateGray">Время входа:</font><?=test($row['time'])?><br>
<font color="SlateGray">IP:</font> <?=$row['ip']?><br>
<font color="SlateGray">Браузер:</font>
<?
if($row['result']==1){
echo'<font color="geen">';
}else{
echo'<font color="red">';
}
echo''.$row['browser'].'</font><br>'?>
<font color="SlateGray">Пароль:</font><?=$row['password']?><hr>
<?
}
echo '<div class='block_zero'>'.pages2('/settings/log/?').'</div>';
}
else
{
echo '<div class='block_zero'><font color='#909090'>пусто</font></div>';
}
include './system/f.php';
break;
//////////////////////////////////////////////
case 'log_login':
$title = 'История Ников';
include './system/h.php';
//// вывод страниц зделан немного по красивей
function pages2($path) {
global $page, $pages;
echo'<center>';
if(($page - 1) > 0) {
echo ' <a class="btn22" href="'.$path.'page=1"><<</a> ';
}else{
echo '<<';
}
if($page - 1 > 0) {
echo ' <a class="btn22" href="'.$path.'page='.($page - 1).'"><</a> ';
} else{
echo ' < ';
}
if($page == $pages && $page - 4 > 0) {
echo ' <a class="btn22" href="'.$path.'page='.($page - 4).'">'.($page - 4).'</a> ';
}
if($page == $pages && $page - 3 > 0) {
echo ' <a class="btn22" href="'.$path.'page='.($page - 3).'">'.($page - 3).'</a> ';
}
if($page - 2 > 0) {
echo ' <a class="btn22" href="'.$path.'page='.($page - 2).'">'.($page - 2).'</a> ';
}
if($page - 1 > 0) {
echo ' <a class="btn22" href="'.$path.'page='.($page - 1).'">'.($page - 1).'</a> ';
}
echo $page;
if($page + 1 <= $pages) {
echo ' <a class="btn22" href="'.$path.'page='.($page + 1).'">'.($page + 1).'</a> ';
}
if($page + 2 <= $pages) {
echo ' <a class="btn22" href="'.$path.'page='.($page + 2).'">'.($page + 2).'</a> ';
}
if($page == 1 && $page + 3 <= $pages) {
echo ' <a class="btn22" href="'.$path.'page='.($page + 3).'">'.($page + 3).'</a> ';
}
if($page == 1 && $page + 4 <= $pages) {
echo ' <a class="btn22" href="'.$path.'page='.($page + 4).'">'.($page + 4).'</a> ';
}
if($page + 1 <= $pages) {
echo ' <a class="btn22" href="'.$path.'page='.($page + 1).'">></a> ';
}else{
echo ' > ';
}
if(($page + 1) <= $pages) {
echo ' <a class="btn22" href="'.$path.'page='.$pages.'">>></a> ';
}else{
echo ' >> ';
}
echo'</center>';
}
?>
<a class="btn22" style="width: 98%; height: 20px;" href="/user/<?=$_GET['id']?>/">Вернутся к Игроку</a>
<?
$get_id = '"._string(_num("';
$max = 7;
$count = mysql_result(mysql_query('SELECT COUNT(*) FROM `log_login` WHERE `user` = ''._string(_num($_GET['id'])).'''),0);
$pages = ceil($count/$max);
$page = _string(_num($_GET['page']));
if($page > $pages) $page = $pages;
if($page < 1) $page = 1;
$start = $page * $max - $max;
if($count > 0) {
$q = mysql_query('SELECT * FROM `log_login` WHERE `user` = ''._string(_num($_GET['id'])).'' ORDER BY `time` DESC LIMIT '.$start.', '.$max.'');
while($row = mysql_fetch_array($q)) {
?>
<div class='feedback'>
<font color='darkred'><?=vremja($row['time'])?></font> <font color='green'><?=$row['login1']?></font> <font color='darkred'>сменил ник на</font> <font color='green'><?=$row['login2']?></font>
</div>
<?
}
echo '<div class='block_zero'>'.pages2('/settings/log_login/?').'</div>';
}
else
{
echo '<div class='block_zero'><font color='#909090'>пусто</font></div>';
}
include './system/f.php';
break;
case 'quit':
$title = 'Настройки';
if($clan_memb['rank'] < 4){
header('location: /settings/');
}
$id = _string(_num($_GET['id']));
if(!$id && $clan) {
$id = $clan['id'];
}
$i = mysql_query('SELECT * FROM `clans` WHERE `id` = "'.$id.'"');
$i = mysql_fetch_array($i);
if(!$clan['id'] OR $clan['id'] != $i['id']) {
header('location: /settings/');
exit;
}
include './system/h.php';
?>
<?
include './system/f.php';
break;
}
?>