<?php
# Script by seg0ro http://mobilarts.ru
# Not for sale!!!

defined('_IN_JOHNCMS') or die('Error: restricted access');

$textl .= ' | Поднять тему';
require_once('../incfiles/head.php');

if (isset($_POST['send'])){
	
	$shop = mysql_fetch_assoc(mysql_query("SELECT * FROM `cms_settings` WHERE `key` = 'upc' LIMIT 1"));
$user = functions::get_user($user);

   if ($user['balans']<$shop['val']){
  echo functions::display_error('Не достаточно денег');
  require_once('incfiles/end.php');
   exit;
}

  if (!$error){
    
     
      mysql_query("UPDATE `forum_topics` SET `time` = '".time()."' WHERE `topic` = '$topic' LIMIT 1");
mysql_query("UPDATE `users` SET `balans` = '".($user['balans']-$shop['val'])."' WHERE `id` = '$user[id]' LIMIT 1");

  
        
   
    header ('Refresh:1; URL=index.php?topic='.$topic.'&page='.$page);
    echo '<div class="gmenu">Вы успешно подняли тему<br /><a href="index.php?topic='.$topic.'&amp;page='.$page.'">Далее</a></div>';
    require_once('../incfiles/end.php');
    exit;
  }
}
$shop = mysql_fetch_assoc(mysql_query("SELECT * FROM `cms_settings` WHERE `key` = 'upc' LIMIT 1"));

$user = functions::get_user($user);
echo'<div class="phdr">Поднять тему</div>' .
    '<div class="user"><p>' . functions::display_user($user, array('iphide' => 1,)) . '</p></div>';
	echo '<div class="gmenu"><p>Ваш баланс: ' . $user['balans'] . ' рублей</p>';
	echo '<p>Цена поднятия: ' . $shop['val'] . ' рублей</p>';
echo '</div>';
echo '<div class="user"><form id="form" action="index.php?act=up&amp;topic='.$topic.'&amp;page='.$page.'" method="post">';

echo '<input type="submit" class="btn btn-default" name="send" value="Поднять" /></form> </div>';