<?php

require_once '../incfiles/core.php';
require_once '../incfiles/func.php';
require_once '../incfiles/auth.php';
require_once '../incfiles/user.php';


if (!empty($_POST['save_status']))
{
	$status = check($_POST['status']);
	$status = substr($status, 0, 500);

	mysql_query("UPDATE `users` SET `status` = '".$status."' WHERE `id` = '".$user_id."'");
}

$title = lang('Изменить','Змінити').' статус';
if ($window == false) require_once '../incfiles/head.php';


?>
<script type="text/javascript">
$(function(){
	$('#form_status').on('submit', function(e){
    e.preventDefault();
    var $that = $(this),
        formData = new FormData($that.get(0));
    $.ajax({
      url: $that.attr('action'),
      type: $that.attr('method'),
      contentType: false,
      processData: false,
      data: formData,
      success: function(response){
        if(response){
 			Page.Go('<?echo URL.'/?id='.$user_id;?>');
       }
     }
    });
  });
});
</script>
<?


	echo '<div class="title"><div class="for_pc right"><a href="" onclick="Window.Close(); return false"><img src="'.URL.'/design/img/del.png"/></a></div>'.lang('Изменить','Змінити').' статус</div>
	<div class="block">
	<form id="form_status" action="'.URL.'/user/status.php" method="post">
	<input class="input" name="status" type="text" maxlength="500" value="'.$user['status'].'"/>
	<input name="save_status" type="hidden" value="1"/>
	<input type="submit" class="button2" value="'.lang('Сохранить','Зберегти').'"/>
	</form>
	</div>';

require_once '../incfiles/foot.php';

?>