Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php ob_start();
- include("inc/settings.php");
- $index_lang = $_GET['lang'];
- if ($index_lang == null) {
- $index_lang = $mcishop_settings['lang'];
- } else {
- if ($mcishop_lang['admin_select_id'] == null) {
- $index_lang = $mcishop_settings['lang'];
- }
- }
- include("inc/lang/".$index_lang.".php");
- session_start();
- $dbhost = $mcishop_settings['db_host'];
- $dbuser = $mcishop_settings['db_user'];
- $dbpass = $mcishop_settings['db_pass'];
- $dbname = $mcishop_settings['db_name'];
- $conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
- if ($conn->connect_error)
- {
- die("Connection failed: " . $conn->connect_error);
- }
- $index_temp = $_GET['temp'];
- if ($index_temp == null) {
- $index_temp = $mcishop_settings['template'];
- }
- include("css/templates/".$index_temp."/template.php");
- $index_template="css/templates/".$index_temp."/template.html";
- $server_id_view = $_GET['serv'];
- $index_file = file_get_contents($index_template);
- $index_file = str_replace('{{mcishop.value_titlecms}}',$mcishop_settings['title'],$index_file);
- $index_file = str_replace('{{mcishop.value_namecms}}',$mcishop_settings['name'],$index_file);
- $index_file = str_replace('{{mcishop.value_desccms}}',$mcishop_settings['desc'],$index_file);
- $index_file = str_replace('{{mcishop.value_favicon}}',$mcishop_settings['favicon'],$index_file);
- $index_file = str_replace('{{mcishop.template_blocks}}',$mcishop_template['blocks'],$index_file);
- $index_file = str_replace('{{mcishop.lang_blocks_stats_name}}',$mcishop_lang['blocks_servers_stats_name'],$index_file);
- $index_file = str_replace('{{mcishop.lang_blocks_heads_name}}',$mcishop_lang['blocks_heads_name'],$index_file);
- $index_file = str_replace('{{mcishop.lang_blocks_list_name}}',$mcishop_lang['blocks_servers_list_name'],$index_file);
- $index_file = str_replace('{{mcishop.lang_blocks_offers_name}}',$mcishop_lang['blocks_offers_name'],$index_file);
- $index_file = str_replace('{{mcishop.lang_vouchers_button_name}}',$mcishop_lang['vouchers_button_name'],$index_file);
- $sql = "Select * from mcishop_buys ORDER BY id DESC LIMIT 100";
- $result = $conn->query($sql);
- while($row = $result->fetch_assoc())
- {
- $head_nick = $row['mcis_nick'];
- $head_serv = $row['mcis_serv'];
- $head_offer = $row['mcis_offer'];
- $index_file = str_replace('{{mcishop.template_heads}}',$mcishop_template['blocks_heads_list'].'{{mcishop.template_heads}}',$index_file);
- $index_file = str_replace('{{mcishop.value_head_nick}}',$head_nick,$index_file);
- $index_file = str_replace('{{mcishop.lang_head_title}}',$mcishop_lang['blocks_heads_title'],$index_file);
- $index_file = str_replace('{{mcishop.user_login}}',$head_nick,$index_file);
- $sql2 = "Select * from mcishop_offers WHERE id = '$head_offer'";
- $result2 = $conn->query($sql2);
- while($row2 = $result2->fetch_assoc())
- {
- $head_offer = $row2['mcis_name'];
- }
- $sql3 = "Select * from mcishop_servers WHERE id = '$head_serv'";
- $result3 = $conn->query($sql3);
- while($row3 = $result3->fetch_assoc())
- {
- $head_serv = $row3['mcis_name'];
- }
- $index_file = str_replace('{{mcishop.value_offer_name}}',$head_offer,$index_file);
- $index_file = str_replace('{{mcishop.value_serv_name}}',$head_serv,$index_file);
- }
- $index_file = str_replace('{{mcishop.template_heads}}','',$index_file);
- $id_server = $_GET['server'];
- $loop['server_start'] = 0;
- $sql = "Select * from mcishop_servers WHERE mcis_active = '1' ORDER BY mcis_lp ASC";
- $result = $conn->query($sql);
- while($row = $result->fetch_assoc())
- {
- $loop['server_start']++;
- if ($loop['server_start'] == 1) {
- $id_server_view = $row['id'];
- $server_name_view = $row['mcis_name'];
- $server_ip_view = $row['mcis_ip'];
- $server_port_view = $row['mcis_queryport'];
- }
- $server_online = TRUE;
- $server_id = $row['id'];
- $server_name = $row['mcis_name'];
- $server_ip = $row['mcis_ip'];
- $server_port = $row['mcis_queryport'];
- $index_file = str_replace('{{mcishop.template_servers_select}}',$mcishop_template["blocks_servers_list"].'{{mcishop.template_servers_select}}',$index_file);
- $index_file = str_replace('{{mcishop.value_server_name}}',$server_name,$index_file);
- $index_file = str_replace('{{mcishop.value_server_img}}',$server_img,$index_file);
- $index_file = str_replace('{{mcishop.value_server_href}}','index.php?server='.$server_id,$index_file);
- }
- $index_file = str_replace('{{mcishop.template_servers_select}}','',$index_file);
- $sql = "Select * from mcishop_servers WHERE id = '$id_server' AND mcis_active = '1'";
- $result = $conn->query($sql);
- while($row = $result->fetch_assoc())
- {
- $server_id = $row['id'];
- $server_name = $row['mcis_name'];
- $server_ip = $row['mcis_ip'];
- $server_port = $row['mcis_queryport'];
- $index_file = str_replace('{{mcishop.value_offer_server}}',$server_name,$index_file);
- $server_online = TRUE;
- }
- if ($server_id == NULL) {
- $server_id = $id_server_view;
- $server_name = $server_name_view;
- $server_ip = $server_ip_view;
- $server_port = $server_port_view;
- }
- $index_file = str_replace('{{mcishop.value_offer_server}}',$server_name,$index_file);
- if ($server_online == TRUE) {
- foreach(array('Server', 'Stats', 'StatsException') as $file) {
- include sprintf('inc/connect/query/inc/%s.php', $file);
- }
- $servers = array(
- "$server_ip:$server_port"
- );
- foreach($servers as $server){
- $stats = \Minecraft\Stats::retrieve(new \Minecraft\Server($server));
- $online['1'] = $stats->is_online;
- $online['2'] = $stats->online_players;
- $online['3'] = $stats->max_players;
- $online['4'] = ($online['2'] * 100) / $online['3'];
- unset($stats);
- }
- if ($online['1'] != 1) {
- $index_file = str_replace('{{mcishop.lang_servers_stats_online}}',$mcishop_lang['blocks_servers_stats_online_off'],$index_file);
- $index_file = str_replace('{{mcishop.value_blocks_servers_stats_online_players}}' ,'0',$index_file);
- $index_file = str_replace('{{mcishop.value_blocks_servers_stats_online_maxplayers}}','0',$index_file);
- $index_file = str_replace('{{mcishop.value_blocks_servers_stats_online_progress}}','100',$index_file);
- $index_file = str_replace('{{mcishop.value_blocks_servers_stats_online_progress_color}}','danger',$index_file);
- }
- }
- $index_file = str_replace('{{mcishop.lang_servers_stats_online}}',$mcishop_lang['blocks_servers_stats_online_on'],$index_file);
- $index_file = str_replace('{{mcishop.value_blocks_servers_stats_online_players}}' ,$online['2'],$index_file);
- $index_file = str_replace('{{mcishop.value_blocks_servers_stats_online_maxplayers}}',$online['3'],$index_file);
- $index_file = str_replace('{{mcishop.value_blocks_servers_stats_online_progress}}',$online['4'],$index_file);
- $index_file = str_replace('{{mcishop.value_blocks_servers_stats_online_progress_color}}','success',$index_file);
- $sql = "Select * from mcishop_offers WHERE mcis_active = 1 AND mcis_use = '$server_id' ORDER BY mcis_lp ASC";
- $result = $conn->query($sql);
- while($row = $result->fetch_assoc())
- {
- $offer_id = $row['id'];
- $offer_servid = $row['mcis_use'];
- $offer_name = $row['mcis_name'];
- $offer_img = $row['mcis_img'];
- $offer_desc = $row['mcis_desc'];
- $offer_desc_small = $row['mcis_desc_small'];
- $offer_number = $row['mcis_number'];
- $offer_prefix = $row['mcis_prefix'];
- $offer_text = $row['mcis_text'];
- $offer_price = $row['mcis_price'];
- $offer_price_vat = $offer_price * 1.23;
- $offer_field = $row['mcis_field1'];
- if ($offer_img == NULL) {
- $offer_img = 'img/icon/none.png';
- }
- $index_file = str_replace('{{mcishop.template_offers_select}}',$mcishop_template['offer_index'].'{{mcishop.template_offers_select}}',$index_file);
- $index_file = str_replace('{{mcishop.value_offer_modal_sms}}',$mcishop_template['offer_modal_sms'],$index_file);
- $index_file = str_replace('{{mcishop.value_offer_modal_psc}}',$mcishop_template['offer_modal_psc'],$index_file);
- $sql2 = "Select * from mcishop_hosts WHERE mcis_active = '1' AND mcis_type = 'sms'";
- $result2 = $conn->query($sql2);
- while($row2 = $result2->fetch_assoc())
- {
- $index_file = str_replace('{{mcishop.value_offer_button_payment_sms}}',$mcishop_template['offer_button_payment_sms'],$index_file);
- }
- $sql2 = "Select * from mcishop_hosts WHERE mcis_active = '1' AND mcis_type = 'psc'";
- $result2 = $conn->query($sql2);
- while($row2 = $result2->fetch_assoc())
- {
- $index_file = str_replace('{{mcishop.value_offer_button_payment_psc}}',$mcishop_template['offer_button_payment_psc'],$index_file);
- }
- $sql2 = "Select * from mcishop_hosts WHERE mcis_active = '1' AND mcis_type = 'pp'";
- $result2 = $conn->query($sql2);
- while($row2 = $result2->fetch_assoc())
- {
- $index_file = str_replace('{{mcishop.value_offer_button_payment_pp}}',$mcishop_template['offer_button_payment_pp'],$index_file);
- }
- $index_file = str_replace('{{mcishop.value_offer_button_payment_sms}}','',$index_file);
- $index_file = str_replace('{{mcishop.value_offer_button_payment_psc}}','',$index_file);
- $index_file = str_replace('{{mcishop.value_offer_button_payment_pp}}' ,'',$index_file);
- $index_file = str_replace('{{mcishop.value_offer_payment_sms}}' ,'',$index_file);
- $index_file = str_replace('{{mcishop.value_offer_payment_psc}}' ,'',$index_file);
- $index_file = str_replace('{{mcishop.value_offer_payment_sms_name}}' ,'',$index_file);
- $index_file = str_replace('{{mcishop.value_offer_payment_psc_name}}' ,'',$index_file);
- $index_file = str_replace('{{mcishop.value_offer_id}}' ,$offer_id,$index_file);
- $index_file = str_replace('{{mcishop.value_server_id}}' ,$offer_servid,$index_file);
- $index_file = str_replace('{{mcishop.value_offer_name}}' ,$offer_name,$index_file);
- $index_file = str_replace('{{mcishop.value_offer_img}}' ,$offer_img,$index_file);
- $index_file = str_replace('{{mcishop.value_offer_href}}' ,'offer'.$offer_id,$index_file);
- $index_file = str_replace('{{mcishop.value_offer_server}}',$server_name,$index_file);
- $index_file = str_replace('{{mcishop.value_offer_price_vat}}' ,$offer_price_vat,$index_file);
- $index_file = str_replace('{{mcishop.value_offer_price}}' ,$offer_price,$index_file);
- $index_file = str_replace('{{mcishop.value_offer_desc}}' ,$offer_desc,$index_file);
- $index_file = str_replace('{{mcishop.value_offer_desc_small}}',$offer_desc_small,$index_file);
- $index_file = str_replace('{{mcishop.value_offer_number}}',$offer_number,$index_file);
- $index_file = str_replace('{{mcishop.value_offer_text}}' ,$offer_text,$index_file);
- $index_file = str_replace('{{mcishop.value_offer_prefix}}',$offer_prefix,$index_file);
- $index_file = str_replace('{{mcishop.value_offer_field}}' ,$offer_field,$index_file);
- }
- $index_file = str_replace('{{mcishop.template_offers_select}}','',$index_file);
- if ($_POST['voucher_start'] == '1') {
- if ($_POST['nick'] && $_POST['code'] != NULL) {
- $voucher_nick = $_POST['nick'];
- $voucher_code = $_POST['code'];
- $sql = "Select * from mcishop_vouchers WHERE mcis_code = '$voucher_code'";
- $result = $conn->query($sql);
- while($row = $result->fetch_assoc())
- {
- $voucher_id = $row['id'];
- $voucher_offer = $row['mcis_use'];
- }
- if ($voucher_offer != NULL) {
- $offer_id = $voucher_offer;
- $sql = "Select * from mcishop_offers WHERE id = '$offer_id'";
- $result = $conn->query($sql);
- while($row = $result->fetch_assoc())
- {
- $server_id = $row['mcis_use'];
- }
- $player_nick = $voucher_nick;
- if ($mcishop_settings['connect_server'] == 'rcon') {
- include 'inc/connect/rcon/rcon.php';
- include 'inc/connect/rcon/index.php';
- } else {
- include 'inc/connect/txt/index.php';
- }
- $conn->query("DELETE FROM `mcishop_vouchers` WHERE `id` = '$voucher_id'");
- } else {
- header('Location: index.php?modal_open=voucher');
- }
- } else {
- header('Location: index.php?modal_open=voucher');
- }
- }
- $index_file = str_replace('{{mcishop.value_complaint_psc}}',$mcishop_settings["offer_complaint_psc"],$index_file);
- $index_file = str_replace('{{mcishop.value_complaint_sms}}',$mcishop_settings["offer_complaint_sms"],$index_file);
- $index_file = str_replace('{{mcishop.value_rules_psc}}',$mcishop_settings["offer_complaint_psc"],$index_file);
- $index_file = str_replace('{{mcishop.value_rules_sms}}',$mcishop_settings["offer_rules_sms"],$index_file);
- if ($_GET['modal_open'] == 'paneladmin') {
- $modal_text = $_GET['modal_msg_text'];
- $index_file = str_replace('{{mcishop.value_modal_open}}',$mcishop_template["modal_open"],$index_file);
- $index_file = str_replace('{{mcishop.value_modal_href}}','loginadmin',$index_file);
- $index_file = str_replace('{{mcishop.value_modal_msg}}',$mcishop_template["modal_sms"],$index_file);
- $index_file = str_replace('{{mcishop.lang_modal_msg_text}}',$mcishop_lang['msg_'.$modal_text],$index_file);
- $index_file = str_replace('{{mcishop.value_modal_msg_color}}',$_GET['modal_msg_color'],$index_file);
- } elseif ($_GET['modal_open'] == 'offer') {
- $offer_id = $_GET['offer'];
- $offer_msg = $_GET['msg'];
- $offer_paym = $_GET['paym'];
- $modal_text = $_GET['modal_msg_text'];
- $index_file = str_replace('{{mcishop.value_modal_open}}',$mcishop_template["modal_open"],$index_file);
- $index_file = str_replace('{{mcishop.value_modal_href}}','offer'.$offer_id.'_'.$offer_paym,$index_file);
- $index_file = str_replace('{{mcishop.value_modal_msg}}',$mcishop_template["modal_msg"],$index_file);
- $index_file = str_replace('{{mcishop.lang_modal_msg_text}}',$mcishop_lang['msg_'.$modal_text],$index_file);
- $index_file = str_replace('{{mcishop.value_modal_msg_color}}',$_GET['modal_msg_color'],$index_file);
- } elseif ($_GET['modal_open'] == 'voucher') {
- $modal_text = $_GET['modal_msg_text'];
- $index_file = str_replace('{{mcishop.value_modal_open}}',$mcishop_template["modal_open"],$index_file);
- $index_file = str_replace('{{mcishop.value_modal_href}}','voucher',$index_file);
- $index_file = str_replace('{{mcishop.value_modal_msg}}',$mcishop_template["modal_sms"],$index_file);
- $index_file = str_replace('{{mcishop.lang_modal_msg_text}}',$mcishop_lang['msg_'.$modal_text],$index_file);
- $index_file = str_replace('{{mcishop.value_modal_msg_color}}',$_GET['modal_msg_color'],$index_file);
- }
- $index_file = str_replace('{{mcishop.value_modal_open}}' ,'',$index_file);
- $index_file = str_replace('{{mcishop.value_modal_msg}}' ,'',$index_file);
- $index_file = str_replace('{{mcishop.template_footer}}',$mcishop_template['footer'],$index_file);
- echo $index_file;
- $stats_date = date("dmY");
- $sql = "Select * from `mcishop_stats_global` WHERE mcis_date = '$stats_date'";
- $result = $conn->query($sql);
- while($row = $result->fetch_assoc())
- {
- $stats_view = $row['mcis_view'];
- }
- if ($stats_view != NULL) {
- $stats_view++;
- $sql = "UPDATE `mcishop_stats_global` SET `mcis_view`='$stats_view' WHERE `mcis_date` = '$stats_date'";
- $conn->query($sql);
- } else {
- $sql = "INSERT INTO `mcishop_stats_global`(`mcis_date`, `mcis_offer`, `mcis_money`, `mcis_report`, `mcis_view`) VALUES ('$stats_date','0','0','0','1')";
- $conn->query($sql);
- }
- ob_end_flush(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement