Просмотр файла gta/cfg.php

Размер файла: 5.88Kb
  1. <?
  2. ###########################
  3. # Модификация swa #
  4. ###########################
  5. require 'functions.php';
  6. if (isset($_GET['usr']))
  7. {
  8. $_GET['usr'] = basename($_GET['usr']);
  9. }
  10. if (isset($_GET['pwd']))
  11. {
  12. $_GET['pwd'] = namepass($_GET['pwd']);
  13. }
  14. if (isset($_GET['v']))
  15. {
  16. $_GET['v'] = htmlspecialchars(stripslashes(trim($_GET['v'])));
  17. }
  18. function vremya($time)
  19. {
  20. $tim = date("d.m.y", $time);
  21.  
  22. return $tim;
  23. }
  24. function news_time($time)
  25. {
  26. $tim = date("d.m.y H:i", $time);
  27. return $tim;
  28. }
  29. function chat($time)
  30. {
  31. $tim = date("d.m H:i",$time);
  32. return $tim;
  33. }
  34.  
  35. function vremja($time=NULL,$times=NULL)
  36. {
  37. global $set;
  38. $timesdvig=$set['timesdvig'];
  39. if ($time==NULL)$time=time();
  40. if ($times==NULL)$time=$time+$timesdvig;
  41. else $time=$time+intval($times);
  42. $timep="".date("j M Y в H:i", $time)."";
  43. $time_p[0]=date("j n Y", $time);
  44. $time_p[1]=date("H:i", $time);
  45. if ($time_p[0]==date("j n Y", time()+$timesdvig))$timep="сегодня в $time_p[1]";
  46. if ($time_p[0]==date("j n Y", time()+$timesdvig-86400))$timep="вчера в $time_p[1]";
  47. $timep=str_replace("Jan","01",$timep);
  48. $timep=str_replace("Feb","02",$timep);
  49. $timep=str_replace("Mar","03",$timep);
  50. $timep=str_replace("May","04",$timep);
  51. $timep=str_replace("Apr","05",$timep);
  52. $timep=str_replace("Jun","06",$timep);
  53. $timep=str_replace("Jul","07",$timep);
  54. $timep=str_replace("Aug","08",$timep);
  55. $timep=str_replace("Sep","09",$timep);
  56. $timep=str_replace("Oct","10",$timep);
  57. $timep=str_replace("Nov","11",$timep);
  58. $timep=str_replace("Dec","12",$timep);
  59. return $timep;
  60. }
  61. function otdih($time)
  62. {
  63. $timeo = date("i|s", $time);
  64. $tim = explode("|", $timeo);
  65. $t = "$tim[0] минут $tim[1] секунд";
  66. return $t;
  67. }
  68. function pochta()
  69. {
  70. $q = mysql_query("SELECT COUNT(*) FROM `msg_r` WHERE `user_to` = '".mysql_real_escape_string($_GET['usr'])."' AND `read` = '1';");
  71. $new_mail = mysql_result($q, 0);
  72. if ($new_mail>0)
  73. {
  74. echo "<font color=\"green\"><big><b><a href=\"msg.php?usr=$_GET[usr]&amp;pwd=$_GET[pwd]&amp;id=read\">У вас сообщение!</a>[$new_mail]</b></big></font><br/>";
  75. }
  76. }
  77.  
  78. function head($title=NULL)
  79. {
  80. # Глобал set
  81. global $set,$exist;
  82. if ($title==NULL) $title=$set['title'];
  83. if (empty($_GET['usr']))
  84. {
  85. if (isset($_GET['v']) && $_GET['v'] == 'xhtml' || isset($_GET['v']) && $_GET['v'] != 'web')
  86. {
  87. require 'themes/1/head.php';
  88. } elseif (isset($_GET['v']) && $_GET['v'] == 'web')
  89. {
  90. require 'themes/2/head.php';
  91. }
  92. } elseif ($exist == 1)
  93. {
  94. $u = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `usr` = '".mysql_real_escape_string($_GET['usr'])."'"));
  95. $id = strip_tags($u['id']);
  96. $d = mysql_fetch_array(mysql_query("SELECT `design` FROM `settings` WHERE `u_id` = '".mysql_real_escape_string($id)."'"));
  97. $design = strip_tags($d['design']);
  98. ###################################
  99. if ($design == 0 or $design == null)
  100. {
  101. require 'themes/1/head.php';
  102. } elseif ($design != 0 and is_file("themes/".$design."/head.php"))
  103. {
  104. require "themes/".$design."/head.php";
  105. }
  106. } else
  107. {
  108. require 'themes/1/head.php';
  109. }
  110. }
  111. function foot()
  112. {
  113.  
  114. global $usr,$exist;
  115.  
  116. if (empty($usr) or $exist == 0)
  117. {
  118. if (isset($_GET['v']))
  119. {
  120. if ($_GET['v'] == '' OR $_GET[v] == 'xhtml' || isset($_GET['v']))
  121. {
  122. require "themes/1/foot.php";
  123. }
  124. elseif ($_GET['v'] == 'web')
  125. {
  126. require "themes/2/foot.php";
  127. }
  128. } else
  129. {
  130. require "themes/1/foot.php";
  131. }
  132. }elseif (isset($usr) && $diz > 0)
  133. {
  134. $u = mysql_fetch_array(mysql_query("SELECT id FROM users WHERE usr = '".mysql_real_escape_string($_GET['usr'])."'"));
  135. $id = $u['id'];
  136. $diz = mysql_num_rows(mysql_query("SELECT * FROM settings WHERE u_id = '".mysql_real_escape_string($id)."'"));
  137. $t = mysql_fetch_array(mysql_query("SELECT design FROM settings WHERE u_id = '".mysql_real_escape_string($id)."'"));
  138. require "themes/$t[design]/foot.php";
  139. }
  140. }
  141. function foot_main()
  142. {
  143. $diz = mysql_num_rows(mysql_query("SELECT * FROM users WHERE usr = '".mysql_real_escape_string($_GET['usr'])."'"));
  144. if (empty($_GET['usr']))
  145. {
  146. if (isset($_GET['v']))
  147. {
  148. if ($_GET['v'] == '' OR $_GET['v'] == 'xhtml')
  149. {
  150. require "themes/1/foot_main.php";
  151. }
  152. elseif ($_GET['v'] == 'web')
  153. {
  154. require "themes/2/foot_main.php";
  155. }
  156. } else
  157. {
  158. require "themes/1/foot_main.php";
  159. }
  160. }elseif (isset($_GET['usr']) && $diz > 0)
  161. {
  162. $t = mysql_fetch_array(mysql_query("SELECT design FROM settings WHERE user = '".mysql_real_escape_string($_GET['usr'])."'"));
  163. require "themes/$t[design]/foot_main.php";
  164. }
  165. }
  166. function title($msg = NULL,$img = NULL) // Загловок страницы
  167. {
  168. if (!isset($_SESSION['web']) || $_SESSION['web']==0)
  169. {
  170. global $set;
  171. if ($msg=='no' || $msg=='notitle' || $msg=='not')$msg=NULL;
  172. elseif ($msg==NULL || $msg=='default' || $msg=='DEFAULT')$msg=$set['welcome'];
  173.  
  174.  
  175. if ($img!=NULL && $msg!=NULL)$img.="<br />\n";
  176.  
  177. echo "<div class=\"title\"></div>";
  178. }
  179. }
  180. function ban()
  181. {
  182. $u = mysql_fetch_array(mysql_query("SELECT id FROM users WHERE usr = '".mysql_real_escape_string($_GET['usr'])."'"));
  183. $ban = mysql_num_rows(mysql_query("SELECT * FROM ban WHERE user_id = '".mysql_real_escape_string($u['id'])."'"));
  184. $bn = mysql_fetch_array(mysql_query("SELECT * FROM ban WHERE user_id = '".mysql_real_escape_string($u['id'])."'"));
  185. $times = time();
  186. echo "<div class=\"main\"><div class=\"in\">";
  187. if ($ban > 0 && $times<$bn['time'])
  188. {
  189. echo "Вы в бане!<br/>\n";
  190. $who = iconv("windows-1251","utf-8",$bn['who']);
  191. $why = iconv("windows-1251","utf-8",$bn['why']);
  192. echo "Забанил: $who <br/>\n";
  193. echo "Причина: $why <br/>\n";
  194. echo "До: ".vremja($bn[time])." <br/>\n";
  195. $r = rand(10000,999999);
  196. echo "<a href=\"main.php?usr=$_GET[usr]&amp;pwd=$_GET[pwd]&amp;rand=$r\">назад</a><br/>\n";
  197. }
  198. elseif ($times >= $bn['time'])
  199. {
  200. mysql_query("DELETE FROM ban WHERE user_id = '$u[id]'");
  201. echo "Вы успешно вышли из бана<br/>\n<a href=\"main.php?usr=$_GET[usr]&amp;pwd=$_GET[pwd]\">в игру</a>";
  202. }
  203. foot();
  204. exit();
  205. }
  206.  
  207. ?>