View file admin_list/user_edit.php

File size: 5.61Kb
<?php
/*
=============================================
Движок: SHCMS Engine
=============================================
Название файла: Редактирование личных данных пользователей
=============================================
Official website: http://shcms.ru
=============================================
*/
define('SHCMS', true);
include_once'../system/inc/system_core.php';
$shcmsengine['title'] = Lang::get('Редактирование личных данных пользователей');
include_once'../template/head.php';
engine::available();
if($_GET['id']){$id =$_GET['id'];}
user::users_admin();

if($user_id and $user4['team'] != 6) {
echo engine::errors(Lang::get('У вас недостаточно прав для доступа'));
header('Refresh: 1; url=/index.php?'.$conservation.'&');
	include_once'../template/foot.php';
exit();
}
if(!$id)
{
engine::errors(Lang::get('Вы зашли неправильно'));
header('Refresh: 1; url=/index.php?'.$conservation.'&');
exit();
}
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='$id'"));

if(isset($_POST['submit']))
{$submit = $_POST['submit'];}

if(isset($submit))
{
if ($user['id'] == $user_id);
if(isset($_POST['name']))
{$name = $_POST['name'];}
if(isset($_POST['login']))
{$login = $_POST['login'];}
if(isset($_POST['last_name']))
{$last_name = $_POST['last_name'];}
if(isset($_POST['email']))
{$email = $_POST['email'];}
if(isset($_POST['icq']))
{$icq = $_POST['icq'];}
if(isset($_POST['skype']))
{$skype = $_POST['skype'];}
if(isset($_POST['us_d']))
{$us_d = $_POST['us_d'];}
if(isset($_POST['us_m']))
{$us_m = $_POST['us_m'];}
if(isset($_POST['us_g']))
{$us_g = $_POST['us_g'];}
if(isset($_POST['description']))
{$description = $_POST['description'];}
if(isset($_POST['wmid']))
{$wmid = $_POST['wmid'];}
if($_POST['pol'])
{$pol =$_POST['pol'];}
$user['name'] = isset($name) ? engine::inspect(substr($name, 0, 30)) : '';  
$user['login'] = isset($login) ? engine::inspect(substr($login, 0, 40)) : '';  
$user['last_name'] = isset($last_name) ? engine::inspect(substr($last_name, 0, 30)) : '';           
$user['email'] = isset($email) ? engine::inspect(substr($email, 0, 30)) : ''; 
$user['icq'] = isset($icq) ? engine::inspect(substr($icq, 0, 10)) : ''; 
$user['skype'] = isset($skype) ? engine::inspect(substr($skype, 0, 25)) : ''; 
$user['us_d'] = isset($us_d) ? engine::inspect(substr($us_d, 0, 2)) : ''; 
$user['us_m'] = isset($us_m) ? engine::inspect(substr($us_m, 0, 2)) : ''; 
$user['us_g'] = isset($us_g) ? engine::inspect(substr($us_g, 0, 25)) : ''; 
$user['description'] = isset($description) ? engine::inspect(substr($description, 0, 255)) : '';  
$user['wmid'] = isset($wmid) ? engine::inspect(substr($wmid, 0, 13)) : '';  
$user['pol'] = (isset ($pol) && $pol);
$icq = engine::rus_lat(strtolower($user['icq']));
			
			if(!is_numeric($icq)){
			engine::errors(Lang::get('В ICQ должны быть только цифры!'));
			}
	
			if($submit ==true)
{

$ok_true = mysql_query("UPDATE `users` SET `name`='$name',`last_name`='$last_name',`email`='$email',`icq`='$icq',`skype`='$skype',`us_d`='$us_d',`us_m`='$us_m',`us_g`='$us_g',`description`='$description',`wmid`='$wmid',`pol`='$pol' WHERE `id`='$id'");

if ($ok_true == true)
{
engine::correct(Lang::get('Изменение успешно вступили в силу'));
}
else
{
engine::errors(Lang::get('Возникла ошибка при изменение профиля'));
}

}

}

echo '<form action="?id='.$id.'&'.$conservation.'" method="post">';
echo '<div class="maintitle mainrazd">'.Lang::get('Изменить логин:').'</div><div class="maintext">';
echo Lang::get('Логин:').'<br/><input type="text" maxlength="32" name="login" value="'.$user['login'].'"></div>';
echo '<div class="maintitle mainrazd">'.Lang::get('Изменить личные данные:').'</div><div class="maintext">';
echo Lang::get('Имя:').'<br/><input type="text" maxlength="32" name="name" value="'.$user['name'].'"><br/>';
echo Lang::get('Фамилия:').'<br/><input type="text" maxlength="32" name="last_name" value="'.$user['last_name'].'"><br/>';
echo Lang::get('Дата рождение:').'<br/><input size="2" type="text"  maxlength="2"name="us_d" value="'.$user['us_d'].'"> ';
echo '<input size="2" type="text"  maxlength="2"name="us_m" value="'.$user['us_m'].'"> ';
echo '<input size="4" type="text"  maxlength="4"name="us_g" value="'.$user['us_g'].'"><br/>';
echo Lang::get('E-mail:').'<br/><input type="text"  maxlength="32"name="email" value="'.$user['email'].'"><br/>';
echo Lang::get('ICQ:').'<br/><input type="text" maxlength="10" name="icq" value="'.$user['icq'].'"><br/>';
echo Lang::get('Skype:').'<br/><input type="text" maxlength="32" name="skype" value="'.$user['skype'].'"><br/>';
echo Lang::get('WMID:').'<br/><input type="text" maxlength="12" name="wmid" value="'.$user['wmid'].'"><br/>';
echo Lang::get('Ваш Пол:').'<br/> <select name="pol">';
echo '<option value="1"'.((isset($user['pol']) and $user['pol'] == 1)?" selected='selected'":null).'>'.Lang::get('Мужской').'</option>';
echo '<option value="2"'.((isset($user['pol']) and $user['pol'] == 2)?" selected='selected'":null).'>'.Lang::get('Женский').'</option>';
echo '</select><br/>';
echo Lang::get('О себе:(мах: 255 символов)').'<br/><textarea name="description">'.$user['description'].'</textarea><br/>';
echo '<input type="submit" name="submit" value="'.Lang::get('Применить').'"></form></div>';




	include_once'../template/foot.php';

?>