Файл: titwar.ru/mystatus.php
Строк: 28
<?
include './system/common.php';
include './system/functions.php';
include './system/user.php';
if(!$user) {
header('location: /');
exit;
}
if($user['tut'] == 1) {
header('location: /');
exit;
}
$title = 'Status';
include './system/h.php';
$status = _string($_POST['status']);
if($status) {
if(!preg_match('/[a-z0-9а-я]{2,20}/i', $status)) $errors[] = 'Error status';
if(mysql_result(mysql_query('SELECT COUNT(*) FROM `users` WHERE `status` = ''.$status.'''),0) != 0) $errors[] = 'Status of error';
if($errors) {
echo '<div class='content' align='center'>';
foreach($errors as $error) {
echo $error.'<br/>';
}
echo '</div>
<div class='line'></div>';
}
else
{
mysql_query('UPDATE `users` SET `status` = ''.$status.'',
`save` = ''.$save.'',
`save` = '1',
`g` = `g` - 100 WHERE `id` = ''.$user['id'].''');
setCookie('password', $password, time() + 86400, '/');
header('location: /user');
}
}
echo '
<div class='line'></div>
<div class='content' align='center'>
<form action='/mystatus.php' method='post'>
My status: <br/>
<input name='status' size='40' value=''.$status.''/><br/>
<input type='submit' value='Save'/>
</form>
</div>
<div class='line'></div>
</div>';
include './system/f.php';
?>