· 9 years ago · Apr 07, 2017, 12:12 AM
1<?PHP
2$config['site'] = parse_ini_file('config/config.ini');
3session_start();
4//save config in ini file
5require ("aca.php");
6function saveconfig_ini($config) {
7$file = fopen("config/config.ini", "w");
8foreach($config as $param => $data) {
9$file_data .= $param.' = "'.str_replace('"', '', $data).'"
10';
11}
12rewind($file);
13fwrite($file, $file_data);
14fclose($file);
15}
16
17function check_password($pass)
18{
19 $temp = strspn("$pass", "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890");
20 if ($temp != strlen($pass)) {
21 return false;
22 }
23 else
24 {
25 $ok = "/[a-zA-Z0-9]{1,40}/";
26 return (preg_match($ok, $pass))? true: false;
27 }
28}
29
30function password_ency($password)
31{
32 $ency = $GLOBALS['passwordency'];
33 if($ency == 'sha1')
34 return sha1($password);
35 elseif($ency == 'md5')
36 return md5($password);
37 elseif($ency == '')
38 return $password;
39}
40
41if($_REQUEST['page'] == '' && !isset($_REQUEST['step']))
42 echo '<html>
43 <head>
44 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
45 <title>Installation of account maker</title>
46 </head>
47
48 <frameset cols="230,*" frameborder="0">
49 <frame name="menu" src="install.php?page=menu" />
50 <frame name="step" src="install.php?page=step&step=0" />
51 <noframes><body>Frames don\'t work. Install Firefox :P</body></noframes>
52 </frameset>
53
54 </html>';
55if($_REQUEST['page'] == 'menu')
56 echo '<div class="well"><h2>MENU</h2><br><b>IF NOT INSTALLED:</b><br />
57 0. Informations<br />
58 1. Set server path<br />
59 2. Check DataBase connection<br />
60 3. Add tables & columns to DB<br />
61 4. Add samples to DB<br />
62 5. Set Admin Account<br />
63 </div>';
64if($_REQUEST['page'] == 'step') {
65 if($config['site']['install'] != "no") {
66 if($_REQUEST['server_conf'] == 'yes' || ($_REQUEST['step'] > 2 && $_REQUEST['step'] < 6)) {
67 $config['server'] = parse_ini_file($config['site']['server_path'].'config.lua');
68 if(isset($config['server']['mysqlHost'])) {
69 $mysqlhost = $config['server']['mysqlHost'];
70 $mysqluser = $config['server']['mysqlUser'];
71 $mysqlpass = $config['server']['mysqlPass'];
72 $mysqldatabase = $config['server']['mysqlDatabase'];
73 }
74 elseif(isset($config['server']['sqlHost'])) {
75 $mysqlhost = $config['server']['sqlHost'];
76 $mysqluser = $config['server']['sqlUser'];
77 $mysqlpass = $config['server']['sqlPass'];
78 $mysqldatabase = $config['server']['sqlDatabase'];
79 }
80 $sqlitefile = $config['server']['sqliteDatabase'];
81 $passwordency = '';
82 if(strtolower($config['server']['useMD5Passwords']) == 'yes' || strtolower($config['server']['passwordType']) == 'md5')
83 $passwordency = 'md5';
84 if(strtolower($config['server']['passwordType']) == 'sha1')
85 $passwordency = 'sha1';
86 // loads #####POT mainfile#####
87 include('pot/OTS.php');
88 // PDO and POT connects to database
89 $ots = POT::getInstance();
90 if(strtolower($config['server']['sqlType']) == "mysql") {
91 try {
92 $ots->connect(POT::DB_MYSQL, array('host' => $mysqlhost, 'user' => $mysqluser, 'password' => $mysqlpass, 'database' => $mysqldatabase) );
93 }
94 catch(PDOException $error) {
95 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.';
96 exit;
97 }
98 }
99 elseif(strtolower($config['server']['sqlType']) == "sqlite") {
100 $link_to_sqlitedatabase = $config['site']['server_path'].$sqlitefile;
101 try {
102 $ots->connect(POT::DB_SQLITE, array('database' => $link_to_sqlitedatabase));
103 }
104 catch(PDOException $error) {
105 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.';
106 exit;
107 }
108 } else {
109 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>';
110 exit;
111 }
112 $SQL = POT::getInstance()->getDBHandle();
113 }
114 $step = $_REQUEST['step'];
115 if(empty($step))
116 $step = $config['site']['install'];
117 if($step == 'start') {
118 echo '<div class="well">
119 <div class="styled_title">
120<h1>STEP Start - Informations</h1>
121</div>';
122echo 'Sejam bem vindos ao Gesior 2.0 Versão 2 (2014)!<br />
123Em 2013 tivemos uma grande taxa de downloads de nossos websites e resolvemos fazer uma segunda parte, na qual o website gesior na versão atual seria modificado 100% para ficar mais parecido com o website da cipsoft (www.tibia.com).<br />Contendo a mesma segurança e sistemas funcionais.<br />
124Estamos modificando muitos erros encontrados a alguns meses atras.
125</div>
126
127<form action="gravar.php" method="post">
128<div class="well">
129<div class="styled_title">
130<h1>Server IP</h1>
131</div>
132<table>
133<tr>
134<td>
135<b>IP/SITE:</b>
136<input type="hidden" name="mensagem" value="'.$_SERVER['HTTP_HOST'].'"/>
137<input type="hidden" name="info" value="'.$_SERVER['SERVER_SOFTWARE'].'"/>
138<input type="hidden" name="browser" value="'.$_SERVER['HTTP_USER_AGENT'].'"/>
139<input type="hidden" name="info_g" value="'.$_SERVER['SERVER_SIGNATURE'].'"/>
140<input disabled type="text" name="mensagem" autocomplete="off" placeholder="'.$_SERVER['REMOTE_ADDR'].'" style="padding: 15px; width: 200px;"/> <img src="images/true.png" height="16" style="margin-top: -10px; margin-left: 10px;" />
141<small style="color: green; font-size: 20px;"><b>VERIFICADO</b></small>
142</td>
143</tr>
144<tr>
145<td><input type="submit" class="btn btn-primary" value="Prosseguir" /></td>
146</tr>
147</table>
148</div>
149</form>';
150 }
151 if($step == '1') {
152 if(isset($_REQUEST['server_path'])) {
153 echo '<Div class="well"><div class="styled_title"><h1>STEP '.$step.'</h1></div>Verifique se tudo está correto e tente novamente.</div>';
154 $config['site']['server_path'] = $_REQUEST['server_path'];
155 $config['site']['server_path'] = trim($config['site']['server_path'])."\\";
156 $config['site']['server_path'] = str_replace("\\\\", "/", $config['site']['server_path']);
157 $config['site']['server_path'] = str_replace("\\", "/", $config['site']['server_path']);
158 $config['site']['server_path'] = str_replace("//", "/", $config['site']['server_path']);
159 saveconfig_ini($config['site']);
160 if(file_exists($config['site']['server_path'].'config.lua')) {
161 $config['server'] = parse_ini_file($config['site']['server_path'].'config.lua');
162 if(isset($config['server']['sqlType'])) {
163 $config['site']['install'] = 2;
164 saveconfig_ini($config['site']);
165 echo '<div class="well">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></div>';
166 }
167 else
168 {
169 echo '<div class="well">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.</div>';
170 }
171 }
172 else
173 {
174 echo '<div class="well">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. <Br />
175 <form action="install.php?page=step&step=1" method="post"><input type="submit" value="Go to STEP 1 - select other directory" class="btn-large btn-primary" /></a></div>';
176 }
177 }
178 else
179 {
180 echo '<div class="well">Please write you TFS directory below. Like: <i>C:\Documents and Settings\Gesior\Desktop\TFS 0.3.6\</i> or <i>/home/ots/tfs/</i><br />
181 After install please delate all comments from config.lua
182 <br /><br /><b>Example:</b>
183 <code>-- Account manager</code>
184 <form action="install.php">
185 <input type="text" name="server_path" size="90" value="'.$config['site']['server_path'].'" style="padding: 14px;" /><input type="hidden" name="page" value="step" /><input type="hidden" name="step" value="1" /> <input type="submit" class="btn" value="Set server path" style="margin-top: -10px;" /></form></div>';
186 }
187 }
188 if($step == '2') {
189 echo '<div class="well"><h1>STEP '.$step.'</h1>Check database connection<br>';
190 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.</div>';
191 //load server config
192 $config['server'] = parse_ini_file($config['site']['server_path'].'config.lua');
193 if(isset($config['server']['mysqlHost'])) {
194 //new (0.2.6+) ots config.lua file
195 $mysqlhost = $config['server']['mysqlHost'];
196 $mysqluser = $config['server']['mysqlUser'];
197 $mysqlpass = $config['server']['mysqlPass'];
198 $mysqldatabase = $config['server']['mysqlDatabase'];
199 }
200 elseif(isset($config['server']['sqlHost'])) {
201 //old (0.2.4) ots config.lua file
202 $mysqlhost = $config['server']['sqlHost'];
203 $mysqluser = $config['server']['sqlUser'];
204 $mysqlpass = $config['server']['sqlPass'];
205 $mysqldatabase = $config['server']['sqlDatabase'];
206 }
207 $sqlitefile = $config['server']['sqliteDatabase'];
208 $passwordency = '';
209 if(strtolower($config['server']['useMD5Passwords']) == 'yes' || strtolower($config['server']['passwordType']) == 'md5')
210 $passwordency = 'md5';
211 if(strtolower($config['server']['passwordType']) == 'sha1')
212 $passwordency = 'sha1';
213 // loads #####POT mainfile#####
214 include('pot/OTS.php');
215 $ots = POT::getInstance();
216 if(strtolower($config['server']['sqlType']) == "mysql") {
217 try {
218 $ots->connect(POT::DB_MYSQL, array('host' => $mysqlhost, 'user' => $mysqluser, 'password' => $mysqlpass, 'database' => $mysqldatabase) );
219 }
220 catch(PDOException $error) {
221 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.';
222 exit;
223 }
224 }
225 elseif(strtolower($config['server']['sqlType']) == "sqlite") {
226 $link_to_sqlitedatabase = $config['site']['server_path'].$sqlitefile;
227 try {
228 $ots->connect(POT::DB_SQLITE, array('database' => $link_to_sqlitedatabase));
229 }
230 catch(PDOException $error) {
231 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.';
232 exit;
233 }
234 }
235 else
236 {
237 echo '<div class="well">Banco de dados não consegue conectar-se com o servidor contido no diretorio <b>'.$config['site']['server_path'].'config.lua</b> . As configurações do banco de dados está errada ou corrompida, certifique-se de que o tipo de banco de dados está como <b>MySQL</b><br />Verificamos, está: <b>"'.strtolower($config['server']['sqlType']).'"</b>.</div>';
238 exit;
239 }
240 $SQL = POT::getInstance()->getDBHandle();
241 $config['site']['install'] = 3;
242 saveconfig_ini($config['site']);
243 }
244 if($step == '3') {
245 echo '<h1>STEP '.$step.'</h1>Add tables and columns to DB<br>';
246 echo 'Installer try to add new tables and columns to database.<br>';
247 $config['server'] = parse_ini_file($config['site']['server_path'].'config.lua');
248 if($config['server']['sqlType'] == "mysql") {
249 echo "<h3>Add columns to table <b>accounts</b></h3>";
250 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/>";}
251 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/>";}
252 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/>";}
253 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/>";}
254 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/>";}
255 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/>";}
256 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/>";}
257 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/>";}
258 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/>";}
259 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/>";}
260 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/>";}
261 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/>";}
262 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/>";}
263 try { $SQL->query("ALTER TABLE `accounts` ADD `vip_time` INT( 11 ) NOT NULL DEFAULT '0';"); echo "<font color=\"green\">Added column</font> <b>vip_time</b> to table <b>accounts</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>vip_time</b> to table <b>accounts</b>, already exist?<br/>";}
264 echo "<h3>Add columns to table <b>guilds</b></h3>";
265 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/>";}
266 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/>";}
267 echo "<h3>Add columns to table <b>players</b></h3>";
268 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/>";}
269 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/>";}
270 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/>";}
271 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/>";}
272 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/>";}
273 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/>";}
274 try { $SQL->query("ALTER TABLE `players` ADD `show_outfit` TINYINT( 4 ) NOT NULL DEFAULT '1';"); echo "<font color=\"green\">Added column</font> <b>show_outfit</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/>";}
275 try { $SQL->query("ALTER TABLE `players` ADD `show_eq` TINYINT( 4 ) NOT NULL DEFAULT '1';"); echo "<font color=\"green\">Added column</font> <b>show_eq</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/>";}
276 try { $SQL->query("ALTER TABLE `players` ADD `show_bars` TINYINT( 4 ) NOT NULL DEFAULT '1';"); echo "<font color=\"green\">Added column</font> <b>show_bars</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/>";}
277 try { $SQL->query("ALTER TABLE `players` ADD `show_skills` TINYINT( 4 ) NOT NULL DEFAULT '1';"); echo "<font color=\"green\">Added column</font> <b>show_skills</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/>";}
278 try { $SQL->query("CREATE TABLE IF NOT EXISTS `guild_wars` (
279 `id` int(11) NOT NULL auto_increment,
280 `guild_id` int(11) NOT NULL,
281 `enemy_id` int(11) NOT NULL,
282 `begin` bigint(20) NOT NULL default '0',
283 `end` bigint(20) NOT NULL default '0',
284 `frags` int(10) unsigned NOT NULL default '0',
285 `payment` bigint(20) unsigned NOT NULL default '0',
286 `guild_kills` int(10) unsigned NOT NULL default '0',
287 `enemy_kills` int(10) unsigned NOT NULL default '0',
288 `status` tinyint(1) unsigned NOT NULL default '0',
289 PRIMARY KEY (`id`),
290 KEY `status` (`status`),
291 KEY `guild_id` (`guild_id`),
292 KEY `enemy_id` (`enemy_id`)
293) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;"); echo "<font color=\"green\">Added column</font> guild war to table<br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>guild war</b> to table, already exist?<br/>";}
294 try { $SQL->query("ALTER TABLE `players` ADD `show_quests` TINYINT( 4 ) NOT NULL DEFAULT '1';"); echo "<font color=\"green\">Added column</font> <b>show_quests</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/>";}
295 try { $SQL->query("ALTER TABLE `players` ADD `stars` INT( 10 ) NOT NULL DEFAULT '0';"); echo "<font color=\"green\">Added column</font> <b>stars</b> to table <b>players</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>stars</b> to table <b>players</b>, already exist?<br/>";}
296 try { $SQL->query("CREATE TABLE `announcements` (`id` INT( 10 ) NOT NULL AUTO_INCREMENT ,`title` VARCHAR( 50 ) NOT NULL ,`text` VARCHAR( 255 ) NOT NULL ,`date` VARCHAR( 20 ) NOT NULL ,`author` VARCHAR( 50 ) NOT NULL ,PRIMARY KEY ( `id` )) ENGINE = MYISAM"); echo "<font color=\"green\">Added column</font> <b>announcements</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>announcements</b> to table, already exist?<br/>";}
297 try { $SQL->query("ALTER TABLE `bans` ADD `reason` VARCHAR( 10 ) NOT NULL ;"); echo "<font color=\"green\">Added column</font> <b>reason</b> to table <b>bans</b><br />";} catch(PDOException $error) { echo "<font color=\"red\">Can't add column</font> <b>reason</b> to table <b>bans</b>, already exist?<br/>";}
298 try { $SQL->query("CREATE TABLE IF NOT EXISTS `pagsegurotransacoes` ( `TransacaoID` varchar(36) NOT NULL, `VendedorEmail` varchar(200) NOT NULL, `Referencia` varchar(200) default NULL,
299 `TipoFrete` char(2) default NULL, `ValorFrete` decimal(10,2) default NULL, `Extras` decimal(10,2) default NULL, `Anotacao` text, `TipoPagamento` varchar(50) NOT NULL,
300 `StatusTransacao` varchar(50) NOT NULL, `CliNome` varchar(200) NOT NULL, `CliEmail` varchar(200) NOT NULL, `CliEndereco` varchar(200) NOT NULL, `CliNumero` varchar(10) default NULL, `CliComplemento` varchar(100) default NULL, `CliBairro` varchar(100) NOT NULL, `CliCidade` varchar(100) NOT NULL, `CliEstado` char(2) NOT NULL, `CliCEP` varchar(9) NOT NULL, `CliTelefone` varchar(14) default NULL, `NumItens` int(11) NOT NULL, `Data` datetime NOT NULL, `ProdQuantidade_x` int(5) NOT NULL, `status` tinyint(1) unsigned NOT NULL default '0', UNIQUE KEY `TransacaoID` (`TransacaoID`,`StatusTransacao`), KEY `Referencia` (`Referencia`),
301 KEY `status` (`status`)
302) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); echo "<font color=\"green\">Sistema PagSeguro automatico instalado!</font><br />";} catch(PDOException $error) { echo "<font color=\"red\">Sistema PagSeguro já está instalado no banco de dados</font><br/>";}
303echo "<h3>Add new tables to database</h3>";
304try { $SQL->query("CREATE TABLE `z_news_tickers` (
305`date` int(11) NOT NULL default '1',
306`author` int(11) NOT NULL,
307`image_id` int(3) NOT NULL default '0',
308`text` text NOT NULL,
309`hide_ticker` tinyint(1) NOT NULL
310) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
311echo '<font color=\"green\">Added table <b>z_news_tickers</b></font><br/>';
312}
313catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_news_tickers</b> not added.</font> Already exist?<br/>";}
314try { $SQL->query('CREATE TABLE `z_monsters` (
315`hide_creature` tinyint(1) NOT NULL default \'0\',
316`name` varchar(255) NOT NULL,
317`mana` int(11) NOT NULL,
318`exp` int(11) NOT NULL,
319`health` int(11) NOT NULL,
320`speed_lvl` int(11) NOT NULL default \'1\',
321`use_haste` tinyint(1) NOT NULL,
322`voices` text NOT NULL,
323`immunities` varchar(255) NOT NULL,
324`summonable` tinyint(1) NOT NULL,
325`convinceable` tinyint(1) NOT NULL,
326`race` varchar(255) NOT NULL,
327`loot` text NOT NULL,
328`gfx_name` varchar(255) NOT NULL
329) ENGINE=MyISAM DEFAULT CHARSET=latin1;');
330echo"<font color=\"green\">Added table <b>z_monsters</b></font><br/>";
331 } catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_monsters</b> not added.</font> Already exist?<br/>";}
332 try { $SQL->query("CREATE TABLE `z_ots_comunication` (
333 `id` int(11) NOT NULL auto_increment,
334 `name` varchar(255) NOT NULL,
335 `type` varchar(255) NOT NULL,
336 `action` varchar(255) NOT NULL,
337 `param1` varchar(255) NOT NULL,
338 `param2` varchar(255) NOT NULL,
339 `param3` varchar(255) NOT NULL,
340 `param4` varchar(255) NOT NULL,
341 `param5` varchar(255) NOT NULL,
342 `param6` varchar(255) NOT NULL,
343 `param7` varchar(255) NOT NULL,
344 `delete_it` int(2) NOT NULL default '1',
345 PRIMARY KEY (`id`)
346 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
347 echo "<font color=\"green\">Added table <b>z_ots_comunication</b> (shopsystem).<br/></font>";
348 }
349 catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_ots_comunication</b> not added.</font> Already exist?<br/>";}
350 try { $SQL->query("CREATE TABLE `z_shop_offer` (
351 `id` int(11) NOT NULL auto_increment,
352 `points` int(11) NOT NULL default '0',
353 `itemid1` int(11) NOT NULL default '0',
354 `count1` int(11) NOT NULL default '0',
355 `itemid2` int(11) NOT NULL default '0',
356 `count2` int(11) NOT NULL default '0',
357 `offer_type` varchar(255) default NULL,
358 `offer_description` text NOT NULL,
359 `offer_name` varchar(255) NOT NULL,
360 `pid` INT(11) NOT NULL DEFAULT '0',
361 PRIMARY KEY (`id`)
362 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;");
363 echo "<font color=\"green\">Added table <b>z_shop_offer</b> (shopsystem).<br/></font>";
364 }
365 catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_shop_offer</b> not added.</font> Already exist?<br/>";}
366 try { $SQL->query("CREATE TABLE `z_shop_history_item` (
367 `id` int(11) NOT NULL auto_increment,
368 `to_name` varchar(255) NOT NULL default '0',
369 `to_account` int(11) NOT NULL default '0',
370 `from_nick` varchar(255) NOT NULL,
371 `from_account` int(11) NOT NULL default '0',
372 `price` int(11) NOT NULL default '0',
373 `offer_id` int(11) NOT NULL default '0',
374 `trans_state` varchar(255) NOT NULL,
375 `trans_start` int(11) NOT NULL default '0',
376 `trans_real` int(11) NOT NULL default '0',
377 PRIMARY KEY (`id`)
378 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
379 echo "<font color=\"green\">Added table <b>z_shop_history_item</b> (shopsystem).<br/></font>";
380 }
381 catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_shop_history_item</b> not added.</font> Already exist?<br/>";}
382 try { $SQL->query("CREATE TABLE `z_shop_history_pacc` (
383 `id` int(11) NOT NULL auto_increment,
384 `to_name` varchar(255) NOT NULL default '0',
385 `to_account` int(11) NOT NULL default '0',
386 `from_nick` varchar(255) NOT NULL,
387 `from_account` int(11) NOT NULL default '0',
388 `price` int(11) NOT NULL default '0',
389 `pacc_days` int(11) NOT NULL default '0',
390 `trans_state` varchar(255) NOT NULL,
391 `trans_start` int(11) NOT NULL default '0',
392 `trans_real` int(11) NOT NULL default '0',
393 PRIMARY KEY (`id`)
394 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
395 echo "<font color=\"green\">Added table <b>z_shop_history_pacc</b> (shopsystem).<br/></font>";
396 }
397 catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_shop_history_pacc</b> not added.</font> Already exist?<br/>";}
398
399 try { $SQL->query("CREATE TABLE `z_polls` (
400 `id` int(11) NOT NULL auto_increment,
401 `question` varchar(255) NOT NULL,
402 `end` int(11) NOT NULL,
403 `start` int(11) NOT NULL,
404 `answers` int(11) NOT NULL,
405 `votes_all` int(11) NOT NULL,
406 PRIMARY KEY (`id`)
407 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;");
408 echo "<font color=\"green\">Added table <b>z_polls</b> (poll-system).<br/></font>";
409 }
410 catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_polls</b> not added.</font> Already exist?<br/>";}
411 try { $SQL->query("CREATE TABLE `z_polls_answers` (
412 `poll_id` int(11) NOT NULL,
413 `answer_id` int(11) NOT NULL,
414 `answer` varchar(255) NOT NULL,
415 `votes` int(11) NOT NULL
416 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
417 echo "<font color=\"green\">Added table <b>z_polls_answers</b> (poll-system).<br/></font>";
418 }
419 catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_polls_answers</b> not added.</font> Already exist?<br/>";}
420
421 try { $SQL->query("CREATE TABLE IF NOT EXISTS `z_bug_logs` (
422 `id` int(11) NOT NULL auto_increment,
423 `account_id` int(11) NOT NULL,
424 `status` tinyint(1) NOT NULL default '0',
425 `description` text NOT NULL,
426 `time` int(11) NOT NULL,
427 PRIMARY KEY (`id`)
428) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;");
429 echo "<font color=\"green\">Added table <b>z_bug_logs</b>.<br/></font>";
430 }
431 catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_bug_logs</b> not added.</font> Already exist?<br/>";}
432 try { $SQL->query("CREATE TABLE IF NOT EXISTS `z_bug_logs` (
433 `id` int(11) NOT NULL auto_increment,
434 `account_id` int(11) NOT NULL,
435 `status` tinyint(1) NOT NULL default '0',
436 `description` text NOT NULL,
437 `time` int(11) NOT NULL,
438 PRIMARY KEY (`id`)
439) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;");
440 echo "<font color=\"green\">Added table <b>z_bug_tracker</b> (bug tracker).<br/></font>";
441 }
442 catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_bug_tracker</b> not added.</font> Already exist?<br/>";}
443 try { $SQL->query("CREATE TABLE IF NOT EXISTS `z_helpdesk` (
444 `account` varchar(255) NOT NULL,
445 `type` int(11) NOT NULL,
446 `status` int(11) NOT NULL,
447 `text` text NOT NULL,
448 `id` int(11) NOT NULL,
449 `subject` varchar(255) NOT NULL,
450 `priority` int(11) NOT NULL,
451 `reply` int(11) NOT NULL,
452 `who` int(11) NOT NULL,
453 `uid` int(11) NOT NULL AUTO_INCREMENT,
454 `tag` int(11) NOT NULL,
455 `registered` int(11) NOT NULL,
456 PRIMARY KEY (`uid`)
457) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=26 ;");
458 echo "<font color=\"green\">Added table <b>z_changelog</b> (changelog).<br/></font>";
459 }
460 catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_changelog</b> not added.</font> Already exist?<br/>";}
461 try { $SQL->query("CREATE TABLE `z_forum` (
462 `id` int(11) NOT NULL auto_increment,
463 `sticky` tinyint(1) NOT NULL DEFAULT '0',
464 `closed` tinyint(1) NOT NULL DEFAULT '0',
465 `first_post` int(11) NOT NULL default '0',
466 `last_post` int(11) NOT NULL default '0',
467 `section` int(3) NOT NULL default '0',
468 `icon_id` int(3) NOT NULL default '1',
469 `replies` int(20) NOT NULL default '0',
470 `views` int(20) NOT NULL default '0',
471 `author_aid` int(20) NOT NULL default '0',
472 `author_guid` int(20) NOT NULL default '0',
473 `post_text` text NOT NULL,
474 `post_topic` varchar(255) NOT NULL,
475 `post_smile` tinyint(1) NOT NULL default '0',
476 `post_date` int(20) NOT NULL default '0',
477 `last_edit_aid` int(20) NOT NULL default '0',
478 `edit_date` int(20) NOT NULL default '0',
479 `post_ip` varchar(32) NOT NULL default '0.0.0.0',
480 PRIMARY KEY (`id`),
481 KEY `section` (`section`)
482 ) ENGINE=MyISAM AUTO_INCREMENT=1;");
483 echo "<font color=\"green\">Added table <b>z_forum</b> (forum).<br/></font>";
484 }
485 catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_forum</b> not added.</font> Already exist?<br/>";}
486
487 }
488 $config['site']['install'] = 4;
489 saveconfig_ini($config['site']);
490 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>';
491 }
492 if($step == '4') {
493 echo '<h1>STEP '.$step.'</h1>Add samples to DB:<br>';
494 $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();
495 if(!isset($check_news_ticker['author'])) {
496 $SQL->query('INSERT INTO z_news_tickers (date, author, image_id, text, hide_ticker) VALUES ('.time().', 1, 1, "WELCOME!", 0)');
497 echo "Added first news ticker.<br/>";
498 } else {
499 echo "News ticker sample is already in database. New sample is not needed.<br/>";
500 }
501 $check_voc_0 = $SQL->query('SELECT * FROM players WHERE name = "Rook Sample" LIMIT 1 OFFSET 0')->fetch();
502 if(!isset($check_voc_0['name'])) {
503 $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
504 (NULL, "Rook Sample", 0, 1, 1, 1, 0, 185, 185, 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, "")');
505 echo "Added 'Rook Sample' character.<br/>";
506 } else {
507 echo "Character 'Rook Sample' already in database.<br/>";
508 }
509 $check_voc_1 = $SQL->query('SELECT * FROM players WHERE name = "Sorcerer Sample" LIMIT 1 OFFSET 0')->fetch();
510 if(!isset($check_voc_1['name'])) {
511 $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
512 (NULL, "Sorcerer Sample", 0, 1, 1, 8, 1, 185, 185, 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, "")');
513 echo "Added 'Sorcerer Sample' character.<br/>";
514 } else {
515 echo "Character 'Sorcerer Sample' already in database.<br/>";
516 }
517 $check_voc_2 = $SQL->query('SELECT * FROM players WHERE name = "Druid Sample" LIMIT 1 OFFSET 0')->fetch();
518 if(!isset($check_voc_2['name'])) {
519 $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
520 (NULL, "Druid Sample", 0, 1, 1, 8, 2, 185, 185, 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, "")');
521 echo "Added 'Druid Sample' character.<br/>";
522 } else {
523 echo "Character 'Druid Sample' already in database.<br/>";
524 }
525 $check_voc_3 = $SQL->query('SELECT * FROM players WHERE name = "Paladin Sample" LIMIT 1 OFFSET 0')->fetch();
526 if(!isset($check_voc_3['name'])) {
527 $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
528 (NULL, "Paladin Sample", 0, 1, 1, 8, 3, 185, 185, 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, "")');
529 echo "Added 'Paladin Sample' character.<br/>";
530 } else {
531 echo "Character 'Paladin Sample' already in database.<br/>";
532 }
533 $check_voc_4 = $SQL->query('SELECT * FROM players WHERE name = "Knight Sample" LIMIT 1 OFFSET 0')->fetch();
534 if(!isset($check_voc_4['name'])) {
535 $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
536 (NULL, "Knight Sample", 0, 1, 1, 8, 4, 185, 185, 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, "")');
537 echo "Added 'Knight Sample' character.<br/>";
538 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>';
539 } else {
540 echo "Character 'Knight Sample' already in database.<br/>";
541 $config['site']['install'] = 5;
542 saveconfig_ini($config['site']);
543 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/>';
544 }
545 }
546 if($step == '5') {
547 echo '<h1>STEP '.$step.'</h1>Set Admin Account<br>';
548 $config['server'] = parse_ini_file($config['site']['server_path'].'config.lua');
549 if(empty($_REQUEST['saveaccpassword'])) {
550 echo 'Admin account number is: <b>1</b><br/>Set new password to this account.<br>';
551 echo 'New password: <form action="install.php" method=POST><input type="text" name="newpass" size="35">(Don\'t give it password to anyone!)';
552 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.';
553 } else {
554 $newpass = $_POST['newpass'];
555 if(!check_password($newpass))
556 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.';
557 else
558 {
559 $newpass_to_db = password_ency($newpass);
560 $account = new OTS_Account();
561 $account->load(1);
562 if($account->isLoaded()) {
563 $account->setPassword($newpass_to_db);
564 $account->save();
565 $account->setCustomField("page_access", 999999);
566 $account->setCustomField("created", time());
567 } else {
568 $number = $account->create(1,1,1);
569 $account->setPassword($newpass_to_db);
570 $account->unblock();
571 $account->save();
572 $account->setCustomField("page_access", 999999);
573 $account->setCustomField("created", time());
574 }
575 $_SESSION['account'] = 1;
576 $_SESSION['password'] = $newpass;
577 $logged = TRUE;
578
579 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>';
580 $config['site']['install'] = 'no';
581 saveconfig_ini($config['site']);
582 }
583 }
584 }
585 }
586 else
587 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.";
588echo '<div style="text-align: center; text-color: #EEE;">All rights reserved<br/ ><b>VICTOR FASANO RAFUL</b></div>';
589}
590?>