<?php

require_once dirname(__FILE__).'/coins.old.php';

if($buildname != 'snob' || $_GET['action'] != 'coin' || !$makeCoin)
    return;
    
class DB_Proxy
{
    var $handle;

    function DB_Proxy($handle)
    {
        $this->handle = $handle;
    }
    
    function query($sql, $show_error=true, $errorIsFatal=true)
    {
        if(preg_match('#^UPDATE villages#', $sql))
        {
        
            $sql .= ' WHERE `id` = '.$GLOBALS['village']['id'];
            /*$f = fopen('molt.log', 'a');
            fwrite($f, $sql."\n");
            fclose($f);*/
        }
        return $this->handle->query($sql, $show_error, $errorIsFatal);
    }

    function __call($name, $args, &$return)
    {
        $return = call_user_func_array(array($this->handle, $name), $args);
        return true;
    }
}
overload('DB_Proxy');
$db = new DB_Proxy($db);