Файл: modules/users/edit.php
Строк: 99
<?php
define('R', $_SERVER['DOCUMENT_ROOT']);
define('S', R.'/system');
require_once(R.'/system/kernel.php');
$tmp->header('edit_profile');
$tmp->title('title', Language::config('edit_profile'));
User::panel();
if(!User::aut()){
header('location: /');
}
if (isset($_REQUEST['submit'])) {
$name = $db->guard($_POST['name']);
$fname = $db->guard($_POST['fname']);
$strana = $db->guard($_POST['strana']);
$gorod = $db->guard($_POST['gorod']);
$osebe = $db->guard($_POST['osebe']);
$email = $db->guard($_POST['email']);
$tg = $db->guard($_POST['tg']);
$sex = $db->guard($_POST['sex']);
if (!empty($name) && !preg_match("#^([A-zА-я0-9-_ ])+$#ui", $_POST['name']) || (!empty($fname) && !preg_match("#^([A-zА-я0-9-_ ])+$#ui", $_POST['fname']))) {
$error .= Language::config('sim_no_reg_name')."<br/>";
}
if (!empty($email) && !filter_var($email, FILTER_VALIDATE_EMAIL)) $error .= Language::config('email_error')."<br/>";
if (!isset($error)) {
$db->query("UPDATE `users` set `name` = '".$db->escape($name)."', `first_name` = '".$db->escape($fname)."', `sex` = '".$db->escape($sex)."', `country` = '".$db->escape($strana)."', `city` = '".$db->escape($gorod)."', `about` = '".$db->escape($osebe)."', `email`= '".$db->escape($email)."', `tg` = '".$db->escape($tg)."' WHERE `id`='".User::ID()."' ");
$tmp->div('success', Language::config('ok_save'));
}
}
error($error);
$a=$db->fass("select * from `users` where `id` = '".User::ID()."'");
$tmp->div('menu' ,'<a class="items" href="/ava">'.img('ava.png').' '.Language::config('downl_ava').'</a>');
$tmp->div('main' ,'<form method="POST" action="">
'.Language::config('name').': <br/>
<input type="text" name="name" value="'.out($a['name']).'" /><br/>
'.Language::config('fname').'<br/>
<input type="text" name="fname" value="'.out($a['first_name']).'"/><br/>
'.Language::config('country').':<br/>
<input type="text" name="strana" value="'.out($a['country']).'"/><br/>
'.Language::config('city').':<br/>
<input type="text" name="gorod" value="'.out($a['city']).'"/><br/>
'.Language::config('about').':<br/>
<input type="text" name="osebe" value="'.out($a['about']).'"/><br/>
'.Language::config('sex').': <br/>
<select name="sex">
<option value="1" '.(out($a['sex']) == 1 ? 'selected="selected"':NULL).'>'.Language::config('men').'</option>
<option value="0" '.(out($a['sex']) == 0 ? 'selected="selected"':NULL).'>'.Language::config('wom').'</option>
</select><br/>
'.Language::config('email').':<br/>
<input type="text" name="email" value="'.out($a['email']).'"/><br/>
'.Language::config('tg').':<br/>
<input type="text" name="tg" value="'.out($a['tg']).'"/><br/>
<input type="submit" name="submit" value="'.Language::config('save').'" /></form>');
$tmp->div('menu', '<hr><a href="/panel">'.img('link.png').' '.Language::config('back').'</a>');
$tmp->footer();
?>