hello guys
so guys I need help with the site nicaw 8.40
when you create a bill he creates in "id" and not "name" and That it is not possible Log on Server
I want to help to re create in "name" and "id" again be the number of each account Here is the script
so guys I need help with the site nicaw 8.40
when you create a bill he creates in "id" and not "name" and That it is not possible Log on Server
I want to help to re create in "name" and "id" again be the number of each account Here is the script
<? Php
/ *
Copyright (C) 2007-2008 Nicaw
Este programa é software livre; você pode redistribuí-lo e / ou modificá-
-lo sob os termos da GNU General Public License como publicado pela
Free Software Foundation; tanto a versão 2 da Licença, ou
(A seu critério) qualquer versão posterior.
Este programa é distribuído na esperança que possa ser útil,
mas SEM QUALQUER GARANTIA; mesmo sem a garantia implícita de
COMERCIALIZAÇÃO ou ADEQUAÇÃO A UM DETERMINADO FIM. Veja a
Licença Pública Geral GNU para obter mais detalhes.
Você deve ter recebido uma cópia da Licença Pública Geral GNU junto
com este programa; se não, escreva para a Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 EUA.
* /
Conta classe estende SQL
{
$ attrs privadas;
$ agentes públicos;
public function __construct ()
{
parent :: __ construct ();
}
carga função pública ($ id)
{
if (is_numeric ($ id)!) return false;
// Atributos de carga da base de dados
Acc $ = $ this-> myRetrieve ('contas', array ('id' => $ id));
$ Nicaw_acc = $ this-> myRetrieve ('nicaw_accounts', array ('account_id' => $ id));
if ($ acc === false) {
if ($ this-> existe ())
throw new Exception ("Não é possível carregar conta existente: <br/> '. $ this-> getError ());
return false;
}
// Organizar atributos, queridos à esquerda será utilizada em todo o aac
$ This-> attrs ['accno'] = (int) $ acc ['id'];
$ This-> attrs ['password'] = (string) $ acc ['password'];
$ This-> attrs ['email'] = (string) $ acc ['email'];
$ This-> attrs ['rlname'] = $ nicaw_acc ['rlname'];
$ This-> attrs ['localização'] = $ nicaw_acc ['localização'];
$ This-> attrs ['comentário'] = $ nicaw_acc ['comentário'];
$ This-> attrs ['recovery_key'] = $ nicaw_acc ['recovery_key'];
if ($ Prec ['premdays']> 0) $ this-> attrs ['premend'] = $ acc ['premdays'] * 24 * 3600 + tempo ();
elseif ($ acc ['premEnd']> 0) $ this-> attrs ['premend'] = $ acc ['premEnd'];
// Obtém personagens desta conta
$ This-> MyQuery ('players.id SELECT, players.name DE jogadores WHERE (`account_id` =' $ this-> Citação ($ this-> attrs ['accno']) ')'..);
if ($ this-> falhou ()) throw new Exception ($ this-> getError ());
while ($ a = $ this-> fetch_array ()) {
$ This-> jogadores [] = array ('name' => $ a ['name'], 'id' => $ a ['id']);
}
// Bom, agora temos todos os atributos armazenados em objeto
return true;
}
public function save ()
{
$ Prec ['id'] = $ this-> attrs ['accno'];
Acc $ ['password'] = $ this-> attrs ['password'];
Acc $ ['email'] = $ this-> attrs ['email'];
$ Nicaw_acc ['account_id'] = $ this-> attrs ['accno'];
$ Nicaw_acc ['rlname'] = $ this-> attrs ['rlname'];
$ Nicaw_acc ['localização'] = $ this-> attrs ['localização'];
$ Nicaw_acc ['comentário'] = $ this-> attrs ['comentário'];
$ Nicaw_acc ['recovery_key'] = $ this-> attrs ['recovery_key'];
if (! $ this-> myReplace ('', nicaw_accounts $ nicaw_acc))
throw new Exception ("Não é possível salvar conta: <br/> '. $ this-> getError ());
if ($ this-> existe ()) {
if (! $ this-> MyUpdate (array 'contas', $ acc, ('id' => $ this-> attrs ['accno'])))
throw new Exception ("Não é possível salvar conta: <br/> '. $ this-> getError ());
} Else {
if (! $ this-> myInsert ('contas', $ acc))
throw new Exception ("Não é possível salvar conta: <br/> '. $ this-> getError ());
}
return true;
}
função pública GetAttr ($ attr)
{
return $ this-> attrs [$ attr];
}
função pública SetAttr ($ attr, $ value)
{
$ This-> attrs [$ attr] = $ value;
}
função pública setPassword ($ new)
{$ Cfg global;
. $ New = $ new $ cfg ['password_salt'];
if ($ cfg ['password_type'] == 'md5')
$ New = md5 ($ nova);
elseif ($ cfg ['password_type'] 'sha1' ==)
$ New = sha1 ($ nova);
if (empty ($ new)) throw new Exception ("senha vazia não é permitida. ');
$ This-> attrs ['password'] = $ nova;
}
função pública checkPassword ($ pass)
{$ Cfg global;
$ Pass = $ passagem $ cfg ['password_salt'].;
if ($ cfg ['password_type'] == 'md5') {
$ Pass = md5 ($ pass);
} Elseif ($ cfg ['password_type'] == 'sha1') {
$ Pass = sha1 ($ pass);
} Elseif ($ cfg ['password_type'] == 'simples') {
} Else throw new Exception ("codificação desconhecida senha. ');
return $ this-> attrs ['password'] == (string) $ passagem && empty ($ passagem!);
}
função pública existe ()
{
$ This-> MyQuery ('SELECT * FROM `` id` accounts` ONDE =' $ this-> Citação ($ this-> attrs ['accno']).);
if ($ this-> falhou ()) throw new Exception ("Conta :: existe () não pode determinar se existe conta ');
if ($ this-> num_rows ()> 0) return true;
return false;
}
função pública logAction ($ action)
{
$ This-> MyQuery ("INSERT INTO` nicaw_account_logs` (id, ip, account_id, data, ação) VALUES (NULL, INET_ATON ('. $ This-> Citação ($ _ SERVER [' REMOTE_ADDR ']).'), ' . $ this-> Citação ($ this-> attrs ['accno']) ', UNIX_TIMESTAMP (NOW ()),' $ this-> Citação ($ action) ')')...;
if ($ this-> falhou ())
throw new Exception ($ this-> getError ());
}
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->myQuery('INSERT INTO `nicaw_poll_votes` (option_id, ip, account_id) VALUES('.$this->quote($option).', INET_ATON('.$this->quote($_SERVER['REMOTE_ADDR']).'), '.$this->quote($this->attrs['accno']).')');
if ($this->failed())
throw new Exception($this->getError());
}
public function getMaxLevel()
{
$this->myQuery('SELECT MAX(level) AS maxlevel FROM `players` WHERE `account_id` = '.$this->quote($this->attrs['accno']));
if ($this->failed())
throw new Exception($this->getError);
$row = $this->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->quote($option).'
AND '.$this->quote($this->getMaxLevel()).' > minlevel
AND nicaw_polls.startdate < UNIX_TIMESTAMP(NOW())
AND nicaw_polls.enddate > UNIX_TIMESTAMP(NOW())';
$this->myQuery($query);
if ($this->failed())
throw new Exception($this->getError);
if ($this->num_rows() == 0) return false;
if ($this->num_rows() > 1) throw new Exception('Unexpected SQL answer.');
$a = $this->fetch_array();
$poll_id = $a['id'];
$query = 'SELECT * FROM nicaw_poll_votes, nicaw_poll_options
WHERE nicaw_poll_options.poll_id = '.$this->quote($poll_id).'
AND nicaw_poll_options.id = nicaw_poll_votes.option_id
AND (account_id = '.$this->quote($this->attrs['accno']).' OR ip = INET_ATON('.$this->quote($_SERVER['REMOTE_ADDR']).')
)';
$this->myQuery($query);
if ($this->failed())
throw new Exception($this->getError);
if ($this->num_rows() == 0) return true;
elseif ($this->num_rows() == 1) return false;
else throw new Exception('Unexpected SQL answer.');
}
}
?>
/ *
Copyright (C) 2007-2008 Nicaw
Este programa é software livre; você pode redistribuí-lo e / ou modificá-
-lo sob os termos da GNU General Public License como publicado pela
Free Software Foundation; tanto a versão 2 da Licença, ou
(A seu critério) qualquer versão posterior.
Este programa é distribuído na esperança que possa ser útil,
mas SEM QUALQUER GARANTIA; mesmo sem a garantia implícita de
COMERCIALIZAÇÃO ou ADEQUAÇÃO A UM DETERMINADO FIM. Veja a
Licença Pública Geral GNU para obter mais detalhes.
Você deve ter recebido uma cópia da Licença Pública Geral GNU junto
com este programa; se não, escreva para a Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 EUA.
* /
Conta classe estende SQL
{
$ attrs privadas;
$ agentes públicos;
public function __construct ()
{
parent :: __ construct ();
}
carga função pública ($ id)
{
if (is_numeric ($ id)!) return false;
// Atributos de carga da base de dados
Acc $ = $ this-> myRetrieve ('contas', array ('id' => $ id));
$ Nicaw_acc = $ this-> myRetrieve ('nicaw_accounts', array ('account_id' => $ id));
if ($ acc === false) {
if ($ this-> existe ())
throw new Exception ("Não é possível carregar conta existente: <br/> '. $ this-> getError ());
return false;
}
// Organizar atributos, queridos à esquerda será utilizada em todo o aac
$ This-> attrs ['accno'] = (int) $ acc ['id'];
$ This-> attrs ['password'] = (string) $ acc ['password'];
$ This-> attrs ['email'] = (string) $ acc ['email'];
$ This-> attrs ['rlname'] = $ nicaw_acc ['rlname'];
$ This-> attrs ['localização'] = $ nicaw_acc ['localização'];
$ This-> attrs ['comentário'] = $ nicaw_acc ['comentário'];
$ This-> attrs ['recovery_key'] = $ nicaw_acc ['recovery_key'];
if ($ Prec ['premdays']> 0) $ this-> attrs ['premend'] = $ acc ['premdays'] * 24 * 3600 + tempo ();
elseif ($ acc ['premEnd']> 0) $ this-> attrs ['premend'] = $ acc ['premEnd'];
// Obtém personagens desta conta
$ This-> MyQuery ('players.id SELECT, players.name DE jogadores WHERE (`account_id` =' $ this-> Citação ($ this-> attrs ['accno']) ')'..);
if ($ this-> falhou ()) throw new Exception ($ this-> getError ());
while ($ a = $ this-> fetch_array ()) {
$ This-> jogadores [] = array ('name' => $ a ['name'], 'id' => $ a ['id']);
}
// Bom, agora temos todos os atributos armazenados em objeto
return true;
}
public function save ()
{
$ Prec ['id'] = $ this-> attrs ['accno'];
Acc $ ['password'] = $ this-> attrs ['password'];
Acc $ ['email'] = $ this-> attrs ['email'];
$ Nicaw_acc ['account_id'] = $ this-> attrs ['accno'];
$ Nicaw_acc ['rlname'] = $ this-> attrs ['rlname'];
$ Nicaw_acc ['localização'] = $ this-> attrs ['localização'];
$ Nicaw_acc ['comentário'] = $ this-> attrs ['comentário'];
$ Nicaw_acc ['recovery_key'] = $ this-> attrs ['recovery_key'];
if (! $ this-> myReplace ('', nicaw_accounts $ nicaw_acc))
throw new Exception ("Não é possível salvar conta: <br/> '. $ this-> getError ());
if ($ this-> existe ()) {
if (! $ this-> MyUpdate (array 'contas', $ acc, ('id' => $ this-> attrs ['accno'])))
throw new Exception ("Não é possível salvar conta: <br/> '. $ this-> getError ());
} Else {
if (! $ this-> myInsert ('contas', $ acc))
throw new Exception ("Não é possível salvar conta: <br/> '. $ this-> getError ());
}
return true;
}
função pública GetAttr ($ attr)
{
return $ this-> attrs [$ attr];
}
função pública SetAttr ($ attr, $ value)
{
$ This-> attrs [$ attr] = $ value;
}
função pública setPassword ($ new)
{$ Cfg global;
. $ New = $ new $ cfg ['password_salt'];
if ($ cfg ['password_type'] == 'md5')
$ New = md5 ($ nova);
elseif ($ cfg ['password_type'] 'sha1' ==)
$ New = sha1 ($ nova);
if (empty ($ new)) throw new Exception ("senha vazia não é permitida. ');
$ This-> attrs ['password'] = $ nova;
}
função pública checkPassword ($ pass)
{$ Cfg global;
$ Pass = $ passagem $ cfg ['password_salt'].;
if ($ cfg ['password_type'] == 'md5') {
$ Pass = md5 ($ pass);
} Elseif ($ cfg ['password_type'] == 'sha1') {
$ Pass = sha1 ($ pass);
} Elseif ($ cfg ['password_type'] == 'simples') {
} Else throw new Exception ("codificação desconhecida senha. ');
return $ this-> attrs ['password'] == (string) $ passagem && empty ($ passagem!);
}
função pública existe ()
{
$ This-> MyQuery ('SELECT * FROM `` id` accounts` ONDE =' $ this-> Citação ($ this-> attrs ['accno']).);
if ($ this-> falhou ()) throw new Exception ("Conta :: existe () não pode determinar se existe conta ');
if ($ this-> num_rows ()> 0) return true;
return false;
}
função pública logAction ($ action)
{
$ This-> MyQuery ("INSERT INTO` nicaw_account_logs` (id, ip, account_id, data, ação) VALUES (NULL, INET_ATON ('. $ This-> Citação ($ _ SERVER [' REMOTE_ADDR ']).'), ' . $ this-> Citação ($ this-> attrs ['accno']) ', UNIX_TIMESTAMP (NOW ()),' $ this-> Citação ($ action) ')')...;
if ($ this-> falhou ())
throw new Exception ($ this-> getError ());
}
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->myQuery('INSERT INTO `nicaw_poll_votes` (option_id, ip, account_id) VALUES('.$this->quote($option).', INET_ATON('.$this->quote($_SERVER['REMOTE_ADDR']).'), '.$this->quote($this->attrs['accno']).')');
if ($this->failed())
throw new Exception($this->getError());
}
public function getMaxLevel()
{
$this->myQuery('SELECT MAX(level) AS maxlevel FROM `players` WHERE `account_id` = '.$this->quote($this->attrs['accno']));
if ($this->failed())
throw new Exception($this->getError);
$row = $this->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->quote($option).'
AND '.$this->quote($this->getMaxLevel()).' > minlevel
AND nicaw_polls.startdate < UNIX_TIMESTAMP(NOW())
AND nicaw_polls.enddate > UNIX_TIMESTAMP(NOW())';
$this->myQuery($query);
if ($this->failed())
throw new Exception($this->getError);
if ($this->num_rows() == 0) return false;
if ($this->num_rows() > 1) throw new Exception('Unexpected SQL answer.');
$a = $this->fetch_array();
$poll_id = $a['id'];
$query = 'SELECT * FROM nicaw_poll_votes, nicaw_poll_options
WHERE nicaw_poll_options.poll_id = '.$this->quote($poll_id).'
AND nicaw_poll_options.id = nicaw_poll_votes.option_id
AND (account_id = '.$this->quote($this->attrs['accno']).' OR ip = INET_ATON('.$this->quote($_SERVER['REMOTE_ADDR']).')
)';
$this->myQuery($query);
if ($this->failed())
throw new Exception($this->getError);
if ($this->num_rows() == 0) return true;
elseif ($this->num_rows() == 1) return false;
else throw new Exception('Unexpected SQL answer.');
}
}
?>
Last edited: