Dam cały skrypt

<?php
/**
* File functions:
* Clean city and earn money
*
* @name : premium.php
* @copyright : (C) 2004-2005 EE Team for Vallheru Engine
* @author : Klaus Korner <albitos.snape@gmail.com>
* @version : 1.0.7
* @since : 30.10.2006
*
*/
//
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
//
$title = "Punkty premium";
require_once("includes/head.php");
/**
* Get the localization for game
*/
require_once("languages/".$player -> lang."/premium.php");
$arrBonus = array('credits' => 100000, 'energy' => 50, 'platinum' => 1000
); $objBonus = $db -> Execute('SELECT points FROM premium WHERE id='.$player -> id);
if (!isset($_GET['action'])) {
$_GET['action'] = '';
$smarty -> assign
(array("Landinfo" => LAND_INFO
, "Landinfo2" => GOLD_COINS,
"Awork" => A_WORK,
"Points" => $objBonus -> fields['points'],
"Times" => TIMES,
"Codeinfo" => CODE_INFO));
}
elseif(isset($_GET['action']) && $_GET['action'] == 'work') {
if (!isset($_POST['amount']) || !isset($_POST['what'])) {
error(NO_AMOUNT);
}
{
error (ERROR);
}
if ($objBonus -> fields['points'] < $_POST['amount'])
{
error (NO_ENERGY);
}
$db -> Execute("UPDATE players SET ".$_POST['what']."=".$_POST['what']."+".$arrBonus[$_POST['what']]*$_POST['amount']." WHERE id=".$player -> id);
$db -> Execute("UPDATE premium SET points=points-".$_POST['amount']." WHERE id=".$player -> id);
$smarty -> assign
(array("Gain" => $arrBonus[$_POST['what']], "Amount" => $_POST['amount'],
"Inwork" => IN_WORK,
"Inwork2" => IN_WORK2,
"Goldcoins" => GOLD_COINS,
"Aback" => A_BACK));
}
elseif(isset($_GET['action']) && $_GET['action'] == 'add') {
$_POST['code'] = $db -> qstr($_POST['code']);
$objCheck = $db -> Execute('SELECT code FROM codes WHERE code='.$_POST['code']);
if(isset($objCheck -> fields
['code'])) {
$kop = $db -> Execute('SELECT id FROM premium WHERE id='.$player -> id);
if (!$kop -> fields['id'])
{
$db -> Execute("INSERT INTO premium (id, points) VALUES(".$player -> id.",10)");
}
else
{
$db -> Execute("UPDATE premium SET points=points+10 WHERE id=".$player -> id);
}
$db -> Execute('DELETE FROM codes WHERE code='.$_POST['code']);
error('Wymieniłeś kod na punkty premium.');
}
else
{
error(NO_CODE);
}
}
/**
* Assign variables to template and display page
*/
$smarty -> assign ("Action", $_GET['action']);
$smarty -> display ('premium.tpl');
require_once("includes/foot.php");
?>