<?php
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
$set['title']='Кактусомания';
include_once '../sys/inc/thead.php';
title();
aut();

if(!isset($user)){
  header("Location:/index.php");
  break;
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kaktuz` WHERE `id_u`='".$user['id']."'"),0)<='4'){
  if(isset($_GET['yes']) && $user['balls']>='1000'){
    mysql_query("UPDATE `user` SET `balls`=`balls`-1000 WHERE `id`='".$user['id']."' LIMIT 1");
    mysql_query("INSERT INTO `kaktuz`(`id_u`, `time_l`, `date_r`) VALUES('".$user['id']."', '".time()."', '".time()."')");
  header("location:index.php?".$passgen."");
  exit;
  }
  echo "<a href='?yes'>Купить кактус (1000 баллов)</a><br/>";
}
else
{
  echo "Разрешается иметь не больше 5 кактусов<br/>";
}

echo "<div class='aut'><a href='index.php'>Назад</a></div>";



include_once '../sys/inc/tfoot.php';
?>