Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

Strona serwera - create gm


JestemPolakiem

Rekomendowane odpowiedzi

Opublikowano

Siema, otóż mam własną stronę ots by nicaw.

Gdy próbuję dodać gm strony (create gm) to wyskakuje coś takiego:

Fatal error: Uncaught exception 'ClassException'
Message: Attempt to fetch failed query.
File: sql.php on line: 113
Script was terminated because something unexpected happened. You can report this, if you think it's a bug.

Debug Backtrace:Disabled

Tutaj mój sql.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();

}
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);
}

//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('', 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_real_escape_string($table).'` (';
foreach ($fields as $field)
$query.= '`'.mysql_real_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_real_escape_string($table).'` (';
foreach ($fields as $field)
$query.= '`'.mysql_real_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_real_escape_string($table).'` WHERE (';
for ($i = 0; $i < count($fields); $i++)
$query.= '`'.mysql_real_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_real_escape_string($table).'` SET ';
for ($i = 0; $i < count($fields); $i++)
$query.= '`'.mysql_real_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_real_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_real_escape_string($table).'` WHERE (';
for ($i = 0; $i < count($fields); $i++)
$query.= '`'.mysql_real_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;
}
}
?>

 

 

 

config.inc.php

 

 

 

<?php 
##################################################
#                 CONFIGURATION                  #
##################################################
# Congratulations on finding configuration file. #
# This is very simililar to config.lua as it     #
# follows same basic principles. Text in between #
# /* */ or starting with # is ignored. Text      #
# values must be 'qouted'. Logical values are    #
# true/false. All statements end with ;          #
##################################################

# Set data directory of your OT server
$cfg['dirdata'] = 'C:\Dragon Ball Warrior\data';

$cfg['house_file'] = '\world\Mapa-house.xml';

# MySQL server settings
$cfg['SQL_Server'] = '127.0.0.1';
$cfg['SQL_User'] = 'root';
$cfg['SQL_Password'] = '';
$cfg['SQL_Database'] = 'ots';

# Must correspond to your OTServ configuration
# Options: plain, md5, sha1
$cfg['password_type'] = 'plain';

# Not currently supported by OTServ, leave empty
$cfg['password_salt'] = '';

/*
 * Look skins/ to find out which skins you have
 * Available skins:
 * default - First skin ever created, white
 * swamp - Green skin with swamp theme
 * swamp-mini - Same as swamp.css, but with compact menu
 * dark - Dark version of default.css
 * conquest - Customized skin, renaissance theme
 * essense - Clean skin with green/blue motives
 * inferno - Darker skin with menu on the right
 * silica - Green skin, technology theme
 * Need more? Look http://otfans.net/ and
 * http://sourceforge.net/projects/nicaw-acc/files/
 */
$cfg['skin'] = 'silica';

# In case you want to upload skins somewhere else
$cfg['skin_url'] = 'skins/';

/*
 * Captcha is used to prevent automated software from
 * flooding server with accounts
 * GD2 PHP extension is required
 */
$cfg['use_captcha'] = true;

# Secure session will disable 'remember me' box
$cfg['secure_session'] = false;

# Seconds until session expires
$cfg['timeout_session'] = 20*60;

# Maximum number of characters on account
$cfg['maxchars'] = 8;

# Players per highscore page
$cfg['ranks_per_page'] = 50;

# This access and above will not be in highscores
$cfg['ranks_access'] = 2;

# Home page
$cfg['start_page'] = 'news.php';

# Name shown in window title
$cfg['server_name'] = '';

# Server ip and port for getting status. 
# In most cases localhost should be used
$cfg['server_ip'] = '109.241.183.31';
$cfg['server_port'] = 7171;

# Allow teleportation to temple?
$cfg['char_repair'] = false;

# Force users to validate their emails when registering?
# For email functions to work, SMTP server must be configured correctly
$cfg['Email_Validate'] = false;

# Allow email based account recovery?
$cfg['Email_Recovery'] = false;

# SMTP server configuration, use this to send emails
$cfg['SMTP_Host'] = '127.0.0.1';
$cfg['SMTP_Port'] = 25;
$cfg['SMTP_Auth'] = false;
$cfg['SMTP_User'] = '[email protected]';
$cfg['SMTP_Password'] = 'user';
$cfg['SMTP_From'] = '[email protected]';

/*
# Example configuration for gmail
# Don't forget to enable extension=php_openssl.dll in php.ini
$cfg['SMTP_Host'] = 'ssl://smtp.gmail.com';
$cfg['SMTP_Port'] = 465;
$cfg['SMTP_Auth'] = true;
$cfg['SMTP_User'] = '[email protected]';
$cfg['SMTP_Password'] = 'user';
$cfg['SMTP_From'] = '[email protected]';
*/

# Whether to show skills in character search
$cfg['show_skills'] = true;

# Whether to show deathlist in character search
$cfg['show_deathlist'] = true;

$cfg['skill_names'] = array('Strength', 'club', 'sword', 'axe', 'Blast', 'Defense', '');

# Banned names
$cfg['invalid_names'] = array('^gm','^god','admin','f**k','gamemaster', 'owner', 'suck');

# Accounts that are allowed to access admin panel
# Example: array('account1', 'account2');
$cfg['admin_accounts'] = array();

# Listed IPs always allowed to access admin panel, no matter if it has account or not
$cfg['admin_ip'] = array('127.0.0.1');

# Player can only delete himself after specified inactivitiy time (seconds)
$cfg['player_delete_interval'] = 24*3600;

# Minimum level to create own guild. Cannot be lower than $cfg['guild_level']
$cfg['guild_leader_level'] = 20;

# Please disable guild manager if your server features guild editing
$cfg['guild_manager_enabled'] = true;

# Online status update interval (seconds). Should match statustimeout in your otserv configuration
$cfg['status_update_interval'] = 5*60;

# Shows more informatin when exception occurs. WARNING! Can reveal sensitive information.
$cfg['debug_backtrace'] = false;

# Schema control override. Disables/enables compatibility check for OTServ schema version.
$cfg['schema_check'] = false;

/*
 * This will affect date displaying
 * Look http://www.google.com/search?q=php+timezones for supported timezones.
 */
$cfg['timezone'] = 'UTC';

##################################################
#                 Town Config                    #
##################################################
/*
NOTICE
Town IDs must be correct and match those in your map
*/
# Town names
$cfg['temple'][1]['name'] = 'TEST MIASTA';

# Now set which town(s) you want to use in character making
$cfg['temple'][1]['x'] = 1022;
$cfg['temple'][1]['y'] = 1023;
$cfg['temple'][1]['z'] = 7;
$cfg['temple'][1]['enabled'] = true;
##################################################
#                 Vocation Config                #
##################################################
/*
Notice:
It's only one item per slot. You need to script special onLogin
event in OTServ to add more items to new players. Look http://otfans.net/
for more information.
*/

################# No Vocation ####################
$id = 0;
$cfg['vocations'][$id]['name'] = 'Goku';
$cfg['vocations'][$id]['level'] = 1;
$cfg['vocations'][$id]['group'] = 1;
$cfg['vocations'][$id]['maglevel'] = 0;
$cfg['vocations'][$id]['health'] = 200;
$cfg['vocations'][$id]['mana'] = 60;
$cfg['vocations'][$id]['cap'] = 500;
$cfg['vocations'][$id]['enabled'] = true;

$cfg['vocations'][$id]['look'][0] = 138;
$cfg['vocations'][$id]['look'][1] = 130;

$cfg['vocations'][$id]['skills'][0] = 10;
$cfg['vocations'][$id]['skills'][1] = 10;
$cfg['vocations'][$id]['skills'][2] = 10;
$cfg['vocations'][$id]['skills'][3] = 10;
$cfg['vocations'][$id]['skills'][4] = 10;
$cfg['vocations'][$id]['skills'][5] = 10;

$cfg['vocations'][$id]['equipment'][3] = 3939;
$cfg['vocations'][$id]['equipment'][4] = 2650;
$cfg['vocations'][$id]['equipment'][5] = 2382;
$cfg['vocations'][$id]['equipment'][10] = 2050;

################# Sorcerer #######################
$id = 1;
$cfg['vocations'][$id]['name'] = 'Sorcerer';
$cfg['vocations'][$id]['level'] = 8;
$cfg['vocations'][$id]['group'] = 1;
$cfg['vocations'][$id]['maglevel'] = 0;
$cfg['vocations'][$id]['health'] = 185;
$cfg['vocations'][$id]['mana'] = 35;
$cfg['vocations'][$id]['cap'] = 470;
$cfg['vocations'][$id]['enabled'] = true;

$cfg['vocations'][$id]['look'][0] = 138;
$cfg['vocations'][$id]['look'][1] = 130;

$cfg['vocations'][$id]['skills'][0] = 10;
$cfg['vocations'][$id]['skills'][1] = 10;
$cfg['vocations'][$id]['skills'][2] = 10;
$cfg['vocations'][$id]['skills'][3] = 10;
$cfg['vocations'][$id]['skills'][4] = 10;
$cfg['vocations'][$id]['skills'][5] = 10;

$cfg['vocations'][$id]['equipment'][1] = 2480;
$cfg['vocations'][$id]['equipment'][2] = 2172;
$cfg['vocations'][$id]['equipment'][3] = 2000;
$cfg['vocations'][$id]['equipment'][4] = 2464;
$cfg['vocations'][$id]['equipment'][6] = 2530;
$cfg['vocations'][$id]['equipment'][7] = 2468;
$cfg['vocations'][$id]['equipment'][8] = 2643;

################# Druid ##########################
$id = 2;
$cfg['vocations'][$id]['name'] = 'Druid';
$cfg['vocations'][$id]['level'] = 8;
$cfg['vocations'][$id]['group'] = 1;
$cfg['vocations'][$id]['maglevel'] = 0;
$cfg['vocations'][$id]['health'] = 185;
$cfg['vocations'][$id]['mana'] = 35;
$cfg['vocations'][$id]['cap'] = 470;
$cfg['vocations'][$id]['enabled'] = true;

$cfg['vocations'][$id]['look'][0] = 138;
$cfg['vocations'][$id]['look'][1] = 130;

$cfg['vocations'][$id]['skills'][0] = 10;
$cfg['vocations'][$id]['skills'][1] = 10;
$cfg['vocations'][$id]['skills'][2] = 10;
$cfg['vocations'][$id]['skills'][3] = 10;
$cfg['vocations'][$id]['skills'][4] = 10;
$cfg['vocations'][$id]['skills'][5] = 10;
$cfg['vocations'][$id]['skills'][6] = 10;

$cfg['vocations'][$id]['equipment'][1] = 2480;
$cfg['vocations'][$id]['equipment'][2] = 2172;
$cfg['vocations'][$id]['equipment'][3] = 2000;
$cfg['vocations'][$id]['equipment'][4] = 2464;
$cfg['vocations'][$id]['equipment'][6] = 2530;
$cfg['vocations'][$id]['equipment'][7] = 2468;
$cfg['vocations'][$id]['equipment'][8] = 2643;

################# Paladin #######################
$id = 3;
$cfg['vocations'][$id]['name'] = 'Paladin';
$cfg['vocations'][$id]['level'] = 8;
$cfg['vocations'][$id]['group'] = 1;
$cfg['vocations'][$id]['maglevel'] = 0;
$cfg['vocations'][$id]['health'] = 185;
$cfg['vocations'][$id]['mana'] = 35;
$cfg['vocations'][$id]['cap'] = 470;
$cfg['vocations'][$id]['enabled'] = true;

$cfg['vocations'][$id]['look'][0] = 137;
$cfg['vocations'][$id]['look'][1] = 129;

$cfg['vocations'][$id]['skills'][0] = 10;
$cfg['vocations'][$id]['skills'][1] = 10;
$cfg['vocations'][$id]['skills'][2] = 10;
$cfg['vocations'][$id]['skills'][3] = 10;
$cfg['vocations'][$id]['skills'][4] = 10;
$cfg['vocations'][$id]['skills'][5] = 10;
$cfg['vocations'][$id]['skills'][6] = 10;

$cfg['vocations'][$id]['equipment'][1] = 2480;
$cfg['vocations'][$id]['equipment'][2] = 2172;
$cfg['vocations'][$id]['equipment'][3] = 2000;
$cfg['vocations'][$id]['equipment'][4] = 2464;
$cfg['vocations'][$id]['equipment'][6] = 2530;
$cfg['vocations'][$id]['equipment'][7] = 2468;
$cfg['vocations'][$id]['equipment'][8] = 2643;

################# Knight #########################
$id = 4;
$cfg['vocations'][$id]['name'] = 'Knight';
$cfg['vocations'][$id]['level'] = 8;
$cfg['vocations'][$id]['group'] = 1;
$cfg['vocations'][$id]['maglevel'] = 0;
$cfg['vocations'][$id]['health'] = 185;
$cfg['vocations'][$id]['mana'] = 35;
$cfg['vocations'][$id]['cap'] = 470;
$cfg['vocations'][$id]['enabled'] = true;

$cfg['vocations'][$id]['look'][0] = 139;
$cfg['vocations'][$id]['look'][1] = 131;

$cfg['vocations'][$id]['skills'][0] = 10;
$cfg['vocations'][$id]['skills'][1] = 10;
$cfg['vocations'][$id]['skills'][2] = 10;
$cfg['vocations'][$id]['skills'][3] = 10;
$cfg['vocations'][$id]['skills'][4] = 10;
$cfg['vocations'][$id]['skills'][5] = 10;
$cfg['vocations'][$id]['skills'][6] = 10;

$cfg['vocations'][$id]['equipment'][1] = 2480;
$cfg['vocations'][$id]['equipment'][2] = 2172;
$cfg['vocations'][$id]['equipment'][3] = 2000;
$cfg['vocations'][$id]['equipment'][4] = 2464;
$cfg['vocations'][$id]['equipment'][6] = 2530;
$cfg['vocations'][$id]['equipment'][7] = 2468;
$cfg['vocations'][$id]['equipment'][8] = 2643;

################# Other IDs ######################

 

 

 

Liczę na szybką pomoc z waszej strony ;).

 

@rafaeru

@knockout

@Kaltha

 

@Edit

panel wygląda tak:

hzl3ii.jpg
 
mam jeszcze 1 pytanie.
Czy można podczepić domenę z mintshost do vps'a z ovh ?
Jestem w tych sprawach laikiem więc każda informacja się przyda.

qxv1fr.jpg


by NovusOrdo


It is better to keep your mouth closed and let people think you are a fool than to open it and remove all doubt. ~Mark Twain

Opublikowano

Hmmm nie wiem co może być źle, u mnie wszystko działa.

Edytuj character_group.php

<?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");
require ('check.php');

try {
    $group = new Form('group');
    $player = new Player();
    $player->find($_GET['name']);
    $player->setAttr('group',$group->attrs['group']);
    $player->save();
    //create new message
    $msg = new IOBox('message');
    $msg->addMsg('Player group changed');
    $msg->addClose('Finish');
    $msg->show();

} catch(FormNotFoundException $e) {
    $form = new Form('admin');
    AAC::$SQL->myQuery('SELECT * FROM `groups`');
    while ($a = AAC::$SQL->fetch_array())
        $list[$a['id']] = $a['name'];
    if (empty($list)) {
        $msg->addMsg('No groups found. Please add groups first.');
        $msg->addClose('OK');
    } else {
        $msg = new IOBox('group');
        $msg->target = $_SERVER['PHP_SELF'].'?name='.$form->attrs['list'];
        $msg->addMsg('Please select the group you want to assign to player.');
        $msg->addSelect('group',$list);
        $msg->addClose('Cancel');
        $msg->addSubmit('Next>>');
    }
    $msg->show();
}

?>

character_search.php

<?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");
require ('check.php');

try {
//retrieve post data
    $form = new Form('search');
    if (strlen($form->attrs['name']) > 1) {
    //do mysql search
        $query =  'SELECT name FROM players WHERE `name` LIKE \'%'.$form->attrs['name'].'%\'';
        $SQL = AAC::$SQL;
        $SQL->myQuery($query);
        if ($SQL->num_rows() == 0) {
        //create new message
            $msg = new IOBox('message');
            $msg->addMsg('Nothing found.');
            $msg->addReload('<< Back');
            $msg->addClose('Close');
            $msg->show();
        }else {
            while ($a = $SQL->fetch_array())
                $characters[] = $a['name'];
            //create new message
            $msg = new IOBox('admin');
            $msg->target = $_GET['script'];
            $msg->addMsg($SQL->num_rows().' character(s) found!');
            $msg->addSelect('list',array_combine($characters,$characters));
            $msg->addReload('<< Back');
            $msg->addClose('Cancel');
            $msg->addSubmit('Next >>');
            $msg->show();
        }
    } else {
    //create new message
        $msg = new IOBox('message');
        $msg->addMsg('Name must contain 2 characters at least.');
        $msg->addReload('<< Back');
        $msg->addClose('Close');
        $msg->show();
    }
} catch(FormNotFoundException $e) {
//create new form
    $form = new IOBox('search');
    $form->target = $_SERVER['PHP_SELF'].'?script='.$_POST['script'];
    $form->addLabel('Find Character');
    $form->addInput('name');
    $form->addClose('Cancel');
    $form->addSubmit('Next >>');
    $form->show();
}
?>

Co do tego hosta to pewnie tak jeśli obsługuje DNS'a

 

@edit: a po co Ci to ? mozna przeciez w pma zmienic w tabeli, a tak duzo roboty nie ma raptem 5 klikniec i wpisac 1 cyfre, a GM kazdemu dawał nie będziesz.

Opublikowano

Dzięki, zaraz sprawdzę to, myślisz że ovh+mintshost obsługuję dns ?

@Edit

nadal ten sam error.

Dodam to, że gdy klikam update ip wyskakuje taki error:

Can't find config.lua

qxv1fr.jpg


by NovusOrdo


It is better to keep your mouth closed and let people think you are a fool than to open it and remove all doubt. ~Mark Twain

Opublikowano

sql.php

<?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;
    }
}
?>

Co do DNS to obsluguje bo sprawdzilem

Opublikowano

sql.php

<?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;
    }
}
?>

Co do DNS to obsluguje bo sprawdzilem

Dzięki !

Teraz pojawił się kolejny problem, tym razem z mysql

Fatal error: Uncaught exception 'DatabaseQueryException'
Message: Error #1146:Table 'ots.groups' doesn't exist
SQL query: SELECT * FROM `groups`
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:Disabled

Dodam, że mogę normalnie tworzyć nowe grupy poprzez stronę oraz nadawać access poprzez bazę danych.

qxv1fr.jpg


by NovusOrdo


It is better to keep your mouth closed and let people think you are a fool than to open it and remove all doubt. ~Mark Twain

Opublikowano

W tym problem ... skąd, wybacz ale robię chyba 2 raz bazę danych tak więc... bardziej się skupiałem na mapie i skryptach, które ogarniam perfecto.

 

@rafaeru

robiłem tak z 3 razy zanim wszedłem tu na forum, 

 

Baza danych:

x691ub.jpg

13ydp2.jpg

 

a tutaj error gdy próbuję wrzucić tam ten plik

Błąd
SQL query:


CREATE TABLE `nicaw_accounts` (
  `account_id` int(10) unsigned NOT NULL,
  `rlname` varchar(50) NULL,
  `location` varchar(50) NULL,
  `comment` tinytext NULL,
  `recovery_key` char(32) NULL,
  `reveal_characters` tinyint(1) NOT NULL default '1',
  UNIQUE KEY `account_id` (`account_id`)
) ENGINE = InnoDB;
MySQL zwrócił komunikat: Dokumentacja

#1050 - Table 'nicaw_accounts' already exists 

qxv1fr.jpg


by NovusOrdo


It is better to keep your mouth closed and let people think you are a fool than to open it and remove all doubt. ~Mark Twain

Opublikowano

Niestety to samo, widzę że też robisz/masz/robiłeś serwer dragonball :).

Spróbuję usunąć ręcznie w bazie danych wszystko związane ze stroną a następnie dodać ten schems.

 

@Edit

nie obrazisz się jak pożyczę sobie SMS Shop ;D? 

 

@rafaeru

znalazłem coś dziwnego w bazie danych

 

ecb85b.jpg

qxv1fr.jpg


by NovusOrdo


It is better to keep your mouth closed and let people think you are a fool than to open it and remove all doubt. ~Mark Twain

Opublikowano

Nie wiem własnie co jest błędem u Ciebie. Musisz sie pobawić bo u mnie wszystko elegancko działa.

Co do SMS shopu to on nie działa do końca bo nie daje itema w grze :P

 

PS. ide spać wiec sam pokombinuj.

Opublikowano

Mhmm zauważyłem, że w shema nie ma żadnego "groups" więc jak jutro będziesz do mógłbyć przesłać całą zawartość shema.mysql ?

qxv1fr.jpg


by NovusOrdo


It is better to keep your mouth closed and let people think you are a fool than to open it and remove all doubt. ~Mark Twain

Opublikowano

Mhmm zauważyłem, że w shema nie ma żadnego "groups" więc jak jutro będziesz do mógłbyć przesłać całą zawartość shema.mysql ?

ale ja tez patrzylem i nie mam w pma tabeli group. a wszystko dziala

Opublikowano

Dobra, bo zauważyłem że ta tabela w sumie mało daje, tylko możliwość nadania GM Create.

Co dodaje opcja GM Create ? Nadaje po prostu dany access na serwerze ? 

qxv1fr.jpg


by NovusOrdo


It is better to keep your mouth closed and let people think you are a fool than to open it and remove all doubt. ~Mark Twain

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...