Ir para conteúdo
  • Cadastre-se

Erro Com Instalaçao do Website


Posts Recomendados

To tentando cria um website pro meu otserv e to na parte do step 1

o problema e qui eu boto o link la do meu otserv e apareçe isso

Warning: Error parsing C:/Documents and Settings/NTSYS/Desktop/TibiaBaiakwar/config.lua on line 14 in C:\xampp\htdocs\install.php on line 130

File config.lua loaded from C:/Documents and Settings/NTSYS/Desktop/TibiaBaiakwar/config.lua and it's not valid TFS config.lua file. Go to STEP 1 - select other directory. If it's your config.lua file from TFS contact with acc. maker author.

Ajudem Ae Plz

Editado por paulosexy (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

:P</body></noframes> </frameset> </html>'; if($_REQUEST['page'] == 'menu') echo '<h2>MENU</h2><br><b>IF NOT INSTALLED:</b><br> <a href="install.php?page=step&step=start" target="step">0. Informations</a><br> <a href="install.php?page=step&step=1" target="step">1. Set server path</a><br> <a href="install.php?page=step&step=2" target="step">2. Check DataBase connection</a><br> <a href="install.php?page=step&step=3&server_conf=yes" target="step">3. Add tables and columns to DB</a><br> <a href="install.php?page=step&step=4&server_conf=yes" target="step">4. Add samples to DB</a><br> <a href="install.php?page=step&step=5&server_conf=yes" target="step">5. Set Admin Account</a><br> <b>FOR ADMINS:</b><br> <a href="index.php?subtopic=adminpanel&action=install_monsters" target="step">6. Load Monsters from OTS</a><br> <a href="index.php?subtopic=adminpanel&action=install_spells" target="step">7. Load Spells from OTS</a><br>'; if($_REQUEST['page'] == 'step') { if($config['site']['install'] != "no") { if($_REQUEST['server_conf'] == 'yes' || ($_REQUEST['step'] > 2 && $_REQUEST['step'] < 6)) { $config['server'] = parse_ini_file($config['site']['server_path'].'config.lua'); if(isset($config['server']['mysqlHost'])) { $mysqlhost = $config['server']['mysqlHost']; $mysqluser = $config['server']['mysqlUser']; $mysqlpass = $config['server']['mysqlPass']; $mysqldatabase = $config['server']['mysqlDatabase']; } elseif(isset($config['server']['sqlHost'])) { $mysqlhost = $config['server']['sqlHost']; $mysqluser = $config['server']['sqlUser']; $mysqlpass = $config['server']['sqlPass']; $mysqldatabase = $config['server']['sqlDatabase']; } $sqlitefile = $config['server']['sqliteDatabase']; $passwordency = ''; if(strtolower($config['server']['useMD5Passwords']) == 'yes' || strtolower($config['server']['passwordType']) == 'md5') $passwordency = 'md5'; if(strtolower($config['server']['passwordType']) == 'sha1') $passwordency = 'sha1'; // loads #####POT mainfile##### include('pot/OTS.php'); // PDO and POT connects to database $ots = POT::getInstance(); if(strtolower($config['server']['sqlType']) == "mysql") { try { $ots->connect(POT::DB_MYSQL, array('host' => $mysqlhost, 'user' => $mysqluser, 'password' => $mysqlpass, 'database' => $mysqldatabase) ); } catch(PDOException $error) { echo 'Database error - can\'t connect to MySQL database. Possible reasons:<br>1. MySQL server is not running on host.<br>2. MySQL user, password, database or host isn\'t configured in: <b>'.$config['site']['server_path'].'config.lua</b> .<br>3. MySQL user, password, database or host is wrong.'; exit; } } elseif(strtolower($config['server']['sqlType']) == "sqlite") { $link_to_sqlitedatabase = $config['site']['server_path'].$sqlitefile; try { $ots->connect(POT::DB_SQLITE, array('database' => $link_to_sqlitedatabase)); } catch(PDOException $error) { echo 'Database error - can\'t open SQLite database. Possible reasons:<br><b>'.$link_to_sqlitedatabase.'</b> - file isn\'t valid SQLite database.<br><b>'.$link_to_sqlitedatabase.'</b> - doesn\'t exist.'; exit; } } else { echo 'Database error. Unknown database type in <b>'.$config['site']['server_path'].'config.lua</b> . Must be equal to: "<b>mysql</b>" or "<b>sqlite</b>". Now is: "<b>'.strtolower($config['server']['sqlType']).'"</b>'; exit; } $SQL = POT::getInstance()->getDBHandle(); } $step = $_REQUEST['step']; if(empty($step)) $step = $config['site']['install']; if($step == 'start') { echo '<h1>STEP '.$step.'</h1>Informations<br>'; echo 'Welcome to Gesior Account Maker installer. <b>First do steps 1-5 one by one, later (when you will be logged on admin account) press on links to steps 6-8 to load configuration from OTS.</b>'; } if($step == '1') { if(isset($_REQUEST['server_path'])) { echo '<h1>STEP '.$step.'</h1>Check server configuration<br>'; $config['site']['server_path'] = $_REQUEST['server_path']; $config['site']['server_path'] = trim($config['site']['server_path'])."\\"; $config['site']['server_path'] = str_replace("\\\\", "/", $config['site']['server_path']); $config['site']['server_path'] = str_replace("\\", "/", $config['site']['server_path']); $config['site']['server_path'] = str_replace("//", "/", $config['site']['server_path']); saveconfig_ini($config['site']); if(file_exists($config['site']['server_path'].'config.lua')) { $config['server'] = parse_ini_file($config['site']['server_path'].'config.lua'); if(isset($config['server']['sqlType'])) { $config['site']['install'] = 2; saveconfig_ini($config['site']); echo 'File <b>config.lua</b> loaded from <font color="red"><i>'.$config['site']['server_path'].'config.lua</i></font> and looks like fine server config file. Now you can check database('.$config['server']['sqlType'].') connection: <a href="install.php?page=step&step=2">STEP 2 - check database connection</a>'; } else { echo 'File <b>config.lua</b> loaded from <font color="red"><i>'.$config['site']['server_path'].'config.lua</i></font> and it\'s not valid TFS config.lua file. <a href="install.php?page=step&step=1">Go to STEP 1 - select other directory.</a> If it\'s your config.lua file from TFS contact with acc. maker author.'; } } else { echo 'Can\'t load file <b>config.lua</b> from <font color="red"><i>'.$config['site']['server_path'].'config.lua</i></font> File doesn\'t exist in selected directory. <a href="install.php?page=step&step=1">Go to STEP 1 - select other directory.</a>'; } } else { echo 'Please write you TFS directory below. Like: <i>C:\Documents and Settings\Gesior\Desktop\TFS 0.2.9\</i><form action="install.php"> <input type="text" name="server_path" size="90" value="'.$config['site']['server_path'].'" /><input type="hidden" name="page" value="step" /><input type="hidden" name="step" value="1" /><input type="submit" value="Set server path" /></form>'; } } if($step == '2') { echo '<h1>STEP '.$step.'</h1>Check database connection<br>'; echo 'If you don\'t see any errors press <a href="install.php?page=step&step=3&server_conf=yes">link to STEP 3 - Add tables and columns to DB</a>. If you see some errors it mean server has wrong configuration. Check FAQ or ask author of acc. maker.'; //load server config $config['server'] = parse_ini_file($config['site']['server_path'].'config.lua'); if(isset($config['server']['mysqlHost'])) { //new (0.2.6+) ots config.lua file $mysqlhost = $config['server']['mysqlHost']; $mysqluser = $config['server']['mysqlUser']; $mysqlpass = $config['server']['mysqlPass']; $mysqldatabase = $config['server']['mysqlDatabase']; } elseif(isset($config['server']['sqlHost'])) { //old (0.2.4) ots config.lua file $mysqlhost = $config['server']['sqlHost']; $mysqluser = $config['server']['sqlUser']; $mysqlpass = $config['server']['sqlPass']; $mysqldatabase = $config['server']['sqlDatabase']; } $sqlitefile = $config['server']['sqliteDatabase']; $passwordency = ''; if(strtolower($config['server']['useMD5Passwords']) == 'yes' || strtolower($config['server']['passwordType']) == 'md5') $passwordency = 'md5'; if(strtolower($config['server']['passwordType']) == 'sha1') $passwordency = 'sha1'; // loads #####POT mainfile##### include('pot/OTS.php'); $ots = POT::getInstance(); if(strtolower($config['server']['sqlType']) == "mysql") { try { $ots->connect(POT::DB_MYSQL, array('host' => $mysqlhost, 'user' => $mysqluser, 'password' => $mysqlpass, 'database' => $mysqldatabase) ); } catch(PDOException $error) { echo 'Database error - can\'t connect to MySQL database. Possible reasons:<br>1. MySQL server is not running on host.<br>2. MySQL user, password, database or host isn\'t configured in: <b>'.$config['site']['server_path'].'config.lua</b> .<br>3. MySQL user, password, database or host is wrong.'; exit; } } elseif(strtolower($config['server']['sqlType']) == "sqlite") { $link_to_sqlitedatabase = $config['site']['server_path'].$sqlitefile; try { $ots->connect(POT::DB_SQLITE, array('database' => $link_to_sqlitedatabase)); } catch(PDOException $error) { echo 'Database error - can\'t open SQLite database. Possible reasons:<br><b>'.$link_to_sqlitedatabase.'</b> - file isn\'t valid SQLite database.<br><b>'.$link_to_sqlitedatabase.'</b> - doesn\'t exist.'; exit; } } else { echo 'Database error. Unknown database type in <b>'.$config['site']['server_path'].'config.lua</b> . Must be equal to: "<b>mysql</b>" or "<b>sqlite</b>". Now is: "<b>'.strtolower($config['server']['sqlType']).'"</b>'; exit; } $SQL = POT::getInstance()->getDBHandle(); $config['site']['install'] = 3; saveconfig_ini($config['site']); } if($step == '3') { echo '<h1>STEP '.$step.'</h1>Add tables and columns to DB<br>'; echo 'Installer try to add new tables and columns to database.<br>'; $config['server'] = parse_ini_file($config['site']['server_path'].'config.lua'); if($config['server']['sqlType'] == "sqlite") { try { $SQL->query('ALTER TABLE accounts ADD "key" VARCHAR(255) NOT NULL DEFAULT "";'); } catch(PDOException $error) {} try { $SQL->query('ALTER TABLE accounts ADD "page_lastday" INTEGER(11) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {} try { $SQL->query('ALTER TABLE accounts ADD "email_new" VARCHAR(255) NOT NULL DEFAULT "";'); } catch(PDOException $error) {} try { $SQL->query('ALTER TABLE accounts ADD "email_new_time" INTEGER(15) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {} try { $SQL->query('ALTER TABLE accounts ADD "created" INTEGER(11) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {} try { $SQL->query('ALTER TABLE accounts ADD "rlname" VARCHAR(255) NOT NULL DEFAULT "";'); } catch(PDOException $error) {} try { $SQL->query('ALTER TABLE accounts ADD "location" VARCHAR(255) NOT NULL DEFAULT "";'); } catch(PDOException $error) {} try { $SQL->query('ALTER TABLE accounts ADD "page_access" INTEGER(11) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {} try { $SQL->query('ALTER TABLE accounts ADD "email_code" VARCHAR(255) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {} try { $SQL->query('ALTER TABLE accounts ADD "next_email" INTEGER(11) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {} try { $SQL->query('ALTER TABLE accounts ADD "premium_points" INTEGER(11) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {} echo "Added columns to table <b>accounts</b>.<br/>"; try { $SQL->query('ALTER TABLE guilds ADD "description" TEXT NOT NULL DEFAULT "";'); } catch(PDOException $error) {} try { $SQL->query('ALTER TABLE guilds ADD "logo_gfx_name" VARCHAR(255) NOT NULL DEFAULT "";'); } catch(PDOException $error) {} echo "Added columns to table <b>guilds</b>.<br/>"; try { $SQL->query('ALTER TABLE players ADD "online" INTEGER(11) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {} try { $SQL->query('ALTER TABLE players ADD "created" INTEGER(11) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {} try { $SQL->query('ALTER TABLE players ADD "nick_verify" INTEGER(11) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {} try { $SQL->query('ALTER TABLE players ADD "old_name" VARCHAR(255) NOT NULL DEFAULT "";'); } catch(PDOException $error) {} try { $SQL->query('ALTER TABLE players ADD "hide_char" INTEGER(11) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {} try { $SQL->query('ALTER TABLE players ADD "comment" TEXT NOT NULL DEFAULT "";'); } catch(PDOException $error) {} echo "Added columns to table <b>players</b>.<br/>"; try { $SQL->query('CREATE TABLE "z_news_tickers" ( "date" INTEGER NOT NULL, "author" INTEGER NOT NULL, "image_id" INTEGER NOT NULL DEFAULT 0, "text" TEXT NOT NULL, "hide_ticker" INTEGER NOT NULL DEFAULT 0);'); } catch(PDOException $error) {} echo "Added table <b>z_news_tickers</b> (tickers).<br/>"; try { $SQL->query('CREATE TABLE "z_spells" ( "name" VARCHAR(255) NOT NULL, "spell" VARCHAR(255) NOT NULL, "spell_type" VARCHAR(255) NOT NULL, "mana" INTEGER NOT NULL DEFAULT 0, "lvl" INTEGER NOT NULL DEFAULT 0, "mlvl" INTEGER NOT NULL DEFAULT 0, "soul" INTEGER NOT NULL DEFAULT 0, "pacc" VARCHAR(255) NOT NULL, "vocations" VARCHAR(255) NOT NULL, "conj_count" INTEGER NOT NULL DEFAULT 0, "hide_spell" INTEGER NOT NULL DEFAULT 0);'); } catch(PDOException $error) {} echo "Added table <b>z_spells</b> (spells list).<br/>"; try { $SQL->query('CREATE TABLE "z_monsters" ( "hide_creature" INTEGER NOT NULL DEFAULT 0, "name" VARCHAR(255) NOT NULL, "mana" INTEGER NOT NULL, "exp" INTEGER NOT NULL, "health" INTEGER NOT NULL, "speed_lvl" INTEGER NOT NULL DEFAULT 1, "use_haste" INTEGER NOT NULL, "voices" text NOT NULL, "immunities" VARCHAR(255) NOT NULL, "summonable" INTEGER NOT NULL, "convinceable" INTEGER NOT NULL, "race" VARCHAR(255) NOT NULL, "gfx_name" VARCHAR(255) NOT NULL)'); } catch(PDOException $error) {} echo "Added table <b>z_monsters</b> (monsters list).<br/>"; } elseif($config['server']['sqlType'] == "mysql") { echo "<h3>Add columns to table <b>accounts</b></h3>"; try { $SQL->query("ALTER TABLE `accounts` ADD `key` VARCHAR( 20 ) NOT NULL DEFAULT '0';"); echo "<font color=\"green\">Added column</font> <b>key</b> to table <b>accounts</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>key</b> to table <b>accounts</b>, already exist?<br/>";} try { $SQL->query("ALTER TABLE `accounts` ADD `page_lastday` INT( 11 ) NOT NULL;"); echo "<font color=\"green\">Added column</font> <b>page_lastday</b> to table <b>accounts</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>page_lastday</b> to table <b>accounts</b>, already exist?<br/>";} try { $SQL->query("ALTER TABLE `accounts` ADD `email_new` VARCHAR( 255 ) NOT NULL;"); echo "<font color=\"green\">Added column</font> <b>email_new</b> to table <b>accounts</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>email_new</b> to table <b>accounts</b>, already exist?<br/>";} try { $SQL->query("ALTER TABLE `accounts` ADD `email_new_time` INT( 15 ) NOT NULL;"); echo "<font color=\"green\">Added column</font> <b>email_new_time</b> to table <b>accounts</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>email_new_time</b> to table <b>accounts</b>, already exist?<br/>";} try { $SQL->query("ALTER TABLE `accounts` ADD `created` INT( 11 ) NOT NULL DEFAULT '0';"); echo "<font color=\"green\">Added column</font> <b>created</b> to table <b>accounts</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>created</b> to table <b>accounts</b>, already exist?<br/>";} try { $SQL->query("ALTER TABLE `accounts` ADD `rlname` VARCHAR( 255 ) NOT NULL DEFAULT '';"); echo "<font color=\"green\">Added column</font> <b>rlname</b> to table <b>accounts</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>rlname</b> to table <b>accounts</b>, already exist?<br/>";} try { $SQL->query("ALTER TABLE `accounts` ADD `location` VARCHAR( 255 ) NOT NULL DEFAULT '';"); echo "<font color=\"green\">Added column</font> <b>location</b> to table <b>accounts</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>location</b> to table <b>accounts</b>, already exist?<br/>";} try { $SQL->query("ALTER TABLE `accounts` ADD `page_access` INT( 11 ) NOT NULL DEFAULT '0';"); echo "<font color=\"green\">Added column</font> <b>page_access</b> to table <b>accounts</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>page_access</b> to table <b>accounts</b>, already exist?<br/>";} try { $SQL->query("ALTER TABLE `accounts` ADD `email_code` VARCHAR( 255 ) NOT NULL DEFAULT '0';"); echo "<font color=\"green\">Added column</font> <b>email_code</b> to table <b>accounts</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>email_code</b> to table <b>accounts</b>, already exist?<br/>";} try { $SQL->query("ALTER TABLE `accounts` ADD `next_email` INT( 11 ) NOT NULL DEFAULT '0';"); echo "<font color=\"green\">Added column</font> <b>next_email</b> to table <b>accounts</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>next_email</b> to table <b>accounts</b>, already exist?<br/>";} try { $SQL->query("ALTER TABLE `accounts` ADD `premium_points` INT( 11 ) NOT NULL DEFAULT '0';"); echo "<font color=\"green\">Added column</font> <b>premium_points</b> to table <b>accounts</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>premium_points</b> to table <b>accounts</b>, already exist?<br/>";} try { $SQL->query("ALTER TABLE `accounts` ADD `vote` INT( 11 ) NOT NULL;"); echo "<font color=\"green\">Added column</font> <b>vote</b> to table <b>players</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>vote</b> to table <b>players</b>, already exist?<br/>";} try { $SQL->query("ALTER TABLE `accounts` ADD `last_post` INT( 11 ) NOT NULL DEFAULT '0';"); echo "<font color=\"green\">Added column</font> <b>last post</b> to table <b>accounts</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>last posts</b> to table <b>accounts</b>, already exist?<br/>";} try { $SQL->query("ALTER TABLE `accounts` ADD `flag` VARCHAR( 255 ) NOT NULL;"); echo "<font color=\"green\">Added column</font> <b>flag</b> to table <b>accounts</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>flag</b> to table <b>accounts</b>, already exist?<br/>";} echo "<h3>Add columns to table <b>guilds</b></h3>"; try { $SQL->query('ALTER TABLE `guilds` ADD `description` TEXT NOT NULL DEFAULT "";'); echo "<font color=\"green\">Added column</font> <b>description</b> to table <b>guilds</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>description</b> to table <b>guilds</b>, already exist?<br/>";} try { $SQL->query('ALTER TABLE `guilds` ADD `logo_gfx_name` VARCHAR( 255 ) NOT NULL DEFAULT "";'); echo "<font color=\"green\">Added column</font> <b>logo_gfx_name</b> to table <b>guilds</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>logo_gfx_name</b> to table <b>guilds</b>, already exist?<br/>";} echo "<h3>Add columns to table <b>players</b></h3>"; try { $SQL->query("ALTER TABLE `players` ADD `online` INT( 11 ) NOT NULL DEFAULT '0';"); echo "<font color=\"green\">Added column</font> <b>online</b> to table <b>players</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>online</b> to table <b>players</b>, already exist?<br/>";} try { $SQL->query("ALTER TABLE `players` ADD `created` INT( 11 ) NOT NULL DEFAULT '0';"); echo "<font color=\"green\">Added column</font> <b>created</b> to table <b>players</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>created</b> to table <b>players</b>, already exist?<br/>";} try { $SQL->query("ALTER TABLE `players` ADD `nick_verify` INT( 11 ) NOT NULL DEFAULT '0';"); echo "<font color=\"green\">Added column</font> <b>nick_verify</b> to table <b>players</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>nick_verify</b> to table <b>players</b>, already exist?<br/>";} try { $SQL->query("ALTER TABLE `players` ADD `old_name` VARCHAR( 255 ) NOT NULL DEFAULT '';"); echo "<font color=\"green\">Added column</font> <b>old_name</b> to table <b>players</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>old_name</b> to table <b>players</b>, already exist?<br/>";} try { $SQL->query("ALTER TABLE `players` ADD `hide_char` INT( 11 ) NOT NULL DEFAULT '0';"); echo "<font color=\"green\">Added column</font> <b>hide_char</b> to table <b>players</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>hide_char</b> to table <b>players</b>, already exist?<br/>";} try { $SQL->query("ALTER TABLE `players` ADD `worldtransfer` int(11) NOT NULL DEFAULT '0';"); echo "<font color=\"green\">Added column</font> <b>worldtransfer</b> to table <b>players</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>worldtransfer</b> to table <b>players</b>, already exist?<br/>";} try { $SQL->query("ALTER TABLE `players` ADD `comment` TEXT NOT NULL;"); echo "<font color=\"green\">Added column</font> <b>comment</b> to table <b>players</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>comment</b> to table <b>players</b>, already exist?<br/>";} echo "<h3>Add new tables to database</h3>"; try { $SQL->query("CREATE TABLE `z_news_tickers` ( `date` int(11) NOT NULL default '1', `author` int(11) NOT NULL, `image_id` int(3) NOT NULL default '0', `text` text NOT NULL, `hide_ticker` tinyint(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); echo '<font color=\"green\">Added table <b>z_news_tickers</b></font><br/>'; } catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_news_tickers</b> not added.</font> Already exist?<br/>";} try { $SQL->query('CREATE TABLE `z_spells` ( `name` VARCHAR(255) NOT NULL, `spell` VARCHAR(255) NOT NULL, `spell_type` VARCHAR(255) NOT NULL, `mana` INTEGER NOT NULL DEFAULT 0, `lvl` INTEGER NOT NULL DEFAULT 0, `mlvl` INTEGER NOT NULL DEFAULT 0, `soul` INTEGER NOT NULL DEFAULT 0, `pacc` VARCHAR(255) NOT NULL, `vocations` VARCHAR(255) NOT NULL, `conj_count` INTEGER NOT NULL DEFAULT 0, `hide_spell` INTEGER NOT NULL DEFAULT 0);'); echo '<font color=\"green\">Added table <b>z_spells</b></font><br/>'; } catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_spells</b> not added.</font> Already exist?<br/>";} try { $SQL->query('CREATE TABLE `z_monsters` ( `hide_creature` tinyint(1) NOT NULL default \'0\', `name` varchar(255) NOT NULL, `mana` int(11) NOT NULL, `exp` int(11) NOT NULL, `health` int(11) NOT NULL, `speed_lvl` int(11) NOT NULL default \'1\', `use_haste` tinyint(1) NOT NULL, `voices` text NOT NULL, `immunities` varchar(255) NOT NULL, `summonable` tinyint(1) NOT NULL, `convinceable` tinyint(1) NOT NULL, `race` varchar(255) NOT NULL, `gfx_name` varchar(255) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1;'); echo"<font color=\"green\">Added table <b>z_monsters</b></font><br/>"; } catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_monsters</b> not added.</font> Already exist?<br/>";} try { $SQL->query("CREATE TABLE `z_ots_comunication` ( `id` int(11) NOT NULL auto_increment, `name` varchar(255) NOT NULL, `type` varchar(255) NOT NULL, `action` varchar(255) NOT NULL, `param1` varchar(255) NOT NULL, `param2` varchar(255) NOT NULL, `param3` varchar(255) NOT NULL, `param4` varchar(255) NOT NULL, `param5` varchar(255) NOT NULL, `param6` varchar(255) NOT NULL, `param7` varchar(255) NOT NULL, `delete_it` int(2) NOT NULL default '1', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); echo "<font color=\"green\">Added table <b>z_ots_comunication</b> (shopsystem).<br/></font>"; } catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_ots_comunication</b> not added.</font> Already exist?<br/>";} try { $SQL->query("CREATE TABLE `z_shop_offer` ( `id` int(11) NOT NULL auto_increment, `points` int(11) NOT NULL default '0', `itemid1` int(11) NOT NULL default '0', `count1` int(11) NOT NULL default '0', `itemid2` int(11) NOT NULL default '0', `count2` int(11) NOT NULL default '0', `offer_type` varchar(255) default NULL, `offer_description` text NOT NULL, `offer_name` varchar(255) NOT NULL, `pid` INT(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;"); echo "<font color=\"green\">Added table <b>z_shop_offer</b> (shopsystem).<br/></font>"; } catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_shop_offer</b> not added.</font> Already exist?<br/>";} try { $SQL->query("CREATE TABLE `z_shop_history_item` ( `id` int(11) NOT NULL auto_increment, `to_name` varchar(255) NOT NULL default '0', `to_account` int(11) NOT NULL default '0', `from_nick` varchar(255) NOT NULL, `from_account` int(11) NOT NULL default '0', `price` int(11) NOT NULL default '0', `offer_id` int(11) NOT NULL default '0', `trans_state` varchar(255) NOT NULL, `trans_start` int(11) NOT NULL default '0', `trans_real` int(11) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); echo "<font color=\"green\">Added table <b>z_shop_history_item</b> (shopsystem).<br/></font>"; } catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_shop_history_item</b> not added.</font> Already exist?<br/>";} try { $SQL->query("CREATE TABLE `z_shop_history_pacc` ( `id` int(11) NOT NULL auto_increment, `to_name` varchar(255) NOT NULL default '0', `to_account` int(11) NOT NULL default '0', `from_nick` varchar(255) NOT NULL, `from_account` int(11) NOT NULL default '0', `price` int(11) NOT NULL default '0', `pacc_days` int(11) NOT NULL default '0', `trans_state` varchar(255) NOT NULL, `trans_start` int(11) NOT NULL default '0', `trans_real` int(11) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); echo "<font color=\"green\">Added table <b>z_shop_history_pacc</b> (shopsystem).<br/></font>"; } catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_shop_history_pacc</b> not added.</font> Already exist?<br/>";} try { $SQL->query("CREATE TABLE IF NOT EXISTS `z_changelog` ( `id` int(11) NOT NULL auto_increment, `type` varchar(255) NOT NULL default '', `where` varchar(255) NOT NULL default '', `date` int(11) NOT NULL default '0', `description` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;"); echo "<font color=\"green\">Added table <b>z_changelog</b> (changelog).<br/></font>"; } catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_changelog</b> not added.</font> Already exist?<br/>";} try { $SQL->query("CREATE TABLE `z_polls` ( `id` int(11) NOT NULL auto_increment, `question` varchar(255) NOT NULL, `end` int(11) NOT NULL, `start` int(11) NOT NULL, `answers` int(11) NOT NULL, `votes_all` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;"); echo "<font color=\"green\">Added table <b>z_polls</b> (poll-system).<br/></font>"; } catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_polls</b> not added.</font> Already exist?<br/>";} try { $SQL->query("CREATE TABLE `z_polls_answers` ( `poll_id` int(11) NOT NULL, `answer_id` int(11) NOT NULL, `answer` varchar(255) NOT NULL, `votes` int(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); echo "<font color=\"green\">Added table <b>z_polls_answers</b> (poll-system).<br/></font>"; } catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_polls_answers</b> not added.</font> Already exist?<br/>";} try { $SQL->query("CREATE TABLE IF NOT EXISTS `z_forum` ( `id` int(11) NOT NULL auto_increment, `sticky` tinyint(1) NOT NULL DEFAULT '0', `closed` tinyint(1) NOT NULL DEFAULT '0', `first_post` int(11) NOT NULL default '0', `last_post` int(11) NOT NULL default '0', `section` int(3) NOT NULL default '0', `replies` int(20) NOT NULL default '0', `views` int(20) NOT NULL default '0', `author_aid` int(20) NOT NULL default '0', `author_guid` int(20) NOT NULL default '0', `post_text` text NOT NULL, `post_topic` varchar(255) NOT NULL, `post_smile` tinyint(1) NOT NULL default '0', `post_date` int(20) NOT NULL default '0', `last_edit_aid` int(20) NOT NULL default '0', `edit_date` int(20) NOT NULL default '0', `post_ip` varchar(32) NOT NULL default '0.0.0.0', PRIMARY KEY (`id`), KEY `section` (`section`) ) ENGINE=MyISAM AUTO_INCREMENT=1 ;"); echo "<font color=\"green\">Added table <b>z_forum</b>.<br/></font>"; } catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_forum/b> not added.</font> Already exist?<br/>";} try { $SQL->query("CREATE TABLE `zaypay_payment` ( `payID` bigint(30) NOT NULL, `account_id` int(20) NOT NULL, `status` varchar(255) NOT NULL, PRIMARY KEY (`payID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; "); echo "<font color=\"green\">Added table <b>zaypay_payment</b>.<br/></font>"; } catch(PDOException $error) { echo "<font color=\"red\">Table <b>zaypay_payment</b> not added.</font> Already exist?<br/>";} try { $SQL->query("CREATE TABLE `z_bug_tracker` ( `account` varchar(255) NOT NULL, `type` int(11) NOT NULL, `status` int(11) NOT NULL, `text` text NOT NULL, `id` int(11) NOT NULL, `subject` varchar(255) NOT NULL, `reply` int(11) NOT NULL, `who` int(11) NOT NULL, `uid` int(11) NOT NULL auto_increment, `tag` int(11) NOT NULL, PRIMARY KEY (`uid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;"); echo "<font color=\"green\">Added table <b>z_bug_tracker</b> (bug tracker).<br/></font>"; } catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_bug_tracker</b> not added.</font> Already exist?<br/>";} } $config['site']['install'] = 4; saveconfig_ini($config['site']); echo '<br>Tables and columns added to database.<br>Go to <a href="install.php?page=step&step=4&server_conf=yes">STEP 4 - Add samples</a>'; } if($step == '4') { echo '<h1>STEP '.$step.'</h1>Add samples to DB:<br>'; $check_news_ticker = $SQL->query('SELECT * FROM z_news_tickers WHERE image_id = 1 AND author = 1 AND hide_ticker = 0 LIMIT 1 OFFSET 0')->fetch(); if(!isset($check_news_ticker['author'])) { $SQL->query('INSERT INTO z_news_tickers (date, author, image_id, text, hide_ticker) VALUES ('.time().', 1, 1, "Hello! Gesior account manager 0.3.6 installed. Report bugs Otland.Net Thread. Thanks to widnet and Norix.", 0)'); echo "Added first news ticker.<br/>"; } else { echo "News ticker sample is already in database. New sample is not needed.<br/>"; } $check_voc_0 = $SQL->query('SELECT * FROM players WHERE name = "Rook Sample" LIMIT 1 OFFSET 0')->fetch(); if(!isset($check_voc_0['name'])) { $SQL->query('INSERT INTO `players` (`id`, `name`, `world_id`, `group_id`, `account_id`, `level`, `vocation`, `health`, `healthmax`, `experience`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons`, `maglevel`, `mana`, `manamax`, `manaspent`, `soul`, `town_id`, `posx`, `posy`, `posz`, `conditions`, `cap`, `sex`, `lastlogin`, `lastip`, `save`, `skull`, `skulltime`, `rank_id`, `guildnick`, `lastlogout`, `blessings`, `balance`, `stamina`, `direction`, `loss_experience`, `loss_mana`, `loss_skills`, `loss_containers`, `loss_items`, `premend`, `online`, `marriage`, `promotion`, `deleted`, `description`, `created`, `nick_verify`, `old_name`, `hide_char`, `comment`) VALUES (NULL, "Rook Sample", 0, 1, 1, 1, 0, 150, 150, 0, 0, 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0, 50, 50, 7, "", 400, 0, 0, 0, 0, 0, 0, 0, "", 0, 0, 0, 201660000, 0, 100, 100, 100, 100, 100, 0, 0, 0, 0, 0, "", 0, 0, "", 0, "")'); echo "Added 'Rook Sample' character.<br/>"; } else { echo "Character 'Rook Sample' already in database.<br/>"; } $check_voc_1 = $SQL->query('SELECT * FROM players WHERE name = "Sorcerer Sample" LIMIT 1 OFFSET 0')->fetch(); if(!isset($check_voc_1['name'])) { $SQL->query('INSERT INTO `players` (`id`, `name`, `world_id`, `group_id`, `account_id`, `level`, `vocation`, `health`, `healthmax`, `experience`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons`, `maglevel`, `mana`, `manamax`, `manaspent`, `soul`, `town_id`, `posx`, `posy`, `posz`, `conditions`, `cap`, `sex`, `lastlogin`, `lastip`, `save`, `skull`, `skulltime`, `rank_id`, `guildnick`, `lastlogout`, `blessings`, `balance`, `stamina`, `direction`, `loss_experience`, `loss_mana`, `loss_skills`, `loss_containers`, `loss_items`, `premend`, `online`, `marriage`, `promotion`, `deleted`, `description`, `created`, `nick_verify`, `old_name`, `hide_char`, `comment`) VALUES (NULL, "Sorcerer Sample", 0, 1, 1, 1, 1, 150, 150, 0, 0, 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0, 50, 50, 7, "", 400, 0, 0, 0, 0, 0, 0, 0, "", 0, 0, 0, 201660000, 0, 100, 100, 100, 100, 100, 0, 0, 0, 0, 0, "", 0, 0, "", 0, "")'); echo "Added 'Sorcerer Sample' character.<br/>"; } else { echo "Character 'Sorcerer Sample' already in database.<br/>"; } $check_voc_2 = $SQL->query('SELECT * FROM players WHERE name = "Druid Sample" LIMIT 1 OFFSET 0')->fetch(); if(!isset($check_voc_2['name'])) { $SQL->query('INSERT INTO `players` (`id`, `name`, `world_id`, `group_id`, `account_id`, `level`, `vocation`, `health`, `healthmax`, `experience`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons`, `maglevel`, `mana`, `manamax`, `manaspent`, `soul`, `town_id`, `posx`, `posy`, `posz`, `conditions`, `cap`, `sex`, `lastlogin`, `lastip`, `save`, `skull`, `skulltime`, `rank_id`, `guildnick`, `lastlogout`, `blessings`, `balance`, `stamina`, `direction`, `loss_experience`, `loss_mana`, `loss_skills`, `loss_containers`, `loss_items`, `premend`, `online`, `marriage`, `promotion`, `deleted`, `description`, `created`, `nick_verify`, `old_name`, `hide_char`, `comment`) VALUES (NULL, "Druid Sample", 0, 1, 1, 1, 2, 150, 150, 0, 0, 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0, 50, 50, 7, "", 400, 0, 0, 0, 0, 0, 0, 0, "", 0, 0, 0, 201660000, 0, 100, 100, 100, 100, 100, 0, 0, 0, 0, 0, "", 0, 0, "", 0, "")'); echo "Added 'Druid Sample' character.<br/>"; } else { echo "Character 'Druid Sample' already in database.<br/>"; } $check_voc_3 = $SQL->query('SELECT * FROM players WHERE name = "Paladin Sample" LIMIT 1 OFFSET 0')->fetch(); if(!isset($check_voc_3['name'])) { $SQL->query('INSERT INTO `players` (`id`, `name`, `world_id`, `group_id`, `account_id`, `level`, `vocation`, `health`, `healthmax`, `experience`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons`, `maglevel`, `mana`, `manamax`, `manaspent`, `soul`, `town_id`, `posx`, `posy`, `posz`, `conditions`, `cap`, `sex`, `lastlogin`, `lastip`, `save`, `skull`, `skulltime`, `rank_id`, `guildnick`, `lastlogout`, `blessings`, `balance`, `stamina`, `direction`, `loss_experience`, `loss_mana`, `loss_skills`, `loss_containers`, `loss_items`, `premend`, `online`, `marriage`, `promotion`, `deleted`, `description`, `created`, `nick_verify`, `old_name`, `hide_char`, `comment`) VALUES (NULL, "Paladin Sample", 0, 1, 1, 1, 3, 150, 150, 0, 0, 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0, 50, 50, 7, "", 400, 0, 0, 0, 0, 0, 0, 0, "", 0, 0, 0, 201660000, 0, 100, 100, 100, 100, 100, 0, 0, 0, 0, 0, "", 0, 0, "", 0, "")'); echo "Added 'Paladin Sample' character.<br/>"; } else { echo "Character 'Paladin Sample' already in database.<br/>"; } $check_voc_4 = $SQL->query('SELECT * FROM players WHERE name = "Knight Sample" LIMIT 1 OFFSET 0')->fetch(); if(!isset($check_voc_4['name'])) { $SQL->query('INSERT INTO `players` (`id`, `name`, `world_id`, `group_id`, `account_id`, `level`, `vocation`, `health`, `healthmax`, `experience`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons`, `maglevel`, `mana`, `manamax`, `manaspent`, `soul`, `town_id`, `posx`, `posy`, `posz`, `conditions`, `cap`, `sex`, `lastlogin`, `lastip`, `save`, `skull`, `skulltime`, `rank_id`, `guildnick`, `lastlogout`, `blessings`, `balance`, `stamina`, `direction`, `loss_experience`, `loss_mana`, `loss_skills`, `loss_containers`, `loss_items`, `premend`, `online`, `marriage`, `promotion`, `deleted`, `description`, `created`, `nick_verify`, `old_name`, `hide_char`, `comment`) VALUES (NULL, "Knight Sample", 0, 1, 1, 1, 4, 150, 150, 0, 0, 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0, 50, 50, 7, "", 400, 0, 0, 0, 0, 0, 0, 0, "", 0, 0, 0, 201660000, 0, 100, 100, 100, 100, 100, 0, 0, 0, 0, 0, "", 0, 0, "", 0, "")'); echo "Added 'Knight Sample' character.<br/>"; } else { echo "Character 'Knight Sample' already in database.<br/>"; $config['site']['install'] = 5; saveconfig_ini($config['site']); echo 'All samples added to database. Now you can go to <a href="install.php?page=step&step=5&server_conf=yes">STEP 5 - Set Admin Account</a><br/>'; } } if($step == '5') { echo '<h1>STEP '.$step.'</h1>Set Admin Account<br>'; $config['server'] = parse_ini_file($config['site']['server_path'].'config.lua'); if(empty($_REQUEST['saveaccpassword'])) { echo 'Admin account number is: <b>1</b><br/>Set new password to this account.<br>'; echo 'New password: <form action="install.php" method=POST><input type="text" name="newpass" size="35">(Don\'t give it password to anyone!)'; echo '<input type="hidden" name="saveaccpassword" value="yes"><input type="hidden" name="page" value="step"><input type="hidden" name="step" value="5"><input type="submit" value="SET"></form><br>If account with number 1 doesn\'t exist installator will create it and set your password.'; } else { $newpass = $_POST['newpass']; if(!check_password($newpass)) echo 'Password contains illegal characters. Please use only a-Z and 0-9. <a href="install.php?page=step&step=5&server_conf=yes">GO BACK</a> and write other password.'; else { $newpass_to_db = password_ency($newpass); $account = new OTS_Account(); $account->load(1); if($account->isLoaded()) { $account->setPassword($newpass_to_db); $account->save(); $account->setCustomField("page_access", 3); } else { $number = $account->create(1,1,1); $account->setPassword($newpass_to_db); $account->unblock(); $account->save(); $account->setCustomField("page_access", 3); } $_SESSION['account'] = 1; $_SESSION['password'] = $newpass; $logged = TRUE; $account->setCustomField("page_lastday", time()); echo '<h1>Admin account number: 1<br>Admin account password: '.$_POST['newpass'].'</h1><br/><h3>It\'s end of first part of installation. Installation is blocked. From now don\'t modify file config.ini!<br>Press links to STEPs 6 and 7 in menu.</h3>'; $config['site']['install'] = 'no'; saveconfig_ini($config['site']); } } } } else echo "Account maker is already installed! To reinstall open file 'config.ini' in directory 'config' and change:<br/><b>install = \"no\"</b><br/>to:</br><b>install = \"start\"</b><br/>and enter this site again."; } ?>

<?PHP

$config['site'] = parse_ini_file('config/config.ini');

session_start();

//save config in ini file

function saveconfig_ini($config) {

$file = fopen("config/config.ini", "w");

foreach($config as $param => $data) {

$file_data .= $param.' = "'.str_replace('"', '', $data).'"

';

}

rewind($file);

fwrite($file, $file_data);

fclose($file);

}

function check_password($pass)

{

  $temp = strspn("$pass", "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890");

  if ($temp != strlen($pass)) {

  return false;

  }

  else

  {

  $ok = "/[a-zA-Z0-9]{1,40}/";

  return (preg_match($ok, $pass))? true: false;

  }

}

function password_ency($password)

{

$ency = $GLOBALS['passwordency'];

if($ency == 'sha1')

  return sha1($password);

elseif($ency == 'md5')

  return md5($password);

elseif($ency == '')

  return $password;

}

if($_REQUEST['page'] == '' && !isset($_REQUEST['step']))

echo '<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />

<title>Installation of account maker</title>

</head>

<frameset cols="230,*">

<frame name="menu" src="install.php?page=menu" />

<frame name="step" src="install.php?page=step&step=0" />

<noframes><body>Frames don\'t work. Install Firefox 

Bem se seu config.lua tive configurado certo isso ae /\ é pra dar certo se não der o config.lua ñ ta do jeito certo

Editado por Augusto (veja o histórico de edições)


Regras Gerais 

 

"Califórnia Brasileira :cool: "

Link para o post
Compartilhar em outros sites

Meu colega estava com este mesmo problema , agora ele sabe oq fazer vlw , um joinha pra vc ! :rock:

Se você Gostou ou Eu te ajudei Da REP , Não custa nadinha =D

MELHOR GAME DE ESTRATEGIA \/

468x60.jpg

CONTATO: [email protected]

AJUDA É SÓ CLICAR PF > 8550452.png

Link para o post
Compartilhar em outros sites

tah do mermo jeito nao sei oqui e quado eu cliclo pra ir pro step 2 ele volta pro 1

Link para o post
Compartilhar em outros sites

"and it's not valid TFS config.lua file"

Precisa dizer mais algo? Seu arquivo de configurações do server não é válido para o determinado site.

Deve ser "um pouco" modificado. Tente outro site disponível para download ou troque o seu server.

Aliás, peço que por favor, mude o título do tópico para ficar mais "visível" para todos, o que o título "Ajudem Ake" irá trazer para seu tópico? Recomendo ponhar algo do tipo "Erro instalação website". Tirando os erros de português que seu tópico fica quase ilegível por este motivo.

Link para o post
Compartilhar em outros sites

suspeitei já que seu config.lua n tava configurado certo

Retire os espaços no começo de cada linha no config e retire toda as linhas com 2 traços EX:--


Regras Gerais 

 

"Califórnia Brasileira :cool: "

Link para o post
Compartilhar em outros sites

Consegui Passa agr fika dando erro na parte da acc do adm apareçe isso

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'vip_time' in 'field list'' in C:\xampp\htdocs\pot\OTS_Account.php:237 Stack trace: #0 C:\xampp\htdocs\pot\OTS_Account.php(237): PDO->query('SELECT `id`, `n...') #1 C:\xampp\htdocs\install.php(572): OTS_Account->load(1) #2 {main} thrown in C:\xampp\htdocs\pot\OTS_Account.php on line 237

Link para o post
Compartilhar em outros sites

ta faltando alguma linha


<?php

/**#@+

* @version 0.0.1

*/

/**

* @package POT

* @version 0.1.5

* @author Wrzasq <[email protected]>

* @copyright 2007 - 2008 (C) by Wrzasq

* @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU Lesser General Public License, Version 3

*/

/**

* OTServ account abstraction.

*

* @package POT

* @version 0.1.5

* @property string $name Account name.

* @property string $password Password.

* @property string $eMail Email address.

* @property int $premiumEnd Timestamp of PACC end.

* @property bool $blocked Blocked flag state.

* @property bool $deleted Deleted flag state.

* @property bool $warned Warned flag state.

* @property bool $banned Ban state.

* @property-read int $id Account number.

* @property-read bool $loaded Loaded state.

* @property-read OTS_Players_List $playersList Characters of this account.

* @property-read int $access Access level.

* @tutorial POT/Accounts.pkg

*/

class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable

{

/**

* Account data.

*

* @var array

* @version 0.1.5

*/

	private $data = array('email' => '', 'key' => '', 'premium_points' => 0, 'blocked' => false, 'warned' => false, 'rlname' => '', 'location' => '', 'page_access' => 0, 'lastday' => 0, 'premdays' => 0, 'created' => 0);

/**

* Creates new account.

*

* <p>

* This method creates new account with given name. Account number is generated automaticly and saved into {@link OTS_Account::getId() ID field}.

* </p>

*

* <p>

* If you won't specify account name then random one will be generated.

* </p>

*

* <p>

* If you use own account name then it will be returned after success, and exception will be generated if it will be alredy used as name will be simply used in query with account create attempt.

* </p>

*

* @version 0.1.5

* @since 0.1.5

* @param string $name Account name.

* @return string Account name.

* @throws PDOException On PDO operation error.

* @example examples/create.php create.php

* @tutorial POT/Accounts.pkg#create

*/

	public function createNamed($name = null)

	{

		// if name is not passed then it will be generated randomly

		if( !isset($name) )

		{

			$exist = array();

			// reads already existing names

			foreach( $this->db->query('SELECT ' . $this->db->fieldName('name') . ' FROM ' . $this->db->tableName('accounts') )->fetchAll() as $account)

			{

				$exist[] = $account['name'];

			}

			// initial name

			$name = uniqid();

			// repeats until name is unique

			while( in_array($name, $exist) )

			{

				$name .= '_';

			}

		}

		// saves blank account info

		$this->db->query('INSERT INTO ' . $this->db->tableName('accounts') . ' (' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('password') . ', ' . $this->db->fieldName('email') . ', ) VALUES (' . $this->db->quote($name) . ', \'\', \'\')');

		// reads created account's ID

		$this->data['id'] = $this->db->lastInsertId();

		// return name of newly created account

		return $name;

	}

/**

* Creates new account.

*

* <p>

* Create new account in given range (1 - 9999999 by default).

* </p>

*

* <p>

* Note: If account name won't be speciffied random will be created.

* </p>

*

* <p>

* Note: Since 0.0.3 version this method doesn't require buffered queries.

* </p>

*

* <p>

* Note: Since 0.1.5 version you should use {@link OTS_Account::createNamed() createNamed() method} since OTServ now uses account names.

* </p>

*

* <p>

* Note: Since 0.1.1 version this method throws {@link E_OTS_Generic E_OTS_Generic} exceptions instead of general Exception class objects. Since all exception classes are child classes of Exception class so your old code will still handle all exceptions.

* </p>

*

* <p>

* Note: Since 0.1.5 version this method no longer creates account as blocked.

* </p>

*

* @version 0.1.5

* @param int $min Minimum number.

* @param int $max Maximum number.

* @param string $name Account name.

* @return int Created account number.

* @throws E_OTS_Generic When there are no free account numbers.

* @throws PDOException On PDO operation error.

* @deprecated 0.1.5 Use createNamed().

*/

	public function create($min = 1, $max = 9999999, $name = null)

	{

		// generates random account number

		$random = rand($min, $max);

		$number = $random;

		$exist = array();

		// if name is not passed then it will be generated randomly

		if( !isset($name) )

		{

			// reads already existing names

			foreach( $this->db->query('SELECT ' . $this->db->fieldName('name') . ' FROM ' . $this->db->tableName('accounts') )->fetchAll() as $account)

			{

				$exist[] = $account['name'];

			}

			// initial name

			$name = uniqid();

			// repeats until name is unique

			while( in_array($name, $exist) )

			{

				$name .= '_';

			}

			// resets array for account numbers loop

			$exist = array();

		}

		// reads already existing accounts

		foreach( $this->db->query('SELECT ' . $this->db->fieldName('id') . ' FROM ' . $this->db->tableName('accounts') )->fetchAll() as $account)

		{

			$exist[] = $account['id'];

		}

		// finds unused number

		while(true)

		{

			// unused - found

			if( !in_array($number, $exist) )

			{

				break;

			}

			// used - next one

			$number++;

			// we need to re-set

			if($number > $max)

			{

				$number = $min;

			}

			// we checked all possibilities

			if($number == $random)

			{

				throw new E_OTS_Generic(E_OTS_Generic::CREATE_ACCOUNT_IMPOSSIBLE);

			}

		}

		// saves blank account info

		$this->data['id'] = $number;

		$this->db->query('INSERT INTO ' . $this->db->tableName('accounts') . ' (' . $this->db->fieldName('id') . ', ' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('password') . ', ' . $this->db->fieldName('email') . ') VALUES (' . $number . ', ' . $this->db->quote($name) . ', \'\', \'\')');

		return $number;

	}

/**

* @version 0.0.6

* @since 0.0.4

* @param OTS_Group $group Group to be assigned to account.

* @param int $min Minimum number.

* @param int $max Maximum number.

* @return int Created account number.

* @deprecated 0.0.6 There is no more group_id field in database, use create().

*/

	public function createEx(OTS_Group $group, $min = 1, $max = 9999999)

	{

		return $this->create($min, $max);

	}

/**

* Loads account with given number.

*

* @version 0.0.6

* @param int $id Account number.

* @throws PDOException On PDO operation error.

*/

	public function load($id)

	{

		// SELECT query on database

	   $this->data = $this->db->query('SELECT ' . $this->db->fieldName('id') . ', ' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('password') . ', ' . $this->db->fieldName('email') . ', ' . $this->db->fieldName('blocked') . ', ' . $this->db->fieldName('rlname') . ', ' . $this->db->fieldName('location') . ', ' . $this->db->fieldName('key') . ', ' . $this->db->fieldName('premium_points') . ', ' . $this->db->fieldName('page_access') . ', ' . $this->db->fieldName('premdays') . ', ' . $this->db->fieldName('lastday') . ',  ' . $this->db->fieldName('created') . ' FROM ' . $this->db->tableName('accounts') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . (int) $id)->fetch();

	}

/**

* Loads account by it's name.

*

* <p>

* Note: Since 0.1.5 version this method loads account by it's name not by e-mail address. To find account by it's e-mail address use {@link OTS_Account::findByEMail() findByEMail() method}.

* </p>

*

* @version 0.1.5

* @since 0.0.2

* @param string $name Account's name.

* @throws PDOException On PDO operation error.

*/

	public function find($name)

	{

		// finds player's ID

		$id = $this->db->query('SELECT ' . $this->db->fieldName('id') . ' FROM ' . $this->db->tableName('accounts') . ' WHERE ' . $this->db->fieldName('name') . ' = ' . $this->db->quote($name) )->fetch();

		// if anything was found

		if( isset($id['id']) )

		{

			$this->load($id['id']);

		}

	}

/**

* Loads account by it's e-mail address.

*

* @version 0.1.5

* @since 0.1.5

* @param string $email Account's e-mail address.

* @throws PDOException On PDO operation error.

*/

	public function findByEMail($email)

	{

		// finds player's ID

		$id = $this->db->query('SELECT ' . $this->db->fieldName('id') . ' FROM ' . $this->db->tableName('accounts') . ' WHERE ' . $this->db->fieldName('email') . ' = ' . $this->db->quote($email) )->fetch();

		// if anything was found

		if( isset($id['id']) )

		{

			$this->load($id['id']);

		}

	}

/**

* Checks if object is loaded.

*

* @return bool Load state.

*/

	public function isLoaded()

	{

		return isset($this->data['id']);

	}

/**

* Updates account in database.

*

* <p>

* Unlike other DAO objects account can't be saved without ID being set. It means that you can't just save unexisting account to automaticly create it. First you have to create record by using {@link OTS_Account::createName() createNamed() method}

* </p>

*

* <p>

* Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded exception} instead of triggering E_USER_WARNING.

* </p>

*

* @version 0.1.5

* @throws E_OTS_NotLoaded If account doesn't have ID assigned.

* @throws PDOException On PDO operation error.

*/

	public function save()

	{

		if( !isset($this->data['id']) )

		{

			throw new E_OTS_NotLoaded();

		}

		// UPDATE query on database

		$this->db->query('UPDATE ' . $this->db->tableName('accounts') . ' SET ' . $this->db->fieldName('password') . ' = ' . $this->db->quote($this->data['password']) . ', ' . $this->db->fieldName('email') . ' = ' . $this->db->quote($this->data['email']) . ', ' . $this->db->fieldName('rlname') . ' = ' . $this->db->quote($this->data['rlname']) . ', ' . $this->db->fieldName('premium_points') . ' = ' . $this->db->quote($this->data['premium_points']) . ', ' . $this->db->fieldName('key') . ' = ' . $this->db->quote($this->data['key']) . ', ' . $this->db->fieldName('location') . ' = ' . $this->db->quote($this->data['location']) . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);

	}

/**

* Account number.

*

* <p>

* Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING.

* </p>

*

* @version 0.0.3

* @return int Account number.

* @throws E_OTS_NotLoaded If account is not loaded.

*/

	public function getId()

	{

		if( !isset($this->data['id']) )

		{

			throw new E_OTS_NotLoaded();

		}

		return $this->data['id'];

	}


/**

* Other Account Information.

*

* <p>

* Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING.

* </p>

*

* @version 0.0.3

* @return int Account Information.

* @throws E_OTS_NotLoaded If account is not loaded.

*/


public function getRLName()

	{

		if( !isset($this->data['rlname']) )

		{

			throw new E_OTS_NotLoaded();

		}

		return $this->data['rlname'];

	}


	public function getLocation()

	{

		if( !isset($this->data['location']) )

		{

			throw new E_OTS_NotLoaded();

		}

		return $this->data['location'];

	}


	public function getPageAccess()

	{

		if( !isset($this->data['page_access']) )

		{

			throw new E_OTS_NotLoaded();

		}

		return $this->data['page_access'];

	}


	public function getPremDays()

	{

		if( !isset($this->data['premdays']) || !isset($this->data['lastday']) )

		{

			throw new E_OTS_NotLoaded();

		}

		return $this->data['premdays'] - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->data['lastday']))) - date("z", $this->data['lastday']));

	}


	public function getLastLogin()

	{

		if( !isset($this->data['lastday']) )

		{

			throw new E_OTS_NotLoaded();

		}

		return $this->data['lastday'];

	}


	public function isPremium()

	{

		return ($this->data['premdays'] - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->data['lastday']))) - date("z", $this->data['lastday'])) > 0);

	}

	public function getCreated()

	{

		if( !isset($this->data['created']) )

		{

			throw new E_OTS_NotLoaded();

		}

		return $this->data['created'];

	}

public function getRecoveryKey()

	{

		if( !isset($this->data['key']) )

		{

			throw new E_OTS_NotLoaded();

		}

		return $this->data['key'];

	}

public function getPremiumPoints()

	{

		if( !isset($this->data['premium_points']) )

		{

			throw new E_OTS_NotLoaded();

		}

		return $this->data['premium_points'];

	}

	public function setRLName($rlname)

	{

		$this->data['rlname'] = (string) $rlname;

	}


	public function setLocation($loc)

	{

		$this->data['location'] = (string) $loc;

	}


	public function setRecoveryKey($rec_key)

	{

		$this->data['key'] = (string) $rec_key;

	}


	public function setPremiumPoints($premium_points)

	{

		$this->data['premium_points'] = (string) $premium_points;

	}

/**

* @version 0.1.0

* @since 0.0.4

* @return OTS_Group Group of which current account is member (currently random group).

* @throws E_OTS_NotLoaded If account is not loaded.

* @deprecated 0.0.6 There is no more group_id field in database.

*/

	public function getGroup()

	{

		if( !isset($this->data['id']) )

		{

			throw new E_OTS_NotLoaded();

		}

		// loads default group

		$groups = new OTS_Groups_List();

		$groups->rewind();

		return $groups->current();

	}

/**

* Name.

*

* @version 0.1.5

* @since 0.1.5

* @return string Name.

* @throws E_OTS_NotLoaded If account is not loaded.

*/

	public function getName()

	{

		if( !isset($this->data['name']) )

		{

			throw new E_OTS_NotLoaded();

		}

		return $this->data['name'];

	}

/**

* Sets account's name.

*

* <p>

* This method only updates object state. To save changes in database you need to use {@link OTS_Account::save() save() method} to flush changed to database.

* </p>

*

* @version 0.1.5

* @since 0.1.5

* @param string $name Account name.

*/

	public function setName($name)

	{

		$this->data['name'] = (string) $name;

	}

/**

* Account's password.

*

* <p>

* Doesn't matter what password hashing mechanism is used by OTServ - this method will just return RAW database content. It is not possible to "decrypt" hashed strings, so it even wouldn't be possible to return real password string.

* </p>

*

* <p>

* Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING.

* </p>

*

* @version 0.0.3

* @return string Password.

* @throws E_OTS_NotLoaded If account is not loaded.

*/

	public function getPassword()

	{

		if( !isset($this->data['password']) )

		{

			throw new E_OTS_NotLoaded();

		}

		return $this->data['password'];

	}

/**

* Sets account's password.

*

* <p>

* This method only updates object state. To save changes in database you need to use {@link OTS_Account::save() save() method} to flush changed to database.

* </p>

*

* <p>

* Remember that this method just sets database field's content. It doesn't apply any hashing/encryption so if OTServ uses hashing for passwords you have to apply it by yourself before passing string to this method.

* </p>

*

* @param string $password Password.

*/

	public function setPassword($password)

	{

		$this->data['password'] = (string) $password;

	}

/**

* E-mail address.

*

* <p>

* Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING.

* </p>

*

* @version 0.0.3

* @return string E-mail.

* @throws E_OTS_NotLoaded If account is not loaded.

*/

	public function getEMail()

	{

		if( !isset($this->data['email']) )

		{

			throw new E_OTS_NotLoaded();

		}

		return $this->data['email'];

	}

/**

* Sets account's email.

*

* <p>

* This method only updates object state. To save changes in database you need to use {@link OTS_Account::save() save() method} to flush changed to database.

* </p>

*

* @param string $email E-mail address.

*/

	public function setEMail($email)

	{

		$this->data['email'] = (string) $email;

	}


/**

* Checks if account is blocked.

*

* <p>

* Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING.

* </p>

*

* @version 0.0.3

* @return bool Blocked state.

* @throws E_OTS_NotLoaded If account is not loaded.

*/

	public function isBlocked()

	{

		if( !isset($this->data['blocked']) )

		{

			throw new E_OTS_NotLoaded();

		}

		return $this->data['blocked'];

	}

/**

* Unblocks account.

*

* <p>

* This method only updates object state. To save changes in database you need to use {@link OTS_Account::save() save() method} to flush changed to database.

* </p>

*/

	public function unblock()

	{

		$this->data['blocked'] = false;

	}

/**

* Blocks account.

*

* <p>

* This method only updates object state. To save changes in database you need to use {@link OTS_Account::save() save() method} to flush changed to database.

* </p>

*/

	public function block()

	{

		$this->data['blocked'] = true;

	}

/**

* Checks if account is deleted (by flag setting).

*

* @version 0.1.5

* @since 0.1.5

* @return bool Flag state.

* @throws E_OTS_NotLoaded If account is not loaded.

*/

	public function isDeleted()

	{

		if( !isset($this->data['deleted']) )

		{

			throw new E_OTS_NotLoaded();

		}

		return $this->data['blocked'];

	}

/**

* Unsets account's deleted flag.

*

* <p>

* This method only updates object state. To save changes in database you need to use {@link OTS_Account::save() save() method} to flush changed to database.

* </p>

*

* @version 0.1.5

* @since 0.1.5

*/

	public function unsetDeleted()

	{

		$this->data['deleted'] = false;

	}

/**

* Deletes account (only by setting flag state, not physicly).

*

* <p>

* This method only updates object state. To save changes in database you need to use {@link OTS_Account::save() save() method} to flush changed to database.

* </p>

*

* @version 0.1.5

* @since 0.1.5

*/

	public function setDeleted()

	{

		$this->data['deleted'] = true;

	}

/**

* Checks if account is warned.

*

* @version 0.1.5

* @since 0.1.5

* @return bool Flag state.

* @throws E_OTS_NotLoaded If account is not loaded.

*/

	public function isWarned()

	{

		if( !isset($this->data['warned']) )

		{

			throw new E_OTS_NotLoaded();

		}

		return $this->data['warned'];

	}

/**

* Unwarns account.

*

* <p>

* This method only updates object state. To save changes in database you need to use {@link OTS_Account::save() save() method} to flush changed to database.

* </p>

*

* @version 0.1.5

* @since 0.1.5

*/

	public function unwarn()

	{

		$this->data['warned'] = false;

	}

/**

* Warns account.

*

* <p>

* This method only updates object state. To save changes in database you need to use {@link OTS_Account::save() save() method} to flush changed to database.

* </p>

*

* @version 0.1.5

* @since 0.1.5

*/

	public function warn()

	{

		$this->data['warned'] = true;

	}

/**

* @version 0.0.4

* @return int PACC days.

* @throws E_OTS_NotLoaded If account is not loaded.

* @deprecated 0.0.3 There is no more premdays field in accounts table.

*/

	public function getPACCDays()

	{

		if( !isset($this->data['id']) )

		{

			throw new E_OTS_NotLoaded();

		}

		return 0;

	}

/**

* @version 0.0.4

* @param int $pacc PACC days.

* @deprecated 0.0.3 There is no more premdays field in accounts table.

*/

	public function setPACCDays($premdays)

	{

	}

/**

* Reads custom field.

*

* <p>

* Reads field by it's name. Can read any field of given record that exists in database.

* </p>

*

* <p>

* Note: You should use this method only for fields that are not provided in standard setters/getters (SVN fields). This method runs SQL query each time you call it so it highly overloads used resources.

* </p>

*

* @version 0.0.5

* @since 0.0.3

* @param string $field Field name.

* @return string Field value.

* @throws E_OTS_NotLoaded If account is not loaded.

* @throws PDOException On PDO operation error.

*/

	public function getCustomField($field)

	{

		if( !isset($this->data['id']) )

		{

			throw new E_OTS_NotLoaded();

		}

		$value = $this->db->query('SELECT ' . $this->db->fieldName($field) . ' FROM ' . $this->db->tableName('accounts') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id'])->fetch();

		return $value[$field];

	}

/**

* Writes custom field.

*

* <p>

* Write field by it's name. Can write any field of given record that exists in database.

* </p>

*

* <p>

* Note: You should use this method only for fields that are not provided in standard setters/getters (SVN fields). This method runs SQL query each time you call it so it highly overloads used resources.

* </p>

*

* <p>

* Note: Make sure that you pass $value argument of correct type. This method determinates whether to quote field name. It is safe - it makes you sure that no unproper queries that could lead to SQL injection will be executed, but it can make your code working wrong way. For example: $object->setCustomField('foo', '1'); will quote 1 as as string ('1') instead of passing it as a integer.

* </p>

*

* @version 0.0.5

* @since 0.0.3

* @param string $field Field name.

* @param mixed $value Field value.

* @throws E_OTS_NotLoaded If account is not loaded.

* @throws PDOException On PDO operation error.

*/

	public function setCustomField($field, $value)

	{

		if( !isset($this->data['id']) )

		{

			throw new E_OTS_NotLoaded();

		}

		// quotes value for SQL query

		if(!( is_int($value) || is_float($value) ))

		{

			$value = $this->db->quote($value);

		}

		$this->db->query('UPDATE ' . $this->db->tableName('accounts') . ' SET ' . $this->db->fieldName($field) . ' = ' . $value . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);

	}

/**

* @version 0.1.0

* @return array Array of OTS_Player objects from given account.

* @throws E_OTS_NotLoaded If account is not loaded.

* @deprecated 0.0.5 Use getPlayersList().

*/

	public function getPlayers()

	{

		if( !isset($this->data['id']) )

		{

			throw new E_OTS_NotLoaded();

		}

		$players = array();

		foreach( $this->db->query('SELECT ' . $this->db->fieldName('id') . ' FROM ' . $this->db->tableName('players') . ' WHERE ' . $this->db->fieldName('account_id') . ' = ' . $this->data['id'])->fetchAll() as $player)

		{

			// creates new object

			$object = new OTS_Player();

			$object->load($player['id']);

			$players[] = $object;

		}

		return $players;

	}

/**

* List of characters on account.

*

* <p>

* In difference to {@link OTS_Account::getPlayers() getPlayers() method} this method returns filtered {@link OTS_Players_List OTS_Players_List} object instead of array of {@link OTS_Player OTS_Player} objects. It is more effective since OTS_Player_List doesn't perform all rows loading at once.

* </p>

*

* <p>

* Note: Returned object is only prepared, but not initialised. When using as parameter in foreach loop it doesn't matter since it will return it's iterator, but if you will wan't to execute direct operation on that object you will need to call {@link OTS_Base_List::rewind() rewind() method} first.

* </p>

*

* @version 0.1.4

* @since 0.0.5

* @return OTS_Players_List List of players from current account.

* @throws E_OTS_NotLoaded If account is not loaded.

*/

	public function getPlayersList()

	{

		if( !isset($this->data['id']) )

		{

			throw new E_OTS_NotLoaded();

		}

		// creates filter

		$filter = new OTS_SQLFilter();

		$filter->compareField('account_id', (int) $this->data['id']);

		// creates list object

		$list = new OTS_Players_List();

		$list->setFilter($filter);

		return $list;

	}

/**

* @version 0.1.5

* @since 0.0.5

* @param int $time Time for time until expires (0 - forever).

* @throws PDOException On PDO operation error.

* @deprecated 0.1.5 Use OTS_AccountBan class.

*/

	public function ban($time = 0)

	{

		// can't ban nothing

		if( !$this->isLoaded() )

		{

			throw new E_OTS_NotLoaded();

		}

		// creates ban entry

		$ban = new OTS_AccountBan();

		$ban->setValue($this->data['id']);

		$ban->setExpires($time);

		$ban->setAdded( time() );

		$ban->activate();

		$ban->save();

	}

/**

* @version 0.1.5

* @since 0.0.5

* @throws PDOException On PDO operation error.

* @deprecated 0.1.5 Use OTS_AccountBan class.

*/

	public function unban()

	{

		// can't unban nothing

		if( !$this->isLoaded() )

		{

			throw new E_OTS_NotLoaded();

		}

		// deletes ban entry

		$ban = new OTS_AccountBan();

		$ban->find($this->data['id']);

		$ban->delete();

	}

/**

* @version 0.1.5

* @since 0.0.5

* @return bool True if account is banned, false otherwise.

* @throws PDOException On PDO operation error.

* @deprecated 0.1.5 Use OTS_AccountBan class.

*/

	public function isBanned()

	{

		// nothing can't be banned

		if( !$this->isLoaded() )

		{

			throw new E_OTS_NotLoaded();

		}

		// finds ban entry

		$ban = new OTS_AccountBan();

		$ban->find($this->data['id']);

		return $ban->isLoaded() && $ban->isActive() && ( $ban->getExpires() == 0 || $ban->getExpires() > time() );

	}

/**

* Deletes account.

*

* <p>

* This method physicly deletes account from database! To set <i>deleted</i> flag use {@link OTS_Account::setDeleted() setDeleted() method}.

* </p>

*

* @version 0.0.5

* @since 0.0.5

* @throws E_OTS_NotLoaded If account is not loaded.

* @throws PDOException On PDO operation error.

*/

	public function delete()

	{

		if( !isset($this->data['id']) )

		{

			throw new E_OTS_NotLoaded();

		}

		// deletes row from database

		$this->db->query('DELETE FROM ' . $this->db->tableName('accounts') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);

		// resets object handle

		unset($this->data['id']);

	}

/**

* Checks highest access level of account.

*

* @return int Access level (highest access level of all characters).

* @throws PDOException On PDO operation error.

*/

	public function getAccess()

	{

		// by default

		$access = 0;

		// finds groups of all characters

		foreach( $this->getPlayersList() as $player)

		{

			$group = $player->getGroup();

			// checks if group's access level is higher then previouls found highest

			if( $group->getAccess() > $access)

			{

				$access = $group->getAccess();

			}

		}

		return $access;

	}

/**

* Checks highest access level of account in given guild.

*

* @param OTS_Guild $guild Guild in which access should be checked.

* @return int Access level (highest access level of all characters).

* @throws PDOException On PDO operation error.

*/

	public function getGuildAccess(OTS_Guild $guild)

	{

		// by default

		$access = 0;

		// finds ranks of all characters

		foreach( $this->getPlayersList() as $player)

		{

			$rank = $player->getRank();

			// checks if rank's access level is higher then previouls found highest

			if( isset($rank) && $rank->getGuild()->getId() == $guild->getId() && $rank->getLevel() > $access)

			{

				$access = $rank->getLevel();

			}

		}

		return $access;

	}

/**

* Returns players iterator.

*

* <p>

* There is no need to implement entire Iterator interface since we have {@link OTS_Players_List players list class} for it.

* </p>

*

* @version 0.0.5

* @since 0.0.5

* @throws E_OTS_NotLoaded If account is not loaded.

* @throws PDOException On PDO operation error.

* @return Iterator List of players.

*/

	public function getIterator()

	{

		return $this->getPlayersList();

	}

/**

* Returns number of player within.

*

* @version 0.0.5

* @since 0.0.5

* @throws E_OTS_NotLoaded If account is not loaded.

* @throws PDOException On PDO operation error.

* @return int Count of players.

*/

	public function count()

	{

		return $this->getPlayersList()->count();

	}

/**

* Magic PHP5 method.

*

* @version 0.1.5

* @since 0.1.0

* @param string $name Property name.

* @return mixed Property value.

* @throws E_OTS_NotLoaded If account is not loaded.

* @throws OutOfBoundsException For non-supported properties.

* @throws PDOException On PDO operation error.

*/

	public function __get($name)

	{

		switch($name)

		{

			case 'id':

				return $this->getId();

			case 'name':

				return $this->getName();

			case 'password':

				return $this->getPassword();

			case 'eMail':

				return $this->getEMail();

			case 'premiumEnd':

				return $this->getPremiumEnd();

			case 'loaded':

				return $this->isLoaded();

			case 'playersList':

				return $this->getPlayersList();

			case 'blocked':

				return $this->isBlocked();

			case 'deleted':

				return $this->isDeleted();

			case 'warned':

				return $this->isWarned();

			case 'banned':

				return $this->isBanned();

			case 'access':

				return $this->getAccess();

			default:

				throw new OutOfBoundsException();

		}

	}

/**

* Magic PHP5 method.

*

* @version 0.1.5

* @since 0.1.0

* @param string $name Property name.

* @param mixed $value Property value.

* @throws E_OTS_NotLoaded If account is not loaded.

* @throws OutOfBoundsException For non-supported properties.

* @throws PDOException On PDO operation error.

*/

	public function __set($name, $value)

	{

		switch($name)

		{

			case 'name':

				$this->setName($name);

				break;

			case 'password':

				$this->setPassword($value);

				break;

			case 'eMail':

				$this->setEMail($value);

				break;

			case 'premiumEnd':

				$this->setPremiumEnd($value);

				break;

			case 'blocked':

				if($value)

				{

					$this->block();

				}

				else

				{

					$this->unblock();

				}

				break;

			case 'deleted':

				if($value)

				{

					$this->setDeleted();

				}

				else

				{

					$this->unsetDeleted();

				}

				break;

			case 'warned':

				if($value)

				{

					$this->warn();

				}

				else

				{

					$this->unwarn();

				}

				break;

			case 'banned':

				if($value)

				{

					$this->ban();

				}

				else

				{

					$this->unban();

				}

				break;

			default:

				throw new OutOfBoundsException();

		}

	}

/**

* Returns string representation of object.

*

* <p>

* If any display driver is currently loaded then it uses it's method. Otherwise just returns account number.

* </p>

*

* @version 0.1.3

* @since 0.1.0

* @return string String representation of object.

*/

	public function __toString()

	{

		$ots = POT::getInstance();

		// checks if display driver is loaded

		if( $ots->isDisplayDriverLoaded() )

		{

			return $ots->getDisplayDriver()->displayAccount($this);

		}

		return $this->getId();

	}

}

/**#@-*/

?>

ve se ae /\


Regras Gerais 

 

"Califórnia Brasileira :cool: "

Link para o post
Compartilhar em outros sites

Consegui Passa agr fika dando erro na parte da acc do adm apareçe isso

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'vip_time' in 'field list'' in C:\xampp\htdocs\pot\OTS_Account.php:237 Stack trace: #0 C:\xampp\htdocs\pot\OTS_Account.php(237): PDO->query('SELECT `id`, `n...') #1 C:\xampp\htdocs\install.php(572): OTS_Account->load(1) #2 {main} thrown in C:\xampp\htdocs\pot\OTS_Account.php on line 237

Tente rodar isso na sua database

ALTER TABLE `accounts` ADD `vip_time` INT(15) NOT NULL
Link do tópico -> http://tibiaking.com...-conta-do-site/ @Sociopata Utiliza o spoiler para colocar esses códigos, são muito grandes!
[spoiler][/spoiler]

# Regras Gerais - TibiaKing.com #
Contato: [email protected]
Não respondo dúvidas via MP.


1C2tu.png4Tlqo.png1C2tu.png


 

Link para o post
Compartilhar em outros sites

Sim consegui e o ip do site como eu fasso

-Editado-

Alguem ajuda ae agr arumei o site todo direito e agr meu ot nao fika+on fika dando erro na config.lua

Link para o post
Compartilhar em outros sites

Cara, sem post duplo ok? Uni seus posts.

Em relação ao erro, tente voltar o config.lua original do OT pra ver se o erro continua!

# Regras Gerais - TibiaKing.com #
Contato: [email protected]
Não respondo dúvidas via MP.


1C2tu.png4Tlqo.png1C2tu.png


 

Link para o post
Compartilhar em outros sites

e em relaçao ao o ip do site qui nao tah aparecendo como eu boto o ip do site?

Eu Botei a config.lua original e o site paro de funciona

Editado por paulosexy (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

o ip fixo do seu servidor, tanta ele

mas com o no-ip aberto

Editado por Sociopata (veja o histórico de edições)


Regras Gerais 

 

"Califórnia Brasileira :cool: "

Link para o post
Compartilhar em outros sites

agr o site tah certo dando pra all entra

so quer quando vai loga no ot apareçe uma msg assim >Temple Position Is wrong.contact with the administration

Ajudem ae

Editado por paulosexy (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Sabe o config lua logo no começo ele tem a posiçao do templo e so ir templo de carlin thais venore onde quizer digitar !pos e substituir ou se preferir vai no remeres mesmo

Account Manager

accountManager = "yes"

newPlayerChooseVoc = "yes"

newPlayerSpawnPosX = 657 <<<

newPlayerSpawnPosY = 1007 <<<<

newPlayerSpawnPosZ = 6 <<<<

newPlayerTownId = 5

newPlayerLevel = 10

newPlayerMagicLevel = 0

generateAccountNumber = "no"

Isto e um exemplo

Ou como o seu tem os chares sample voce tem q levar eles ate o templo :) mesma coisa o level deles eles tao level 1 por exemplo tem que ir database e mudar um por um life level mana etc

Editado por menbro (veja o histórico de edições)
frozzenteam.jpg
Link para o post
Compartilhar em outros sites

ela tah ingual a do q eu usava quando nao tinha site ela pega ai quando eu boto site nao quer pega+

Link para o post
Compartilhar em outros sites

para arrumar isso Temple Position Is wrong.contact with the administration vc tem q ir no php admin e arruma o chares de exemplo (sample)

paladin sample

knight sample

druid sample

rook sample

sorcerer sample

account manager

Coloca eles todos pra nascerem no templo nas posições certas


Regras Gerais 

 

"Califórnia Brasileira :cool: "

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.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo