예제 #1
0
<?php

// includes POT main file
include_once 'classes/OTS.php';
// database configuration - can be simply moved to external file, eg. config.php
$config = array('driver' => POT::DB_MYSQL, 'host' => 'localhost', 'user' => 'wrzasq', 'database' => 'otserv');
// creates POT instance (or get existing one)
// dont use POT::getInstance() anymore
POT::connect(null, $config);
// could be: POT::connect(POT::DB_MYSQL, $config);
예제 #2
0
파일: framework.php 프로젝트: Tobbebror/POT
<?php

// includes POT main file
include_once 'classes/OTS.php';
// dont use POT::getInstance() anymore
// connects to database
POT::connect(POT::DB_MYSQL, array('host' => 'localhost', 'user' => 'wrzasq', 'database' => 'otserv'));
// load all resources
POT::loadVocations('/home/wrzasq/.otserv/data/vocations.xml');
POT::loadMonsters('/home/wrzasq/.otserv/data/monster/');
POT::loadSpells('/home/wrzasq/.otserv/data/spells/spells.xml');
POT::loadItems('/home/wrzasq/.otserv/data/items/');
POT::loadMap('/home/wrzasq/.otserv/data/world/map.otbm');
/*
    Invites handling driver.
*/
class InvitesDriver implements IOTS_GuildAction
{
}
/*
    Membership requests handling driver.
*/
class RequestsDriver implements IOTS_GuildAction
{
}
/*
    Standard binary format cache.
*/
class FileCache implements IOTS_FileCache
{
}
예제 #3
0
파일: multidb.php 프로젝트: Tobbebror/POT
<?php

// includes POT main file
include_once 'classes/OTS.php';
// define database ids
define(DB_OTSERV1, 100);
define(DB_OTSERV2, 101);
// Config of first database
$config_db1 = array('driver' => POT::DB_MYSQL, 'prefix' => '', 'host' => 'localhost', 'user' => 'wrzasq', 'password' => '', 'database' => 'otserv1');
// Config of second database
$config_db2 = array('driver' => POT::DB_MYSQL, 'prefix' => '', 'host' => 'localhost', 'user' => 'wrzasq', 'password' => '', 'database' => 'otserv2');
// Catch PDO Exceptions!
try {
    // Set the database we want to use
    POT::setCurrentDB(DB_OTSERV1);
    POT::connect(null, $config_db1);
    // Change to another ID to connect
    POT::setCurrentDB(DB_OTSERV2);
    POT::connect(null, $config_db2);
} catch (Exception $e) {
    var_dump($e->getMessage());
}
// To use a database you must set it with POT::setCurrentDB(DB_ID)
POT::setCurrentDB(DB_OTSERV1);
// Then you can get the DB Handle
$ot_db = POT::getDBHandle();
// ... and use it!