33 lines
926 B
PHP
33 lines
926 B
PHP
|
<?php
|
||
|
|
||
|
//Проверяем права доступа
|
||
|
|
||
|
if ( $_SESSION['dostup'] !=='a' ) header( 'Location: /403/' );
|
||
|
|
||
|
unset( $user );
|
||
|
unset( $a );
|
||
|
if ($_POST){
|
||
|
$user['email'] = $_POST['email'];
|
||
|
$user['pwd'] = md5( $_POST['pwd'] );
|
||
|
$user['txt'] = $_POST['txt'];
|
||
|
$user['parent'] = $_SESSION['user_id'];
|
||
|
$a['email'] = $_POST['email'];
|
||
|
$id = $db -> get_val( 'users', $a, 'id' );//проверяем существование пользователя
|
||
|
if ( $id ) {
|
||
|
$smarty -> assign( 'error', 'Пользователь уже существует!' );
|
||
|
}else{
|
||
|
$db -> add('users', $user);
|
||
|
unset($a);
|
||
|
$a['user_id'] = $db -> id;
|
||
|
$a['dostup'] = 'u';
|
||
|
$db -> add('users_groupe', $a);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
unset( $a );
|
||
|
$a['parent'] = $_SESSION['user_id'];
|
||
|
$list = $db -> get_massiv( 'users', $a );
|
||
|
$smarty -> assign( 'list', $list );
|
||
|
|
||
|
|
||
|
?>
|