PageRenderTime 61ms CodeModel.GetById 30ms RepoModel.GetById 1ms app.codeStats 0ms

/Admin/database.php

https://github.com/DEVVELO/TravianZ-By-Shadowss
PHP | 566 lines | 473 code | 64 blank | 29 comment | 91 complexity | 9c05c4e70959556dcf2cfd0b3552b798 MD5 | raw file
  1. <?php
  2. #################################################################################
  3. ## ##
  4. ## -= YOU MUST NOT REMOVE OR CHANGE THIS NOTICE =- ##
  5. ## ##
  6. ## --------------------------------------------------------------------------- ##
  7. ## ##
  8. ## Project: TravianZ ##
  9. ## Version: 05.03.2014 ##
  10. ## Filename: Admin/database.php ##
  11. ## Developed by: Dzoki ##
  12. ## Edited by: Shadow and ronix ##
  13. ## License: Creative Commons BY-NC-SA 3.0 ##
  14. ## Copyright: TravianZ (c) 2014 - All rights reserved ##
  15. ## URLs: http://travian.shadowss/ro ##
  16. ## Source code: https://github.com/Shadowss/TravianZ ##
  17. ## ##
  18. #################################################################################
  19. if($gameinstall == 1){
  20. include_once("../../GameEngine/config.php");
  21. include_once("../../GameEngine/Data/buidata.php");
  22. }else{
  23. include_once("../GameEngine/config.php");
  24. include_once("../GameEngine/Data/buidata.php");
  25. include_once("../GameEngine/Data/unitdata.php");
  26. include_once("../GameEngine/Technology.php");
  27. include_once("../GameEngine/Units.php");
  28. }
  29. class adm_DB {
  30. var $connection;
  31. function adm_DB(){
  32. global $database;
  33. $this->connection = mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS) or die(mysql_error());
  34. mysql_select_db(SQL_DB, $this->connection) or die(mysql_error());
  35. }
  36. function Login($username,$password){
  37. $q = "SELECT password FROM ".TB_PREFIX."users where username = '$username' and access >= ".MULTIHUNTER;
  38. $result = mysql_query($q, $this->connection);
  39. $dbarray = mysql_fetch_array($result);
  40. if($dbarray['password'] == md5($password)) {
  41. mysql_query("Insert into ".TB_PREFIX."admin_log values (0,'X','$username logged in (IP: <b>".$_SERVER['REMOTE_ADDR']."</b>)',".time().")");
  42. return true;
  43. }
  44. else {
  45. mysql_query("Insert into ".TB_PREFIX."admin_log values (0,'X','<font color=\'red\'><b>IP: ".$_SERVER['REMOTE_ADDR']." tried to log in with username <u> $username</u> but access was denied!</font></b>',".time().")");
  46. return false;
  47. }
  48. }
  49. function recountPopUser($uid){
  50. global $database;
  51. $villages = $database->getProfileVillages($uid);
  52. for ($i = 0; $i <= count($villages)-1; $i++) {
  53. $vid = $villages[$i]['wref'];
  54. $this->recountPop($vid);
  55. $this->recountCP($vid);
  56. }
  57. }
  58. function recountPop($vid){
  59. global $database;
  60. $fdata = $database->getResourceLevel($vid);
  61. $popTot = 0;
  62. for ($i = 1; $i <= 40; $i++) {
  63. $lvl = $fdata["f".$i];
  64. $building = $fdata["f".$i."t"];
  65. if($building){
  66. $popTot += $this->buildingPOP($building,$lvl);
  67. }
  68. }
  69. $q = "UPDATE ".TB_PREFIX."vdata set pop = $popTot where wref = $vid";
  70. mysql_query($q, $this->connection);
  71. }
  72. function buildingPOP($f,$lvl){
  73. $name = "bid".$f;
  74. global $$name;
  75. $popT = 0;
  76. $dataarray = $$name;
  77. for ($i = 0; $i <= $lvl; $i++) {
  78. $popT += $dataarray[$i]['pop'];
  79. }
  80. return $popT;
  81. }
  82. function buildingCP($f,$lvl){
  83. $name = "bid".$f;
  84. global $$name;
  85. $popT = 0;
  86. $dataarray = $$name;
  87. for ($i = 0; $i <= $lvl; $i++) {
  88. $popT += $dataarray[$i]['cp'];
  89. }
  90. return $popT;
  91. }
  92. function recountCP($vid){
  93. global $database;
  94. $fdata = $database->getResourceLevel($vid);
  95. $popTot = 0;
  96. for ($i = 1; $i <= 40; $i++) {
  97. $lvl = $fdata["f".$i];
  98. $building = $fdata["f".$i."t"];
  99. if($building){
  100. $popTot += $this->buildingCP($building,$lvl);
  101. }
  102. }
  103. $q = "UPDATE ".TB_PREFIX."vdata set cp = $popTot where wref = $vid";
  104. mysql_query($q, $this->connection);
  105. }
  106. function getWref($x,$y) {
  107. $q = "SELECT id FROM ".TB_PREFIX."wdata where x = $x and y = $y";
  108. $result = mysql_query($q, $this->connection);
  109. $r = mysql_fetch_array($result);
  110. return $r['id'];
  111. }
  112. function AddVillage($post){
  113. global $database;
  114. $wid = $this->getWref($post['x'],$post['y']);
  115. $uid = $post['uid'];
  116. $status = $database->getVillageState($wid);
  117. $status = 0;
  118. if($status == 0){
  119. mysql_query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Added new village <b><a href=\'admin.php?p=village&did=$wid\'>$wid</a></b> to user <b><a href=\'admin.php?p=player&uid=$uid\'>$uid</a></b>',".time().")");
  120. $database->setFieldTaken($wid);
  121. $database->addVillage($wid,$uid,'new village','0');
  122. $database->addResourceFields($wid,$database->getVillageType($wid));
  123. $database->addUnits($wid);
  124. $database->addTech($wid);
  125. $database->addABTech($wid);
  126. }
  127. }
  128. function Punish($post){
  129. global $database;
  130. $villages = $database->getProfileVillages($post['uid']);
  131. $admid = $post['admid'];
  132. $user = $database->getUserArray($post['uid'],1);
  133. for ($i = 0; $i <= count($villages)-1; $i++) {
  134. $vid = $villages[$i]['wref'];
  135. if($post['punish']){
  136. $popOld = $villages[$i]['pop'];
  137. $proc = 100-$post['punish'];
  138. $pop = floor(($popOld/100)*($proc));
  139. if($pop <= 1 ){$pop = 2;}
  140. $this->PunishBuilding($vid,$proc,$pop);
  141. }
  142. if($post['del_troop']){
  143. if($user['tribe'] == 1) {
  144. $unit = 1;
  145. }else if($user['tribe'] == 2) {
  146. $unit = 11;
  147. }else if($user['tribe'] == 3) {
  148. $unit = 21;
  149. }
  150. $this->DelUnits($villages[$i]['wref'],$unit);
  151. }
  152. if($post['clean_ware']){
  153. $time = time();
  154. $q = "UPDATE ".TB_PREFIX."vdata SET `wood` = '0', `clay` = '0', `iron` = '0', `crop` = '0', `lastupdate` = '$time' WHERE wref = $vid;";
  155. mysql_query($q, $this->connection);
  156. }
  157. }
  158. mysql_query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Punished user: <a href=\'admin.php?p=player&uid=".$post['uid']."\'>".$post['uid']."</a> with <b>-".$post['punish']."%</b> population',".time().")");
  159. }
  160. function PunishBuilding($vid,$proc,$pop){
  161. global $database;
  162. $q = "UPDATE ".TB_PREFIX."vdata set pop = $pop where wref = $vid;";
  163. mysql_query($q, $this->connection);
  164. $fdata = $database->getResourceLevel($vid);
  165. for ($i = 1; $i <= 40; $i++) {
  166. if($fdata['f'.$i]>1){
  167. $zm = ($fdata['f'.$i]/100)*$proc;
  168. if($zm < 1){$zm = 1;}else{$zm = floor($zm);}
  169. $q = "UPDATE ".TB_PREFIX."fdata SET `f$i` = '$zm' WHERE `vref` = $vid;";
  170. mysql_query($q, $this->connection);
  171. }
  172. }
  173. }
  174. function DelUnits($vid,$unit){
  175. for ($i = $unit; $i <= 9+$unit; $i++) {
  176. $this->DelUnits2($vid,$unit);
  177. }
  178. }
  179. function DelUnits2($vid,$unit){
  180. $q = "UPDATE ".TB_PREFIX."units SET `u$unit` = '0' WHERE `vref` = $vid;";
  181. mysql_query($q, $this->connection);
  182. }
  183. function DelPlayer($uid,$pass){
  184. global $database;
  185. $ID = $_SESSION['id'];
  186. if($this->CheckPass($pass,$ID)){
  187. $villages = $database->getProfileVillages($uid);
  188. for ($i = 0; $i <= count($villages)-1; $i++) {
  189. $this->DelVillage($villages[$i]['wref'], 1);
  190. }
  191. $q = "DELETE FROM ".TB_PREFIX."hero where uid = $uid";
  192. mysql_query($q, $this->connection);
  193. $name = $database->getUserField($uid,"username",0);
  194. mysql_query("Insert into ".TB_PREFIX."admin_log values (0,$ID,'Deleted user <a>$name</a>',".time().")");
  195. $q = "DELETE FROM ".TB_PREFIX."users WHERE `id` = $uid;";
  196. mysql_query($q, $this->connection);
  197. }
  198. }
  199. function getUserActive() {
  200. $time = time() - (60*5);
  201. $q = "SELECT * FROM ".TB_PREFIX."users where timestamp > $time and username != 'support'";
  202. $result = mysql_query($q, $this->connection);
  203. return $this->mysql_fetch_all($result);
  204. }
  205. function CheckPass($password,$uid){
  206. $q = "SELECT password FROM ".TB_PREFIX."users where id = '$uid' and access = ".ADMIN;
  207. $result = mysql_query($q, $this->connection);
  208. $dbarray = mysql_fetch_array($result);
  209. if($dbarray['password'] == md5($password)) {
  210. return true;
  211. }else{
  212. return false;
  213. }
  214. }
  215. function DelVillage($wref, $mode=0){
  216. global $database;
  217. if($mode==0){
  218. $q = "SELECT * FROM ".TB_PREFIX."vdata WHERE `wref` = $wref and capital = 0";
  219. }else{
  220. $q = "SELECT * FROM ".TB_PREFIX."vdata WHERE `wref` = $wref";
  221. }
  222. $result = mysql_query($q, $this->connection);
  223. if(mysql_num_rows($result) > 0){
  224. mysql_query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Deleted village <b>$wref</b>',".time().")");
  225. $database->clearExpansionSlot($wref);
  226. $q = "DELETE FROM ".TB_PREFIX."abdata where vref = $wref";
  227. mysql_query($q, $this->connection);
  228. $q = "DELETE FROM ".TB_PREFIX."bdata where wid = $wref";
  229. mysql_query($q, $this->connection);
  230. $q = "DELETE FROM ".TB_PREFIX."market where vref = $wref";
  231. mysql_query($q, $this->connection);
  232. $q = "DELETE FROM ".TB_PREFIX."odata where wref = $wref";
  233. mysql_query($q, $this->connection);
  234. $q = "DELETE FROM ".TB_PREFIX."research where vref = $wref";
  235. mysql_query($q, $this->connection);
  236. $q = "DELETE FROM ".TB_PREFIX."tdata where vref = $wref";
  237. mysql_query($q, $this->connection);
  238. $q = "DELETE FROM ".TB_PREFIX."fdata where vref = $wref";
  239. mysql_query($q, $this->connection);
  240. $q = "DELETE FROM ".TB_PREFIX."training where vref = $wref";
  241. mysql_query($q, $this->connection);
  242. $q = "DELETE FROM ".TB_PREFIX."units where vref = $wref";
  243. mysql_query($q, $this->connection);
  244. $q = "DELETE FROM ".TB_PREFIX."farmlist where wref = $wref";
  245. mysql_query($q, $this->connection);
  246. $q = "DELETE FROM ".TB_PREFIX."raidlist where towref = $wref";
  247. mysql_query($q, $this->connection);
  248. $q = "DELETE FROM ".TB_PREFIX."movement where `from` = $wref and proc=0";
  249. mysql_query($q, $this->connection);
  250. $getmovement = $database->getMovement(3,$wref,1);
  251. foreach($getmovement as $movedata) {
  252. $time = microtime(true);
  253. $time2 = $time - $movedata['starttime'];
  254. $database->setMovementProc($movedata['moveid']);
  255. $database->addMovement(4,$movedata['to'],$movedata['from'],$movedata['ref'],$time,$time+$time2);
  256. }
  257. //check return enforcement from del village
  258. $this->returnTroops($wref);
  259. $q = "DELETE FROM ".TB_PREFIX."vdata WHERE `wref` = $wref";
  260. mysql_query($q, $this->connection);
  261. if (mysql_affected_rows()>0) {
  262. $q = "UPDATE ".TB_PREFIX."wdata set occupied = 0 where id = $wref";
  263. mysql_query($q, $this->connection);
  264. $getprisoners = $database->getPrisoners($wref);
  265. foreach($getprisoners as $pris) {
  266. $troops = 0;
  267. for($i=1;$i<12;$i++){
  268. $troops += $pris['t'.$i];
  269. }
  270. $database->modifyUnit($pris['wref'],array("99o"),array($troops),array(0));
  271. $database->deletePrisoners($pris['id']);
  272. }
  273. $getprisoners = $database->getPrisoners3($wref);
  274. foreach($getprisoners as $pris) {
  275. $troops = 0;
  276. for($i=1;$i<12;$i++){
  277. $troops += $pris['t'.$i];
  278. }
  279. $database->modifyUnit($pris['wref'],array("99o"),array($troops),array(0));
  280. $database->deletePrisoners($pris['id']);
  281. }
  282. }
  283. }
  284. }
  285. public function returnTroops($wref) {
  286. global $database;
  287. $getenforce=$database->getEnforceVillage($wref,0);
  288. foreach($getenforce as $enforce) {
  289. $to = $database->getVillage($enforce['from']);
  290. $Gtribe = "";
  291. if ($database->getUserField($to['owner'],'tribe',0) == '2'){ $Gtribe = "1"; }
  292. else if ($database->getUserField($to['owner'],'tribe',0) == '3'){ $Gtribe = "2"; }
  293. else if ($database->getUserField($to['owner'],'tribe',0) == '4'){ $Gtribe = "3"; }
  294. else if ($database->getUserField($to['owner'],'tribe',0) == '5'){ $Gtribe = "4"; }
  295. $start = ($database->getUserField($to['owner'],'tribe',0)-1)*10+1;
  296. $end = ($database->getUserField($to['owner'],'tribe',0)*10);
  297. $from = $database->getVillage($enforce['from']);
  298. $fromcoor = $database->getCoor($enforce['from']);
  299. $tocoor = $database->getCoor($enforce['vref']);
  300. $fromCor = array('x'=>$tocoor['x'], 'y'=>$tocoor['y']);
  301. $toCor = array('x'=>$fromcoor['x'], 'y'=>$fromcoor['y']);
  302. $speeds = array();
  303. //find slowest unit.
  304. for($i=$start;$i<=$end;$i++){
  305. if(intval($enforce['u'.$i]) > 0){
  306. if($unitarray) { reset($unitarray); }
  307. $unitarray = $GLOBALS["u".$i];
  308. $speeds[] = $unitarray['speed'];
  309. //echo print_r(array_keys($speeds))."unitspd\n".$i."trib\n";
  310. } else {
  311. $enforce['u'.$i]='0';
  312. }
  313. }
  314. if( intval($enforce['hero']) > 0){
  315. $q = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".$from['owner']."";
  316. $result = mysql_query($q);
  317. $hero_f=mysql_fetch_array($result);
  318. $hero_unit=$hero_f['unit'];
  319. $speeds[] = $GLOBALS['u'.$hero_unit]['speed'];
  320. } else {
  321. $enforce['hero']='0';
  322. }
  323. $artefact = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,3,0));
  324. $artefact1 = count($database->getOwnUniqueArtefactInfo2($enforce['from'],2,1,1));
  325. $artefact2 = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,2,0));
  326. if($artefact > 0){
  327. $fastertroops = 3;
  328. }else if($artefact1 > 0){
  329. $fastertroops = 2;
  330. }else if($artefact2 > 0){
  331. $fastertroops = 1.5;
  332. }else{
  333. $fastertroops = 1;
  334. }
  335. $time = round($this->procDistanceTime($fromCor,$toCor,min($speeds),$enforce['from'])/$fastertroops);
  336. $foolartefact2 = $database->getFoolArtefactInfo(2,$enforce['from'],$from['owner']);
  337. if(count($foolartefact2) > 0){
  338. foreach($foolartefact2 as $arte){
  339. if($arte['bad_effect'] == 1){
  340. $time *= $arte['effect2'];
  341. }else{
  342. $time /= $arte['effect2'];
  343. $time = round($time);
  344. }
  345. }
  346. }
  347. $reference = $database->addAttack($enforce['from'],$enforce['u'.$start],$enforce['u'.($start+1)],$enforce['u'.($start+2)],$enforce['u'.($start+3)],$enforce['u'.($start+4)],$enforce['u'.($start+5)],$enforce['u'.($start+6)],$enforce['u'.($start+7)],$enforce['u'.($start+8)],$enforce['u'.($start+9)],$enforce['hero'],2,0,0,0,0);
  348. $database->addMovement(4,$wref,$enforce['from'],$reference,time(),($time+time()));
  349. $database->deleteReinf($enforce['id']);
  350. }
  351. }
  352. public function getTypeLevel($tid,$vid) {
  353. global $village,$database;
  354. $keyholder = array();
  355. if($vid == 0) {
  356. $resourcearray = $village->resarray;
  357. } else {
  358. $resourcearray = $database->getResourceLevel($vid);
  359. }
  360. foreach(array_keys($resourcearray,$tid) as $key) {
  361. if(strpos($key,'t')) {
  362. $key = preg_replace("/[^0-9]/", '', $key);
  363. array_push($keyholder, $key);
  364. }
  365. }
  366. $element = count($keyholder);
  367. if($element >= 2) {
  368. if($tid <= 4) {
  369. $temparray = array();
  370. for($i=0;$i<=$element-1;$i++) {
  371. array_push($temparray,$resourcearray['f'.$keyholder[$i]]);
  372. }
  373. foreach ($temparray as $key => $val) {
  374. if ($val == max($temparray))
  375. $target = $key;
  376. }
  377. }
  378. else {
  379. $target = 0;
  380. for($i=1;$i<=$element-1;$i++) {
  381. if($resourcearray['f'.$keyholder[$i]] > $resourcearray['f'.$keyholder[$target]]) {
  382. $target = $i;
  383. }
  384. }
  385. }
  386. }
  387. else if($element == 1) {
  388. $target = 0;
  389. }
  390. else {
  391. return 0;
  392. }
  393. if($keyholder[$target] != "") {
  394. return $resourcearray['f'.$keyholder[$target]];
  395. }
  396. else {
  397. return 0;
  398. }
  399. }
  400. public function procDistanceTime($coor,$thiscoor,$ref,$vid) {
  401. global $bid28,$bid14;
  402. $xdistance = ABS($thiscoor['x'] - $coor['x']);
  403. if($xdistance > WORLD_MAX) {
  404. $xdistance = (2 * WORLD_MAX + 1) - $xdistance;
  405. }
  406. $ydistance = ABS($thiscoor['y'] - $coor['y']);
  407. if($ydistance > WORLD_MAX) {
  408. $ydistance = (2 * WORLD_MAX + 1) - $ydistance;
  409. }
  410. $distance = SQRT(POW($xdistance,2)+POW($ydistance,2));
  411. $speed = $ref;
  412. if($this->getTypeLevel(14,$vid) != 0 && $distance >= TS_THRESHOLD) {
  413. $speed = $speed * ($bid14[$this->getTypeLevel(14,$vid)]['attri']/100) ;
  414. }
  415. if($speed!=0){
  416. return round(($distance/$speed) * 3600 / INCREASE_SPEED);
  417. }else{
  418. return round($distance * 3600 / INCREASE_SPEED);
  419. }
  420. }
  421. function DelBan($uid,$id){
  422. global $database;
  423. $name = addslashes($database->getUserField($uid,"username",0));
  424. mysql_query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Unbanned user <a href=\'admin.php?p=player&uid=$uid\'>$name</a>',".time().")");
  425. $q = "UPDATE ".TB_PREFIX."users SET `access` = '".USER."' WHERE `id` = $uid;";
  426. mysql_query($q, $this->connection);
  427. $q = "UPDATE ".TB_PREFIX."banlist SET `active` = '0' WHERE `id` = $id;";
  428. mysql_query($q, $this->connection);
  429. }
  430. function AddBan($uid,$end,$reason){
  431. global $database;
  432. $name = addslashes($database->getUserField($uid,"username",0));
  433. mysql_query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Banned user <a href=\'admin.php?p=player&uid=$uid\'>$name</a>',".time().")");
  434. $q = "UPDATE ".TB_PREFIX."users SET `access` = '0' WHERE `id` = $uid;";
  435. mysql_query($q, $this->connection);
  436. $time = time();
  437. $admin = $_SESSION['id']; //$database->getUserField($_SESSION['username'],'id',1);
  438. $name = addslashes($database->getUserField($uid,'username',0));
  439. $q = "INSERT INTO ".TB_PREFIX."banlist (`uid`, `name`, `reason`, `time`, `end`, `admin`, `active`) VALUES ($uid, '$name' , '$reason', '$time', '$end', '$admin', '1');";
  440. mysql_query($q, $this->connection);
  441. }
  442. function search_player($player){
  443. $q = "SELECT id,username FROM ".TB_PREFIX."users WHERE `username` LIKE '%$player%' and username != 'support'";
  444. $result = mysql_query($q, $this->connection);
  445. return $this->mysql_fetch_all($result);
  446. }
  447. function search_email($email){
  448. $q = "SELECT id,email FROM ".TB_PREFIX."users WHERE `email` LIKE '%$email%' and username != 'support'";
  449. $result = mysql_query($q, $this->connection);
  450. return $this->mysql_fetch_all($result);
  451. }
  452. function search_village($village){
  453. $q = "SELECT * FROM ".TB_PREFIX."vdata WHERE `name` LIKE '%$village%' or `wref` LIKE '%$village%'";
  454. $result = mysql_query($q, $this->connection);
  455. return $this->mysql_fetch_all($result);
  456. }
  457. function search_alliance($alliance){
  458. $q = "SELECT * FROM ".TB_PREFIX."alidata WHERE `name` LIKE '%$alliance%' or `tag` LIKE '%$alliance%' or `id` LIKE '%$alliance%'";
  459. $result = mysql_query($q, $this->connection);
  460. return $this->mysql_fetch_all($result);
  461. }
  462. function search_ip($ip){
  463. $q = "SELECT * FROM ".TB_PREFIX."login_log WHERE `ip` LIKE '%$ip%'";
  464. $result = mysql_query($q, $this->connection);
  465. return $this->mysql_fetch_all($result);
  466. }
  467. function search_banned(){
  468. $q = "SELECT * FROM ".TB_PREFIX."banlist where active = '1'";
  469. $result = mysql_query($q, $this->connection);
  470. return $this->mysql_fetch_all($result);
  471. }
  472. function Del_banned(){
  473. //$q = "SELECT * FROM ".TB_PREFIX."banlist";
  474. $result = mysql_query($q, $this->connection);
  475. return $this->mysql_fetch_all($result);
  476. }
  477. /***************************
  478. Function to process MYSQLi->fetch_all (Only exist in MYSQL)
  479. References: Result
  480. ***************************/
  481. function mysql_fetch_all($result) {
  482. $all = array();
  483. if($result) {
  484. while ($row = mysql_fetch_assoc($result)){ $all[] = $row; }
  485. return $all;
  486. }
  487. }
  488. function query_return($q) {
  489. $result = mysql_query($q, $this->connection);
  490. return $this->mysql_fetch_all($result);
  491. }
  492. /***************************
  493. Function to do free query
  494. References: Query
  495. ***************************/
  496. function query($query) {
  497. return mysql_query($query, $this->connection);
  498. }
  499. };
  500. $admin = new adm_DB;
  501. include("function.php");
  502. ?>