Advertisement
Guest User

Untitled

a guest
Feb 4th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.05 KB | None | 0 0
  1. <?php ob_start();
  2. include("inc/settings.php");
  3. $index_lang = $_GET['lang'];
  4. if ($index_lang == null) {
  5. $index_lang = $mcishop_settings['lang'];
  6. } else {
  7. if ($mcishop_lang['admin_select_id'] == null) {
  8. $index_lang = $mcishop_settings['lang'];
  9. }
  10. }
  11. include("inc/lang/".$index_lang.".php");
  12. session_start();
  13. $dbhost = $mcishop_settings['db_host'];
  14. $dbuser = $mcishop_settings['db_user'];
  15. $dbpass = $mcishop_settings['db_pass'];
  16. $dbname = $mcishop_settings['db_name'];
  17. $conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
  18. if ($conn->connect_error)
  19. {
  20. die("Connection failed: " . $conn->connect_error);
  21. }
  22. $index_temp = $_GET['temp'];
  23. if ($index_temp == null) {
  24. $index_temp = $mcishop_settings['template'];
  25. }
  26. include("css/templates/".$index_temp."/template.php");
  27. $index_template="css/templates/".$index_temp."/template.html";
  28. $server_id_view = $_GET['serv'];
  29.  
  30. $index_file = file_get_contents($index_template);
  31. $index_file = str_replace('{{mcishop.value_titlecms}}',$mcishop_settings['title'],$index_file);
  32. $index_file = str_replace('{{mcishop.value_namecms}}',$mcishop_settings['name'],$index_file);
  33. $index_file = str_replace('{{mcishop.value_desccms}}',$mcishop_settings['desc'],$index_file);
  34. $index_file = str_replace('{{mcishop.value_favicon}}',$mcishop_settings['favicon'],$index_file);
  35. $index_file = str_replace('{{mcishop.template_blocks}}',$mcishop_template['blocks'],$index_file);
  36.  
  37. $index_file = str_replace('{{mcishop.lang_blocks_stats_name}}',$mcishop_lang['blocks_servers_stats_name'],$index_file);
  38. $index_file = str_replace('{{mcishop.lang_blocks_heads_name}}',$mcishop_lang['blocks_heads_name'],$index_file);
  39. $index_file = str_replace('{{mcishop.lang_blocks_list_name}}',$mcishop_lang['blocks_servers_list_name'],$index_file);
  40. $index_file = str_replace('{{mcishop.lang_blocks_offers_name}}',$mcishop_lang['blocks_offers_name'],$index_file);
  41. $index_file = str_replace('{{mcishop.lang_vouchers_button_name}}',$mcishop_lang['vouchers_button_name'],$index_file);
  42. $sql = "Select * from mcishop_buys ORDER BY id DESC LIMIT 100";
  43. $result = $conn->query($sql);
  44. while($row = $result->fetch_assoc())
  45. {
  46. $head_nick = $row['mcis_nick'];
  47. $head_serv = $row['mcis_serv'];
  48. $head_offer = $row['mcis_offer'];
  49. $index_file = str_replace('{{mcishop.template_heads}}',$mcishop_template['blocks_heads_list'].'{{mcishop.template_heads}}',$index_file);
  50. $index_file = str_replace('{{mcishop.value_head_nick}}',$head_nick,$index_file);
  51. $index_file = str_replace('{{mcishop.lang_head_title}}',$mcishop_lang['blocks_heads_title'],$index_file);
  52. $index_file = str_replace('{{mcishop.user_login}}',$head_nick,$index_file);
  53. $sql2 = "Select * from mcishop_offers WHERE id = '$head_offer'";
  54. $result2 = $conn->query($sql2);
  55. while($row2 = $result2->fetch_assoc())
  56. {
  57. $head_offer = $row2['mcis_name'];
  58. }
  59. $sql3 = "Select * from mcishop_servers WHERE id = '$head_serv'";
  60. $result3 = $conn->query($sql3);
  61. while($row3 = $result3->fetch_assoc())
  62. {
  63. $head_serv = $row3['mcis_name'];
  64. }
  65. $index_file = str_replace('{{mcishop.value_offer_name}}',$head_offer,$index_file);
  66. $index_file = str_replace('{{mcishop.value_serv_name}}',$head_serv,$index_file);
  67. }
  68. $index_file = str_replace('{{mcishop.template_heads}}','',$index_file);
  69.  
  70. $id_server = $_GET['server'];
  71. $loop['server_start'] = 0;
  72. $sql = "Select * from mcishop_servers WHERE mcis_active = '1' ORDER BY mcis_lp ASC";
  73. $result = $conn->query($sql);
  74. while($row = $result->fetch_assoc())
  75. {
  76. $loop['server_start']++;
  77. if ($loop['server_start'] == 1) {
  78. $id_server_view = $row['id'];
  79. $server_name_view = $row['mcis_name'];
  80. $server_ip_view = $row['mcis_ip'];
  81. $server_port_view = $row['mcis_queryport'];
  82. }
  83. $server_online = TRUE;
  84. $server_id = $row['id'];
  85. $server_name = $row['mcis_name'];
  86. $server_ip = $row['mcis_ip'];
  87. $server_port = $row['mcis_queryport'];
  88. $index_file = str_replace('{{mcishop.template_servers_select}}',$mcishop_template["blocks_servers_list"].'{{mcishop.template_servers_select}}',$index_file);
  89. $index_file = str_replace('{{mcishop.value_server_name}}',$server_name,$index_file);
  90. $index_file = str_replace('{{mcishop.value_server_img}}',$server_img,$index_file);
  91. $index_file = str_replace('{{mcishop.value_server_href}}','index.php?server='.$server_id,$index_file);
  92. }
  93. $index_file = str_replace('{{mcishop.template_servers_select}}','',$index_file);
  94.  
  95. $sql = "Select * from mcishop_servers WHERE id = '$id_server' AND mcis_active = '1'";
  96. $result = $conn->query($sql);
  97. while($row = $result->fetch_assoc())
  98. {
  99. $server_id = $row['id'];
  100. $server_name = $row['mcis_name'];
  101. $server_ip = $row['mcis_ip'];
  102. $server_port = $row['mcis_queryport'];
  103.  
  104. $index_file = str_replace('{{mcishop.value_offer_server}}',$server_name,$index_file);
  105. $server_online = TRUE;
  106. }
  107.  
  108. if ($server_id == NULL) {
  109. $server_id = $id_server_view;
  110. $server_name = $server_name_view;
  111. $server_ip = $server_ip_view;
  112. $server_port = $server_port_view;
  113. }
  114.  
  115. $index_file = str_replace('{{mcishop.value_offer_server}}',$server_name,$index_file);
  116. if ($server_online == TRUE) {
  117. foreach(array('Server', 'Stats', 'StatsException') as $file) {
  118. include sprintf('inc/connect/query/inc/%s.php', $file);
  119. }
  120. $servers = array(
  121. "$server_ip:$server_port"
  122. );
  123. foreach($servers as $server){
  124. $stats = \Minecraft\Stats::retrieve(new \Minecraft\Server($server));
  125. $online['1'] = $stats->is_online;
  126. $online['2'] = $stats->online_players;
  127. $online['3'] = $stats->max_players;
  128. $online['4'] = ($online['2'] * 100) / $online['3'];
  129. unset($stats);
  130. }
  131. if ($online['1'] != 1) {
  132. $index_file = str_replace('{{mcishop.lang_servers_stats_online}}',$mcishop_lang['blocks_servers_stats_online_off'],$index_file);
  133. $index_file = str_replace('{{mcishop.value_blocks_servers_stats_online_players}}' ,'0',$index_file);
  134. $index_file = str_replace('{{mcishop.value_blocks_servers_stats_online_maxplayers}}','0',$index_file);
  135. $index_file = str_replace('{{mcishop.value_blocks_servers_stats_online_progress}}','100',$index_file);
  136. $index_file = str_replace('{{mcishop.value_blocks_servers_stats_online_progress_color}}','danger',$index_file);
  137. }
  138. }
  139. $index_file = str_replace('{{mcishop.lang_servers_stats_online}}',$mcishop_lang['blocks_servers_stats_online_on'],$index_file);
  140. $index_file = str_replace('{{mcishop.value_blocks_servers_stats_online_players}}' ,$online['2'],$index_file);
  141. $index_file = str_replace('{{mcishop.value_blocks_servers_stats_online_maxplayers}}',$online['3'],$index_file);
  142. $index_file = str_replace('{{mcishop.value_blocks_servers_stats_online_progress}}',$online['4'],$index_file);
  143. $index_file = str_replace('{{mcishop.value_blocks_servers_stats_online_progress_color}}','success',$index_file);
  144.  
  145. $sql = "Select * from mcishop_offers WHERE mcis_active = 1 AND mcis_use = '$server_id' ORDER BY mcis_lp ASC";
  146. $result = $conn->query($sql);
  147. while($row = $result->fetch_assoc())
  148. {
  149. $offer_id = $row['id'];
  150. $offer_servid = $row['mcis_use'];
  151. $offer_name = $row['mcis_name'];
  152. $offer_img = $row['mcis_img'];
  153. $offer_desc = $row['mcis_desc'];
  154. $offer_desc_small = $row['mcis_desc_small'];
  155. $offer_number = $row['mcis_number'];
  156. $offer_prefix = $row['mcis_prefix'];
  157. $offer_text = $row['mcis_text'];
  158. $offer_price = $row['mcis_price'];
  159. $offer_price_vat = $offer_price * 1.23;
  160. $offer_field = $row['mcis_field1'];
  161. if ($offer_img == NULL) {
  162. $offer_img = 'img/icon/none.png';
  163. }
  164.  
  165.  
  166. $index_file = str_replace('{{mcishop.template_offers_select}}',$mcishop_template['offer_index'].'{{mcishop.template_offers_select}}',$index_file);
  167. $index_file = str_replace('{{mcishop.value_offer_modal_sms}}',$mcishop_template['offer_modal_sms'],$index_file);
  168. $index_file = str_replace('{{mcishop.value_offer_modal_psc}}',$mcishop_template['offer_modal_psc'],$index_file);
  169. $sql2 = "Select * from mcishop_hosts WHERE mcis_active = '1' AND mcis_type = 'sms'";
  170. $result2 = $conn->query($sql2);
  171. while($row2 = $result2->fetch_assoc())
  172. {
  173. $index_file = str_replace('{{mcishop.value_offer_button_payment_sms}}',$mcishop_template['offer_button_payment_sms'],$index_file);
  174. }
  175. $sql2 = "Select * from mcishop_hosts WHERE mcis_active = '1' AND mcis_type = 'psc'";
  176. $result2 = $conn->query($sql2);
  177. while($row2 = $result2->fetch_assoc())
  178. {
  179. $index_file = str_replace('{{mcishop.value_offer_button_payment_psc}}',$mcishop_template['offer_button_payment_psc'],$index_file);
  180. }
  181. $sql2 = "Select * from mcishop_hosts WHERE mcis_active = '1' AND mcis_type = 'pp'";
  182. $result2 = $conn->query($sql2);
  183. while($row2 = $result2->fetch_assoc())
  184. {
  185. $index_file = str_replace('{{mcishop.value_offer_button_payment_pp}}',$mcishop_template['offer_button_payment_pp'],$index_file);
  186. }
  187. $index_file = str_replace('{{mcishop.value_offer_button_payment_sms}}','',$index_file);
  188. $index_file = str_replace('{{mcishop.value_offer_button_payment_psc}}','',$index_file);
  189. $index_file = str_replace('{{mcishop.value_offer_button_payment_pp}}' ,'',$index_file);
  190.  
  191.  
  192.  
  193.  
  194. $index_file = str_replace('{{mcishop.value_offer_payment_sms}}' ,'',$index_file);
  195. $index_file = str_replace('{{mcishop.value_offer_payment_psc}}' ,'',$index_file);
  196. $index_file = str_replace('{{mcishop.value_offer_payment_sms_name}}' ,'',$index_file);
  197. $index_file = str_replace('{{mcishop.value_offer_payment_psc_name}}' ,'',$index_file);
  198. $index_file = str_replace('{{mcishop.value_offer_id}}' ,$offer_id,$index_file);
  199. $index_file = str_replace('{{mcishop.value_server_id}}' ,$offer_servid,$index_file);
  200. $index_file = str_replace('{{mcishop.value_offer_name}}' ,$offer_name,$index_file);
  201. $index_file = str_replace('{{mcishop.value_offer_img}}' ,$offer_img,$index_file);
  202. $index_file = str_replace('{{mcishop.value_offer_href}}' ,'offer'.$offer_id,$index_file);
  203. $index_file = str_replace('{{mcishop.value_offer_server}}',$server_name,$index_file);
  204. $index_file = str_replace('{{mcishop.value_offer_price_vat}}' ,$offer_price_vat,$index_file);
  205. $index_file = str_replace('{{mcishop.value_offer_price}}' ,$offer_price,$index_file);
  206. $index_file = str_replace('{{mcishop.value_offer_desc}}' ,$offer_desc,$index_file);
  207. $index_file = str_replace('{{mcishop.value_offer_desc_small}}',$offer_desc_small,$index_file);
  208. $index_file = str_replace('{{mcishop.value_offer_number}}',$offer_number,$index_file);
  209. $index_file = str_replace('{{mcishop.value_offer_text}}' ,$offer_text,$index_file);
  210. $index_file = str_replace('{{mcishop.value_offer_prefix}}',$offer_prefix,$index_file);
  211. $index_file = str_replace('{{mcishop.value_offer_field}}' ,$offer_field,$index_file);
  212. }
  213. $index_file = str_replace('{{mcishop.template_offers_select}}','',$index_file);
  214.  
  215. if ($_POST['voucher_start'] == '1') {
  216. if ($_POST['nick'] && $_POST['code'] != NULL) {
  217. $voucher_nick = $_POST['nick'];
  218. $voucher_code = $_POST['code'];
  219. $sql = "Select * from mcishop_vouchers WHERE mcis_code = '$voucher_code'";
  220. $result = $conn->query($sql);
  221. while($row = $result->fetch_assoc())
  222. {
  223. $voucher_id = $row['id'];
  224. $voucher_offer = $row['mcis_use'];
  225. }
  226. if ($voucher_offer != NULL) {
  227. $offer_id = $voucher_offer;
  228. $sql = "Select * from mcishop_offers WHERE id = '$offer_id'";
  229. $result = $conn->query($sql);
  230. while($row = $result->fetch_assoc())
  231. {
  232. $server_id = $row['mcis_use'];
  233. }
  234. $player_nick = $voucher_nick;
  235. if ($mcishop_settings['connect_server'] == 'rcon') {
  236. include 'inc/connect/rcon/rcon.php';
  237. include 'inc/connect/rcon/index.php';
  238. } else {
  239. include 'inc/connect/txt/index.php';
  240. }
  241. $conn->query("DELETE FROM `mcishop_vouchers` WHERE `id` = '$voucher_id'");
  242.  
  243. } else {
  244. header('Location: index.php?modal_open=voucher');
  245. }
  246. } else {
  247. header('Location: index.php?modal_open=voucher');
  248. }
  249. }
  250.  
  251. $index_file = str_replace('{{mcishop.value_complaint_psc}}',$mcishop_settings["offer_complaint_psc"],$index_file);
  252. $index_file = str_replace('{{mcishop.value_complaint_sms}}',$mcishop_settings["offer_complaint_sms"],$index_file);
  253. $index_file = str_replace('{{mcishop.value_rules_psc}}',$mcishop_settings["offer_complaint_psc"],$index_file);
  254. $index_file = str_replace('{{mcishop.value_rules_sms}}',$mcishop_settings["offer_rules_sms"],$index_file);
  255.  
  256. if ($_GET['modal_open'] == 'paneladmin') {
  257. $modal_text = $_GET['modal_msg_text'];
  258. $index_file = str_replace('{{mcishop.value_modal_open}}',$mcishop_template["modal_open"],$index_file);
  259. $index_file = str_replace('{{mcishop.value_modal_href}}','loginadmin',$index_file);
  260. $index_file = str_replace('{{mcishop.value_modal_msg}}',$mcishop_template["modal_sms"],$index_file);
  261. $index_file = str_replace('{{mcishop.lang_modal_msg_text}}',$mcishop_lang['msg_'.$modal_text],$index_file);
  262. $index_file = str_replace('{{mcishop.value_modal_msg_color}}',$_GET['modal_msg_color'],$index_file);
  263. } elseif ($_GET['modal_open'] == 'offer') {
  264. $offer_id = $_GET['offer'];
  265. $offer_msg = $_GET['msg'];
  266. $offer_paym = $_GET['paym'];
  267. $modal_text = $_GET['modal_msg_text'];
  268. $index_file = str_replace('{{mcishop.value_modal_open}}',$mcishop_template["modal_open"],$index_file);
  269. $index_file = str_replace('{{mcishop.value_modal_href}}','offer'.$offer_id.'_'.$offer_paym,$index_file);
  270. $index_file = str_replace('{{mcishop.value_modal_msg}}',$mcishop_template["modal_msg"],$index_file);
  271. $index_file = str_replace('{{mcishop.lang_modal_msg_text}}',$mcishop_lang['msg_'.$modal_text],$index_file);
  272. $index_file = str_replace('{{mcishop.value_modal_msg_color}}',$_GET['modal_msg_color'],$index_file);
  273. } elseif ($_GET['modal_open'] == 'voucher') {
  274. $modal_text = $_GET['modal_msg_text'];
  275. $index_file = str_replace('{{mcishop.value_modal_open}}',$mcishop_template["modal_open"],$index_file);
  276. $index_file = str_replace('{{mcishop.value_modal_href}}','voucher',$index_file);
  277. $index_file = str_replace('{{mcishop.value_modal_msg}}',$mcishop_template["modal_sms"],$index_file);
  278. $index_file = str_replace('{{mcishop.lang_modal_msg_text}}',$mcishop_lang['msg_'.$modal_text],$index_file);
  279. $index_file = str_replace('{{mcishop.value_modal_msg_color}}',$_GET['modal_msg_color'],$index_file);
  280. }
  281. $index_file = str_replace('{{mcishop.value_modal_open}}' ,'',$index_file);
  282. $index_file = str_replace('{{mcishop.value_modal_msg}}' ,'',$index_file);
  283.  
  284.  
  285. $index_file = str_replace('{{mcishop.template_footer}}',$mcishop_template['footer'],$index_file);
  286.  
  287. echo $index_file;
  288.  
  289. $stats_date = date("dmY");
  290. $sql = "Select * from `mcishop_stats_global` WHERE mcis_date = '$stats_date'";
  291. $result = $conn->query($sql);
  292. while($row = $result->fetch_assoc())
  293. {
  294. $stats_view = $row['mcis_view'];
  295. }
  296. if ($stats_view != NULL) {
  297. $stats_view++;
  298. $sql = "UPDATE `mcishop_stats_global` SET `mcis_view`='$stats_view' WHERE `mcis_date` = '$stats_date'";
  299. $conn->query($sql);
  300. } else {
  301. $sql = "INSERT INTO `mcishop_stats_global`(`mcis_date`, `mcis_offer`, `mcis_money`, `mcis_report`, `mcis_view`) VALUES ('$stats_date','0','0','0','1')";
  302. $conn->query($sql);
  303. }
  304.  
  305. ob_end_flush(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement