Вход Регистрация
Файл: user/private/index.php
Строк: 70
<?php

/* Мод "Приватность"
 * Версия v0.0.3
 * Дата последнего редактирования 28.04.2015
 * Двиг DCMS Special
 * Модифицировал densnet
 * Файл index.php
 * Описание: приватность странички пользователя
 */

require_once '../../sys/inc/start.php';
require_once 
H . 'sys/inc/compress.php';
require_once 
H . 'sys/inc/sess.php';
require_once 
H . 'sys/inc/settings.php';
require_once 
H . 'sys/inc/db_connect.php';
require_once 
H . 'sys/inc/ipua.php';
require_once 
H . 'sys/inc/fnc.php';
require_once 
H . 'sys/inc/user.php';
require_once 
H . 'sys/inc/thead.php';

user::only_reg();

$set['title'] = 'Приватность';

title();
aut();
err();

#Навигация
//echo "<div class = 'navigation'><a href = '/index.php'>Главная</a> > <a href = '/umenu.php'>Кабинет</a> > <a href = '?'><b>Приватность</b></a></div>";

if (isset($_POST['submited'])) {
    if (
in_array($_POST['access'], array('all', 'only_me', 'friends', 'pass'))) {
        
$access = $_POST['access'];
    } else {
        
$access = 'all';
    }
    if (
$access == 'pass') {
        if (
text::utf8_strlen($_POST['passwd']) < 1) {
            
$err[] = 'Введите пароль.';
        }
        if (
text::utf8_strlen($_POST['passwd']) > 16) {
            
$err[] = 'Пароль слишком длинный.';
        }
        
$password = $_POST['passwd'];
    } else {
        
$password = NULL;
    }

    if (!isset(
$err)) {
        
mysql_query("UPDATE `user` SET `profile_access` = '$access', `profile_password` = '" . mysql_real_escape_string($password) . "' WHERE `id` = '$user[id]'");
        
msg('Изменения успешно приняты');

        
header("Refresh: 1; url=/user/private/");
        echo 
"<div class = 'comm'><a href = '?mod=information'>" . img('left.png', '') . " Назад</a></div>";

        require_once 
H . 'sys/inc/tfoot.php';
        exit();
    }
}

if (!isset(
$user)) {
    
err('Доступ закрыт гостям');
} else {
    echo 
"<form class = 'comm' action = '' method = 'POST'>";
    echo 
"Кому доступен мой профиль?<br/>";
    echo 
"<label><input type = 'radio' name = 'access' value = 'all' " . ($user['profile_access'] == 'all' ? " checked = 'checked'" : NULL) . "/>" . img('globe-small.png', '') . " Всем</label><br />";
    echo 
"<label><input type = 'radio' name = 'access' value = 'only_me' " . ($user['profile_access'] == 'only_me' ? " checked='checked'" : NULL) . "/>" . img('lock-small.png', '') . " Только мне</label> <br />";
    echo 
"<label><input type='radio' name='access' value='friends' " . ($user['profile_access'] == 'friends' ? " checked='checked'" : NULL) . "/>" . img('user-small.png', '') . " Только друзьям</label><br />";
    echo 
"<label><input type='radio' name='access'  value='pass' " . ($user['profile_access'] == 'pass' ? " checked='checked'" : NULL) . " />" . img('bullet_key.png', '') . " Только по паролю <br />";
    echo 
"<input name = 'passwd' size = '16' maxlength = '16' type = 'text' value = '" . htmlspecialchars($user['profile_password']) . "' /></label><br />";
    echo 
"<button name = 'submited' class = 'flat blue md'>Сохранить";
    echo 
"</button></form>";
}

if (isset(
$_SESSION['refer']) && $_SESSION['refer'] != NULL && otkuda($_SESSION['refer'])) {
    echo 
"<div class = 'comm'><a href = '$_SESSION[refer]'>" . img('left.png', '') . " " . otkuda($_SESSION['refer']) . "</a></div>";
}
echo 
"<div class = 'comm'><a href = '/umenu.php'>" . img('left.png', '') . " Кабинет</a></div>";

require_once 
H . 'sys/inc/tfoot.php';
Онлайн: 0
Реклама