Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
912
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 40.18 KB | None | 0 0
  1. <?PHP
  2. $config['site'] = parse_ini_file('config/config.ini');
  3. session_start();
  4. //save config in ini file
  5. function saveconfig_ini($config) {
  6. $file = fopen("config/config.ini", "w");
  7. foreach($config as $param => $data) {
  8. $file_data .= $param.' = "'.str_replace('"', '', $data).'"
  9. ';
  10. }
  11. rewind($file);
  12. fwrite($file, $file_data);
  13. fclose($file);
  14. }
  15.  
  16. function check_password($pass)
  17. {
  18. $temp = strspn("$pass", "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890");
  19. if ($temp != strlen($pass)) {
  20. return false;
  21. }
  22. else
  23. {
  24. $ok = "/[a-zA-Z0-9]{1,40}/";
  25. return (preg_match($ok, $pass))? true: false;
  26. }
  27. }
  28.  
  29. function password_ency($password)
  30. {
  31. $ency = $GLOBALS['passwordency'];
  32. if($ency == 'sha1')
  33. return sha1($password);
  34. elseif($ency == 'md5')
  35. return md5($password);
  36. elseif($ency == '')
  37. return $password;
  38. }
  39.  
  40. if($_REQUEST['page'] == '' && !isset($_REQUEST['step'])) {
  41. echo '<html>
  42. <head>
  43. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
  44. <title>Installation of account maker</title>
  45. </head>
  46. <frameset cols="230,*">
  47. <frame name="menu" src="install.php?page=menu" />
  48. <frame name="step" src="install.php?page=step&step=0" />
  49. <noframes><body>Frames don\'t work. Install Firefox :P</body></noframes>
  50. </frameset>
  51. </html>';
  52. }
  53. if($_REQUEST['page'] == 'menu') {
  54. echo '<h2>MENU</h2><br>
  55. <b>IF NOT INSTALLED:</b><br>
  56. <a href="install.php?page=step&step=start" target="step">0. Informations</a><br>
  57. <a href="install.php?page=step&step=1" target="step">1. Set server path</a><br>
  58. <a href="install.php?page=step&step=2" target="step">2. Check DataBase connection</a><br>
  59. <a href="install.php?page=step&step=3&server_conf=yes" target="step">3. Add tables and columns to DB</a><br>
  60. <a href="install.php?page=step&step=4&server_conf=yes" target="step">4. Add samples to DB</a><br>
  61. <a href="install.php?page=step&step=5&server_conf=yes" target="step">5. Set Admin Account</a><br>
  62. <b>FOR ADMINS:</b><br>
  63. <a href="index.php?subtopic=adminpanel&action=install_monsters" target="step">6. Load Monsters from OTS</a><br>
  64. <a href="index.php?subtopic=adminpanel&action=install_spells" target="step">7. Load Spells from OTS</a><br>';
  65.  
  66. }
  67. if($_REQUEST['page'] == 'step') {
  68. if($config['site']['install'] != "no") {
  69. if($_REQUEST['server_conf'] == 'yes' || ($_REQUEST['step'] > 2 && $_REQUEST['step'] < 6)) {
  70. //load server config
  71. $config['server'] = parse_ini_file($config['site']['server_path'].'config.lua');
  72. if(isset($config['server']['mysqlHost'])) {
  73. //new (0.2.6+) ots config.lua file
  74. $mysqlhost = $config['server']['mysqlHost'];
  75. $mysqluser = $config['server']['mysqlUser'];
  76. $mysqlpass = $config['server']['mysqlPass'];
  77. $mysqldatabase = $config['server']['mysqlDatabase'];
  78. }
  79. elseif(isset($config['server']['sqlHost'])) {
  80. //old (0.2.4) ots config.lua file
  81. $mysqlhost = $config['server']['sqlHost'];
  82. $mysqluser = $config['server']['sqlUser'];
  83. $mysqlpass = $config['server']['sqlPass'];
  84. $mysqldatabase = $config['server']['sqlDatabase'];
  85. }
  86. $sqlitefile = $config['server']['sqliteDatabase'];
  87. $passwordency = '';
  88. if(strtolower($config['server']['useMD5Passwords']) == 'yes' || strtolower($config['server']['passwordType']) == 'md5') {
  89. $passwordency = 'md5';
  90. }
  91. if(strtolower($config['server']['passwordType']) == 'sha1') {
  92. $passwordency = 'sha1';
  93. }
  94. // loads #####POT mainfile#####
  95. include('pot/OTS.php');
  96. // PDO and POT connects to database
  97. $ots = POT::getInstance();
  98. if(strtolower($config['server']['sqlType']) == "mysql")
  99. {
  100. //connect to MySQL database
  101. try
  102. {
  103. $ots->connect(POT::DB_MYSQL, array('host' => $mysqlhost, 'user' => $mysqluser, 'password' => $mysqlpass, 'database' => $mysqldatabase) );
  104. }
  105. catch(PDOException $error)
  106. {
  107. 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.';
  108. exit;
  109. }
  110. }
  111. elseif(strtolower($config['server']['sqlType']) == "sqlite")
  112. {
  113. //connect to SQLite database
  114. $link_to_sqlitedatabase = $config['site']['server_path'].$sqlitefile;
  115. try
  116. {
  117. $ots->connect(POT::DB_SQLITE, array('database' => $link_to_sqlitedatabase));
  118. }
  119. catch(PDOException $error)
  120. {
  121. 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.';
  122. exit;
  123. }
  124. }
  125. else
  126. {
  127. 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>';
  128. exit;
  129. }
  130. $SQL = POT::getInstance()->getDBHandle();
  131. }
  132. $step = $_REQUEST['step'];
  133. if(empty($step)) {
  134. $step = $config['site']['install'];
  135. }
  136. if($step == 'start') {
  137. echo '<h1>STEP '.$step.'</h1>Informations<br>';
  138. 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-11 to load configuration from OTS.</b>';
  139. }
  140. if($step == '1') {
  141. if(isset($_REQUEST['server_path'])) {
  142. echo '<h1>STEP '.$step.'</h1>Check server configuration<br>';
  143. $config['site']['server_path'] = $_REQUEST['server_path'];
  144. $config['site']['server_path'] = trim($config['site']['server_path'])."\\";
  145. $config['site']['server_path'] = str_replace("\\\\", "/", $config['site']['server_path']);
  146. $config['site']['server_path'] = str_replace("\\", "/", $config['site']['server_path']);
  147. $config['site']['server_path'] = str_replace("//", "/", $config['site']['server_path']);
  148. saveconfig_ini($config['site']);
  149. if(file_exists($config['site']['server_path'].'config.lua')) {
  150. $config['server'] = parse_ini_file($config['site']['server_path'].'config.lua');
  151. if(isset($config['server']['sqlType'])) {
  152. $config['site']['install'] = 2;
  153. saveconfig_ini($config['site']);
  154. 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>';
  155. }
  156. else
  157. {
  158. 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.';
  159. }
  160. }
  161. else
  162. {
  163. 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>';
  164. }
  165. }
  166. else
  167. {
  168. echo 'Please write you TFS directory below. Like: <i>C:\Documents and Settings\Gesior\Desktop\TFS 0.2.9\</i><form action="install.php">
  169. <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" />
  170. </form>';
  171. }
  172. }
  173. if($step == '2') {
  174. echo '<h1>STEP '.$step.'</h1>Check database connection<br>';
  175. 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.';
  176. //load server config
  177. $config['server'] = parse_ini_file($config['site']['server_path'].'config.lua');
  178. if(isset($config['server']['mysqlHost'])) {
  179. //new (0.2.6+) ots config.lua file
  180. $mysqlhost = $config['server']['mysqlHost'];
  181. $mysqluser = $config['server']['mysqlUser'];
  182. $mysqlpass = $config['server']['mysqlPass'];
  183. $mysqldatabase = $config['server']['mysqlDatabase'];
  184. }
  185. elseif(isset($config['server']['sqlHost'])) {
  186. //old (0.2.4) ots config.lua file
  187. $mysqlhost = $config['server']['sqlHost'];
  188. $mysqluser = $config['server']['sqlUser'];
  189. $mysqlpass = $config['server']['sqlPass'];
  190. $mysqldatabase = $config['server']['sqlDatabase'];
  191. }
  192. $sqlitefile = $config['server']['sqliteDatabase'];
  193. $passwordency = '';
  194. if(strtolower($config['server']['useMD5Passwords']) == 'yes' || strtolower($config['server']['passwordType']) == 'md5') {
  195. $passwordency = 'md5';
  196. }
  197. if(strtolower($config['server']['passwordType']) == 'sha1') {
  198. $passwordency = 'sha1';
  199. }
  200. // loads #####POT mainfile#####
  201. include('pot/OTS.php');
  202. // PDO and POT connects to database
  203. $ots = POT::getInstance();
  204. if(strtolower($config['server']['sqlType']) == "mysql")
  205. {
  206. //connect to MySQL database
  207. try
  208. {
  209. $ots->connect(POT::DB_MYSQL, array('host' => $mysqlhost, 'user' => $mysqluser, 'password' => $mysqlpass, 'database' => $mysqldatabase) );
  210. }
  211. catch(PDOException $error)
  212. {
  213. 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.';
  214. exit;
  215. }
  216. }
  217. elseif(strtolower($config['server']['sqlType']) == "sqlite")
  218. {
  219. //connect to SQLite database
  220. $link_to_sqlitedatabase = $config['site']['server_path'].$sqlitefile;
  221. try
  222. {
  223. $ots->connect(POT::DB_SQLITE, array('database' => $link_to_sqlitedatabase));
  224. }
  225. catch(PDOException $error)
  226. {
  227. 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.';
  228. exit;
  229. }
  230. }
  231. else
  232. {
  233. 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>';
  234. exit;
  235. }
  236. $SQL = POT::getInstance()->getDBHandle();
  237. $config['site']['install'] = 3;
  238. saveconfig_ini($config['site']);
  239. }
  240. if($step == '3') {
  241. echo '<h1>STEP '.$step.'</h1>Add tables and columns to DB<br>';
  242. echo 'Installer try to add new tables and columns to database.<br>';
  243. $config['server'] = parse_ini_file($config['site']['server_path'].'config.lua');
  244. if($config['server']['sqlType'] == "sqlite") {
  245. //if sqlite
  246. try { $SQL->query('ALTER TABLE accounts ADD "key" VARCHAR(255) NOT NULL DEFAULT "";'); } catch(PDOException $error) {}
  247. try { $SQL->query('ALTER TABLE accounts ADD "page_lastday" INTEGER(11) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {}
  248. try { $SQL->query('ALTER TABLE accounts ADD "email_new" VARCHAR(255) NOT NULL DEFAULT "";'); } catch(PDOException $error) {}
  249. try { $SQL->query('ALTER TABLE accounts ADD "email_new_time" INTEGER(15) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {}
  250. try { $SQL->query('ALTER TABLE accounts ADD "created" INTEGER(11) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {}
  251. try { $SQL->query('ALTER TABLE accounts ADD "rlname" VARCHAR(255) NOT NULL DEFAULT "";'); } catch(PDOException $error) {}
  252. try { $SQL->query('ALTER TABLE accounts ADD "location" VARCHAR(255) NOT NULL DEFAULT "";'); } catch(PDOException $error) {}
  253. try { $SQL->query('ALTER TABLE accounts ADD "page_access" INTEGER(11) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {}
  254. try { $SQL->query('ALTER TABLE accounts ADD "email_code" VARCHAR(255) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {}
  255. try { $SQL->query('ALTER TABLE accounts ADD "next_email" INTEGER(11) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {}
  256. try { $SQL->query('ALTER TABLE accounts ADD "premium_points" INTEGER(11) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {}
  257. echo "Added columns to table <b>accounts</b>.<br/>";
  258. try { $SQL->query('ALTER TABLE guilds ADD "description" TEXT NOT NULL DEFAULT "";'); } catch(PDOException $error) {}
  259. try { $SQL->query('ALTER TABLE guilds ADD "logo_gfx_name" VARCHAR(255) NOT NULL DEFAULT "";'); } catch(PDOException $error) {}
  260. echo "Added columns to table <b>guilds</b>.<br/>";
  261. try { $SQL->query('ALTER TABLE players ADD "online" INTEGER(11) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {}
  262. try { $SQL->query('ALTER TABLE players ADD "created" INTEGER(11) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {}
  263. try { $SQL->query('ALTER TABLE players ADD "nick_verify" INTEGER(11) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {}
  264. try { $SQL->query('ALTER TABLE players ADD "old_name" VARCHAR(255) NOT NULL DEFAULT "";'); } catch(PDOException $error) {}
  265. try { $SQL->query('ALTER TABLE players ADD "hide_char" INTEGER(11) NOT NULL DEFAULT 0;'); } catch(PDOException $error) {}
  266. try { $SQL->query('ALTER TABLE players ADD "comment" TEXT NOT NULL DEFAULT "";'); } catch(PDOException $error) {}
  267. echo "Added columns to table <b>players</b>.<br/>";
  268. try { $SQL->query('CREATE TABLE "z_news_big" (
  269. "hide_news" INTEGER NOT NULL DEFAULT 0,
  270. "date" INTEGER NOT NULL,
  271. "author" VARCHAR(255) NOT NULL,
  272. "author_id" INTEGER NOT NULL,
  273. "image_id" INTEGER NOT NULL DEFAULT 0,
  274. "topic" VARCHAR(255) NOT NULL,
  275. "text" TEXT NOT NULL);'); } catch(PDOException $error) {}
  276. echo "Added table <b>z_news_big</b> (news).<br/>";
  277. try { $SQL->query('CREATE TABLE "z_news_tickers" (
  278. "date" INTEGER NOT NULL,
  279. "author" INTEGER NOT NULL,
  280. "image_id" INTEGER NOT NULL DEFAULT 0,
  281. "text" TEXT NOT NULL,
  282. "hide_ticker" INTEGER NOT NULL DEFAULT 0);'); } catch(PDOException $error) {}
  283. echo "Added table <b>z_news_tickers</b> (tickers).<br/>";
  284. try { $SQL->query('CREATE TABLE "z_spells" (
  285. "name" VARCHAR(255) NOT NULL,
  286. "spell" VARCHAR(255) NOT NULL,
  287. "spell_type" VARCHAR(255) NOT NULL,
  288. "mana" INTEGER NOT NULL DEFAULT 0,
  289. "lvl" INTEGER NOT NULL DEFAULT 0,
  290. "mlvl" INTEGER NOT NULL DEFAULT 0,
  291. "soul" INTEGER NOT NULL DEFAULT 0,
  292. "pacc" VARCHAR(255) NOT NULL,
  293. "vocations" VARCHAR(255) NOT NULL,
  294. "conj_count" INTEGER NOT NULL DEFAULT 0,
  295. "hide_spell" INTEGER NOT NULL DEFAULT 0);'); } catch(PDOException $error) {}
  296. echo "Added table <b>z_spells</b> (spells list).<br/>";
  297. try { $SQL->query('CREATE TABLE "z_monsters" (
  298. "hide_creature" INTEGER NOT NULL DEFAULT 0,
  299. "name" VARCHAR(255) NOT NULL,
  300. "mana" INTEGER NOT NULL,
  301. "exp" INTEGER NOT NULL,
  302. "health" INTEGER NOT NULL,
  303. "speed_lvl" INTEGER NOT NULL DEFAULT 1,
  304. "use_haste" INTEGER NOT NULL,
  305. "voices" text NOT NULL,
  306. "immunities" VARCHAR(255) NOT NULL,
  307. "summonable" INTEGER NOT NULL,
  308. "convinceable" INTEGER NOT NULL,
  309. "race" VARCHAR(255) NOT NULL,
  310. "gfx_name" VARCHAR(255) NOT NULL)'); } catch(PDOException $error) {}
  311. echo "Added table <b>z_monsters</b> (monsters list).<br/>";
  312. }
  313. elseif($config['server']['sqlType'] == "mysql")
  314. {
  315. //if mysql
  316. echo "<h3>Add columns to table <b>accounts</b></h3>";
  317. 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/>";}
  318. 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/>";}
  319. 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/>";}
  320. 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/>";}
  321. 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/>";}
  322. 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/>";}
  323. 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/>";}
  324. 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/>";}
  325. 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/>";}
  326. 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/>";}
  327. 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/>";}
  328. echo "<h3>Add columns to table <b>guilds</b></h3>";
  329. 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/>";}
  330. 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/>";}
  331. echo "<h3>Add columns to table <b>players</b></h3>";
  332. 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/>";}
  333. 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/>";}
  334. 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/>";}
  335. 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/>";}
  336. 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/>";}
  337. 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/>";}
  338. 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/>";}
  339. echo "<h3>Add new tables to database</h3>";
  340. try { $SQL->query("CREATE TABLE `z_news_big` (
  341. `hide_news` tinyint(1) NOT NULL DEFAULT '0',
  342. `date` int(11) NOT NULL DEFAULT '0',
  343. `author` varchar(255) NOT NULL,
  344. `author_id` int(11) NOT NULL,
  345. `image_id` int(3) NOT NULL DEFAULT '0',
  346. `topic` varchar(255) NOT NULL,
  347. `text` text NOT NULL
  348. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
  349. echo '<font color=\"green\">Added table <b>z_news_big</b></font><br/>';
  350. } catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_news_big</b> not added.</font> Already exist?<br/>";}
  351. try { $SQL->query("CREATE TABLE `z_news_tickers` (
  352. `date` int(11) NOT NULL default '1',
  353. `author` int(11) NOT NULL,
  354. `image_id` int(3) NOT NULL default '0',
  355. `text` text NOT NULL,
  356. `hide_ticker` tinyint(1) NOT NULL
  357. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
  358. echo '<font color=\"green\">Added table <b>z_news_tickers</b></font><br/>';
  359. } catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_news_tickers</b> not added.</font> Already exist?<br/>";}
  360. try { $SQL->query('CREATE TABLE `z_spells` (
  361. `name` VARCHAR(255) NOT NULL,
  362. `spell` VARCHAR(255) NOT NULL,
  363. `spell_type` VARCHAR(255) NOT NULL,
  364. `mana` INTEGER NOT NULL DEFAULT 0,
  365. `lvl` INTEGER NOT NULL DEFAULT 0,
  366. `mlvl` INTEGER NOT NULL DEFAULT 0,
  367. `soul` INTEGER NOT NULL DEFAULT 0,
  368. `pacc` VARCHAR(255) NOT NULL,
  369. `vocations` VARCHAR(255) NOT NULL,
  370. `conj_count` INTEGER NOT NULL DEFAULT 0,
  371. `hide_spell` INTEGER NOT NULL DEFAULT 0);');
  372. echo '<font color=\"green\">Added table <b>z_spells</b></font><br/>';
  373. } catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_spells</b> not added.</font> Already exist?<br/>";}
  374. try { $SQL->query('CREATE TABLE `z_monsters` (
  375. `hide_creature` tinyint(1) NOT NULL default \'0\',
  376. `name` varchar(255) NOT NULL,
  377. `mana` int(11) NOT NULL,
  378. `exp` int(11) NOT NULL,
  379. `health` int(11) NOT NULL,
  380. `speed_lvl` int(11) NOT NULL default \'1\',
  381. `use_haste` tinyint(1) NOT NULL,
  382. `voices` text NOT NULL,
  383. `immunities` varchar(255) NOT NULL,
  384. `summonable` tinyint(1) NOT NULL,
  385. `convinceable` tinyint(1) NOT NULL,
  386. `race` varchar(255) NOT NULL,
  387. `gfx_name` varchar(255) NOT NULL
  388. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;');
  389. echo"<font color=\"green\">Added table <b>z_monsters</b></font><br/>";
  390. } catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_monsters</b> not added.</font> Already exist?<br/>";}
  391. try { $SQL->query("CREATE TABLE `z_ots_comunication` (
  392. `id` int(11) NOT NULL auto_increment,
  393. `name` varchar(255) NOT NULL,
  394. `type` varchar(255) NOT NULL,
  395. `action` varchar(255) NOT NULL,
  396. `param1` varchar(255) NOT NULL,
  397. `param2` varchar(255) NOT NULL,
  398. `param3` varchar(255) NOT NULL,
  399. `param4` varchar(255) NOT NULL,
  400. `param5` varchar(255) NOT NULL,
  401. `param6` varchar(255) NOT NULL,
  402. `param7` varchar(255) NOT NULL,
  403. `delete_it` int(2) NOT NULL default '1',
  404. PRIMARY KEY (`id`)
  405. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
  406. echo "<font color=\"green\">Added table <b>z_ots_comunication</b> (shopsystem).<br/></font>";
  407. }
  408. catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_ots_comunication</b> not added.</font> Already exist?<br/>";}
  409. try { $SQL->query("CREATE TABLE `z_shop_offer` (
  410. `id` int(11) NOT NULL auto_increment,
  411. `points` int(11) NOT NULL default '0',
  412. `itemid1` int(11) NOT NULL default '0',
  413. `count1` int(11) NOT NULL default '0',
  414. `itemid2` int(11) NOT NULL default '0',
  415. `count2` int(11) NOT NULL default '0',
  416. `offer_type` varchar(255) default NULL,
  417. `offer_description` text NOT NULL,
  418. `offer_name` varchar(255) NOT NULL,
  419. `pid` INT(11) NOT NULL DEFAULT '0',
  420. PRIMARY KEY (`id`)
  421. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;");
  422. echo "<font color=\"green\">Added table <b>z_shop_offer</b> (shopsystem).<br/></font>";
  423. }
  424. catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_shop_offer</b> not added.</font> Already exist?<br/>";}
  425. try { $SQL->query("CREATE TABLE `z_shop_history_item` (
  426. `id` int(11) NOT NULL auto_increment,
  427. `to_name` varchar(255) NOT NULL default '0',
  428. `to_account` int(11) NOT NULL default '0',
  429. `from_nick` varchar(255) NOT NULL,
  430. `from_account` int(11) NOT NULL default '0',
  431. `price` int(11) NOT NULL default '0',
  432. `offer_id` int(11) NOT NULL default '0',
  433. `trans_state` varchar(255) NOT NULL,
  434. `trans_start` int(11) NOT NULL default '0',
  435. `trans_real` int(11) NOT NULL default '0',
  436. PRIMARY KEY (`id`)
  437. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
  438. echo "<font color=\"green\">Added table <b>z_shop_history_item</b> (shopsystem).<br/></font>";
  439. }
  440. catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_shop_history_item</b> not added.</font> Already exist?<br/>";}
  441. try { $SQL->query("CREATE TABLE `z_shop_history_pacc` (
  442. `id` int(11) NOT NULL auto_increment,
  443. `to_name` varchar(255) NOT NULL default '0',
  444. `to_account` int(11) NOT NULL default '0',
  445. `from_nick` varchar(255) NOT NULL,
  446. `from_account` int(11) NOT NULL default '0',
  447. `price` int(11) NOT NULL default '0',
  448. `pacc_days` int(11) NOT NULL default '0',
  449. `trans_state` varchar(255) NOT NULL,
  450. `trans_start` int(11) NOT NULL default '0',
  451. `trans_real` int(11) NOT NULL default '0',
  452. PRIMARY KEY (`id`)
  453. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
  454. echo "<font color=\"green\">Added table <b>z_shop_history_pacc</b> (shopsystem).<br/></font>";
  455. }
  456. catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_shop_history_pacc</b> not added.</font> Already exist?<br/>";}
  457. try { $SQL->query("CREATE TABLE IF NOT EXISTS `z_changelog` (
  458. `id` int(11) NOT NULL auto_increment,
  459. `type` varchar(255) NOT NULL default '',
  460. `where` varchar(255) NOT NULL default '',
  461. `date` int(11) NOT NULL default '0',
  462. `description` varchar(255) NOT NULL,
  463. PRIMARY KEY (`id`)
  464. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;");
  465. echo "<font color=\"green\">Added table <b>z_changelog</b> (changelog).<br/></font>";
  466. }
  467. catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_changelog</b> not added.</font> Already exist?<br/>";}
  468. try { $SQL->query("CREATE TABLE `z_polls` (
  469. `id` int(11) NOT NULL auto_increment,
  470. `question` varchar(255) NOT NULL,
  471. `end` int(11) NOT NULL,
  472. `start` int(11) NOT NULL,
  473. `answers` int(11) NOT NULL,
  474. `votes_all` int(11) NOT NULL,
  475. PRIMARY KEY (`id`)
  476. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;");
  477. echo "<font color=\"green\">Added table <b>z_polls</b> (poll-system).<br/></font>";
  478. }
  479. catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_polls</b> not added.</font> Already exist?<br/>";}
  480. try { $SQL->query("CREATE TABLE `z_polls_answers` (
  481. `poll_id` int(11) NOT NULL,
  482. `answer_id` int(11) NOT NULL,
  483. `answer` varchar(255) NOT NULL,
  484. `votes` int(11) NOT NULL
  485. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
  486. echo "<font color=\"green\">Added table <b>z_polls_answers</b> (poll-system).<br/></font>";
  487. }
  488. catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_polls_answers</b> not added.</font> Already exist?<br/>";}
  489. try { $SQL->query("CREATE TABLE `z_bug_tracker` (
  490. `account` varchar(255) NOT NULL,
  491. `type` int(11) NOT NULL,
  492. `status` int(11) NOT NULL,
  493. `text` text NOT NULL,
  494. `id` int(11) NOT NULL,
  495. `subject` varchar(255) NOT NULL,
  496. `reply` int(11) NOT NULL,
  497. `who` int(11) NOT NULL,
  498. `uid` int(11) NOT NULL auto_increment,
  499. `tag` int(11) NOT NULL,
  500. PRIMARY KEY (`uid`)
  501. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;");
  502. echo "<font color=\"green\">Added table <b>z_bug_tracker</b> (bug tracker).<br/></font>";
  503. }
  504. catch(PDOException $error) { echo "<font color=\"red\">Table <b>z_bug_tracker</b> not added.</font> Already exist?<br/>";
  505. }
  506. try { $SQL->query("CREATE TABLE IF NOT EXISTS `posts` (
  507. `id` int(11) NOT NULL auto_increment,
  508. `title` varchar(255) default NULL,
  509. `icon` int(5) default NULL,
  510. `date` varchar(45) default NULL,
  511. `time` varchar(30) default NULL,
  512. `author` varchar(30) default NULL,
  513. `board` int(5) default NULL,
  514. `thread` int(20) default NULL,
  515. `post` text,
  516. `signature` int(5) default NULL,
  517. PRIMARY KEY (`id`)
  518. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  519.  
  520. CREATE TABLE IF NOT EXISTS `threads` (
  521. `id` int(11) NOT NULL auto_increment,
  522. `name` varchar(255) default NULL,
  523. `icon` int(5) default NULL,
  524. `closed` int(5) default NULL,
  525. `stick` int(5) NOT NULL,
  526. `date` varchar(45) default NULL,
  527. `time` varchar(30) default NULL,
  528. `author` varchar(30) default NULL,
  529. `board` int(5) default NULL,
  530. `views` int(20) default NULL,
  531. `last` int(40) default NULL,
  532. PRIMARY KEY (`id`)
  533. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
  534.  
  535. CREATE TABLE IF NOT EXISTS `forums` (
  536. `id` int(11) NOT NULL auto_increment,
  537. `name` varchar(255),
  538. `description` text,
  539. `closed` int(5) default NULL,
  540. `access` int(5) NOT NULL,
  541. PRIMARY KEY (`id`)
  542. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  543.  
  544. --
  545. -- Zrzut danych tabeli `forums`
  546. --
  547.  
  548. INSERT INTO `forums` (`id`, `name`, `description`, `closed`, `access`) VALUES
  549. (2, 'First forum.', 'This is your first forum.', 0, 0);");
  550. echo "<font color=\"green\">Added <b>forum tables</b> (forum).<br/></font>";
  551. }
  552. catch(PDOException $error) { echo "<font color=\"red\">Tables <b>forum</b> not added.</font> Already exist?<br/>";}
  553. }
  554. $config['site']['install'] = 4;
  555. saveconfig_ini($config['site']);
  556. echo '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>';
  557. }
  558. if($step == '4') {
  559. echo '<h1>STEP '.$step.'</h1>Add samples to DB:<br>';
  560. $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();
  561. if(!isset($check_news_ticker['author'])) {
  562. $SQL->query('INSERT INTO z_news_tickers (date, author, image_id, text, hide_ticker) VALUES ('.time().', 1, 1, "Hello! Gesior account manager 0.32beta2 installed. Report bugs to gesiorjr@poczta.fm", 0)');
  563. echo "Added first news ticker.<br/>";
  564. } else {
  565. echo "News ticker sample is already in database. New sample is not needed.<br/>";
  566. }
  567. $check_news = $SQL->query('SELECT * FROM z_news_big WHERE author = "Gesior" LIMIT 1 OFFSET 0')->fetch();
  568. if(!isset($check_news['author'])) {
  569. $SQL->query('INSERT INTO z_news_big (hide_news, date, author, author_id, image_id, topic, text) VALUES (0, '.time().', "Gesior", 1, 0, "New account manager!", "Gesior account manager 0.32beta2 installed. All options should work fine. Report bugs in acc. maker thread");');
  570. echo "Added first news.<br/>";
  571. } else {
  572. echo "News sample is already in database. New sample is not needed.<br/>";
  573. }
  574. $check_voc_0 = $SQL->query('SELECT * FROM players WHERE name = "Rook Sample" LIMIT 1 OFFSET 0')->fetch();
  575. if(!isset($check_voc_0['name'])) {
  576. $SQL->query('INSERT INTO players (name, group_id, account_id, sex, vocation, experience, level, maglevel, health, healthmax, mana, manamax, manaspent, soul, direction, lookbody, lookfeet, lookhead, looklegs, looktype, lookaddons, posx, posy, posz, cap, lastlogin, lastip, save, conditions, skulltime, skull, guildnick, rank_id, town_id, loss_experience, loss_mana, loss_skills, lastlogout, blessings, premend, online, comment, created, hide_char, nick_verify) VALUES ("Rook Sample", 1, 1, 1, 0, 0, 1, 0, 185, 185, 35, 35, 0, 100,"", 44, 44, 44, 44, 128, 0, 0, 0, 0, 420, "", "", 1,"","","","","","1","","","","","","","","",'.time().',1,1)');
  577. echo "Added 'Rook Sample' character.<br/>";
  578. } else {
  579. echo "Character 'Rook Sample' already in database.<br/>";
  580. }
  581. $check_voc_1 = $SQL->query('SELECT * FROM players WHERE name = "Sorcerer Sample" LIMIT 1 OFFSET 0')->fetch();
  582. if(!isset($check_voc_1['name'])) {
  583. $SQL->query('INSERT INTO players (name, group_id, account_id, sex, vocation, experience, level, maglevel, health, healthmax, mana, manamax, manaspent, soul, direction, lookbody, lookfeet, lookhead, looklegs, looktype, lookaddons, posx, posy, posz, cap, lastlogin, lastip, save, conditions, skulltime, skull, guildnick, rank_id, town_id, loss_experience, loss_mana, loss_skills, lastlogout, blessings, premend, online, comment, created, hide_char, nick_verify) VALUES ("Sorcerer Sample", 1, 1, 1, 1, 0, 1, 0, 185, 185, 35, 35, 0, 100,"", 44, 44, 44, 44, 128, 0, 0, 0, 0, 420, "", "", 1,"","","","","","1","","","","","","","","",'.time().',1,1)');
  584. echo "Added 'Sorcerer Sample' character.<br/>";
  585. } else {
  586. echo "Character 'Sorcerer Sample' already in database.<br/>";
  587. }
  588. $check_voc_2 = $SQL->query('SELECT * FROM players WHERE name = "Druid Sample" LIMIT 1 OFFSET 0')->fetch();
  589. if(!isset($check_voc_2['name'])) {
  590. $SQL->query('INSERT INTO players (name, group_id, account_id, sex, vocation, experience, level, maglevel, health, healthmax, mana, manamax, manaspent, soul, direction, lookbody, lookfeet, lookhead, looklegs, looktype, lookaddons, posx, posy, posz, cap, lastlogin, lastip, save, conditions, skulltime, skull, guildnick, rank_id, town_id, loss_experience, loss_mana, loss_skills, lastlogout, blessings, premend, online, comment, created, hide_char, nick_verify) VALUES ("Druid Sample", 1, 1, 1, 2, 0, 1, 0, 185, 185, 35, 35, 0, 100,"", 44, 44, 44, 44, 128, 0, 0, 0, 0, 420, "", "", 1,"","","","","","1","","","","","","","","",'.time().',1,1)');
  591. echo "Added 'Druid Sample' character.<br/>";
  592. } else {
  593. echo "Character 'Druid Sample' already in database.<br/>";
  594. }
  595. $check_voc_3 = $SQL->query('SELECT * FROM players WHERE name = "Paladin Sample" LIMIT 1 OFFSET 0')->fetch();
  596. if(!isset($check_voc_3['name'])) {
  597. $SQL->query('INSERT INTO players (name, group_id, account_id, sex, vocation, experience, level, maglevel, health, healthmax, mana, manamax, manaspent, soul, direction, lookbody, lookfeet, lookhead, looklegs, looktype, lookaddons, posx, posy, posz, cap, lastlogin, lastip, save, conditions, skulltime, skull, guildnick, rank_id, town_id, loss_experience, loss_mana, loss_skills, lastlogout, blessings, premend, online, comment, created, hide_char, nick_verify) VALUES ("Paladin Sample", 1, 1, 1, 3, 0, 1, 0, 185, 185, 35, 35, 0, 100,"", 44, 44, 44, 44, 128, 0, 0, 0, 0, 420, "", "", 1,"","","","","","1","","","","","","","","",'.time().',1,1)');
  598. echo "Added 'Paladin Sample' character.<br/>";
  599. } else {
  600. echo "Character 'Paladin Sample' already in database.<br/>";
  601. }
  602. $check_voc_4 = $SQL->query('SELECT * FROM players WHERE name = "Knight Sample" LIMIT 1 OFFSET 0')->fetch();
  603. if(!isset($check_voc_4['name'])) {
  604. $SQL->query('INSERT INTO players (name, group_id, account_id, sex, vocation, experience, level, maglevel, health, healthmax, mana, manamax, manaspent, soul, direction, lookbody, lookfeet, lookhead, looklegs, looktype, lookaddons, posx, posy, posz, cap, lastlogin, lastip, save, conditions, skulltime, skull, guildnick, rank_id, town_id, loss_experience, loss_mana, loss_skills, lastlogout, blessings, premend, online, comment, created, hide_char, nick_verify) VALUES ("Knight Sample", 1, 1, 1, 4, 0, 1, 0, 185, 185, 35, 35, 0, 100,"", 44, 44, 44, 44, 128, 0, 0, 0, 0, 420, "", "", 1,"","","","","","1","","","","","","","","",'.time().',1,1)');
  605. echo "Added 'Knight Sample' character.<br/>";
  606. } else {
  607. echo "Character 'Knight Sample' already in database.<br/>";
  608. $config['site']['install'] = 5;
  609. saveconfig_ini($config['site']);
  610. 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/>';
  611. }
  612. }
  613. if($step == '5') {
  614. echo '<h1>STEP '.$step.'</h1>Set Admin Account<br>';
  615. $config['server'] = parse_ini_file($config['site']['server_path'].'config.lua');
  616. if(empty($_REQUEST['saveaccpassword'])) {
  617. echo 'Admin account number is: <b>1</b><br/>Set new password to this account.<br>';
  618. echo 'New password: <form action="install.php" method=POST><input type="text" name="newpass" size="35">(Don\'t give it password to anyone!)';
  619. 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.';
  620. } else {
  621. $newpass = $_POST['newpass'];
  622. if(!check_password($newpass))
  623. 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.';
  624. else
  625. {
  626. $newpass_to_db = password_ency($newpass);
  627. //ustawienie/stworzenie konta admina
  628. $account = new OTS_Account();
  629. $account->load(1);
  630. if($account->isLoaded())
  631. {
  632. //set password
  633. $account->setPassword($newpass_to_db);
  634. $account->save();
  635. $account->setCustomField("page_access", 3);
  636. }
  637. else
  638. {
  639. //create account
  640. $number = $account->create(1,1,1);
  641. $account->setPassword($newpass_to_db);
  642. $account->unblock();
  643. $account->save();
  644. $account->setCustomField("page_access", 3);
  645. }
  646. $_SESSION['account'] = 1;
  647. $_SESSION['password'] = $newpass;
  648. $logged = TRUE;
  649. $account->setCustomField("page_lastday", time());
  650. 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-9 in menu.</h3>';
  651. $config['site']['install'] = 'no';
  652. saveconfig_ini($config['site']);
  653. }
  654. }
  655. }
  656. }
  657. else
  658. {
  659. 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.";
  660. }
  661. }
  662. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement