PageRenderTime 55ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/include/functions.php

https://gitlab.com/spd90/cbw
PHP | 789 lines | 754 code | 27 blank | 8 comment | 16 complexity | ac48bd8b84b264d74f88c08180772a80 MD5 | raw file
  1. <?php
  2. $dBASEURL = "http://fcabal.net/";
  3. $server = 'localhost';
  4. $uid = 'sa';
  5. $pwd = '123456';
  6. //SQL Info
  7. define('DB_ADDR',$server);
  8. define('DB_USER',$uid);
  9. define('DB_PASS',$pwd);
  10. //DB's
  11. define('DB_ACC','Account');
  12. define('DB_GS','Server01');
  13. define('DB_CS','CashShop');
  14. define('DB_CC','CabalCash');
  15. define('DB_NC','NetCafeBilling');
  16. function stdhead(){
  17. GLOBAL $dBASEURL;
  18. echo'
  19. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  20. <html xmlns="http://www.w3.org/1999/xhtml">
  21. <head>
  22. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  23. <link rel="stylesheet" type="text/css" href="' . $dBASEURL . 'style.css"/>
  24. <link rel="stylesheet" type="text/css" href="' . $dBASEURL . 'font-awesome.css"/>
  25. <script type="text/javascript" src="'.$dBASEURL.'js/jquery-1.9.1.min.js">
  26. </script>
  27. <script type="text/javascript" src="'.$dBASEURL.'js/jquery.bxslider.min.js">
  28. </script>
  29. <script type="text/javascript" src="'.$dBASEURL.'js/script.js">
  30. </script>
  31. <link rel="stylesheet" type="text/css" href="'.$dBASEURL.'/jquery.bxslider.css" />
  32. <script type="text/javascript">
  33. $(document).ready(function(e) {
  34. $(".bxslider").bxSlider({
  35. auto: true,
  36. pager: false
  37. });
  38. });
  39. </script>
  40. <title>
  41. Funny - Cabal
  42. </title>
  43. <!-- Google Analytics -->
  44. <script>
  45. (function(i,s,o,g,r,a,m){i[\'GoogleAnalyticsObject\']=r;i[r]=i[r]||function(){
  46. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  47. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  48. })(window,document,\'script\',\'//www.google-analytics.com/analytics.js\',\'ga\');
  49. ga(\'create\', \'UA-41777318-1\', \'fcabal.net\');
  50. ga(\'send\', \'pageview\');
  51. </script>
  52. <!-- End Google Analytics -->
  53. </head>
  54. <body>
  55. <div id="wrap">
  56. <div id="header">
  57. ';
  58. if($_COOKIE['logined'] != 1){
  59. echo'
  60. <!--/social-->
  61. <div id="formss">
  62. <form class="form-1" action="takelogin.php" method="post">
  63. <p class="field">
  64. <input type="text" name="login" placeholder="Username">
  65. <i class="icon-user icon-large">
  66. </i>
  67. </p>
  68. <p class="field">
  69. <input type="password" name="password" placeholder="Password">
  70. <i class="icon-lock icon-large">
  71. </i>
  72. </p>
  73. <p class="submit">
  74. <button type="submit" name="submit">
  75. <i class="icon-arrow-right icon-large">
  76. </i>
  77. </button>
  78. </p>
  79. </form>
  80. ';}
  81. else{
  82. echo'
  83. <div id="formss">
  84. <div id="loginedform">
  85. <div id="loginedbox">
  86. Welcome <b class="username">' . $_COOKIE['ID'] . '</b> - <a href="logout.php">Log Out! </a></br>
  87. <img src=images/pc.png alt="Coins" /> ' . getUserCoins($_COOKIE['usernum']) . ' | <img src="images/tpont.png" alt="T-Point"/> ' . getUserTPoint($_COOKIE['usernum']) . ' | <img src=images/PlayTime.png alt="PlayTime" /> '.getUserPlayTime($_COOKIE['usernum']).' </br>
  88. Total eCoin: ' . getUserECoin($_COOKIE['usernum']) . ' <br />
  89. Rankings: <a href="#page_honour-rank">Honour</a> | <a href="#page_playtime-rank">Playtime</a> | <a href="#page_guild-rank">Guild</a>
  90. </div>
  91. </div>
  92. ';
  93. }
  94. echo'
  95. </div>
  96. <!--/formss-->';
  97. if($_COOKIE['logined'] != 1){
  98. echo '<div id="nav">
  99. <ul>
  100. <li>
  101. <a href="#page_home">Home</a>
  102. </li>
  103. <li>
  104. <a href="#page_register" >Register</a>
  105. </li>
  106. <li>
  107. <a href="#page_downloads" >Downloads</a>
  108. </li>
  109. <li>
  110. <a href="#page_informations">Informations</a>
  111. </li>
  112. <li>
  113. <a href="#page_vote">Vote</a>
  114. </li>
  115. <li><img id="loading" src="'.$dBASEURL.'/images/ajax-loader.gif" width="56px" height="21" alt="loading" /></li>
  116. </ul>
  117. <div id="online">
  118. '.OnlinePlayerNum().'
  119. </div>
  120. <div id="search">
  121. <form action="takesearch.php" >
  122. <input type="text" id="s" class="s" name="s"/>
  123. <input type="submit" id="submit" value="sub"/>
  124. </form>
  125. </div>
  126. <!--/search-->
  127. </div>
  128. <!--/nav-->
  129. ';
  130. } else {
  131. echo '<div id="nav">
  132. <ul>
  133. <li>
  134. <a href="#page_home">Home</a>
  135. </li>
  136. <li>
  137. <a href="#page_teamspeak" >TS3srv</a>
  138. </li>
  139. <li>
  140. <a href="#page_downloads" >Downloads</a>
  141. </li>
  142. <li>
  143. <a href="#page_informations">Informations</a>
  144. </li>
  145. <li>
  146. <a href="#page_vote">Vote</a>
  147. </li>
  148. <li><img id="loading" src="'.$dBASEURL.'/images/ajax-loader.gif" width="56px" height="21" alt="loading" /></li>
  149. </ul>
  150. <div id="online">
  151. '.OnlinePlayerNum().'
  152. </div>
  153. <div id="search">
  154. <form action="takesearch.php" >
  155. <input type="text" id="s" class="s" name="s"/>
  156. <input type="submit" id="submit" value="sub"/>
  157. </form>
  158. </div>
  159. <!--/search-->
  160. </div>
  161. <!--/nav-->
  162. ';
  163. }
  164. echo '
  165. </div>
  166. <!--/header-->
  167. </div>
  168. <div id="wrap2">
  169. <div id="content">
  170. <div id="sidebar">
  171. ';
  172. if($_COOKIE['logined'] == "1"){
  173. echo'
  174. <div class="widgets">
  175. <div class="title">
  176. Account
  177. </div>
  178. <div class="content">
  179. <ul id="account-menu">
  180. <li>
  181. <a href="donate.php">Donate</a>
  182. </li>
  183. <li>
  184. <a href="paymentwall.php">Donate with Paymentwall</a>
  185. </li>
  186. <li>
  187. <a href="exchangetpoint.php">Exchange T-Points for Coins</a>
  188. </li>
  189. <li>
  190. <a href="exchangeecoin.php">Exchange eCoins for Coins</a>
  191. </li>
  192. </ul>
  193. </div>
  194. <!--/content-->
  195. </div>
  196. <div class="widgets">
  197. <div class="title">
  198. Donate
  199. </div>
  200. <div class="content" style="text-align: center;" >
  201. <a href="donate.php"><img src="'.$dBASEURL.'images/Donate2.png" width="283px" alt="Donate" /></a>
  202. </div>
  203. <!--/content-->
  204. </div>
  205. ';
  206. }
  207. echo'
  208. <!--/widget-->
  209. <div class="widgets">
  210. <div class="title">
  211. Links
  212. </div>
  213. <div class="content">
  214. <ul>
  215. <li>
  216. <a href="http://fcabal.net/cstyle">custom style</a>
  217. </li>
  218. <li>
  219. <a href="http://4r.fcabal.net/4r">forum</a>
  220. </li>
  221. <li>
  222. <a href="http://facebook.com/funnycabal">Fcabal Facebook</a>
  223. </li>
  224. </ul>
  225. </div>
  226. <!--/content-->
  227. </div>
  228. <div class="widgets">
  229. <div class="content">
  230. <iframe src="//www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2funnycabal&amp;width=290&amp;height=258&amp;show_faces=true&amp;colorscheme=light&amp;stream=false&amp;show_border=false&amp;header=false" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:290px; height:258px;" allowTransparency="true"></iframe>
  231. </div>
  232. <!--/content-->
  233. </div>
  234. <!--/widget-->
  235. </div>
  236. <!--/sidebar-->
  237. <div id="main-content" class="left">
  238. ';
  239. }
  240. function sechead($name){
  241. echo'
  242. <div id="section1" class="sections">
  243. <div class="main_title">
  244. '.$name.'
  245. </div>
  246. <div class="content">
  247. ';
  248. }
  249. function sechead_2($name){
  250. echo'
  251. <div id="section1" class="sections">
  252. <div class="main_title">
  253. '.$name.'
  254. </div>
  255. <div class="content_2">
  256. ';
  257. }
  258. function secfoot(){
  259. echo'
  260. </div>
  261. </div>
  262. <!--/section1-->
  263. ';
  264. }
  265. function stdfoot(){
  266. echo'
  267. </div>
  268. <!--/left-->
  269. </div>
  270. <!--/content-->
  271. <div id="footer">
  272. <div id="copy">
  273. All rights reserved &copy;FG 2013 Developed
  274. </div>
  275. <div id="pro">
  276. <a href="index.php"><img src="'.$dBASEURL.'imgs/fgamerz.png" /></a>
  277. </div>
  278. </div>
  279. <!--/footer-->
  280. </div>
  281. <div style="height:20px; margin:200px auto auto;"></div>
  282. <!--/wrap-->
  283. </body>
  284. </html>
  285. ';
  286. }
  287. function errBlock($errorid, $backp){
  288. stdhead();
  289. sechead(Error);
  290. echo errorList($errorid) . '</br>';
  291. echo 'You will be redirected back!';
  292. secfoot();
  293. stdfoot();
  294. //$backpage = 'index.php#page_'.$backp;
  295. $backpage = 'index.php#page_'.$backp;
  296. header( "refresh:5;url=$backpage" );
  297. die();
  298. }
  299. function errorList($id){
  300. $return = "";
  301. switch ($id) {
  302. case 1:
  303. $return = "You dont entered username and password!";
  304. break;
  305. case 2:
  306. $return = "You not entered an username!";
  307. break;
  308. case 3:
  309. $return = "You not entered a password!";
  310. break;
  311. case 4:
  312. $return = "Username and/or Password not match!";
  313. break;
  314. case 5:
  315. $return = "You need log in to use this page!";
  316. break;
  317. case 6:
  318. $return = "Your login has failed to paymentwall!";
  319. break;
  320. case 7:
  321. $return = "You dont selected a vote site!";
  322. break;
  323. case 8:
  324. $return = "Your account is disabled! You can't use this function anymore";
  325. break;
  326. case 11:
  327. $return = "You have already voted on xtremetop100 within 12hr!";
  328. break;
  329. case 12:
  330. $return = "You have already voted on gtop100 within 12hr!";
  331. break;
  332. case 20:
  333. $return = "You need log out from the game to use this function!";
  334. break;
  335. case 30:
  336. $return = "You dont have Cash Account activated! Please Vote for activating!";
  337. break;
  338. case 31:
  339. $return = "You dont have any eCoins!";
  340. break;
  341. case 32:
  342. $return = "You dont have any T-Points!";
  343. break;
  344. case 33:
  345. $return = "You have already voted on xtremetop100 within 12hr from this <b><u>IP Address</u></b>!";
  346. break;
  347. case 34:
  348. $return = "You have already voted on gtop100 within 12hr from this <b><u>IP Address</u></b>!";
  349. break;
  350. case 100:
  351. $return = "Unhandled Error";
  352. break;
  353. default:
  354. $return = "Unhandled Error";
  355. break;
  356. }
  357. return $return;
  358. }
  359. function sQuery($q, $db){
  360. $link = mssql_connect(DB_ADDR, DB_USER, DB_PASS);
  361. if (!$link) die('Could not connect to MSSQL database.');
  362. $selectdb = mssql_select_db($db, $link);
  363. if (!$selectdb) die('Could not connect to Database: ' . $db);
  364. $query = mssql_query($q , $link);
  365. $link = mssql_close;
  366. return $query;
  367. }
  368. function secure($var){
  369. $var = htmlspecialchars(stripslashes($var));
  370. $var = str_ireplace("script", "blocked", $var);
  371. $var = mysql_escape_string($var);
  372. return $var;
  373. }
  374. function getUserCoins($user){
  375. $q = 'SELECT Alz FROM dbo.Bank WHERE UserNum = "'.$user.'"';
  376. $result = sQuery($q, DB_CS);
  377. $qAlz = "0";
  378. if (mssql_num_rows($result) == 0) {
  379. $qAlz = "Nothing match";
  380. }
  381. else{
  382. while ($row = mssql_fetch_array($result, MSSQL_ASSOC)) {
  383. $qAlz = $row['Alz'];
  384. }
  385. }
  386. return $qAlz;
  387. }
  388. function getUserTPoint($user){
  389. $q = 'SELECT TPoint FROM dbo.Point WHERE UserNum = "'.$user.'"';
  390. $result = sQuery($q, DB_NC);
  391. $qTPoint = "0";
  392. if (mssql_num_rows($result) == 0) {
  393. $qAlz = "Nothing match";
  394. }
  395. else{
  396. while ($row = mssql_fetch_array($result, MSSQL_ASSOC)) {
  397. $qTPoint = $row['TPoint'];
  398. }
  399. }
  400. return $qTPoint;
  401. }
  402. function getUserECoin($user){
  403. $q = 'SELECT CashTotal FROM dbo.CashAccount WHERE UserNum = "'.$user.'"';
  404. $result = sQuery($q, DB_CC);
  405. $qECoin = "0";
  406. if (mssql_num_rows($result) == 0) {
  407. $qECoin = "Nothing match";
  408. }
  409. else{
  410. while ($row = mssql_fetch_array($result, MSSQL_ASSOC)) {
  411. $qECoin = $row['CashTotal'];
  412. }
  413. }
  414. return $qECoin;
  415. }
  416. function getUserPlayTime($user){
  417. $q = 'SELECT PlayTime FROM Account.dbo.cabal_auth_table WHERE UserNum = "'.$user.'"';
  418. $result = sQuery($q, DB_CC);
  419. $minutes = 0;
  420. if (mssql_num_rows($result) == 0) {
  421. $minutes = 0;
  422. }
  423. else{
  424. while ($row = mssql_fetch_array($result, MSSQL_ASSOC)) {
  425. $minutes = $row['PlayTime'];
  426. }
  427. }
  428. $day = floor ($minutes / 1440);
  429. $hour = floor (($minutes - $day * 1440) / 60);
  430. $min = $minutes - ($day * 1440) - ($hour * 60);
  431. $PlayTime = $day."d - ".$hour."h - ".$min."m";
  432. return $PlayTime;
  433. }
  434. function getCharPlayTime($char){
  435. $q = 'SELECT PlayTime FROM Server01.dbo.cabal_character_table WHERE CharacterIdx = "'.$char.'"';
  436. $result = sQuery($q, DB_CC);
  437. $minutes = 0;
  438. if (mssql_num_rows($result) == 0) {
  439. $minutes = 0;
  440. }
  441. else{
  442. while ($row = mssql_fetch_array($result, MSSQL_ASSOC)) {
  443. $minutes = $row['PlayTime'];
  444. }
  445. }
  446. $day = floor ($minutes / 1440);
  447. $hour = floor (($minutes - $day * 1440) / 60);
  448. $min = $minutes - ($day * 1440) - ($hour * 60);
  449. $PlayTime = $day."d - ".$hour."h - ".$min."m";
  450. return $PlayTime;
  451. }
  452. function OnlinePlayerNum(){
  453. $fajl = "cache/online_".date('Y-m-d', strtotime(date('Y-m-d H:i:s'))+ 21600);
  454. $letezik = True;
  455. $fileread = (file_exists($fajl))? fopen($fajl, "r") : $letezik = False;
  456. $sor = 0;
  457. $current = "";
  458. $datum = "";
  459. $szam = 0;
  460. //Output a line of the file until the end is reached
  461. if($letezik == True){
  462. while(!feof($fileread))
  463. {
  464. $sor++;
  465. $szöveg = fgets($fileread);
  466. $current .= $szöveg;
  467. if($sor == 1) $datum = $szöveg;
  468. if($sor == 2) $szam = $szöveg;
  469. }
  470. fclose($fileread);
  471. }
  472. $currentdate = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s'))+ 21600);
  473. if(abs(strtotime($currentdate) - strtotime($datum)) >= 300){
  474. $link = mssql_connect(DB_ADDR, DB_USER, DB_PASS);
  475. if (!$link) die('Could not connect to MSSQL database.');
  476. mssql_select_db("Server01");
  477. $r=mssql_query("SELECT * FROM dbo.cabal_character_table WHERE Login='1' ");
  478. $row_count = mssql_num_rows( $r );
  479. mssql_free_result($r);
  480. $filewrite = fopen($fajl, "w") or exit("0");
  481. // Open the file to get existing content
  482. // Append a new person to the file
  483. $kiir = $currentdate."\n".$row_count."\n--------------------\n".$current;
  484. // Write the contents back to the file
  485. fwrite($filewrite, $kiir);
  486. $szam = $row_count;
  487. }
  488. return($szam);
  489. }
  490. function GetRegCount($ip){
  491. $link = mssql_connect(DB_ADDR, DB_USER, DB_PASS);
  492. if (!$link) die('Could not connect to MSSQL database.');
  493. mssql_select_db("Account");
  494. $r=mssql_query("SELECT * FROM dbo.cabal_auth_table WHERE IP='$ip' ");
  495. $row_count = mssql_num_rows( $r );
  496. mssql_free_result($r);
  497. return $row_count;
  498. }
  499. function GetVoteIP($voteid, $ip){
  500. $currentdate = date('Y-m-d H:i:s');
  501. $link2 = mssql_connect(DB_ADDR, DB_USER, DB_PASS);
  502. $selectdb2 = mssql_select_db('CashShop', $link2);
  503. if (!$selectdb2) die('Could not connect to Database.');
  504. //Get Votes
  505. if($voteid == 1){
  506. $query2 = mssql_query("SELECT votelink1, votedate1, votelink2, votedate2, voteip FROM dbo.Votes WHERE voteip='$ip' ORDER BY [votedate1] Desc ", $link2);
  507. }
  508. if($voteid == 2){
  509. $query2 = mssql_query("SELECT votelink1, votedate1, votelink2, votedate2, voteip FROM dbo.Votes WHERE voteip='$ip' ORDER BY [votedate2] Desc ", $link2);
  510. }
  511. if (!mssql_num_rows($query2)) {
  512. //Write New Line in Votes Table
  513. return "False";
  514. }
  515. else{
  516. //Get Votes Data
  517. $qVotelink1 = "";
  518. $qVotelink2 = "";
  519. $qVotedate1 = "";
  520. $qVotedate2 = "";
  521. while ($row = mssql_fetch_array($query2, MSSQL_ASSOC)) {
  522. $qVotedate1 = $row['votedate1'];
  523. $qVotedate2 = $row['votedate2'];
  524. }
  525. if($voteid == 1){
  526. if(abs(strtotime($currentdate) - strtotime($qVotedate1)) <= 43200){
  527. return "True";
  528. }}
  529. if($voteid == 2){
  530. if(abs(strtotime($currentdate) - strtotime($qVotedate2)) <= 43200){
  531. return "True";
  532. }
  533. }
  534. return "False";
  535. }
  536. }
  537. //RANKING
  538. function ranking_player_honor(){
  539. $currentdate = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s'))+ 21600);
  540. $link = mssql_connect(DB_ADDR, DB_USER, DB_PASS);
  541. $selectdb = mssql_select_db('Server01', $link);
  542. $kethet = date('Y-m-d H:i:s', strtotime($currentdate) - 1209600);
  543. echo "<center>Listing from ".$kethet." to ".$currentdate."</center>";
  544. if (!$selectdb) die('Could not connect to Database.');
  545. $query=mssql_query("SELECT TOP (100) Name, LEV, Reputation, Login, Nation
  546. FROM dbo.cabal_character_table
  547. WHERE (NOT (Nation = '3')) AND (NOT (Name='[T3stR]RaZ00r')) AND ((LogoutTime >= '$kethet') OR (LoginTime >= '$kethet'))
  548. ORDER BY Reputation DESC, LEV DESC", $link);
  549. // echo "<style> body{ background-color: #000000; background-image: url('images/topback9.png'); color:white; } </style>";
  550. echo '<table color="white" align="center" style="margin: auto">';
  551. echo '<tr><th width=20>#</th><th width=200>Character</th><th width=30>Lev</th><th width=100>Honour</th><th width=50>Nation</th><th width=50>Online</th></tr>';
  552. $i = '1';
  553. while ($row = mssql_fetch_array($query, MSSQL_ASSOC)) {
  554. echo '<tr align=center>';
  555. echo '<td>' . $i . '</td>';
  556. echo '<td>' . $row['Name'] . '</td>';
  557. echo '<td>' . $row['LEV'] . '</td>';
  558. echo '<td>' . $row['Reputation'] . '</td>';
  559. echo '<td>' . NationPic($row['Nation']) . '</td>';
  560. echo '<td>' . StatusPic($row['Login']) . '</td>';
  561. echo '</tr>';
  562. $i++;
  563. }
  564. echo '</table>';
  565. echo '<table>';
  566. echo '<tr><td><img src=imgs/neut.jpg /></td><td>Neutral</td></tr>';
  567. echo '<tr><td><img src=imgs/cap.jpg /></td><td>Capella</td></tr>';
  568. echo '<tr><td><img src=imgs/proc.jpg /></td><td>Procyon</td></tr>';
  569. echo '</table>';
  570. mssql_free_result($query);
  571. }
  572. function ranking_player_online(){
  573. $currentdate = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s'))+ 21600);
  574. $kethet = date('Y-m-d H:i:s', strtotime($currentdate) - 1209600);
  575. echo "<center>Listing from ".$kethet." to ".$currentdate."</center>";
  576. $link = mssql_connect(DB_ADDR, DB_USER, DB_PASS);
  577. $selectdb = mssql_select_db('Server01', $link);
  578. if (!$selectdb) die('Could not connect to Database.');
  579. $query=mssql_query("SELECT TOP (100) *
  580. FROM dbo.cabal_character_table
  581. WHERE (NOT (Nation = '3')) AND (NOT (Name='[T3stR]RaZ00r')) AND ((LogoutTime >= '$kethet') OR (LoginTime >= '$kethet'))
  582. ORDER BY PlayTime DESC, LEV DESC", $link);
  583. // echo "<style> body{ background-color: #000000; background-image: url('images/topback9.png'); color:white; } </style>";
  584. echo '<table color="white" align="center" style="margin: auto">';
  585. echo '<tr><th width=20>#</th><th width=200>Character</th><th width=30>Lev</th><th width=160>PlayTime</th><th width=50>Nation</th><th width=50>Online</th></tr>';
  586. $i = '1';
  587. while ($row = mssql_fetch_array($query, MSSQL_ASSOC)) {
  588. echo '<tr align=center>';
  589. echo '<td>' . $i . '</td>';
  590. echo '<td>' . $row['Name'] . '</td>';
  591. echo '<td>' . $row['LEV'] . '</td>';
  592. echo '<td>' . TimeToStr($row['PlayTime']) . '</td>';
  593. echo '<td>' . NationPic($row['Nation']) . '</td>';
  594. echo '<td>' . StatusPic($row['Login']) . '</td>';
  595. echo '</tr>';
  596. $i++;
  597. }
  598. echo '</table>';
  599. echo '<table>';
  600. echo '<tr><td><img src=imgs/neut.jpg /></td><td>Neutral</td></tr>';
  601. echo '<tr><td><img src=imgs/cap.jpg /></td><td>Capella</td></tr>';
  602. echo '<tr><td><img src=imgs/proc.jpg /></td><td>Procyon</td></tr>';
  603. echo '</table>';
  604. mssql_free_result($query);
  605. }
  606. function ranking_guild_score(){
  607. $currentdate = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s'))+ 21600);
  608. $kethet = date('Y-m-d H:i:s', strtotime($currentdate) - 1209600);
  609. //echo "<center>Listing from ".$kethet." to ".$currentdate."</center>";
  610. $link = mssql_connect(DB_ADDR, DB_USER, DB_PASS);
  611. $selectdb = mssql_select_db('Server01', $link);
  612. if (!$selectdb) die('Could not connect to Database.');
  613. $query=mssql_query("SELECT TOP (100) *
  614. FROM dbo.Guild
  615. WHERE Not GuildName = 'FALLEN'
  616. ORDER BY Point DESC, Level DESC", $link);
  617. // echo "<style> body{ background-color: #000000; background-image: url('images/topback9.png'); color:white; } </style>";
  618. echo '<table color="white" align="center" style="margin: auto">';
  619. echo '<tr><th width=20>#</th><th width=200>GuildName</th><th width=30>Level</th><th width=100>Point</th></tr>';
  620. $i = '1';
  621. while ($row = mssql_fetch_array($query, MSSQL_ASSOC)) {
  622. echo '<tr align=center>';
  623. echo '<td>' . $i . '</td>';
  624. echo '<td>' . $row['GuildName'] . '</td>';
  625. echo '<td>' . $row['Level'] . '</td>';
  626. echo '<td>' . $row['Point'] . '</td>';
  627. echo '</tr>';
  628. $i++;
  629. }
  630. echo '</table>';
  631. mssql_free_result($query);
  632. }
  633. function NationPic($nation){
  634. switch($nation){
  635. case 0:
  636. $return = '<img src=imgs/neut.jpg />';
  637. break;
  638. case 1:
  639. $return = '<img src=imgs/cap.jpg />';
  640. break;
  641. case 2:
  642. $return = '<img src=imgs/proc.jpg />';
  643. break;
  644. }
  645. return $return;
  646. }
  647. function StatusPic($status){
  648. switch($status){
  649. case 0:
  650. $return = '<img src=imgs/offline.png />';
  651. break;
  652. case 1:
  653. $return = '<img src=imgs/online.png />';
  654. break;
  655. }
  656. return $return;
  657. }
  658. function TimeToStr($time){
  659. $minutes = $time;
  660. $day = floor ($minutes / 1440);
  661. $hour = floor (($minutes - $day * 1440) / 60);
  662. $min = $minutes - ($day * 1440) - ($hour * 60);
  663. $PlayTime = $day."d - ".$hour."h - ".$min."m";
  664. return $PlayTime;
  665. }
  666. //RaNKING VÉGE
  667. class Security {
  668. function secure($string) {
  669. $pattern1 = "#[^a-z0-9]#";
  670. if(preg_match($pattern1,$string)==true)
  671. return false;
  672. else
  673. return $string;
  674. }
  675. function secUser($username) {
  676. $pattern2 = "#[^a-z0-9]#";
  677. if(preg_match($pattern2,$username)==true)
  678. return false;
  679. else
  680. return $username;
  681. }
  682. function secPass($password) {
  683. $pattern3 = "#[^a-zA-Z0-9]#";
  684. if(preg_match($pattern3,$password)==true)
  685. return false;
  686. else
  687. return $password;
  688. }
  689. //Email validator apache 5.2+
  690. function checkEmail( $email ){
  691. return filter_var( $email, FILTER_VALIDATE_EMAIL );
  692. }
  693. }
  694. ?>