Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Fala galera, estou editando meu site e apareceu esse problema quando eu tento acessar a parte Account do Site: ( http://localhost/account.php)

 

Spoiler

Fatal error: Uncaught exception 'DatabaseQueryException'
Message: Error #1054:Unknown column 'guilds.owner_id' in 'where clause'
SQL query: SELECT guilds.id, guilds.name FROM guilds, accounts, players WHERE players.id = guilds.owner_id AND players.account_id = accounts.id AND accounts.id = 1
File: sql.php on line: 94
Script was terminated because something unexpected happened. You can report this, if you think it's a bug.

Debug Backtrace:
Array
(
    [0] => Array
        (
            [function] => ExceptionHandler
            [class] => AAC
            [type] => ::
            [args] => Array
                (
                    [0] => DatabaseQueryException Object
                        (
                            [query_str:private] => SELECT guilds.id, guilds.name FROM guilds, accounts, players WHERE players.id = guilds.owner_id AND players.account_id = accounts.id AND accounts.id = 1
                            [help_id:private] => 
                            [message:protected] => Error #1054:Unknown column 'guilds.owner_id' in 'where clause'
                            [string:private] => 
                            [code:protected] => 0
                            [file:protected] => C:\xampp\htdocs\class\sql.php
                            [line:protected] => 94
                            [trace:private] => Array
                                (
                                    [0] => Array
                                        (
                                            [file] => C:\xampp\htdocs\class\account.php
                                            [line] => 36
                                            [function] => myQuery
                                            [class] => SQL
                                            [type] => ->
                                            [args] => Array
                                                (
                                                    [0] => SELECT guilds.id, guilds.name FROM guilds, accounts, players WHERE players.id = guilds.owner_id AND players.account_id = accounts.id AND accounts.id = 1
                                                )

                                        )

                                    [1] => Array
                                        (
                                            [file] => C:\xampp\htdocs\class\account.php
                                            [line] => 133
                                            [function] => load_guilds
                                            [class] => Account
                                            [type] => ->
                                            [args] => Array
                                                (
                                                )

                                        )

                                    [2] => Array
                                        (
                                            [file] => C:\xampp\htdocs\account.php
                                            [line] => 61
                                            [function] => __get
                                            [class] => Account
                                            [type] => ->
                                            [args] => Array
                                                (
                                                    [0] => guilds
                                                )

                                        )

                                )

                        )

                )

        )

)


 

TRABALHOS

 

 

[iTEM.XML] Ancient Helmt dar HP e Duration: http://www.tibiaking.com/forum/topic/35010-itemxml-helmet-dar-vida-e-duration/

 

[CreatureScripts] OwNeD ao character morrerhttp://www.tibiaking.com/forum/topic/35733-creaturescripta-owned-quando-morrer/

 

Link para o post
Compartilhar em outros sites
10 horas atrás, Ribeiro Foda disse:

Fala galera, estou editando meu site e apareceu esse problema quando eu tento acessar a parte Account do Site: ( http://localhost/account.php)

 

  Ocultar conteúdo

Fatal error: Uncaught exception 'DatabaseQueryException'
Message: Error #1054:Unknown column 'guilds.owner_id' in 'where clause'
SQL query: SELECT guilds.id, guilds.name FROM guilds, accounts, players WHERE players.id = guilds.owner_id AND players.account_id = accounts.id AND accounts.id = 1
File: sql.php on line: 94
Script was terminated because something unexpected happened. You can report this, if you think it's a bug.

Debug Backtrace:
Array
(
    [0] => Array
        (
            [function] => ExceptionHandler
            [class] => AAC
            [type] => ::
            [args] => Array
                (
                    [0] => DatabaseQueryException Object
                        (
                            [query_str:private] => SELECT guilds.id, guilds.name FROM guilds, accounts, players WHERE players.id = guilds.owner_id AND players.account_id = accounts.id AND accounts.id = 1
                            [help_id:private] => 
                            [message:protected] => Error #1054:Unknown column 'guilds.owner_id' in 'where clause'
                            [string:private] => 
                            [code:protected] => 0
                            [file:protected] => C:\xampp\htdocs\class\sql.php
                            [line:protected] => 94
                            [trace:private] => Array
                                (
                                    [0] => Array
                                        (
                                            [file] => C:\xampp\htdocs\class\account.php
                                            [line] => 36
                                            [function] => myQuery
                                            [class] => SQL
                                            [type] => ->
                                            [args] => Array
                                                (
                                                    [0] => SELECT guilds.id, guilds.name FROM guilds, accounts, players WHERE players.id = guilds.owner_id AND players.account_id = accounts.id AND accounts.id = 1
                                                )

                                        )

                                    [1] => Array
                                        (
                                            [file] => C:\xampp\htdocs\class\account.php
                                            [line] => 133
                                            [function] => load_guilds
                                            [class] => Account
                                            [type] => ->
                                            [args] => Array
                                                (
                                                )

                                        )

                                    [2] => Array
                                        (
                                            [file] => C:\xampp\htdocs\account.php
                                            [line] => 61
                                            [function] => __get
                                            [class] => Account
                                            [type] => ->
                                            [args] => Array
                                                (
                                                    [0] => guilds
                                                )

                                        )

                                )

                        )

                )

        )

)



 

Manda o seu account.php

Link para o post
Compartilhar em outros sites

@Kemmlly

Spoiler

<?php 
/*
    Copyright (C) 2007 - 2009  Nicaw

    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.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
include ("include.inc.php");

try {
    $account = new Account();
    $account->load($_SESSION['account']);
} catch(AccountNotFoundException $e) {
    $_SESSION['account'] = '';
    header('location: login.php?redirect=account.php');
    die();
}
$ptitle="Account - $cfg[server_name]";
include ("header.inc.php");
?>
<div id="content">
<div class="top">Account</div>
<div class="mid">
<table style="width: 100%">
<tr style="vertical-align: top"><td style="width: 200px;">
<h3>Pick a Task</h3>
<ul class="task-menu">
<li onclick="ajax('ajax','modules/character_create.php','',true)" style="background-image: url(resource/user_add.png);">Create Character</li>
<li onclick="ajax('ajax','modules/character_delete.php','',true)" style="background-image: url(resource/user_delete.png);">Delete Character</li>
<?php if ($cfg['char_repair']){?>
<li onclick="ajax('ajax','modules/character_repair.php','',true)" style="background-image: url(resource/user_edit.png);">Repair Character</li>
<?php }?>
<li onclick="ajax('ajax','modules/account_password.php','',true)" style="background-image: url(resource/key.png);">Change Password</li>
<li onclick="ajax('ajax','modules/account_email.php','',true)" style="background-image: url(resource/email.png);">Change Email</li>
<li onclick="ajax('ajax','modules/account_comments.php','',true)" style="background-image: url(resource/page_edit.png);">Edit Comments</li>
<li onclick="ajax('ajax','modules/account_options.php','',true)" style="background-image: url(resource/wrench.png);">Account Options</li>
<li onclick="ajax('ajax','modules/guild_create.php','',true)" style="background-image: url(resource/group_add.png);">Create Guild</li>
<li onclick="window.location.href='login.php?logout&amp;redirect=account.php'" style="background-image: url(resource/resultset_previous.png);">Logout</li>
</ul>
</td><td style="width: 130px;">
<?php 
if ($account->players){
    echo '<h3>Characters</h3>'."\n";
    echo '<ul class="task-menu">';
    foreach ($account->players as $player){
        echo '<li style="background-image: url(resource/user.png);" onclick="window.location.href=\'characters.php?player_id='.htmlspecialchars($player['id']).'\'">'.htmlspecialchars($player['name']).'</li>';
    }
    echo '</ul>';
}
if ($account->guilds){
    echo '<h3>Guilds</h3>'."\n";
    echo '<ul class="task-menu">';
    foreach ($account->guilds as $guild){
        echo '<li style="background-image: url(resource/group.png);" onclick="window.location.href=\'guilds.php?guild_id='.htmlspecialchars($guild['id']).'\'">'.htmlspecialchars($guild['name']).'</li>';
    }
    echo '</ul>';
}
?>
</td></tr>
</table>
<?php
if(isset($account->attrs['premend']) && $account->attrs['premend'] > time()) {
    echo '<b>Premium status:</b> You have ';
    $days = ceil(($account->attrs['premend'] - time())/(3600*24));
    if($days <= 5) echo '<b style="color: red">';
        else echo '<b>';
    echo $days.'</b> day(s) left';
}
?>
<div id="ajax"></div>
</div>
<div class="bot"></div>
</div>
<?php 
include ("footer.inc.php");
?>
 

 

EDIT: Tem outro account dentro da pasta Class:

Spoiler

<?php
/*
     Copyright (C) 2007 - 2009  Nicaw

    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.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
class Account {
    private $attrs, $sql, $guilds, $players;

    public function __construct() {
        $this->sql = AAC::$SQL;
    }

    public function find($name) {
        if (empty($name)) throw new AccountNotFoundException();
        $acc = $this->sql->myRetrieve('accounts', array('name' => $name));
        if ($acc === false) throw new AccountNotFoundException();
        $this->load($acc['id']);
        return true;
    }

    public function load_guilds() {
        if(empty($this->attrs['accno'])) throw new AccountNotLoadedException();
        $this->sql->myQuery('SELECT guilds.id, guilds.name FROM guilds, accounts, players WHERE players.id = guilds.owner_id AND players.account_id = accounts.id AND accounts.id = '.$this->sql->quote($this->attrs['accno']));
        while ($a = $this->sql->fetch_array()) {
            $this->guilds[] = array('id' => $a['id'], 'name' => $a['name']);
        }
        return true;
    }

    public function load_players() {
        if(empty($this->attrs['accno'])) throw new AccountNotLoadedException();
        $this->sql->myQuery('SELECT players.id, players.name FROM players WHERE (`account_id`='.$this->sql->quote($this->attrs['accno']).')');
        while ($a = $this->sql->fetch_array()) {
            $this->players[] = array('name' => $a['name'], 'id' => $a['id']);
        }
        return true;
    }

    public function load($id) {
        if (!is_numeric($id)) throw new AccountNotFoundException();
        //load attributes from database
        $acc = $this->sql->myRetrieve('accounts', array('id' => $id));
        $nicaw_acc = $this->sql->myRetrieve('nicaw_accounts', array('account_id' => $id));
        if ($acc === false) throw new AccountNotFoundException();

        //arranging attributes, ones on the left will be used all over the aac
        $this->attrs['accno'] = (int) $acc['id'];
        $this->attrs['blocked'] = (bool) $acc['blocked'];
        $this->attrs['name'] = (string) $acc['name'];
        $this->attrs['password'] = (string) $acc['password'];
        $this->attrs['email'] = (string) $acc['email'];
        $this->attrs['rlname'] = $nicaw_acc['rlname'];
        $this->attrs['location'] = $nicaw_acc['location'];
        $this->attrs['comment'] = $nicaw_acc['comment'];
        $this->attrs['recovery_key'] = $nicaw_acc['recovery_key'];
        $this->attrs['reveal_characters'] = (bool) $nicaw_acc['reveal_characters'];
        if (isset($acc['premdays']) && $acc['premdays'] > 0) $this->attrs['premend'] = $acc['premdays']*24*3600 + time();
        elseif (isset($acc['premend']) && $acc['premend'] > 0) $this->attrs['premend'] = $acc['premend'];
        
        return true;
    }

    public function save() {
        $acc['id'] = $this->attrs['accno'];
        $acc['name'] = $this->attrs['name'];
        $acc['password'] = $this->attrs['password'];
        $acc['email'] = $this->attrs['email'];

        $this->sql->myUpdate('accounts',$acc, array('id' => $this->attrs['accno']));

        $nicaw_acc['account_id'] = $this->attrs['accno'];
        $nicaw_acc['rlname'] = $this->attrs['rlname'];
        $nicaw_acc['location'] = $this->attrs['location'];
        $nicaw_acc['comment'] = $this->attrs['comment'];
        $nicaw_acc['recovery_key'] = $this->attrs['recovery_key'];
        $nicaw_acc['reveal_characters'] = $this->attrs['reveal_characters'];

        $this->sql->myReplace('nicaw_accounts',$nicaw_acc);

        return true;
    }

    public function hasPlayer($pid) {
        $players = $this->__get('players');
        foreach($players as $p) {
            if ($p['id'] == $pid) {
                return true;
            }
        }
        return false;
    }

    static public function Create($name, $password, $email, $rlname = '', $location = '') {
        $SQL = AAC::$SQL;

        unset($d);
        $d['name'] = $name;
        $d['password'] = Account::encodePassword($password);
        $d['email'] = $email;
        $SQL->myInsert('accounts',$d);
        $aid = $SQL->insert_id();

        unset($d);
        $d['account_id'] = $aid;
        $d['rlname'] = $rlname;
        $d['location'] = $location;
        $SQL->myInsert('nicaw_accounts',$d);

        $account = new Account();
        $account->load($aid);
        return $account;
    }

    public function __get($attr) {
        if(empty($this->attrs['accno']))
            throw new ClassException('Attempt to get attribute of account that is not loaded.');
        if($attr == 'attrs') {
            return $this->attrs;
        }elseif($attr == 'guilds') {
            if(empty($this->guilds)) $this->load_guilds();
            return $this->guilds;
        }elseif($attr == 'players') {
            if(empty($this->players)) $this->load_players();
            return $this->players;
        }else {
            throw new ClassException('Undefined property: '.$attr);
        }
    }

    public function setAttr($attr,$value) {
        $this->attrs[$attr] = $value;
    }

    public function setPassword($pass) {
        if(empty($pass)) return false;
        $this->attrs['password'] = Account::encodePassword($pass);
        return true;
    }

    static private function encodePassword($pass) {global $cfg;
        $pass = $pass.$cfg['password_salt'];
        if ($cfg['password_type'] == 'md5')
            $pass = md5($pass);
        elseif ($cfg['password_type'] == 'sha1')
            $pass = sha1($pass);
        return $pass;
    }

    public function checkPassword($pass) {global $cfg;
        $pass = $pass.$cfg['password_salt'];
        if ($cfg['password_type'] == 'md5') {
            $pass = md5($pass);
        }elseif ($cfg['password_type'] == 'sha1') {
            $pass = sha1($pass);
        }elseif ($cfg['password_type'] == 'plain') {
        }else throw new ClassException('Unknow password encoding $cfg[\'password_type\'].');
        return $this->attrs['password'] == (string)$pass && !empty($pass);
    }

    static public function existsName($name) {
        try {
            AAC::$SQL->myQuery('SELECT * FROM `accounts` WHERE `name` = '.AAC::$SQL->quote($name));
        } catch(DatabaseQueryException $e) {
            throw new DatabaseException('Account::existsName() failed. If your server doesn\'t support account names pelase use AAC release v3.20');
        }
        if (AAC::$SQL->num_rows() > 0) return true;
        return false;
    }

    public function logAction($action) {
        $this->sql->myQuery('INSERT INTO `nicaw_account_logs` (id, ip, account_id, date, action) VALUES(NULL, INET_ATON('.$this->sql->quote($_SERVER['REMOTE_ADDR']).'), '.$this->sql->quote($this->attrs['accno']).', UNIX_TIMESTAMP(NOW()), '.$this->sql->quote($action).')');
    }

    public function removeRecoveryKey() {
        $this->attrs['recovery_key'] = NULL;
    }

    public function addRecoveryKey() {
        $this->attrs['recovery_key'] = substr(str_shuffle(md5(mt_rand()).md5(time())), 0, 32);
        $this->logAction('Recovery key added');
        return $this->attrs['recovery_key'];
    }

    public function checkRecoveryKey($key) {
        return $this->attrs['recovery_key'] === $key && !empty($key);
    }

    public function vote($option) {
        $this->sql->myQuery('INSERT INTO `nicaw_poll_votes` (option_id, ip, account_id) VALUES('.$this->sql->quote($option).', INET_ATON('.$this->sql->quote($_SERVER['REMOTE_ADDR']).'), '.$this->sql->quote($this->attrs['accno']).')');
    }

    public function getMaxLevel() {
        $this->sql->myQuery('SELECT MAX(level) AS maxlevel FROM `players` WHERE `account_id` = '.$this->sql->quote($this->attrs['accno']));
        $row = $this->sql->fetch_array();
        return (int) $row['maxlevel'];
    }

    public function canVote($option) {
        $query = 'SELECT nicaw_polls.id FROM nicaw_polls, nicaw_poll_options
WHERE nicaw_polls.id = nicaw_poll_options.poll_id
AND nicaw_poll_options.id = '.$this->sql->quote($option).'
AND '.$this->sql->quote($this->getMaxLevel()).' > minlevel
AND nicaw_polls.startdate < UNIX_TIMESTAMP(NOW())
AND nicaw_polls.enddate > UNIX_TIMESTAMP(NOW())';
        $this->sql->myQuery($query);
        if ($this->sql->num_rows() == 0) return false;
        if ($this->sql->num_rows() > 1) throw new DatabaseException('Unexpected SQL answer.');
        $a = $this->sql->fetch_array();
        $poll_id = $a['id'];
        $query = 'SELECT * FROM nicaw_poll_votes, nicaw_poll_options
WHERE nicaw_poll_options.poll_id = '.$this->sql->quote($poll_id).'
AND nicaw_poll_options.id = nicaw_poll_votes.option_id
AND (account_id = '.$this->sql->quote($this->attrs['accno']).' OR ip = INET_ATON('.$this->sql->quote($_SERVER['REMOTE_ADDR']).')
)';
        $this->sql->myQuery($query);
        if ($this->sql->num_rows() == 0) return true;
        elseif ($this->sql->num_rows() == 1) return false;
        else throw new DatabaseException('Unexpected SQL answer.');
    }
}
?>

 

Editado por Ribeiro Foda
2 Account.php (veja o histórico de edições)

TRABALHOS

 

 

[iTEM.XML] Ancient Helmt dar HP e Duration: http://www.tibiaking.com/forum/topic/35010-itemxml-helmet-dar-vida-e-duration/

 

[CreatureScripts] OwNeD ao character morrerhttp://www.tibiaking.com/forum/topic/35733-creaturescripta-owned-quando-morrer/

 

Link para o post
Compartilhar em outros sites

SQL: 

Spoiler

<?php
/*
     Copyright (C) 2007 - 2009  Nicaw

    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.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
class SQL {
    private
    $sql_connection,
    $schema_version,
    $sql_tables,
    $last_query,
    $last_insert_id;

    //creates new connection
    public function __construct($server, $user, $password, $database) {

        //warn if MySQL extension is not installed
        if(!extension_loaded('mysql'))
            throw new LibraryMissingException('MySQL library is not installed. Database access is impossible.', 0);

        //establish a link to MySQL
        $con = @mysql_connect($server,$user,$password);
        if ($con === false)
            throw new DatabaseConnectException('Unable to connect to mysql server. Please make sure it is up and running and you have correct user/password in config.inc.php.', 1);

        //select otserv database
        if (!mysql_select_db($database))
            throw new DatabaseSelectException('Unable to select database: '.$database.'. Make sure it exists.', 2);

        //retrieve table list
        $result = mysql_query('SHOW TABLES');
        if ($result === false)
            DatabaseQueryException('Failed to retrieve a table list.');

        while ($a = mysql_fetch_array($result))
            $this->sql_tables[] = $a[0];

        //retrieve schema version
        $result = mysql_query('SELECT value FROM schema_info WHERE name = \'version\'');
        if ($result === false) {
            $this->schema_version = false;
        } else {
            $a = mysql_fetch_array($result);
            $this->schema_version = $a['value'];
        }

        //assign the connection
        $this->sql_connection = $con;

        return true;
    }

    public function getSchemaVersion() {
        return $this->schema_version;
    }

    public function isTable($mixed) {
        return in_array($mixed, $this->sql_tables);
    }

    public function __destruct() {
        if(is_resource($this->last_query))
            mysql_free_result($this->last_query);
        mysql_close($this->sql_connection);
    }

    //Creates tables
    public function setup() {
        $tables = explode(';', file_get_contents('documents/shema.mysql'));
        foreach ($tables as $table) mysql_query($table);
    }

    //Perform simple SQL query
    public function myQuery($q) {
        if(is_resource($this->last_query))
            mysql_free_result($this->last_query);
        $this->last_query = mysql_query($q, $this->sql_connection);
        $this->last_insert_id = mysql_insert_id();
        if ($this->last_query === false) {
            $this->analyze();
            throw new DatabaseQueryException('Error #'.mysql_errno().':'.mysql_error(), $q);
        }
        return $this->last_query;
    }

    //True is last query failed
    public function failed() {
        if ($this->last_query === false) return true;
        return false;
    }

    //Returns current array with data values
    public function fetch_array() {
        if (!$this->failed())
            if (isset($this->last_query))
                return mysql_fetch_array($this->last_query);
            else
                throw new ClassException('Attempt to fetch a null query.');
        else
            throw new ClassException('Attempt to fetch failed query.');
    }

    //Returns the last insert id
    public function insert_id() {
        return $this->last_insert_id;
    }

    //Returns the number of rows affected
    public function num_rows() {
        if (!$this->failed())
            return mysql_num_rows($this->last_query);
        else
            throw new ClassException('Attempt to count failed query.');
    }

    //Quotes a string
    public function escape_string($string) {
        return mysql_real_escape_string($string);
    }

    //Quotes a value so it's safe to use in SQL statement
    public function quote($value) {
        if(is_numeric($value) && $value[0] != '0')
            return (int) $value;
        else
            return '\''.$this->escape_string($value).'\'';
    }

    public function analyze() {
    //determine database type, try to perform autosetup
        $is_aac_db = in_array('nicaw_accounts',$this->sql_tables);
        $is_server_db = in_array('accounts',$this->sql_tables) && in_array('players',$this->sql_tables);
        $is_svn = in_array('player_depotitems',$this->sql_tables) && in_array('groups',$this->sql_tables);
        $is_cvs = in_array('playerstorage',$this->sql_tables) && in_array('skills',$this->sql_tables);
        if (!$is_aac_db) {
            $this->setup();
            throw new DatabaseException('Notice: AutoSetup has attempted to create missing tables for you. Please create MySQL tables manually from "database.sql" if you are still getting this message.', 3);
        }elseif (!$is_server_db) {
            throw new DatabaseException('It appears you don\'t have SQL sample imported for OT server or it is not supported.', 4);
        }elseif ($is_cvs && !$is_svn) {
            throw new DatabaseException('This AAC version does not support your server. Consider using SQL v1.5.', 5);
        }
        return true;
    }

    public function repairTables() {
        if (isset($this->sql_tables))
            foreach($this->sql_tables as $table)
                mysql_query('REPAIR TABLE '.$table);
        return true;
    }

    ######################################
    # Methods for simple  data access    #
    ######################################

    //Insert data
    public function myInsert($table,$data) {global $cfg;
        $fields = array_keys($data);
        $values = array_values($data);
        $query = 'INSERT INTO `'.mysql_escape_string($table).'` (';
        foreach ($fields as $field)
            $query.= '`'.mysql_escape_string($field).'`,';
        $query = substr($query, 0, strlen($query)-1);
        $query.= ') VALUES (';
        foreach ($values as $value)
            if ($value === null)
                $query.= 'NULL,';
            else
                $query.= $this->quote($value).',';
        $query = substr($query, 0, strlen($query)-1);
        $query.= ');';
        $this->myQuery($query);
        return true;
    }

    //Replace data
    public function myReplace($table,$data) {global $cfg;
        $fields = array_keys($data);
        $values = array_values($data);
        $query = 'REPLACE INTO `'.mysql_escape_string($table).'` (';
        foreach ($fields as $field)
            $query.= '`'.mysql_escape_string($field).'`,';
        $query = substr($query, 0, strlen($query)-1);
        $query.= ') VALUES (';
        foreach ($values as $value)
            if ($value === null)
                $query.= 'NULL,';
            else
                $query.= $this->quote($value).',';
        $query = substr($query, 0, strlen($query)-1);
        $query.= ');';
        $this->myQuery($query);
        return true;
    }

    //Retrieve single row
    public function myRetrieve($table,$data) {
        $fields = array_keys($data);
        $values = array_values($data);
        $query = 'SELECT * FROM `'.mysql_escape_string($table).'` WHERE (';
        for ($i = 0; $i < count($fields); $i++)
            $query.= '`'.mysql_escape_string($fields[$i]).'` = '.$this->quote($values[$i]).' AND ';
        $query = substr($query, 0, strlen($query)-4);
        $query.=');';
        $this->myQuery($query);
        if ($this->num_rows() != 1) return false;
        return $this->fetch_array();
    }

    //Update data
    public function myUpdate($table,$data,$where,$limit=1) {
        $fields = array_keys($data);
        $values = array_values($data);
        $query = 'UPDATE `'.mysql_escape_string($table).'` SET ';
        for ($i = 0; $i < count($fields); $i++)
            $query.= '`'.mysql_escape_string($fields[$i]).'` = '.$this->quote($values[$i]).', ';
        $query = substr($query, 0, strlen($query)-2);
        $query.=' WHERE (';
        $fields = array_keys($where);
        $values = array_values($where);
        for ($i = 0; $i < count($fields); $i++)
            $query.= '`'.mysql_escape_string($fields[$i]).'` = '.$this->quote($values[$i]).' AND ';
        $query = substr($query, 0, strlen($query)-4);
        if (isset($limit))
            $query.=') LIMIT '.$limit.';';
        else
            $query.=');';
        $this->myQuery($query);
        return true;
    }

    //Delete data
    public function myDelete($table,$data,$limit = 1) {
        $fields = array_keys($data);
        $values = array_values($data);
        $query = 'DELETE FROM `'.mysql_escape_string($table).'` WHERE (';
        for ($i = 0; $i < count($fields); $i++)
            $query.= '`'.mysql_escape_string($fields[$i]).'` = '.$this->quote($values[$i]).' AND ';
        $query = substr($query, 0, strlen($query)-4);
        if ($limit > 0)
            $query.=') LIMIT '.$limit.';';
        else
            $query.=');';
        $this->myQuery($query);
        return true;
    }
}
?>
 

 

PRINT: http://imgur.com/zxsyROL                    ( NÃO TEM NENHUMA GUILD CRIADA)

TRABALHOS

 

 

[iTEM.XML] Ancient Helmt dar HP e Duration: http://www.tibiaking.com/forum/topic/35010-itemxml-helmet-dar-vida-e-duration/

 

[CreatureScripts] OwNeD ao character morrerhttp://www.tibiaking.com/forum/topic/35733-creaturescripta-owned-quando-morrer/

 

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por Godofcritic
      Preciso de um script em php para recuperação de senha
    • Por Natan Fernandes
      Bom, esta tudo funcionando, crio a conta fala que a conta foi criada, e ela realmente foi, eu só queria ajuda pq quando o player cria a conta aparece isso:
       
      [JavaScript] Cannot parse XML string: Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\class\sql.php on line 174 Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\class\sql.php on line 176 Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\class\sql.php on line 176 Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\class\sql.php on line 176 Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\class\sql.php on line 174 Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\class\sql.php on line 176 Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\class\sql.php on line 176 Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\class\sql.php on line 176 Account created! No caso, eu queria alterar a pagina para aonde ele vai quando ele ter sucesos em criar a conta, alguem poderia me auxiliar?
    • Por Natan Fernandes
      Ola comunidade, bom eu estou com uma versão antiga de tibia, e achei um site compativel, ele esta criando a conta e esta tudo funcionando corretamente, mas no site aparece esse codigo no canto <<:
       
      Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\class\sql.php on line 214 Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\class\sql.php on line 216 Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\class\sql.php on line 214 Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\class\sql.php on line 216 Alguem poderia me ajudar?
    • Por Mathwsz
      Boa noite meus caros! Então, venho até aqui fazer um pedido que eu já fiz uma vez e que não fui atendido e que espero que dessa vez seja atendido. Então, é o seguinte: Eu quero que na página "Characters" logo ali em Special Skills apareça a Spell Vip que o player tem (Storage) talvez, eu não sei muito bem.. Um exemplo é o site: http://hellblazer.servegame.com 
       
      Ps: Se não entendeu e deseja me ajudar, comente aí que darei mais detalhes, mas acho que vendo como funciona vocês entenderam.
      Ps2: Minha página characters.php só mando via PM pois é privado do meu projeto.
       
      Espero que me ajudem, porque da outra vez passou em branco e eu jamais fiz isso com alguém do TK.
      Abçs e obrigado pela atenção!
    • Por Mathwsz
      Salve galera do TK, estou com um problema.. Bom instalei o xampp 1.7.7 e tentei iniciar o Apache/MySql, ambos funcionaram, mas após certo tempo o apache não inicia mais.
       
      Obs: Não tenho skype no meu computador.
       
      Aguardo retornos e obrigado pela atenção.
      Att, Matheus.
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo