Moved the Agents into their own repo. Kept the agent.pl just for reference
This commit is contained in:
parent
22381be29a
commit
8680a02b13
18132 changed files with 0 additions and 2569420 deletions
|
|
@ -1,142 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2017 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
function exec_ogp_module()
|
||||
{
|
||||
global $db ,$view;
|
||||
$settings = $db->getSettings();
|
||||
|
||||
//The service id should also be cast to an int.
|
||||
$service_id = intval($_REQUEST['service_id']);
|
||||
|
||||
// Query for Selected service info.
|
||||
$qry_service = "SELECT DISTINCT service_id, home_cfg_id, mod_cfg_id, service_name, remote_server_id, slot_max_qty, slot_min_qty, price_daily, price_monthly, price_year, description, img_url FROM OGP_DB_PREFIXbilling_services WHERE service_id=".$db->realEscapeSingle($service_id);
|
||||
$result_service = $db->resultQuery($qry_service);
|
||||
$row_service = $result_service[0];
|
||||
//Compiling info about invoice to create an invoice order.
|
||||
|
||||
/*
|
||||
Check if it's numeric before used in the WHERE clause... otherwise an SQL error is possible currently.
|
||||
If it's not an int (or if it's 0 after casting and or not vaild service) redirect to the shop page.
|
||||
*/
|
||||
if ($service_id <= 0 || $result_service === false){
|
||||
$view->refresh("home.php?m=billing&p=shop");
|
||||
return;
|
||||
}
|
||||
|
||||
// remote server value
|
||||
//is now held in the the IP_ID value
|
||||
//$remote_server_id = $row_service['remote_server_id'];
|
||||
$remote_server_id = $_POST['ip_id'];
|
||||
|
||||
// request ogp user to create a home path.
|
||||
$r_server = $db->getRemoteServer($remote_server_id);
|
||||
$ogp_user = $r_server['ogp_user'];
|
||||
|
||||
// request the user name and the game name to generate a game home name.
|
||||
$home_name = $_POST['home_name'];
|
||||
|
||||
//Calculating Price
|
||||
if ($_POST['invoice_duration'] == "day")
|
||||
{
|
||||
$price_slot=$row_service['price_daily'];
|
||||
}
|
||||
elseif ($_POST['invoice_duration'] == "month")
|
||||
{
|
||||
$price_slot=$row_service['price_monthly'];
|
||||
}
|
||||
elseif ($_POST['invoice_duration'] == "year")
|
||||
{
|
||||
$price_slot=$row_service['price_year']*12;
|
||||
}
|
||||
else
|
||||
{
|
||||
$price_slot=$row_service['price_monthly'];
|
||||
}
|
||||
|
||||
|
||||
//Game Server Values
|
||||
$ip_id = $_POST['ip_id'];
|
||||
$ip = $db->getIpById($ip_id);
|
||||
$max_players = $_POST['max_players'];
|
||||
$qty = $_POST['qty'];
|
||||
$invoice_duration = $_POST['invoice_duration'];
|
||||
$user_id = $_SESSION['user_id'];
|
||||
$remote_control_password = $_POST['remote_control_password'];
|
||||
$ftp_password = $_POST['ftp_password'];
|
||||
$tax_amount = $settings['tax_amount'];
|
||||
$currency = $settings['currency'];
|
||||
|
||||
/*
|
||||
Cast $_REQUEST['service_id'] to an int and then check if its value is higher than 0 before using it in the WHERE clause.
|
||||
Checking if it's higher than 0 because if it's a non-numeric value, after casting it to an int it'll be 0.
|
||||
*/
|
||||
if($service_id !== 0) $where_service_id = " WHERE service_id=".$db->realEscapeSingle($service_id); else $where_service_id = "";
|
||||
$qry_services = "SELECT * FROM OGP_DB_PREFIXbilling_services".$where_service_id;
|
||||
$services = $db->resultQuery($qry_services);
|
||||
foreach ($services as $key => $row) {
|
||||
if($max_players < $row['slot_min_qty'] || $qty < 1){
|
||||
$max_players = $row['slot_min_qty'];
|
||||
$qty = 1;
|
||||
}
|
||||
/*
|
||||
An extra check added for the inverse: check max_players against slot_max_qty.
|
||||
It would be good to do in the event someone is only selling a max of 16 slots per server.
|
||||
*/
|
||||
elseif ($max_players > $row['slot_max_qty'])
|
||||
{
|
||||
$max_players = $row['slot_max_qty'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( isset( $_POST["add_to_cart"] ) )
|
||||
{
|
||||
if( isset( $_SESSION['CART'] ) )
|
||||
{
|
||||
$i = count( $_SESSION['CART'] );
|
||||
$i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$i = 0;
|
||||
}
|
||||
|
||||
$_SESSION['CART'][$i] = array( "cart_id" => $i,
|
||||
"service_id" => $service_id,
|
||||
"home_name" => $home_name,
|
||||
"ip" => $ip_id,
|
||||
"max_players" => $max_players,
|
||||
"qty" => $qty,
|
||||
"invoice_duration" => $invoice_duration,
|
||||
"price" => $price_slot,
|
||||
"remote_control_password" => $remote_control_password,
|
||||
"ftp_password" => $ftp_password,
|
||||
"tax_amount" => $tax_amount,
|
||||
"currency" => $currency,
|
||||
"paid" => 0);
|
||||
echo '<meta http-equiv="refresh" content="0;url=?m=billing&p=cart">';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,142 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2017 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
function exec_ogp_module()
|
||||
{
|
||||
global $db ,$view;
|
||||
$settings = $db->getSettings();
|
||||
|
||||
//The service id should also be cast to an int.
|
||||
$service_id = intval($_REQUEST['service_id']);
|
||||
|
||||
// Query for Selected service info.
|
||||
$qry_service = "SELECT DISTINCT service_id, home_cfg_id, mod_cfg_id, service_name, remote_server_id, slot_max_qty, slot_min_qty, price_daily, price_monthly, price_year, description, img_url FROM OGP_DB_PREFIXbilling_services WHERE service_id=".$db->realEscapeSingle($service_id);
|
||||
$result_service = $db->resultQuery($qry_service);
|
||||
$row_service = $result_service[0];
|
||||
//Compiling info about invoice to create an invoice order.
|
||||
|
||||
/*
|
||||
Check if it's numeric before used in the WHERE clause... otherwise an SQL error is possible currently.
|
||||
If it's not an int (or if it's 0 after casting and or not vaild service) redirect to the shop page.
|
||||
*/
|
||||
if ($service_id <= 0 || $result_service === false){
|
||||
$view->refresh("home.php?m=billing&p=shop");
|
||||
return;
|
||||
}
|
||||
|
||||
// remote server value
|
||||
//is now held in the the IP_ID value
|
||||
//$remote_server_id = $row_service['remote_server_id'];
|
||||
$remote_server_id = $_POST['ip_id'];
|
||||
|
||||
// request ogp user to create a home path.
|
||||
$r_server = $db->getRemoteServer($remote_server_id);
|
||||
$ogp_user = $r_server['ogp_user'];
|
||||
|
||||
// request the user name and the game name to generate a game home name.
|
||||
$home_name = $_POST['home_name'];
|
||||
|
||||
//Calculating Price
|
||||
if ($_POST['invoice_duration'] == "day")
|
||||
{
|
||||
$price_slot=$row_service['price_daily'];
|
||||
}
|
||||
elseif ($_POST['invoice_duration'] == "month")
|
||||
{
|
||||
$price_slot=$row_service['price_monthly'];
|
||||
}
|
||||
elseif ($_POST['invoice_duration'] == "year")
|
||||
{
|
||||
$price_slot=$row_service['price_year']*12;
|
||||
}
|
||||
else
|
||||
{
|
||||
$price_slot=$row_service['price_monthly'];
|
||||
}
|
||||
|
||||
|
||||
//Game Server Values
|
||||
$ip_id = $_POST['ip_id'];
|
||||
$ip = $db->getIpById($ip_id);
|
||||
$max_players = $_POST['max_players'];
|
||||
$qty = $_POST['qty'];
|
||||
$invoice_duration = $_POST['invoice_duration'];
|
||||
$user_id = $_SESSION['user_id'];
|
||||
$remote_control_password = $_POST['remote_control_password'];
|
||||
$ftp_password = $_POST['ftp_password'];
|
||||
$tax_amount = $settings['tax_amount'];
|
||||
$currency = $settings['currency'];
|
||||
|
||||
/*
|
||||
Cast $_REQUEST['service_id'] to an int and then check if its value is higher than 0 before using it in the WHERE clause.
|
||||
Checking if it's higher than 0 because if it's a non-numeric value, after casting it to an int it'll be 0.
|
||||
*/
|
||||
if($service_id !== 0) $where_service_id = " WHERE service_id=".$db->realEscapeSingle($service_id); else $where_service_id = "";
|
||||
$qry_services = "SELECT * FROM OGP_DB_PREFIXbilling_services".$where_service_id;
|
||||
$services = $db->resultQuery($qry_services);
|
||||
foreach ($services as $key => $row) {
|
||||
if($max_players < $row['slot_min_qty'] || $qty < 1){
|
||||
$max_players = $row['slot_min_qty'];
|
||||
$qty = 1;
|
||||
}
|
||||
/*
|
||||
An extra check added for the inverse: check max_players against slot_max_qty.
|
||||
It would be good to do in the event someone is only selling a max of 16 slots per server.
|
||||
*/
|
||||
elseif ($max_players > $row['slot_max_qty'])
|
||||
{
|
||||
$max_players = $row['slot_max_qty'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( isset( $_POST["add_to_cart"] ) )
|
||||
{
|
||||
if( isset( $_SESSION['CART'] ) )
|
||||
{
|
||||
$i = count( $_SESSION['CART'] );
|
||||
$i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$i = 0;
|
||||
}
|
||||
|
||||
$_SESSION['CART'][$i] = array( "cart_id" => $i,
|
||||
"service_id" => $service_id,
|
||||
"home_name" => $home_name,
|
||||
"ip" => $ip_id,
|
||||
"max_players" => $max_players,
|
||||
"qty" => $qty,
|
||||
"invoice_duration" => $invoice_duration,
|
||||
"price" => $price_slot,
|
||||
"remote_control_password" => $remote_control_password,
|
||||
"ftp_password" => $ftp_password,
|
||||
"tax_amount" => $tax_amount,
|
||||
"currency" => $currency,
|
||||
"paid" => 0);
|
||||
echo '<meta http-equiv="refresh" content="0;url=?m=billing&p=cart">';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,177 +0,0 @@
|
|||
<?php
|
||||
function exec_ogp_module()
|
||||
{
|
||||
//Include database connection details
|
||||
require('includes/config.inc.php');
|
||||
|
||||
global $db,$view,$settings;
|
||||
if(isset($_GET['type']) && $_GET['type'] == 'cleared')
|
||||
{
|
||||
echo '<body onload="window.print()" >';
|
||||
$view->setCharset(get_lang('lang_charset'));
|
||||
}
|
||||
|
||||
$user_id = $_SESSION['user_id'];
|
||||
$cart_id = $_POST['cart_id'];
|
||||
$cart_id = $db->realEscapeSingle($cart_id);
|
||||
$isAdmin = $db->isAdmin( $_SESSION['user_id'] );
|
||||
if ( $isAdmin )
|
||||
$orders = $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE cart_id=".$db->realEscapeSingle($cart_id) );
|
||||
else
|
||||
$orders = $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE cart_id=".$db->realEscapeSingle($cart_id)." AND user_id=".$db->realEscapeSingle($user_id) );
|
||||
|
||||
$cart = $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_carts WHERE cart_id=".$db->realEscapeSingle($cart_id) );
|
||||
$tempdate = date_create( $cart[0]['date']);
|
||||
$paid_date = date_format($tempdate,"d M Y H:m");
|
||||
|
||||
|
||||
|
||||
if( !empty($orders) )
|
||||
{
|
||||
?>
|
||||
<br><br>
|
||||
<table width="772" height="438" border="0" style="color:#000000" bgcolor="#FFFFFF">
|
||||
<tr bgcolor="#000000">
|
||||
<td colspan="7" align="center" style="color:white">
|
||||
<p style="font-size:18pt"><b><?php print_lang("invoice");?></b></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" >Paid: <?php echo $paid_date; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="150" height="21" align="left"><b><?php echo "<b>Black Market Servers</b><br/>
|
||||
3400 Laurel Rd<br/>
|
||||
Brunswick, OH 44212 "; ?></td>
|
||||
<td colspan="4" rowspan="3"> </td>
|
||||
<td align="center" colspan="2" rowspan="3" ><img src="images/logo.png"><br>Thank you for your preference</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="150" height="21" align="left">Email: <?php echo "<b>".$settings['panel_email_address']."</b>"; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="23" colspan="7"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="23" style="border: 2px solid #000000" bgcolor="#222222"><div align="center"><strong><?php print_lang("order");?></strong></div></td>
|
||||
<td height="23" style="border: 2px solid #000000" bgcolor="#222222"><div align="center"><strong>Server ID</strong></div></td>
|
||||
<td height="23" style="border: 2px solid #000000" bgcolor="#222222"><div align="center"><strong><?php print_lang("item");?></strong></div></td>
|
||||
<td height="23" style="border: 2px solid #000000" bgcolor="#222222"><div align="center"><strong><?php print_lang("invoice_duration");?></strong></div></td>
|
||||
<td height="23" style="border: 2px solid #000000" bgcolor="#222222"><div align="center"><strong><?php print_lang("slot_cost");?></strong></div></td>
|
||||
<td height="23" style="border: 2px solid #000000" bgcolor="#222222"><div align="center"><strong><?php print_lang("slot_quantity");?></strong></div></td>
|
||||
<td height="23" style="border: 2px solid #000000" bgcolor="#222222"><div align="center"><strong><?php print_lang("order_price");?></strong></div></td>
|
||||
<hr/></tr>
|
||||
<?php
|
||||
$subtotal = 0;
|
||||
foreach($orders as $order)
|
||||
{
|
||||
$order_id = $order['order_id'];
|
||||
$user_id = $order['user_id'];
|
||||
$service_id = $order['service_id'];
|
||||
$home_name = $order['home_name']." - ".$order_id;
|
||||
$ip = $order['ip'];
|
||||
$max_players = $order['max_players'];
|
||||
$qty = $order['qty'];
|
||||
$invoice_duration = $order['invoice_duration'];
|
||||
$price = $order['price'];
|
||||
$subtotal= $price * $max_players * $qty;
|
||||
$subtotal2 += $order['price'] * $max_players * $qty;
|
||||
$qry_service = "SELECT DISTINCT price_daily, price_monthly, price_year FROM ".$table_prefix."billing_services WHERE service_id=".$db->realEscapeSingle($service_id);
|
||||
$result_service = $db->resultQuery($qry_service);
|
||||
$row_service = $result_service[0];
|
||||
|
||||
//Calculating Costs
|
||||
|
||||
if ($invoice_duration == "day")
|
||||
{
|
||||
$price_slot=$row_service['price_daily'];
|
||||
}
|
||||
elseif ($invoice_duration == "month")
|
||||
{
|
||||
$price_slot=$row_service['price_monthly'];
|
||||
}
|
||||
elseif ($invoice_duration == "year")
|
||||
{
|
||||
$price_slot=$row_service['price_year']*12;
|
||||
}
|
||||
$duration = $invoice_duration > 1 ? $invoice_duration."s":$invoice_duration;
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td align="center" height="23"><?php echo $order_id; ?></td>
|
||||
<td align="center" height="23"><?php echo $order['home_id']; ?></td>
|
||||
<td align="center" height="23"><?php echo $order['home_name']; ?></td>
|
||||
<td align="center"><?php echo $qty." ".get_lang($duration); ?></td>
|
||||
<td align="center"><?php echo "$" . number_format(floatval(round(($price_slot),2 )),2)." ".$settings['currency']."/".get_lang($invoice_duration); ?></td>
|
||||
<td align="center"><?php echo $max_players; ?></td>
|
||||
<td align="center"><?php echo "$" . number_format(floatval(round(($subtotal),2 )),2)." ".$settings['currency']; ?></td>
|
||||
</tr><?php
|
||||
}
|
||||
|
||||
$coupon_savings = 0;
|
||||
if($cart[0]['coupon_id']>0) {
|
||||
$result = $db->resultquery("SELECT discount from OGP_DB_PREFIXbilling_coupons WHERE id = '". $cart[0]['coupon_id'] . "'");
|
||||
foreach($result as $coupon){
|
||||
$coupon_savings = $subtotal2 * ($coupon['discount'] / 100);
|
||||
}
|
||||
}
|
||||
|
||||
//$subtotal2 += $order['price'] * $max_players * $qty;
|
||||
//$total = $subtotal2+($cart[0]['tax_amount']/100*$subtotal2);
|
||||
$total = ($subtotal2 - $coupon_savings) * ($cart[0]['tax_amount'] / 100 + 1);
|
||||
?>
|
||||
<tr>
|
||||
<td height="24" colspan="5"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" rowspan="5"> </td>
|
||||
<td height="23" style="border: 2px solid #000000"><div align="right"><strong><?php print_lang("subtotal");?> : </strong></div></td>
|
||||
<td style="border: 2px solid #000000"><?php echo "$" . number_format(floatval(round(($subtotal2),2 )),2) . " ".$settings['currency']; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
if($cart[0]['coupon_id']>0) {
|
||||
echo '
|
||||
<tr>
|
||||
<td height="23" style="border: 2px solid #000000"><div align="right"><strong>Discount : </strong></div></td>
|
||||
<td style="border: 2px solid #000000">'. "$" . number_format(floatval(round((($subtotal2-$coupon_savings)-$subtotal2),2 )),2) . " ".$settings['currency'] .'</td>
|
||||
</tr>';
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td height="23" style="border: 2px solid #000000"><div align="right"><strong><?php print_lang("tax");?> : </strong></div></td>
|
||||
<td style="border: 2px solid #000000"><?php echo $cart[0]['tax_amount']."%"; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="23" style="border: 2px solid #000000" bgcolor="#222222"><div align="right"><strong><?php print_lang("total");?> : </strong></div></td>
|
||||
<td style="border: 2px solid #000000" bgcolor="#222222"><?php echo "$" . number_format(floatval(round(($total),2 )),2) ." ".$settings['currency']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="23" style="border: 2px solid #000000"><div align="right"><strong></strong></div></td>
|
||||
<td style="border: 2px solid #000000"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br><br>
|
||||
<form method='post' action='?m=billing&p=bill&type=cleared' >
|
||||
<input type="hidden" name="cart_id" value="<?php echo $_POST['cart_id'];?>">
|
||||
<input type="submit" value="<?php print_lang('print_invoice') ?>" />
|
||||
</form>
|
||||
<form method='post' action='?m=billing&p=<?php
|
||||
$isAdmin = $db->isAdmin($_SESSION['user_id']);
|
||||
if ($isAdmin)
|
||||
{
|
||||
echo 'orders';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'cart';
|
||||
}
|
||||
echo "'><input type='submit' value='";
|
||||
print_lang('back');
|
||||
?>'/>
|
||||
</form>
|
||||
<br><br><?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
$url = "https://";
|
||||
// Append the host(domain name, ip) to the URL.
|
||||
$url.= $_SERVER['HTTP_HOST'];
|
||||
// foreach($_POST as $key => $val) {
|
||||
// echo 'Field name : ' . $key . ' Value :' .$val .'<br>';
|
||||
// }
|
||||
|
||||
if (($_POST['payment_status']=="Completed")){
|
||||
echo "<title>Success</title><h4>Thank you for your order. <br> ... </h4><br>";
|
||||
echo "Processing your payment Information ..";
|
||||
$bounce_to = $url."/home.php?m=billing&p=paid";
|
||||
} else {
|
||||
echo "<title>Uh OH</title><h4>There was a problem, Please contact Support<br> ... </h4><br>";
|
||||
$bounce_to = $url."/home.php?m=billing&p=paid";
|
||||
//we can setup a "failed page" to redirect to. My sandbox payments are not marked completed for some reason
|
||||
|
||||
}
|
||||
?>
|
||||
<form name='paid' action='<?php echo $bounce_to?>' method='post'>
|
||||
<input type='hidden' name='cart_id' value='<?php echo $_POST["item_number"]?>'>
|
||||
<input type='hidden' name='payment_status' value='<?php echo $_POST["payment_status"] ?>'>
|
||||
</form>
|
||||
<script>
|
||||
var auto_refresh = setInterval(
|
||||
function()
|
||||
{
|
||||
submitform();
|
||||
}, 2000);
|
||||
function submitform()
|
||||
{
|
||||
document.paid.submit();
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,658 +0,0 @@
|
|||
<?php
|
||||
function saveOrderToDb($user_id,$service_id,$home_name,$ip,$max_players,$qty,$invoice_duration,$price,$remote_control_password,$ftp_password,$cart_id,$home_id = "0",$status,$finish_date,$extended = "0"){
|
||||
global $db;
|
||||
if(isset($_SESSION['coupon_id'])){
|
||||
$coupon_id = $_SESSION['coupon_id'];
|
||||
} else {
|
||||
$coupon_id = 0;
|
||||
}
|
||||
$fields['user_id'] = $user_id;
|
||||
$fields['service_id'] = $service_id;
|
||||
$fields['home_name'] = $home_name;
|
||||
$fields['ip'] = $ip;
|
||||
$fields['max_players'] = $max_players;
|
||||
$fields['qty'] = $qty;
|
||||
$fields['invoice_duration'] = $invoice_duration;
|
||||
$fields['price'] = $price;
|
||||
$fields['remote_control_password'] = $remote_control_password;
|
||||
$fields['ftp_password'] = $ftp_password;
|
||||
$fields['cart_id'] = $cart_id;
|
||||
$fields['home_id'] = $home_id;
|
||||
$fields['status'] = $status;
|
||||
$fields['finish_date'] = $finish_date;
|
||||
$fields['extended'] = $extended;
|
||||
$fields['coupon_id'] = $coupon_id;
|
||||
return $db->resultInsertId( 'billing_orders', $fields );
|
||||
}
|
||||
|
||||
|
||||
|
||||
function assignOrdersToCart($user_id,$tax_amount,$currency,$coupon_id){
|
||||
global $db;
|
||||
$fields['user_id'] = $user_id;
|
||||
$fields['paid'] = '0';
|
||||
$fields['tax_amount'] = $tax_amount;
|
||||
$fields['currency'] = $currency;
|
||||
//discount coupon
|
||||
if (!isset($coupon_id)) $coupon_id = "0";
|
||||
$fields['coupon_id'] = $coupon_id;
|
||||
$check_expired = $db->resultquery("SELECT id from OGP_DB_PREFIXbilling_coupons WHERE id = $fields[coupon_id] AND count > 0 AND expires >= NOW()");
|
||||
if ($check_expired <= 0) $fields['coupon_id'] = 0;
|
||||
return $db->resultInsertId( 'billing_carts', $fields );
|
||||
}
|
||||
|
||||
function exec_ogp_module()
|
||||
{
|
||||
error_reporting(E_ALL);
|
||||
|
||||
global $db,$view,$settings;
|
||||
$discounted_price = 0;
|
||||
|
||||
$user_id = $_SESSION['user_id'];
|
||||
|
||||
if( isset($_POST["update_cart"] )) {
|
||||
//print_r($_POST);
|
||||
$db->query( "UPDATE OGP_DB_PREFIXbilling_orders SET max_players= ".$_POST['slots']." WHERE order_id=".$db->realEscapeSingle($_POST['order_id']));
|
||||
$db->query( "UPDATE OGP_DB_PREFIXbilling_orders SET qty= ".$_POST['qty']." WHERE order_id=".$db->realEscapeSingle($_POST['order_id']));
|
||||
$db->query( "UPDATE OGP_DB_PREFIXbilling_orders SET invoice_duration = 'month' WHERE order_id=".$db->realEscapeSingle($_POST['order_id']));
|
||||
$db->query( "UPDATE OGP_DB_PREFIXgame_mods SET max_players= ".$_POST['slots']." WHERE home_id=".$db->realEscapeSingle($_POST['homeid']));
|
||||
|
||||
}
|
||||
|
||||
//discount coupon
|
||||
if( isset($_POST["coupon_code"] ) && $_POST["coupon_code"] != "") {
|
||||
$coupon_id = 0;
|
||||
$coupon_code = "";
|
||||
$result = $db->resultquery("SELECT * from OGP_DB_PREFIXbilling_coupons WHERE code= '". $_POST['coupon_code'] . "'");
|
||||
$coupon_name = "<b style='color:red'>NON-EXISTING COUPON</b>";
|
||||
$coupon_discount = 0;
|
||||
foreach($result as $couponDB){
|
||||
$_SESSION['coupon_id'] = $couponDB['id'];
|
||||
$coupon_id = $couponDB['id'];
|
||||
$coupon_code = $couponDB['code'];
|
||||
$coupon_discount = $couponDB['discount'];
|
||||
$coupon_name = $couponDB['name'];
|
||||
$coupon_recurring = $couponDB['recurring'];
|
||||
$coupon_expires = $couponDB['expires'];
|
||||
$coupon_count = $couponDB['count'];
|
||||
$today = date("Y-m-d H:i:s", time());
|
||||
if($coupon_expires < $today || $coupon_count == 0){
|
||||
$coupon_id = 0;
|
||||
$coupon_discount = 0;
|
||||
$coupon_name = "<b style='color:red'>EXPIRED COUPON</b>";
|
||||
}
|
||||
|
||||
if ($coupon_count > 0) {
|
||||
$coupon_count--;
|
||||
$db->resultquery("UPDATE ogp_billing_coupons SET count = $coupon_count WHERE code = '$_POST[coupon_code]'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if( isset( $_POST["buy"] ) or isset( $_POST["pay_paypal"] ) )
|
||||
{
|
||||
if( isset( $_SESSION['CART'] ) )
|
||||
{
|
||||
$orders = $_SESSION['CART'];
|
||||
if(isset($_SESSION['coupon_id'])){
|
||||
$coupon_id = $_SESSION['coupon_id'];
|
||||
} else {
|
||||
$coupon_id = 0;
|
||||
}
|
||||
// Fill The Cart on DB
|
||||
$cart_id = assignOrdersToCart($user_id,$settings['tax_amount'],$settings['currency'],$coupon_id);
|
||||
foreach($orders as $order)
|
||||
{
|
||||
$service_id = $order['service_id'];
|
||||
$home_name = $order['home_name'];
|
||||
$ip = $order['ip'];
|
||||
$max_players = $order['max_players'];
|
||||
|
||||
//They pushed the "buy" button.
|
||||
//So set the quantity and invoice_duration
|
||||
|
||||
if(isset($_POST["buy"]))
|
||||
{
|
||||
$invoice_duration = "month";
|
||||
$qty = 1;
|
||||
}
|
||||
else{
|
||||
$invoice_duration = $order['invoice_duration'];
|
||||
$qty = $order['qty'];
|
||||
}
|
||||
$price = $order['price'];
|
||||
$remote_control_password = $order['remote_control_password'];
|
||||
$ftp_password = $order['ftp_password'];
|
||||
//Save order to DB
|
||||
saveOrderToDb($user_id,$service_id,$home_name,$ip,$max_players,$qty,$invoice_duration,$price,$remote_control_password,$ftp_password,$cart_id,0,0,0,0);
|
||||
if( isset( $_POST["buy"] )) {
|
||||
echo '<meta http-equiv="refresh" content="0;url=home.php?m=billing&p=create_servers&cart_id='.$cart_id.'" >';
|
||||
}
|
||||
}
|
||||
// Remove Cart From Session
|
||||
unset($_SESSION['CART']);
|
||||
unset($_SESSION['coupon_id']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$cart_id = $_POST['cart_id'];
|
||||
}
|
||||
|
||||
if ( !empty( $cart_id ) and isset( $_POST["pay_paypal"] ) and $settings['paypal'] == "1" )
|
||||
{
|
||||
echo '<meta http-equiv="refresh" content="0;url=home.php?m=billing&p=paypal&cart_id='.$cart_id.'" >';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if( isset( $_POST["extend"] ) or isset( $_POST["extend_and_pay_paypal"] ))
|
||||
{
|
||||
|
||||
$orders = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE order_id=".$db->realEscapeSingle($_POST['order_id']));
|
||||
|
||||
// *****************************************
|
||||
//FIGURE OUT IF THIS IS ALREADY BEEN UPDATED
|
||||
//RENEWAL IN DB SO
|
||||
//WE DONT CREATE MULTIPLE INVOICES
|
||||
// *****************************************
|
||||
foreach($orders as $order)
|
||||
{
|
||||
$cart_id = $order['cart_id'];
|
||||
if($order['status'] < 0)
|
||||
{
|
||||
$cart_id = assignOrdersToCart($user_id,$settings['tax_amount'],$settings['currency'],$_SESSION['coupon_id']);
|
||||
$service_id = $order['service_id'];
|
||||
$home_name = $order['home_name'];
|
||||
$ip = $order['ip'];
|
||||
$max_players = $order['max_players'];
|
||||
$qty = $_POST['qty'];
|
||||
$invoice_duration = $_POST['invoice_duration'];
|
||||
$remote_control_password = $order['remote_control_password'];
|
||||
$ftp_password = $order['ftp_password'];
|
||||
$home_id = $order['home_id'];
|
||||
$status = 0;
|
||||
$finish_date = $order['finish_date'];
|
||||
$services = $db->resultQuery( "SELECT *
|
||||
FROM OGP_DB_PREFIXbilling_services
|
||||
WHERE service_id=".$db->realEscapeSingle($service_id) );
|
||||
$service = $services[0];
|
||||
//Calculating Price
|
||||
switch ($_POST['invoice_duration'])
|
||||
{
|
||||
case "day":
|
||||
$price = $service['price_monthly']/30;
|
||||
break;
|
||||
case "month":
|
||||
$price = $service['price_monthly'];
|
||||
break;
|
||||
case "year":
|
||||
$price = $service['price_monthly']*12;
|
||||
break;
|
||||
}
|
||||
|
||||
//Save order to DB
|
||||
//save the EXPIRED finish date into NEW finish date. Then check if FINISH DATE !=0 and move that + 1 month into status
|
||||
$order_id = saveOrderToDb($user_id,$service_id,$home_name,$ip,$max_players,$qty,$invoice_duration,$price,$remote_control_password,$ftp_password,$cart_id,$home_id,$status,$finish_date,"1");
|
||||
//Change the old order expiration to -3 so it can not be extended, since there is a new order managing the same game home.
|
||||
$db->query( "UPDATE OGP_DB_PREFIXbilling_orders
|
||||
SET status=-3
|
||||
WHERE order_id=".$db->realEscapeSingle($_POST['order_id']));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( !empty( $cart_id ) and isset( $_POST["extend_and_pay_paypal"] ) and $settings['paypal'] == "1" )
|
||||
{
|
||||
echo '<meta http-equiv="refresh" content="0;url=home.php?m=billing&p=paypal&cart_id='.$cart_id.'" >';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['remove']))
|
||||
{
|
||||
$cart_id = $_POST['cart_id'];
|
||||
if( isset( $_SESSION['CART'][$cart_id] ) )
|
||||
{
|
||||
unset($_SESSION['CART'][$cart_id]);
|
||||
unset($_SESSION['coupon_id']);
|
||||
}
|
||||
$order_id = $_POST['order_id'];
|
||||
$db->query( "DELETE FROM OGP_DB_PREFIXbilling_orders WHERE order_id=".$db->realEscapeSingle($order_id) );
|
||||
$orders_in_cart = $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE cart_id=".$db->realEscapeSingle($cart_id) );
|
||||
if( !$orders_in_cart )
|
||||
{
|
||||
$db->query( "DELETE FROM OGP_DB_PREFIXbilling_carts WHERE cart_id=".$db->realEscapeSingle($cart_id) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
<style>
|
||||
h4 {
|
||||
width:250px;
|
||||
height:25px;
|
||||
background:#f5f5f5;
|
||||
border-top-style:solid;
|
||||
border-top-color:#afafaf;
|
||||
border-top-width:1px;
|
||||
border-style: solid;
|
||||
border-color: #CFCFCF;
|
||||
border-width: 1px;
|
||||
padding-top:8px;
|
||||
text-align: center;
|
||||
font-family:"Trebuchet MS";
|
||||
}
|
||||
</style>
|
||||
<h2>Cart</h2>
|
||||
<!--
|
||||
SHOW ALL THE INVOICES FOR USER
|
||||
|
||||
<form method="post" action="?m=billing&p=orders">
|
||||
<input type="hidden" name="cart_id" value="<?php echo $order['cart_id'];?>">
|
||||
<input type="submit" value="All Orders">
|
||||
</form>
|
||||
-->
|
||||
<?php
|
||||
if( isset($_SESSION['CART']) and !empty($_SESSION['CART']) )
|
||||
{
|
||||
$carts[0] = $_SESSION['CART'];
|
||||
}
|
||||
|
||||
$user_carts = $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_carts WHERE user_id=".$db->realEscapeSingle($user_id) ." order by cart_id desc" );
|
||||
|
||||
|
||||
if( $user_carts >=1 )
|
||||
{
|
||||
|
||||
// SELECT WHAT KIND OF OLD INVOICES TO DISPLAY. WE NEED A BUTTON?
|
||||
foreach ( $user_carts as $user_cart )
|
||||
{
|
||||
$cart_id = $user_cart['cart_id'];
|
||||
|
||||
$carts[$cart_id] = $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_carts AS cart JOIN
|
||||
OGP_DB_PREFIXbilling_orders AS orders
|
||||
ON orders.cart_id=cart.cart_id
|
||||
WHERE orders.status IN (0, -1 , -2) AND (cart.cart_id=".$db->realEscapeSingle($cart_id). ") order by order_id asc");
|
||||
}
|
||||
}
|
||||
|
||||
if( empty( $carts ) )
|
||||
{
|
||||
print_failure( get_lang('there_are_no_orders_in_cart') );
|
||||
?>
|
||||
<a href="?m=billing&p=shop"><?php print_lang('back'); ?></a>
|
||||
<?php
|
||||
return;
|
||||
}
|
||||
foreach ( $carts as $orders )
|
||||
{
|
||||
if( !empty( $orders ) )
|
||||
{
|
||||
?>
|
||||
<center>
|
||||
<table style="width:95%;text-align:left;" class="center">
|
||||
<tr>
|
||||
<hr />
|
||||
|
||||
|
||||
<th>
|
||||
<?php print_lang("order_desc");?></th>
|
||||
<th>
|
||||
<?php print_lang("price");?>
|
||||
</th>
|
||||
<?php
|
||||
if(isset($orders[0]['paid']) and $orders[0]['paid'] == 3)
|
||||
{
|
||||
?>
|
||||
<th>
|
||||
<?php print_lang('expiration_date');?>
|
||||
</th>
|
||||
|
||||
<th>Status
|
||||
</th>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<th>
|
||||
</th>
|
||||
</tr>
|
||||
<?php
|
||||
$subtotal = 0;
|
||||
$total_orders = count($orders);
|
||||
$order_counter = 0;
|
||||
foreach($orders as $order)
|
||||
{
|
||||
$order_counter++;
|
||||
if ( $order['qty'] > 1 )
|
||||
$order['invoice_duration'] = $order['invoice_duration']."s";
|
||||
|
||||
$subtotal += ($order['price']* $order['max_players'] * $order['qty']);
|
||||
|
||||
?>
|
||||
<tr class="tr">
|
||||
|
||||
<td>
|
||||
<?php
|
||||
$rserver = $db->getRemoteServer($order['ip']);
|
||||
echo "Order# ".$order['order_id'] . " <b>".$order['home_name']."</b> Server ID ".$order['home_id'] ;
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
echo "$" . number_format( $order['price'], 2 ). " " .$order['currency'] . " per slot<br>"
|
||||
|
||||
. $order['max_players'] . " Slots<br>"
|
||||
. $order['qty'] . " " . $order['invoice_duration'] ;
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
if($order['paid'] == 0 and ($order['extended'] == 0))
|
||||
{
|
||||
?>
|
||||
<td align="center">
|
||||
<form method="post" action="">
|
||||
<input type="hidden" name="cart_id" value="<?php echo $order['cart_id'];?>">
|
||||
<input type="hidden" name="order_id" value="<?php echo @$order['order_id'];?>">
|
||||
|
||||
<input type="submit" name="remove" value="<?php print_lang("remove_from_cart");?>">
|
||||
</form>
|
||||
<?php if ($total_orders == $order_counter) { ?>
|
||||
<!--checkbox -->
|
||||
<form method="post" action="" onsubmit="if(document.getElementById('agree').checked) { return true; } else { alert('You must Agree to the TOS'); return false; }">
|
||||
<input type="hidden" name="cart_id" value="<?php echo $order['cart_id'];?>">
|
||||
<?php
|
||||
|
||||
//see if user is a new customer,
|
||||
//check number of orders they have had or if user is an admin (to be able to create server)
|
||||
$isAdmin = $db->isAdmin( $_SESSION['user_id'] );
|
||||
$result = $db->resultQuery("SELECT * FROM ogp_billing_orders WHERE user_id=".$user_id);
|
||||
$server_price = number_format( $order['price'], 2 );
|
||||
if(isset($settings['display_free'])) {
|
||||
$display_free = $settings['display_free'];
|
||||
}else {
|
||||
$display_free = false;
|
||||
}
|
||||
if((($server_price < 0.05 )|| ($isAdmin)) && ($display_free))
|
||||
//if($display_free)
|
||||
{
|
||||
if($isAdmin)
|
||||
{
|
||||
echo '<input name="buy" type="submit" value="Create Server" ><br>';
|
||||
echo 'When created EDIT this server to assign a user';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<input name="buy" type="submit" value="Create FREE Server" ><br>';
|
||||
}
|
||||
}
|
||||
|
||||
else{
|
||||
|
||||
if($settings['paypal'] == "1")
|
||||
echo '<input name="pay_paypal" type="submit" value="'.get_lang_f("pay_from", get_lang('paypal')).'">';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!--checkbox do regulamento -->
|
||||
<br><br><input type="checkbox" name="checkbox" value="check" id="agree" /><?php echo $settings['checkbox'];?>
|
||||
</form>
|
||||
<?php } ?>
|
||||
</td><?php
|
||||
}
|
||||
|
||||
|
||||
if($order['paid'] == 3)
|
||||
{
|
||||
$today=time();
|
||||
$formated_finish_date = date('d/M/Y H:i A',$order['finish_date']);
|
||||
|
||||
//status has a date for invoice
|
||||
if($order['status'] > 0)
|
||||
{
|
||||
$status = "<b style='color:green;'>Active</b>" ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//status is -1, invoice has been created
|
||||
elseif($order['status'] == -1)
|
||||
{
|
||||
$status = "<b style='color:yellow;'>Invoice Due</b>";
|
||||
}
|
||||
//invoice was not paid, server is expired and suspended
|
||||
elseif($order['status'] == -2)
|
||||
{
|
||||
$status = "<b style='color:red;'>Suspended</b>";
|
||||
}
|
||||
|
||||
//display the expiration date and invoice button.
|
||||
if($order['status'] > 0){$warning_status = "<b style='color:green;'>". $formated_finish_date ."</b>";}
|
||||
if($order['status'] == -1){$warning_status ="<b style='color:yellow;'>". $formated_finish_date ."</b>";}
|
||||
if($order['status'] == -2){$warning_status ="<b style='color:red;'>". $formated_finish_date ."</b>" ;}
|
||||
|
||||
?>
|
||||
<td>
|
||||
<?php echo "$warning_status";?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo "$status";
|
||||
|
||||
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
}
|
||||
|
||||
if( isset( $order['status'] ) and $order['status'] == "0" or $order['status'] == "-1" or $order['status'] == "-2")
|
||||
{
|
||||
?>
|
||||
<td></td></tr><tr><td>
|
||||
|
||||
<form method="post" action="">
|
||||
<input type="hidden" name="cart_id" value="<?php echo $order['cart_id'];?>">
|
||||
<input type="hidden" name="order_id" value="<?php echo $order['order_id'];?>">
|
||||
<input type="hidden" name="homeid" value="<?php echo $order['home_id'];?>">
|
||||
|
||||
<select name="slots">
|
||||
<?php
|
||||
//allow to change the amount of max players and invoice time when renewing server
|
||||
//get max_slots and min_slots from the billing_services for this game.
|
||||
|
||||
$services = $db->resultQuery( "SELECT *
|
||||
FROM OGP_DB_PREFIXbilling_services
|
||||
WHERE service_id=".$db->realEscapeSingle($order['service_id']) );
|
||||
$service = $services[0];
|
||||
$min = $service['slot_min_qty'];
|
||||
$max = $service['slot_max_qty'];
|
||||
$slots=$min;
|
||||
while($slots<= $max)
|
||||
{
|
||||
if($slots == $order['max_players'])
|
||||
{
|
||||
echo "<option value='$slots' selected>$slots slots</option>";
|
||||
}else{
|
||||
echo "<option value='$slots' >$slots slots</option>";
|
||||
}
|
||||
$slots++;
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select name="qty">
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$qty=1;
|
||||
while($qty<=12)
|
||||
{
|
||||
if($qty == $order['qty'])
|
||||
{
|
||||
echo "<option value='$qty' selected>$qty months</option>";
|
||||
}else{
|
||||
echo "<option value='$qty'>$qty months</option>";
|
||||
|
||||
}
|
||||
$qty++;
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<input type="hidden" name="invoice_duration" value="month">
|
||||
<!--
|
||||
<input type="submit" name="extend" value="<?php print_lang("extend");?>">
|
||||
-->
|
||||
<?php
|
||||
if($settings['paypal'] == "1")
|
||||
echo '<button name="update_cart" type="submit" value="update_cart">Update Invoice</button>';
|
||||
|
||||
echo '<button name="extend_and_pay_paypal" type="submit" value="extend_and_pay_paypal">Renew Service</button>';
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
</td><?php
|
||||
}
|
||||
?>
|
||||
</tr><?php
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<table style="width:95%;text-align:left;" class="center">
|
||||
<tr>
|
||||
<td>Amount</td>
|
||||
|
||||
<td>
|
||||
<?php
|
||||
echo "$" . number_format( $subtotal , 2 ). " " .$order['currency'];?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b><?php echo $coupon_name;?></b></td>
|
||||
<td>
|
||||
<?php
|
||||
//APPLY COUPON CODE HERE
|
||||
$coupon_discount_amt = $subtotal * ($coupon_discount / 100);
|
||||
echo "-$" . number_format($coupon_discount_amt,2);
|
||||
?></td><td>
|
||||
<table><tr>
|
||||
<form method="post" action="">
|
||||
<td class="child">
|
||||
<input type="text" name="coupon_code"size="5" value="<?php echo $coupon_code ?>"></input>
|
||||
</td>
|
||||
<td>
|
||||
<input type="submit" name="Apply Code" value="Apply Code"></input>
|
||||
</td>
|
||||
</tr></table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Discounted Subtotal</td>
|
||||
<td><?php $subtotal = $subtotal-$coupon_discount_amt;echo "$" . number_format( $subtotal , 2 ). " " .$order['currency'];?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
Tax Amount</td>
|
||||
<td>
|
||||
<?php echo "$" . number_format($order['tax_amount']/100 * $subtotal,2);?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php print_lang("total");?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
$total = $subtotal+($order['tax_amount']/100*$subtotal);
|
||||
echo "$" . number_format( $total , 2 ). " " .$order['currency'];
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if($order['paid'] == 1)
|
||||
{
|
||||
?>
|
||||
<form method="post" action="home.php?m=billing&p=create_servers">
|
||||
<input type="hidden" name="cart_id" value="<?php echo $order['cart_id'];?>">
|
||||
<?php
|
||||
if($order['extended'] == "1")
|
||||
{
|
||||
?>
|
||||
<input name="enable_server" type="submit" value="<?php print_lang("enable_server");?>">
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<input name="create_server" type="submit" value="<?php print_lang("create_server");?>">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
elseif($order['paid'] == 2)
|
||||
{
|
||||
echo get_lang_f("payment_is_pending_of_approval");
|
||||
}
|
||||
elseif($order['paid'] == 3)
|
||||
{
|
||||
?>
|
||||
<form method="post" action="?m=billing&p=bill">
|
||||
<input type="hidden" name="cart_id" value="<?php echo $order['cart_id'];?>">
|
||||
<input name="paid" type="submit" value="<?php print_lang("see_invoice");?>">
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</center>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<a href="?m=billing&p=shop"><?php print_lang('back'); ?></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
<?php
|
||||
function exec_ogp_module()
|
||||
{
|
||||
global $db;
|
||||
|
||||
//Querying UPDATE a service FROM DB
|
||||
if (isset($_POST['update_coupon']) )
|
||||
{
|
||||
$new_code = $db->realEscapeSingle($_POST['new_code']);
|
||||
$new_name = $db->realEscapeSingle($_POST['new_name']);
|
||||
$new_discount = $db->realEscapeSingle($_POST['new_discount']);
|
||||
$new_count = $db->realEscapeSingle($_POST['new_count']);
|
||||
$new_expires = $db->realEscapeSingle($_POST['new_expires']);
|
||||
$id = $db->realEscapeSingle($_POST['id']);
|
||||
|
||||
//Create INSERT query
|
||||
$qry_change_url = "UPDATE OGP_DB_PREFIXbilling_coupons
|
||||
SET code ='".$new_code."',
|
||||
name = '".$new_name."',
|
||||
discount ='".$new_discount."',
|
||||
count = '".$new_count."',
|
||||
expires = '".$new_expires."'
|
||||
WHERE id=".$id;
|
||||
$db->query($qry_change_url);
|
||||
}
|
||||
|
||||
//Querying INSERT new coupon INTO DB
|
||||
if(isset($_POST['add_coupon']))
|
||||
{
|
||||
$id = $_POST['id'];
|
||||
$code = $_POST['code'];
|
||||
$name = $_POST['name'];
|
||||
$discount = $_POST['discount'];
|
||||
$count= $_POST['count'];
|
||||
$expires = $_POST['expires'];
|
||||
|
||||
|
||||
$query = "INSERT INTO OGP_DB_PREFIXbilling_coupons(code, name, discount, count, expires) VALUES('".$code."', '".$name."', '".$discount."', '".$count."', '".$expires."')";
|
||||
$db->query($query);
|
||||
}
|
||||
|
||||
//Querying REMOVE coupon FROM DB
|
||||
if (isset($_POST['del_coupon']))
|
||||
{
|
||||
$db->query( "DELETE FROM OGP_DB_PREFIXbilling_coupons WHERE id=" . $db->realEscapeSingle($_POST['id']) );
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<!-- Show Coupons on DB -->
|
||||
</table>
|
||||
<br>
|
||||
<?php
|
||||
$result = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXbilling_coupons");
|
||||
if ($result > 0)
|
||||
{
|
||||
?>
|
||||
<h2><?php print_lang('current_coupons');?></h2>
|
||||
<table class="center" style='text-align:center;'>
|
||||
<tr>
|
||||
|
||||
<th><?php print_lang('code');?></th>
|
||||
<th><?php print_lang('coupon_name');?></th>
|
||||
<th><?php print_lang('discount');?></th>
|
||||
<th><?php print_lang('count');?></th>
|
||||
<th><?php print_lang('expires');?></th>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
foreach($result as $row)
|
||||
{
|
||||
?>
|
||||
<tr class="tr<?php $i = 0; echo($i++%2);?>">
|
||||
<form method="post" action="">
|
||||
<input name="id" type="hidden" value="<?php echo $row['id'];?>"/></td>
|
||||
<td><input name="new_code" type="text" value="<?php echo $row['code'];?>"/></td>
|
||||
<td><input name="new_name" type="text" value="<?php echo $row['name'];?>" /></td>
|
||||
<td><input name="new_discount" type="text" value="<?php echo $row['discount'];?>"/></td>
|
||||
<td><input name="new_count"type="text" value="<?php echo $row['count'];?>"/></td>
|
||||
<td><input name="new_expires" type="text" value="<?php echo $row['expires'];?>"/></td>
|
||||
<td><input type="submit" name="update_coupon" value="<?php print_lang('update_settings');?>"/></td>
|
||||
<td><input type="submit" name="del_coupon" value="<?php print_lang('del_coupon');?>"/></td>
|
||||
|
||||
</form>
|
||||
</tr><?php
|
||||
}
|
||||
//add new row to insert
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<td><input name="code" type="text" value=""/></td>
|
||||
<td><input name="name" type="text" value="" /></td>
|
||||
<td><input name="discount" type="text" value="0"/></td>
|
||||
<td><input name="count"type="text" value="0"/></td>
|
||||
<td><input name="expires" type="datetime-local" data-date-format="YYYY MMMM DD" value=""/></td>
|
||||
<td><input type="submit" name="add_coupon" value="<?php print_lang('add_coupon');?>"/></td>
|
||||
</form></table>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
<?php
|
||||
function exec_ogp_module()
|
||||
{
|
||||
global $db;
|
||||
|
||||
//Querying UPDATE a service FROM DB
|
||||
if (isset($_POST['update_coupon']) )
|
||||
{
|
||||
$new_code = $db->realEscapeSingle($_POST['new_code']);
|
||||
$new_name = $db->realEscapeSingle($_POST['new_name']);
|
||||
$new_discount = $db->realEscapeSingle($_POST['new_discount']);
|
||||
$new_count = $db->realEscapeSingle($_POST['new_count']);
|
||||
$new_expires = $db->realEscapeSingle($_POST['new_expires']);
|
||||
$id = $db->realEscapeSingle($_POST['id']);
|
||||
|
||||
//Create INSERT query
|
||||
$qry_change_url = "UPDATE OGP_DB_PREFIXbilling_coupons
|
||||
SET code ='".$new_code."',
|
||||
name = '".$new_name."',
|
||||
discount ='".$new_discount."',
|
||||
count = '".$new_count."',
|
||||
expires = '".$new_expires."'
|
||||
WHERE id=".$id;
|
||||
$db->query($qry_change_url);
|
||||
}
|
||||
|
||||
//Querying INSERT new coupon INTO DB
|
||||
if(isset($_POST['add_coupon']))
|
||||
{
|
||||
$id = $_POST['id'];
|
||||
$code = $_POST['code'];
|
||||
$name = $_POST['name'];
|
||||
$discount = $_POST['discount'];
|
||||
$count= $_POST['count'];
|
||||
$expires = $_POST['expires'];
|
||||
|
||||
|
||||
$query = "INSERT INTO OGP_DB_PREFIXbilling_coupons(code, name, discount, count, expires) VALUES('".$code."', '".$name."', '".$discount."', '".$count."', '".$expires."')";
|
||||
$db->query($query);
|
||||
}
|
||||
|
||||
//Querying REMOVE coupon FROM DB
|
||||
if (isset($_POST['del_coupon']))
|
||||
{
|
||||
$db->query( "DELETE FROM OGP_DB_PREFIXbilling_coupons WHERE id=" . $db->realEscapeSingle($_POST['id']) );
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<!-- Show Coupons on DB -->
|
||||
</table>
|
||||
<br>
|
||||
<?php
|
||||
$result = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXbilling_coupons");
|
||||
if ($result > 0)
|
||||
{
|
||||
?>
|
||||
<h2><?php print_lang('current_coupons');?></h2>
|
||||
<table class="center" style='text-align:center;'>
|
||||
<tr>
|
||||
|
||||
<th><?php print_lang('code');?></th>
|
||||
<th><?php print_lang('coupon_name');?></th>
|
||||
<th><?php print_lang('discount');?></th>
|
||||
<th><?php print_lang('count');?></th>
|
||||
<th><?php print_lang('expires');?></th>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
foreach($result as $row)
|
||||
{
|
||||
?>
|
||||
<tr class="tr<?php $i = 0; echo($i++%2);?>">
|
||||
<form method="post" action="">
|
||||
<input name="id" type="hidden" value="<?php echo $row['id'];?>"/></td>
|
||||
<td><input name="new_code" type="text" value="<?php echo $row['code'];?>"/></td>
|
||||
<td><input name="new_name" type="text" value="<?php echo $row['name'];?>" /></td>
|
||||
<td><input name="new_discount" type="text" value="<?php echo $row['discount'];?>"/></td>
|
||||
<td><input name="new_count"type="text" value="<?php echo $row['count'];?>"/></td>
|
||||
<td><input name="new_expires" type="text" value="<?php echo $row['expires'];?>"/></td>
|
||||
<td><input type="submit" name="update_coupon" value="<?php print_lang('update_settings');?>"/></td>
|
||||
<td><input type="submit" name="del_coupon" value="<?php print_lang('del_coupon');?>"/></td>
|
||||
|
||||
</form>
|
||||
</tr><?php
|
||||
}
|
||||
//add new row to insert
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<td><input name="code" type="text" value=""/></td>
|
||||
<td><input name="name" type="text" value="" /></td>
|
||||
<td><input name="discount" type="text" value="0"/></td>
|
||||
<td><input name="count"type="text" value="0"/></td>
|
||||
<td><input name="expires" type="datetime-local" data-date-format="YYYY MMMM DD" value=""/></td>
|
||||
<td><input type="submit" name="add_coupon" value="<?php print_lang('add_coupon');?>"/></td>
|
||||
</form></table>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,378 +0,0 @@
|
|||
<?php
|
||||
require_once("includes/lib_remote.php");
|
||||
require_once("modules/config_games/server_config_parser.php");
|
||||
|
||||
function exec_ogp_module()
|
||||
{
|
||||
global $db,$view,$settings;
|
||||
$user_id = $_SESSION['user_id'];
|
||||
if (isset($_POST['cart_id'])) {
|
||||
$cart_id = $_POST['cart_id'];
|
||||
}
|
||||
if(isset($_GET['cart_id'])){
|
||||
$cart_id = $_GET['cart_id'];
|
||||
}
|
||||
$cart_paid = $db->resultQuery( "SELECT paid FROM OGP_DB_PREFIXbilling_carts WHERE cart_id=".$db->realEscapeSingle($cart_id) );
|
||||
$isAdmin = $db->isAdmin( $_SESSION['user_id'] );
|
||||
if ( $isAdmin ){
|
||||
$orders = $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE cart_id=".$db->realEscapeSingle($cart_id) );
|
||||
} else {
|
||||
$orders = $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE cart_id=".$db->realEscapeSingle($cart_id)." AND user_id=".$db->realEscapeSingle($user_id) );
|
||||
}
|
||||
if( !empty($orders) and !empty($cart_paid) )
|
||||
{
|
||||
|
||||
foreach($orders as $order)
|
||||
{
|
||||
$order_id = $order['order_id'];
|
||||
$service_id = $order['service_id'];
|
||||
$home_name = $order['home_name'];
|
||||
$remote_control_password = $order['remote_control_password'];
|
||||
$ftp_password = $order['ftp_password'];
|
||||
$ip = $order['ip'];
|
||||
$max_players = $order['max_players'];
|
||||
$user_id = $order['user_id'];
|
||||
$extended = $order['extended'] == "1" ? TRUE : FALSE;
|
||||
//Query service info
|
||||
$service = $db->resultQuery( "SELECT *
|
||||
FROM OGP_DB_PREFIXbilling_services
|
||||
WHERE service_id=".$db->realEscapeSingle($service_id) );
|
||||
|
||||
if( !empty( $service[0] ) )
|
||||
{
|
||||
$home_cfg_id = $service[0]['home_cfg_id'];
|
||||
$mod_cfg_id = $service[0]['mod_cfg_id'];
|
||||
//remote_server_id has been stored in IP_ID
|
||||
//$remote_server_id = $service[0]['remote_server_id'];
|
||||
$remote_server_id = $order['ip'];
|
||||
|
||||
$ftp = $service[0]['ftp'];
|
||||
$install_method = $service[0]['install_method'];
|
||||
$manual_url = $service[0]['manual_url'];
|
||||
$access_rights = $service[0]['access_rights'];
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
if($extended)
|
||||
{
|
||||
$home_id = $order['home_id'];
|
||||
|
||||
//Get The home info without mods in 1 array (Necesary for remote connection).
|
||||
$home_info = $db->getGameHomeWithoutMods($home_id);
|
||||
|
||||
//Create the remote connection
|
||||
$remote = new OGPRemoteLibrary($home_info['agent_ip'],$home_info['agent_port'],$home_info['encryption_key'],$home_info['timeout']);
|
||||
|
||||
//Reassign the server
|
||||
$db->assignHomeTo( "user", $user_id, $home_id, $access_rights );
|
||||
|
||||
//Reenable the FTP account
|
||||
if ($ftp == "enabled")
|
||||
{
|
||||
$remote->ftp_mgr("useradd", $home_info['home_id'], $home_info['ftp_password'], $home_info['home_path']);
|
||||
$db->changeFtpStatus('enabled',$home_info['home_id']);
|
||||
}
|
||||
echo "<h4>Server Installed, Check your Email for Details</h4><br>";
|
||||
|
||||
//Panel Log
|
||||
$db->logger( "RENEWED SERVER " . $home_id);
|
||||
// SEND EMAIL
|
||||
$settings = $db->getSettings();
|
||||
$subject = "Gameserver Renewel at " . $settings['panel_name'];
|
||||
$email = $db->resultQuery(" SELECT DISTINCT users_email
|
||||
FROM ogp_users, ogp_billing_orders
|
||||
WHERE ogp_users.user_id = $user_id")[0]["users_email"];
|
||||
|
||||
$message = "Your server, " . $home_name ." ID #". $home_id . " at " . $settings['panel_name'] . " has just been renewed.<br>
|
||||
Thank You for your continued support.<br>
|
||||
If you have any questions or requests, visit our website or contact us directly in our Discord Server.";
|
||||
|
||||
$mail = mymail($email, $subject, $message, $settings);
|
||||
$rundate = date('d/M/y G:i',$now);
|
||||
|
||||
if (!$mail)
|
||||
$db->logger( "Email FAILED - Server Renewed " . $home_id);
|
||||
// END EMAIL
|
||||
|
||||
//WEBHOOK Discord=======================================================================================
|
||||
|
||||
|
||||
$webhookurl = $settings['webhookurl'];
|
||||
|
||||
$msg = "The ". $home_name ." server ID #". $home_id . " has just been renewed.";
|
||||
$json_data = array ('content'=>"$msg");
|
||||
$make_json = json_encode($json_data);
|
||||
$ch = curl_init( $webhookurl );
|
||||
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
|
||||
curl_setopt( $ch, CURLOPT_POST, 1);
|
||||
curl_setopt( $ch, CURLOPT_POSTFIELDS, $make_json);
|
||||
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt( $ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
$response = curl_exec( $ch );
|
||||
//If you need to debug, or find out why you can't send message uncomment line below, and execute script.
|
||||
//echo $response;
|
||||
//end WEBHOOK Discord
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//OPTIONS, change it at your choice;
|
||||
$extra_params = "";//no extra params defined by default
|
||||
$cpu_affinity = "NA";//Affinity to one core/thread of the cpu by number, use NA to disable it
|
||||
$nice = "0";//Min priority=19 Max Priority=-19
|
||||
|
||||
//Add Game home to database
|
||||
//HARD CODE TO /home/gameserver/
|
||||
$rserver = $db->getRemoteServer($remote_server_id);
|
||||
$game_path = "/home/gameserver/";
|
||||
$home_id = $db->addGameHome( $remote_server_id, $user_id, $home_cfg_id, $game_path, $home_name, $remote_control_password, $ftp_password);
|
||||
|
||||
//Add IP:Port Pair to the Game Home
|
||||
//need to get the IP_ID for this remote server.
|
||||
$result = $db->resultQuery("SELECT ip_id FROM OGP_DB_PREFIXremote_server_ips WHERE remote_server_id=".$ip);
|
||||
foreach ($result as $rs)
|
||||
{
|
||||
$ip_id = $rs['ip_id'];
|
||||
}
|
||||
$add_port = $db->addGameIpPort( $home_id, $ip_id, $db->getNextAvailablePort($ip_id,$home_cfg_id) );
|
||||
|
||||
//Assign the Game Mod to the Game Home
|
||||
$mod_id = $db->addModToGameHome( $home_id, $mod_cfg_id );
|
||||
$db->updateGameModParams( $max_players, $extra_params, $cpu_affinity, $nice, $home_id, $mod_cfg_id );
|
||||
$db->assignHomeTo( "user", $user_id, $home_id, $access_rights );
|
||||
|
||||
//Get The home info without mods in 1 array (Necesary for remote connection).
|
||||
$home_info = $db->getGameHomeWithoutMods($home_id);
|
||||
|
||||
//Create the remote connection
|
||||
$remote = new OGPRemoteLibrary($home_info['agent_ip'],$home_info['agent_port'],$home_info['encryption_key'],$home_info['timeout']);
|
||||
|
||||
//Get Full home info in 1 array
|
||||
$home_info = $db->getGameHome($home_id);
|
||||
|
||||
//Read the Game Config from the XML file
|
||||
$server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$home_info['home_cfg_file']);
|
||||
|
||||
//Get Values from XML
|
||||
$modkey = $home_info['mods'][$mod_id]['mod_key'];
|
||||
$mod_xml = xml_get_mod($server_xml, $modkey);
|
||||
$installer_name = $mod_xml->installer_name;
|
||||
$mod_cfg_id = $home_info['mods'][$mod_id]['mod_cfg_id'];
|
||||
|
||||
//Get Preinstall commands from xml
|
||||
$precmd = $server_xml->pre_install;
|
||||
|
||||
|
||||
//Get Postinstall commands from xml
|
||||
$postcmd = $server_xml->post_install;
|
||||
|
||||
|
||||
//Enable FTP account in remote server
|
||||
if ($ftp == "enabled")
|
||||
{
|
||||
$remote->ftp_mgr("useradd", $home_info['home_id'], $home_info['ftp_password'], $home_info['home_path']);
|
||||
$db->changeFtpStatus('enabled',$home_info['home_id']);
|
||||
}
|
||||
|
||||
//Install files for this service in the remote server
|
||||
// -Steam
|
||||
$exec_folder_path = clean_path($home_info['home_path'] . "/" . $server_xml->exe_location );
|
||||
$exec_path = clean_path($exec_folder_path . "/" . $server_xml->server_exec_name );
|
||||
|
||||
if ($install_method == "steam")
|
||||
{
|
||||
if ( $server_xml->installer == "steamcmd" )
|
||||
{
|
||||
if( preg_match("/win32/", $server_xml->game_key) OR preg_match("/win64/", $server_xml->game_key) )
|
||||
$cfg_os = "windows";
|
||||
elseif( preg_match("/linux/", $server_xml->game_key) )
|
||||
$cfg_os = "linux";
|
||||
|
||||
// Some games like L4D2 require anonymous login
|
||||
if($mod_xml->installer_login){
|
||||
$login = $mod_xml->installer_login;
|
||||
$pass = '';
|
||||
}else{
|
||||
$login = $settings['steam_user'];
|
||||
$pass = $settings['steam_pass'];
|
||||
}
|
||||
|
||||
$modname = ( $installer_name == '90' and !preg_match("/(cstrike|valve)/", $modkey) ) ? $modkey : '';
|
||||
$betaname = isset($mod_xml->betaname) ? $mod_xml->betaname : '';
|
||||
$betapwd = isset($mod_xml->betapwd) ? $mod_xml->betapwd : '';
|
||||
$arch = isset($mod_xml->steam_bitness) ? $mod_xml->steam_bitness : '';
|
||||
|
||||
$remote->steam_cmd( $home_id,$home_info['home_path'],$installer_name,$modname,
|
||||
$betaname,$betapwd,$login,$pass,$settings['steam_guard'],
|
||||
$exec_folder_path,$exec_path,$precmd,$postcmd,$cfg_os,'',$arch);
|
||||
}
|
||||
}
|
||||
// -Rsync
|
||||
elseif ($install_method == "rsync")
|
||||
{
|
||||
|
||||
//Rsync Server
|
||||
$url = "files.iaregamer.com";
|
||||
//OS
|
||||
if( preg_match("/win32/", $server_xml->game_key) OR preg_match("/win64/", $server_xml->game_key) )
|
||||
$os = "windows";
|
||||
elseif( preg_match("/linux/", $server_xml->game_key) )
|
||||
$os = "linux";
|
||||
//Rsync Game Name
|
||||
//JUST SET RS_GNAME TO GAME xml NAME
|
||||
$rs_gname = $server_xml->game_key;
|
||||
|
||||
//Starting Sync
|
||||
$full_url = "$url/rsync_installer/$rs_gname/$os/";
|
||||
|
||||
|
||||
|
||||
$remote->start_rsync_install($home_id,$home_info['home_path'],"$full_url",$exec_folder_path,$exec_path,$precmd,$postcmd);
|
||||
}
|
||||
// -Manual
|
||||
elseif ($install_method == "manual")
|
||||
{
|
||||
// Start File Download and uncompress
|
||||
$filename = !empty($manual_url) ? substr($manual_url, -9) : "";
|
||||
$remote->start_file_download($manual_url,$home_info['home_path'],$filename,"uncompress");
|
||||
}
|
||||
echo "<h4><br><p>".get_lang('starting_installations')."</p></h4><br>";
|
||||
//PANEL LOG
|
||||
$db->logger( "CREATED NEW SERVER " . $home_id);
|
||||
// SEND EMAIL to new server only
|
||||
if($order['finish_date'] == 0){
|
||||
$settings = $db->getSettings();
|
||||
$subject = "New Gameserver installed at " . $settings['panel_name'];
|
||||
$email = $db->resultQuery(" SELECT DISTINCT users_email
|
||||
FROM ogp_users, ogp_billing_orders
|
||||
WHERE ogp_users.user_id = $user_id")[0]["users_email"];
|
||||
|
||||
$message = "Your server, " . $home_name ." ID #". $home_id . " at " . $settings['panel_name'] . " has just been created.<br>
|
||||
Thank You for your continued support.<br>
|
||||
If you have any questions or requests, visit our website or contact us directly in our Discord Server.
|
||||
You can login to the Game Panel and click on Game Monitor to see your server. <br><br>
|
||||
Thank you!<br> ";
|
||||
$mail = mymail($email, $subject, $message, $settings);
|
||||
$rundate = date('d/M/y G:i',$now);
|
||||
|
||||
if (!$mail)
|
||||
$db->logger( "Email FAILED - Server Created " . $home_id);
|
||||
|
||||
|
||||
//WEBHOOK Discord=======================================================================================
|
||||
|
||||
$webhookurl = "https://discord.com/api/webhooks/710275918274363412/g5Tr-EUdEnLfFryOlscxJ6FuPiSJuE6EMKRYmh9UGMiqTUxU5-y9CQrBlDJW7znr0Tol";
|
||||
//$settings['webhookurl'];
|
||||
|
||||
|
||||
$msg = "A new server, ". $home_name ." ID #". $home_id . ", has just been created.";
|
||||
$json_data = array ('content'=>"$msg");
|
||||
$make_json = json_encode($json_data);
|
||||
$ch = curl_init( $webhookurl );
|
||||
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
|
||||
curl_setopt( $ch, CURLOPT_POST, 1);
|
||||
curl_setopt( $ch, CURLOPT_POSTFIELDS, $make_json);
|
||||
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt( $ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
$response = curl_exec( $ch );
|
||||
//If you need to debug, or find out why you can't send message uncomment line below, and execute script.
|
||||
//echo $response;
|
||||
//end WEBHOOK Discord
|
||||
}
|
||||
// END EMAIL
|
||||
|
||||
|
||||
}
|
||||
// Set expiration date in ogp database
|
||||
//status is -3 -2 -1 0 and 1
|
||||
// deleted, suspended, invoiced, inactive, active
|
||||
//finish_date the server will be suspended
|
||||
//in cron_shop the finish_date is used to delete the server
|
||||
//several days after being suspended
|
||||
if ($order['invoice_duration'] == "day")
|
||||
{
|
||||
|
||||
if($order['finish_date'] == 0){
|
||||
$finish_date = strtotime('+'.$order['qty'].' day');
|
||||
$status = 1;
|
||||
}
|
||||
else{
|
||||
//this is a renewel, start from end of previous order
|
||||
$finish_date = strtotime('+'.$order['qty'].' day',$order['finish_date']);
|
||||
$status = 1;
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($order['invoice_duration'] == "month")
|
||||
{
|
||||
// this is a new order
|
||||
if($order['finish_date'] == 0){
|
||||
$finish_date = strtotime('+'.$order['qty'].' month');
|
||||
$status = 1;
|
||||
|
||||
}
|
||||
else{
|
||||
//this is a renewel, start from end of previous order
|
||||
$finish_date = strtotime('+'.$order['qty'].' month',$order['finish_date']);
|
||||
$status = 1;
|
||||
}
|
||||
}
|
||||
elseif ($order['invoice_duration'] == "year")
|
||||
{
|
||||
// this is a new order
|
||||
if($order['finish_date'] == 0){
|
||||
$finish_date = strtotime('+'.$order['qty'].' year');
|
||||
$status = 1;
|
||||
}
|
||||
else{
|
||||
//this is a renewel, start from end of previous order
|
||||
$finish_date = strtotime('+'.$order['qty'].' year',$order['finish_date']);
|
||||
$status = 1;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// set order status
|
||||
$db->query("UPDATE OGP_DB_PREFIXbilling_orders
|
||||
SET status='" . $db->realEscapeSingle($status) . "'
|
||||
WHERE order_id=".$db->realEscapeSingle($order_id));
|
||||
|
||||
// set the order expiration
|
||||
$db->query("UPDATE OGP_DB_PREFIXbilling_orders
|
||||
SET finish_date='" . $db->realEscapeSingle($finish_date) . "'
|
||||
WHERE order_id=".$db->realEscapeSingle($order_id));
|
||||
|
||||
// Save home id created by this order
|
||||
$db->query("UPDATE OGP_DB_PREFIXbilling_orders
|
||||
SET home_id='" . $db->realEscapeSingle($home_id) . "' WHERE order_id=".$db->realEscapeSingle($order_id));
|
||||
|
||||
}
|
||||
|
||||
//Update Cart Payment Status as 3(paid and installed)
|
||||
$db->query("UPDATE OGP_DB_PREFIXbilling_carts
|
||||
SET paid=3
|
||||
WHERE cart_id=".$db->realEscapeSingle($cart_id));
|
||||
|
||||
// Set payment/creation date
|
||||
$date = date('d M Y');
|
||||
$db->query("UPDATE OGP_DB_PREFIXbilling_carts
|
||||
SET date='" . $db->realEscapeSingle($date) . "'
|
||||
WHERE cart_id=".$db->realEscapeSingle($cart_id));
|
||||
|
||||
$db->query( "UPDATE OGP_DB_PREFIXgame_mods SET max_players= ".$order['max_players']." WHERE home_id=".$db->realEscapeSingle($home_id));
|
||||
|
||||
|
||||
//Refresh to Game Monitor.
|
||||
$view->refresh("home.php?m=gamemanager&p=game_monitor");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,375 +0,0 @@
|
|||
<?php
|
||||
require_once("includes/lib_remote.php");
|
||||
require_once("modules/config_games/server_config_parser.php");
|
||||
|
||||
function exec_ogp_module()
|
||||
{
|
||||
global $db,$view,$settings;
|
||||
$user_id = $_SESSION['user_id'];
|
||||
if (isset($_POST['cart_id'])) {
|
||||
$cart_id = $_POST['cart_id'];
|
||||
}
|
||||
if(isset($_GET['cart_id'])){
|
||||
$cart_id = $_GET['cart_id'];
|
||||
}
|
||||
$cart_paid = $db->resultQuery( "SELECT paid FROM OGP_DB_PREFIXbilling_carts WHERE cart_id=".$db->realEscapeSingle($cart_id) );
|
||||
$isAdmin = $db->isAdmin( $_SESSION['user_id'] );
|
||||
if ( $isAdmin ){
|
||||
$orders = $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE cart_id=".$db->realEscapeSingle($cart_id) );
|
||||
} else {
|
||||
$orders = $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE cart_id=".$db->realEscapeSingle($cart_id)." AND user_id=".$db->realEscapeSingle($user_id) );
|
||||
}
|
||||
if( !empty($orders) and !empty($cart_paid) )
|
||||
{
|
||||
|
||||
foreach($orders as $order)
|
||||
{
|
||||
$order_id = $order['order_id'];
|
||||
$service_id = $order['service_id'];
|
||||
$home_name = $order['home_name'];
|
||||
$remote_control_password = $order['remote_control_password'];
|
||||
$ftp_password = $order['ftp_password'];
|
||||
$ip = $order['ip'];
|
||||
$max_players = $order['max_players'];
|
||||
$user_id = $order['user_id'];
|
||||
$extended = $order['extended'] == "1" ? TRUE : FALSE;
|
||||
//Query service info
|
||||
$service = $db->resultQuery( "SELECT *
|
||||
FROM OGP_DB_PREFIXbilling_services
|
||||
WHERE service_id=".$db->realEscapeSingle($service_id) );
|
||||
|
||||
if( !empty( $service[0] ) )
|
||||
{
|
||||
$home_cfg_id = $service[0]['home_cfg_id'];
|
||||
$mod_cfg_id = $service[0]['mod_cfg_id'];
|
||||
//remote_server_id has been stored in IP_ID
|
||||
//$remote_server_id = $service[0]['remote_server_id'];
|
||||
$remote_server_id = $order['ip'];
|
||||
|
||||
$ftp = $service[0]['ftp'];
|
||||
$install_method = $service[0]['install_method'];
|
||||
$manual_url = $service[0]['manual_url'];
|
||||
$access_rights = $service[0]['access_rights'];
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
if($extended)
|
||||
{
|
||||
$home_id = $order['home_id'];
|
||||
|
||||
//Get The home info without mods in 1 array (Necesary for remote connection).
|
||||
$home_info = $db->getGameHomeWithoutMods($home_id);
|
||||
|
||||
//Create the remote connection
|
||||
$remote = new OGPRemoteLibrary($home_info['agent_ip'],$home_info['agent_port'],$home_info['encryption_key'],$home_info['timeout']);
|
||||
|
||||
//Reassign the server
|
||||
$db->assignHomeTo( "user", $user_id, $home_id, $access_rights );
|
||||
|
||||
//Reenable the FTP account
|
||||
if ($ftp == "enabled")
|
||||
{
|
||||
$remote->ftp_mgr("useradd", $home_info['home_id'], $home_info['ftp_password'], $home_info['home_path']);
|
||||
$db->changeFtpStatus('enabled',$home_info['home_id']);
|
||||
}
|
||||
echo "<h4>Server Installed, Check your Email for Details</h4><br>";
|
||||
|
||||
//Panel Log
|
||||
$db->logger( "RENEWED SERVER " . $home_id);
|
||||
// SEND EMAIL
|
||||
$settings = $db->getSettings();
|
||||
$subject = "Gameserver Renewel at " . $settings['panel_name'];
|
||||
$email = $db->resultQuery(" SELECT DISTINCT users_email
|
||||
FROM ogp_users, ogp_billing_orders
|
||||
WHERE ogp_users.user_id = $user_id")[0]["users_email"];
|
||||
|
||||
$message = "Your server, " . $home_name ." ID #". $home_id . " at " . $settings['panel_name'] . " has just been renewed.<br>
|
||||
Thank You for your continued support.<br>
|
||||
If you have any questions or requests, visit our website or contact us directly in our Discord Server.";
|
||||
|
||||
$mail = mymail($email, $subject, $message, $settings);
|
||||
$rundate = date('d/M/y G:i',$now);
|
||||
|
||||
if (!$mail)
|
||||
$db->logger( "Email FAILED - Server Renewed " . $home_id);
|
||||
// END EMAIL
|
||||
|
||||
//WEBHOOK Discord=======================================================================================
|
||||
|
||||
|
||||
$webhookurl = $settings['webhookurl'];
|
||||
|
||||
$msg = "The ". $home_name ." server ID #". $home_id . " has just been renewed.";
|
||||
$json_data = array ('content'=>"$msg");
|
||||
$make_json = json_encode($json_data);
|
||||
$ch = curl_init( $webhookurl );
|
||||
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
|
||||
curl_setopt( $ch, CURLOPT_POST, 1);
|
||||
curl_setopt( $ch, CURLOPT_POSTFIELDS, $make_json);
|
||||
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt( $ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
$response = curl_exec( $ch );
|
||||
//If you need to debug, or find out why you can't send message uncomment line below, and execute script.
|
||||
//echo $response;
|
||||
//end WEBHOOK Discord
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//OPTIONS, change it at your choice;
|
||||
$extra_params = "";//no extra params defined by default
|
||||
$cpu_affinity = "NA";//Affinity to one core/thread of the cpu by number, use NA to disable it
|
||||
$nice = "0";//Min priority=19 Max Priority=-19
|
||||
|
||||
//Add Game home to database
|
||||
//HARD CODE TO /home/gameserver/
|
||||
$rserver = $db->getRemoteServer($remote_server_id);
|
||||
$game_path = "/home/gameserver/";
|
||||
$home_id = $db->addGameHome( $remote_server_id, $user_id, $home_cfg_id, $game_path, $home_name, $remote_control_password, $ftp_password);
|
||||
|
||||
//Add IP:Port Pair to the Game Home
|
||||
//need to get the IP_ID for this remote server.
|
||||
$result = $db->resultQuery("SELECT ip_id FROM OGP_DB_PREFIXremote_server_ips WHERE remote_server_id=".$ip);
|
||||
foreach ($result as $rs)
|
||||
{
|
||||
$ip_id = $rs['ip_id'];
|
||||
}
|
||||
$add_port = $db->addGameIpPort( $home_id, $ip_id, $db->getNextAvailablePort($ip_id,$home_cfg_id) );
|
||||
|
||||
//Assign the Game Mod to the Game Home
|
||||
$mod_id = $db->addModToGameHome( $home_id, $mod_cfg_id );
|
||||
$db->updateGameModParams( $max_players, $extra_params, $cpu_affinity, $nice, $home_id, $mod_cfg_id );
|
||||
$db->assignHomeTo( "user", $user_id, $home_id, $access_rights );
|
||||
|
||||
//Get The home info without mods in 1 array (Necesary for remote connection).
|
||||
$home_info = $db->getGameHomeWithoutMods($home_id);
|
||||
|
||||
//Create the remote connection
|
||||
$remote = new OGPRemoteLibrary($home_info['agent_ip'],$home_info['agent_port'],$home_info['encryption_key'],$home_info['timeout']);
|
||||
|
||||
//Get Full home info in 1 array
|
||||
$home_info = $db->getGameHome($home_id);
|
||||
|
||||
//Read the Game Config from the XML file
|
||||
$server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$home_info['home_cfg_file']);
|
||||
|
||||
//Get Values from XML
|
||||
$modkey = $home_info['mods'][$mod_id]['mod_key'];
|
||||
$mod_xml = xml_get_mod($server_xml, $modkey);
|
||||
$installer_name = $mod_xml->installer_name;
|
||||
$mod_cfg_id = $home_info['mods'][$mod_id]['mod_cfg_id'];
|
||||
|
||||
//Get Preinstall commands from xml
|
||||
$precmd = $server_xml->pre_install;
|
||||
|
||||
|
||||
//Get Postinstall commands from xml
|
||||
$postcmd = $server_xml->post_install;
|
||||
|
||||
|
||||
//Enable FTP account in remote server
|
||||
if ($ftp == "enabled")
|
||||
{
|
||||
$remote->ftp_mgr("useradd", $home_info['home_id'], $home_info['ftp_password'], $home_info['home_path']);
|
||||
$db->changeFtpStatus('enabled',$home_info['home_id']);
|
||||
}
|
||||
|
||||
//Install files for this service in the remote server
|
||||
// -Steam
|
||||
$exec_folder_path = clean_path($home_info['home_path'] . "/" . $server_xml->exe_location );
|
||||
$exec_path = clean_path($exec_folder_path . "/" . $server_xml->server_exec_name );
|
||||
|
||||
if ($install_method == "steam")
|
||||
{
|
||||
if ( $server_xml->installer == "steamcmd" )
|
||||
{
|
||||
if( preg_match("/win32/", $server_xml->game_key) OR preg_match("/win64/", $server_xml->game_key) )
|
||||
$cfg_os = "windows";
|
||||
elseif( preg_match("/linux/", $server_xml->game_key) )
|
||||
$cfg_os = "linux";
|
||||
|
||||
// Some games like L4D2 require anonymous login
|
||||
if($mod_xml->installer_login){
|
||||
$login = $mod_xml->installer_login;
|
||||
$pass = '';
|
||||
}else{
|
||||
$login = $settings['steam_user'];
|
||||
$pass = $settings['steam_pass'];
|
||||
}
|
||||
|
||||
$modname = ( $installer_name == '90' and !preg_match("/(cstrike|valve)/", $modkey) ) ? $modkey : '';
|
||||
$betaname = isset($mod_xml->betaname) ? $mod_xml->betaname : '';
|
||||
$betapwd = isset($mod_xml->betapwd) ? $mod_xml->betapwd : '';
|
||||
$arch = isset($mod_xml->steam_bitness) ? $mod_xml->steam_bitness : '';
|
||||
|
||||
$remote->steam_cmd( $home_id,$home_info['home_path'],$installer_name,$modname,
|
||||
$betaname,$betapwd,$login,$pass,$settings['steam_guard'],
|
||||
$exec_folder_path,$exec_path,$precmd,$postcmd,$cfg_os,'',$arch);
|
||||
}
|
||||
}
|
||||
// -Rsync
|
||||
elseif ($install_method == "rsync")
|
||||
{
|
||||
|
||||
//Rsync Server
|
||||
$url = "files.iaregamer.com";
|
||||
//OS
|
||||
if( preg_match("/win32/", $server_xml->game_key) OR preg_match("/win64/", $server_xml->game_key) )
|
||||
$os = "windows";
|
||||
elseif( preg_match("/linux/", $server_xml->game_key) )
|
||||
$os = "linux";
|
||||
//Rsync Game Name
|
||||
//JUST SET RS_GNAME TO GAME xml NAME
|
||||
$rs_gname = $server_xml->game_key;
|
||||
|
||||
//Starting Sync
|
||||
$full_url = "$url/rsync_installer/$rs_gname/$os/";
|
||||
|
||||
|
||||
|
||||
$remote->start_rsync_install($home_id,$home_info['home_path'],"$full_url",$exec_folder_path,$exec_path,$precmd,$postcmd);
|
||||
}
|
||||
// -Manual
|
||||
elseif ($install_method == "manual")
|
||||
{
|
||||
// Start File Download and uncompress
|
||||
$filename = !empty($manual_url) ? substr($manual_url, -9) : "";
|
||||
$remote->start_file_download($manual_url,$home_info['home_path'],$filename,"uncompress");
|
||||
}
|
||||
echo "<h4><br><p>".get_lang('starting_installations')."</p></h4><br>";
|
||||
//PANEL LOG
|
||||
$db->logger( "CREATED NEW SERVER " . $home_id);
|
||||
// SEND EMAIL to new server only
|
||||
if($order['finish_date'] == 0){
|
||||
$settings = $db->getSettings();
|
||||
$subject = "New Gameserver installed at " . $settings['panel_name'];
|
||||
$email = $db->resultQuery(" SELECT DISTINCT users_email
|
||||
FROM ogp_users, ogp_billing_orders
|
||||
WHERE ogp_users.user_id = $user_id")[0]["users_email"];
|
||||
|
||||
$message = "Your server, " . $home_name ." ID #". $home_id . " at " . $settings['panel_name'] . " has just been created.<br>
|
||||
Thank You for your continued support.<br>
|
||||
If you have any questions or requests, visit our website or contact us directly in our Discord Server.
|
||||
You can login to the Game Panel and click on Game Monitor to see your server. <br><br>
|
||||
Thank you!<br> ";
|
||||
$mail = mymail($email, $subject, $message, $settings);
|
||||
$rundate = date('d/M/y G:i',$now);
|
||||
|
||||
if (!$mail)
|
||||
$db->logger( "Email FAILED - Server Created " . $home_id);
|
||||
|
||||
|
||||
//WEBHOOK Discord=======================================================================================
|
||||
|
||||
$webhookurl = $settings['webhookurl'];
|
||||
|
||||
|
||||
$msg = "A new server, ". $home_name ." ID #". $home_id . ", has just been created.";
|
||||
$json_data = array ('content'=>"$msg");
|
||||
$make_json = json_encode($json_data);
|
||||
$ch = curl_init( $webhookurl );
|
||||
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
|
||||
curl_setopt( $ch, CURLOPT_POST, 1);
|
||||
curl_setopt( $ch, CURLOPT_POSTFIELDS, $make_json);
|
||||
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt( $ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
$response = curl_exec( $ch );
|
||||
//If you need to debug, or find out why you can't send message uncomment line below, and execute script.
|
||||
//echo $response;
|
||||
//end WEBHOOK Discord
|
||||
}
|
||||
// END EMAIL
|
||||
|
||||
|
||||
}
|
||||
// Set expiration date in ogp database
|
||||
//End_date is when the invoice is printed.
|
||||
//finish_date the server will be suspended
|
||||
//in cron_shop the finish_date is used to delete the server
|
||||
//several days after being suspended
|
||||
if ($order['invoice_duration'] == "day")
|
||||
{
|
||||
|
||||
if($order['finish_date'] == 0){
|
||||
$finish_date = strtotime('+'.$order['qty'].' day');
|
||||
$end_date = strtotime('- 2 day',$finish_date);
|
||||
}
|
||||
else{
|
||||
//this is a renewel, start from end of previous order
|
||||
$finish_date = strtotime('+'.$order['qty'].' day',$order['finish_date']);
|
||||
$end_date = strtotime('- 6 hour', $finish_date);
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($order['invoice_duration'] == "month")
|
||||
{
|
||||
// this is a new order
|
||||
if($order['finish_date'] == 0){
|
||||
$finish_date = strtotime('+'.$order['qty'].' month');
|
||||
$end_date = strtotime('- 7 day',$finish_date);
|
||||
|
||||
}
|
||||
else{
|
||||
//this is a renewel, start from end of previous order
|
||||
$finish_date = strtotime('+'.$order['qty'].' month',$order['finish_date']);
|
||||
$end_date = strtotime('- 7 day',$finish_date);
|
||||
}
|
||||
}
|
||||
elseif ($order['invoice_duration'] == "year")
|
||||
{
|
||||
// this is a new order
|
||||
if($order['finish_date'] == 0){
|
||||
$finish_date = strtotime('+'.$order['qty'].' year');
|
||||
$end_date = strtotime('- 2 week',$finish_date);
|
||||
}
|
||||
else{
|
||||
//this is a renewel, start from end of previous order
|
||||
$finish_date = strtotime('+'.$order['qty'].' year',$order['finish_date']);
|
||||
$end_date = strtotime('- 2 week',$finish_date);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// set order expire date
|
||||
$db->query("UPDATE OGP_DB_PREFIXbilling_orders
|
||||
SET end_date='" . $db->realEscapeSingle($end_date) . "'
|
||||
WHERE order_id=".$db->realEscapeSingle($order_id));
|
||||
|
||||
$db->query("UPDATE OGP_DB_PREFIXbilling_orders
|
||||
SET finish_date='" . $db->realEscapeSingle($finish_date) . "'
|
||||
WHERE order_id=".$db->realEscapeSingle($order_id));
|
||||
|
||||
// Save home id created by this order
|
||||
$db->query("UPDATE OGP_DB_PREFIXbilling_orders
|
||||
SET home_id='" . $db->realEscapeSingle($home_id) . "' WHERE order_id=".$db->realEscapeSingle($order_id));
|
||||
|
||||
}
|
||||
|
||||
//Update Cart Payment Status as 3(paid and installed)
|
||||
$db->query("UPDATE OGP_DB_PREFIXbilling_carts
|
||||
SET paid=3
|
||||
WHERE cart_id=".$db->realEscapeSingle($cart_id));
|
||||
|
||||
// Set payment/creation date
|
||||
$date = date('d M Y');
|
||||
$db->query("UPDATE OGP_DB_PREFIXbilling_carts
|
||||
SET date='" . $db->realEscapeSingle($date) . "'
|
||||
WHERE cart_id=".$db->realEscapeSingle($cart_id));
|
||||
|
||||
$db->query( "UPDATE OGP_DB_PREFIXgame_mods SET max_players= ".$order['max_players']." WHERE home_id=".$db->realEscapeSingle($home_id));
|
||||
|
||||
|
||||
//Refresh to Game Monitor.
|
||||
$view->refresh("home.php?m=gamemanager&p=game_monitor");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,217 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2017 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
chdir(realpath(dirname(__FILE__))); /* Change to the current file path */
|
||||
chdir("../.."); /* Base path to ogp web files */
|
||||
// Report all PHP errors
|
||||
error_reporting(E_ALL);
|
||||
// Path definitions
|
||||
define("CONFIG_FILE","includes/config.inc.php");
|
||||
//Requiere
|
||||
require_once("includes/functions.php");
|
||||
require_once("includes/helpers.php");
|
||||
require_once("includes/html_functions.php");
|
||||
require_once("modules/config_games/server_config_parser.php");
|
||||
require_once("includes/lib_remote.php");
|
||||
require_once CONFIG_FILE;
|
||||
// Connect to the database server and select database.
|
||||
$db = createDatabaseConnection($db_type, $db_host, $db_user, $db_pass, $db_name, $table_prefix);
|
||||
|
||||
$panel_settings = $db->getSettings();
|
||||
if( isset($panel_settings['time_zone']) && $panel_settings['time_zone'] != "" )
|
||||
date_default_timezone_set($panel_settings['time_zone']);
|
||||
|
||||
|
||||
//these dates are configured in the Shop Settings page
|
||||
$today=time();
|
||||
$invoice_date = strtotime('+ 7 days'); //this many days until the finish_date
|
||||
$suspend_date = $today; //suspend when overdue
|
||||
//final date is 10th, we need to remove on 17th, so final date is > removal_date
|
||||
$removal_date = strtotime('- 7 days'); //finish_date is passed 7 days ago
|
||||
$rundate = date('d/M/y G:i',$today);
|
||||
|
||||
|
||||
//THESE SERVERS HAVE REACHED THE DATE FOR INVOICE, FINISH_DATE - 7 (OR WHAT IS IN SETTINGS)
|
||||
//SET STATUS -1 MEANING INVOICED
|
||||
//LOOP THROUGH ALL SERVERS WITH STATUS = 1 (ACTIVE) -----------------------------------------------------------
|
||||
$user_homes = $db->resultQuery( "SELECT *
|
||||
FROM " . $table_prefix . "billing_orders
|
||||
WHERE status > 0 AND finish_date <" . $invoice_date);
|
||||
|
||||
if (!is_array($user_homes))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($user_homes as $user_home)
|
||||
{
|
||||
|
||||
$user_id = $user_home['user_id'];
|
||||
$home_id = $user_home['home_id'];
|
||||
|
||||
|
||||
// Reset the STATUS -1 so cart.php will create an invoice
|
||||
$db->query( "UPDATE " . $table_prefix . "billing_orders
|
||||
SET status=-1
|
||||
WHERE order_id=".$db->realEscapeSingle($user_home['order_id']));
|
||||
|
||||
// SEND EMAIL
|
||||
$settings = $db->getSettings();
|
||||
$subject = "You have an INVOICE at ". $panel_settings['panel_name'];
|
||||
$email = $db->resultQuery(" SELECT DISTINCT users_email
|
||||
FROM " . $table_prefix . "users, " . $table_prefix . "billing_orders
|
||||
WHERE " . $table_prefix . "users.user_id = $user_id")[0]["users_email"];
|
||||
$message = "Your server with ID ". $home_id . " will expire soon. Please log in and VIEW INVOICES on the Dashboard to renew your server.<br><br><br>~<br>Thanks!<br>";
|
||||
$mail = mymail($email, $subject, $message, $settings);
|
||||
//logger
|
||||
$db->logger( "INVOICE created for server " . $home_id);
|
||||
|
||||
if (!$mail)
|
||||
$db->logger( "Email FAILED - Server Invoiced " . $home_id);
|
||||
|
||||
// END EMAIL
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//THESE ARE THE SERVERS THAT HAVE NOT BEEN PAID AND THE FINISH_DATE IS TODAY
|
||||
//THESE SERVERS GET SUSPENDED
|
||||
//LOOP THROUGH ALL ORDERS WITH STATUS 0 OR -1 (INACTIVE OR INVOICED)
|
||||
$user_homes = $db->resultQuery( "SELECT *
|
||||
FROM " . $table_prefix . "billing_orders
|
||||
WHERE (status = -1 OR status = 0) AND finish_date < ".$today);
|
||||
|
||||
if (!is_array($user_homes))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($user_homes as $user_home)
|
||||
{
|
||||
$user_id = $user_home['user_id'];
|
||||
$home_id = $user_home['home_id'];
|
||||
$home_info = $db->getGameHomeWithoutMods($home_id);
|
||||
$server_info = $db->getRemoteServerById($home_info['remote_server_id']);
|
||||
$remote = new OGPRemoteLibrary($server_info['agent_ip'], $server_info['agent_port'], $server_info['encryption_key'],$server_info['timeout']);
|
||||
$ftp_login = isset($home_info['ftp_login']) ? $home_info['ftp_login'] : $home_id;
|
||||
$remote->ftp_mgr("userdel", $ftp_login);
|
||||
$db->changeFtpStatus('disabled',$home_id);
|
||||
$server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$home_info['home_cfg_file']);
|
||||
if(isset($server_xml->control_protocol_type))$control_type = $server_xml->control_protocol_type; else $control_type = "";
|
||||
$addresses = $db->getHomeIpPorts($home_id);
|
||||
foreach($addresses as $address)
|
||||
{
|
||||
$remote->remote_stop_server($home_id,$address['ip'],$address['port'],$server_xml->control_protocol,$home_info['control_password'],$control_type,$home_info['home_path']);
|
||||
}
|
||||
$db->unassignHomeFrom("user", $user_id, $home_id);
|
||||
|
||||
// Reset the invoice end date to -2
|
||||
// User can still RENEW server
|
||||
$db->query( "UPDATE " . $table_prefix . "billing_orders
|
||||
SET status=-2
|
||||
WHERE order_id=".$db->realEscapeSingle($user_home['order_id']));
|
||||
|
||||
//logger
|
||||
$db->logger( "SUSPENDED server " . $home_id);
|
||||
|
||||
// SEND EMAIL
|
||||
$settings = $db->getSettings();
|
||||
$subject = "GameServer Suspended at ". $panel_settings['panel_name'];
|
||||
$email = $db->resultQuery(" SELECT DISTINCT users_email
|
||||
FROM " . $table_prefix . "users, " . $table_prefix . "billing_orders
|
||||
WHERE " . $table_prefix . "users.user_id = $user_id")[0]["users_email"];
|
||||
$message = "Your server with ID ". $home_id . " has expired and has been suspended. Please log in and VIEW INVOICES on the Dashboard to renew your server.<br>~<br>Thanks!<br>";
|
||||
$mail = mymail($email, $subject, $message, $settings);
|
||||
if (!$mail)
|
||||
$db->logger( "Email FAILED - Server Suspended " . $home_id);
|
||||
// END EMAIL
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// end date = -2 (suspended) and its been suspended for $removal_date days
|
||||
//set removed servers as -99
|
||||
$user_homes = $db->resultQuery( "SELECT *
|
||||
FROM " . $table_prefix . "billing_orders
|
||||
WHERE status = -2 AND finish_date < ".$removal_date );
|
||||
|
||||
if (!is_array($user_homes))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($user_homes as $user_home)
|
||||
{
|
||||
$user_id = $user_home['user_id'];
|
||||
$home_id = $user_home['home_id'];
|
||||
$home_info = $db->getGameHomeWithoutMods($home_id);
|
||||
$server_info = $db->getRemoteServerById($home_info['remote_server_id']);
|
||||
$remote = new OGPRemoteLibrary($server_info['agent_ip'], $server_info['agent_port'], $server_info['encryption_key'],$server_info['timeout']);
|
||||
|
||||
// Remove the game home from db
|
||||
$db->deleteGameHome($home_id);
|
||||
|
||||
// Remove the game home files from remote server
|
||||
$remote->remove_home($home_info['home_path']);
|
||||
|
||||
|
||||
|
||||
// Reset the invoice end date
|
||||
$db->query( "UPDATE " . $table_prefix . "billing_orders
|
||||
SET status=-3
|
||||
WHERE order_id=".$db->realEscapeSingle($user_home['order_id']));
|
||||
|
||||
|
||||
// Set order as not installed
|
||||
$db->query( "UPDATE " . $table_prefix . "billing_orders
|
||||
SET home_id=0
|
||||
WHERE cart_id=".$db->realEscapeSingle($user_home['cart_id']));
|
||||
|
||||
//logger
|
||||
$db->logger( "DELETED server " . $home_id);
|
||||
|
||||
|
||||
// SEND EMAIL
|
||||
$settings = $db->getSettings();
|
||||
$settings = $db->getSettings();
|
||||
$subject = "GameServer DELETED at ". $panel_settings['panel_name'];
|
||||
$email = $db->resultQuery(" SELECT DISTINCT users_email
|
||||
FROM " . $table_prefix . "users, " . $table_prefix . "billing_orders
|
||||
WHERE " . $table_prefix . "users.user_id = $user_id")[0]["users_email"];
|
||||
$message = "Your server with ID ". $home_id . " has been deleted<br><br>You did not renew the service and it was PERMANENTLY REMOVED today. If this was an error, if you contact us immediately we may be able to restore your server.<br>Thanks for being a customer and we hope we can provide a server for you again.<br><br>";
|
||||
$mail = mymail($email, $subject, $message, $settings);
|
||||
if (!$mail)
|
||||
$db->logger( "Email FAILED - Server Deleted " . $home_id);
|
||||
// END EMAIL
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,116 +0,0 @@
|
|||
<?php
|
||||
|
||||
|
||||
chdir("../../"); /* It just makes life easier */
|
||||
|
||||
/* Includes */
|
||||
require_once("includes/helpers.php");
|
||||
require_once("includes/config.inc.php");
|
||||
require_once("includes/functions.php");
|
||||
require_once("includes/lib_remote.php");
|
||||
require_once("includes/lang.php");
|
||||
require_once("modules/config_games/server_config_parser.php");
|
||||
$db = createDatabaseConnection($db_type, $db_host, $db_user, $db_pass, $db_name, $table_prefix);
|
||||
$settings = $db->getSettings();
|
||||
$debug = $settings['debug'];
|
||||
$paypal_email = $settings['paypal_email']; // your paypal email address
|
||||
|
||||
|
||||
|
||||
$cart_id = $_POST['item_number'];
|
||||
|
||||
$fpx = fopen('modules/billing/ipnlog.txt', 'w');
|
||||
$header = "====================== CART ID " . $cart_id . " ========================\n";
|
||||
fwrite($fpx, $header);
|
||||
|
||||
|
||||
// STEP 1: read POST data
|
||||
// Reading POSTed data directly from $_POST causes serialization issues with array data in the POST.
|
||||
// Instead, read raw POST data from the input stream.
|
||||
$raw_post_data = file_get_contents('php://input');
|
||||
$raw_post_array = explode('&', $raw_post_data);
|
||||
$myPost = array();
|
||||
foreach ($raw_post_array as $keyval) {
|
||||
$keyval = explode ('=', $keyval);
|
||||
if (count($keyval) == 2)
|
||||
$myPost[$keyval[0]] = urldecode($keyval[1]);
|
||||
}
|
||||
// read the IPN message sent from PayPal and prepend 'cmd=_notify-validate'
|
||||
$req = 'cmd=_notify-validate';
|
||||
if (function_exists('get_magic_quotes_gpc')) {
|
||||
$get_magic_quotes_exists = true;
|
||||
}
|
||||
foreach ($myPost as $key => $value) {
|
||||
if ($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) {
|
||||
$value = urlencode(stripslashes($value));
|
||||
} else {
|
||||
$value = urlencode($value);
|
||||
}
|
||||
$req .= "&$key=$value";
|
||||
fwrite($fpx, "$key=$value\n");
|
||||
|
||||
}
|
||||
// Step 2: POST IPN data back to PayPal to validate
|
||||
if ( $settings['sandbox'] == 1) {
|
||||
$ch = curl_init('https://ipnpb.sandbox.paypal.com/cgi-bin/webscr');
|
||||
}else {
|
||||
$ch = curl_init('https://ipnpb.paypal.com/cgi-bin/webscr');
|
||||
}
|
||||
|
||||
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
||||
curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));
|
||||
// In wamp-like environments that do not come bundled with root authority certificates,
|
||||
// please download 'cacert.pem' from "https://curl.haxx.se/docs/caextract.html" and set
|
||||
// the directory path of the certificate as shown below:
|
||||
// curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem');
|
||||
if ( !($res = curl_exec($ch)) ) {
|
||||
// error_log("Got " . curl_error($ch) . " when processing IPN data");
|
||||
curl_close($ch);
|
||||
exit;
|
||||
}
|
||||
curl_close($ch);
|
||||
|
||||
|
||||
|
||||
// inspect IPN validation result and act accordingly
|
||||
if (strcmp ($res, "VERIFIED") == 0) {
|
||||
fwrite($fpx, "VERIFIED\n");
|
||||
// assign posted variables to local variables
|
||||
$item_name = $_POST['item_name'];
|
||||
$item_number = $_POST['item_number'];
|
||||
$payment_status = $_POST['payment_status'];
|
||||
$payment_amount = $_POST['mc_gross'];
|
||||
$payment_currency = $_POST['mc_currency'];
|
||||
$txn_id = $_POST['txn_id'];
|
||||
$receiver_email = $_POST['receiver_email'];
|
||||
$payer_email = $_POST['payer_email'];
|
||||
|
||||
$db->query("UPDATE OGP_DB_PREFIXbilling_carts
|
||||
SET paid=1
|
||||
WHERE cart_id=".$db->realEscapeSingle($cart_id));
|
||||
fwrite($fpx, "IPN Processed\n");
|
||||
|
||||
|
||||
// The IPN is verified, process it
|
||||
} else if (strcmp ($res, "INVALID") == 0) {
|
||||
// IPN invalid, log for manual investigation
|
||||
echo "The response from IPN was: <b>" .$res ."</b>";
|
||||
}
|
||||
|
||||
fclose($fpx);
|
||||
|
||||
// Reply with an empty 200 response to indicate to paypal the IPN was received correctly.
|
||||
//header("HTTP/1.1 200 OK");
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
====================== CART ID ========================
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2017 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
// Module general information
|
||||
$module_title = "billing";
|
||||
$module_version = "1";
|
||||
$db_version = 4;
|
||||
$module_required = FALSE;
|
||||
$module_menus = array(
|
||||
array( 'subpage' => 'shop', 'name'=>'Shop', 'group'=>'user,admin' ),
|
||||
array( 'subpage' => 'orders', 'name'=>'Orders', 'group'=>'user,admin' ),
|
||||
array( 'subpage' => 'services', 'name'=>'Services', 'group'=>'admin' ),
|
||||
array( 'subpage' => 'shop_settings', 'name'=>'Shop Settings', 'group'=>'admin' ),
|
||||
array( 'subpage' => 'coupons', 'name'=>'Coupons', 'group'=>'admin' )
|
||||
);
|
||||
|
||||
$install_queries = array();
|
||||
$install_queries[0] = array(
|
||||
"DROP TABLE IF EXISTS `".OGP_DB_PREFIX."billing_services`;",
|
||||
"CREATE TABLE IF NOT EXISTS `".OGP_DB_PREFIX."billing_services` (
|
||||
`service_id` int(11) NOT NULL auto_increment,
|
||||
`home_cfg_id` int(11) NOT NULL,
|
||||
`mod_cfg_id` int(11) NOT NULL,
|
||||
`service_name` varchar(255) NOT NULL,
|
||||
`remote_server_id` varchar(255) NOT NULL,
|
||||
`slot_max_qty` int(11) NOT NULL,
|
||||
`slot_min_qty` int(11) NOT NULL,
|
||||
`price_daily` float(15,4) NOT NULL,
|
||||
`price_monthly` float(15,4) NOT NULL,
|
||||
`price_year` float(15,4) NOT NULL,
|
||||
`description` varchar(1000) NOT NULL,
|
||||
`img_url` varchar(255) NOT NULL,
|
||||
`ftp` varchar(255) NOT NULL,
|
||||
`install_method` varchar(255) NOT NULL,
|
||||
`manual_url` varchar(255) NOT NULL,
|
||||
`access_rights` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`service_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=UTF8;",
|
||||
|
||||
"DROP TABLE IF EXISTS `".OGP_DB_PREFIX."billing_orders`;",
|
||||
"CREATE TABLE IF NOT EXISTS `".OGP_DB_PREFIX."billing_orders` (
|
||||
`order_id` int(11) NOT NULL auto_increment,
|
||||
`user_id` int(11) NOT NULL,
|
||||
`service_id` int(11) NOT NULL,
|
||||
`home_path` varchar(255) NOT NULL,
|
||||
`home_name` varchar(255) NOT NULL,
|
||||
`ip` varchar(255) NOT NULL,
|
||||
`port` varchar(5) NOT NULL,
|
||||
`qty` int(11) NOT NULL,
|
||||
`invoice_duration` varchar(16) NOT NULL,
|
||||
`max_players` int(11) NOT NULL,
|
||||
`remote_control_password` varchar(10) NULL,
|
||||
`ftp_password` varchar(10) NULL,
|
||||
`subtotal` float(15,2) NOT NULL,
|
||||
`rate` int(11) NOT NULL,
|
||||
`total` float(15,2) NOT NULL,
|
||||
`date` varchar(10) NULL,
|
||||
PRIMARY KEY (`order_id`)
|
||||
) ENGINE=MyISAM;"
|
||||
);
|
||||
|
||||
$install_queries[1] = array(
|
||||
"DROP TABLE IF EXISTS `".OGP_DB_PREFIX."billing_carts`;",
|
||||
"CREATE TABLE IF NOT EXISTS `".OGP_DB_PREFIX."billing_carts` (
|
||||
`cart_id` int(11) NOT NULL auto_increment,
|
||||
`user_id` int(11) NOT NULL,
|
||||
`paid` int(11) NULL,
|
||||
PRIMARY KEY (`cart_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=UTF8;",
|
||||
|
||||
"DROP TABLE IF EXISTS `".OGP_DB_PREFIX."billing_orders`;",
|
||||
"CREATE TABLE IF NOT EXISTS `".OGP_DB_PREFIX."billing_orders` (
|
||||
`order_id` int(11) NOT NULL auto_increment,
|
||||
`user_id` int(11) NOT NULL,
|
||||
`service_id` int(11) NOT NULL,
|
||||
`home_path` varchar(255) NOT NULL,
|
||||
`home_name` varchar(255) NOT NULL,
|
||||
`ip` varchar(255) NOT NULL,
|
||||
`qty` int(11) NOT NULL,
|
||||
`invoice_duration` varchar(16) NOT NULL,
|
||||
`max_players` int(11) NOT NULL,
|
||||
`price` float(15,2) NOT NULL,
|
||||
`remote_control_password` varchar(10) NULL,
|
||||
`ftp_password` varchar(10) NULL,
|
||||
`paid` varchar(1) NULL,
|
||||
`date` varchar(10) NULL,
|
||||
`cart_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`order_id`)
|
||||
) ENGINE=MyISAM;"
|
||||
);
|
||||
|
||||
$install_queries[2] = array(
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_orders` DROP `date`;",
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_orders` DROP `home_path`;",
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_orders` DROP `paid`;",
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_orders` ADD `home_id` varchar(255) NOT NULL DEFAULT '0';",
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_orders` ADD `status` varchar(16) NOT NULL DEFAULT '0';",
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_carts` ADD `date` varchar(16) NOT NULL DEFAULT '0';",
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_carts` ADD `tax_amount` varchar(16) NOT NULL DEFAULT '0';",
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_carts` ADD `currency` varchar(3) NOT NULL DEFAULT '0';"
|
||||
);
|
||||
|
||||
$install_queries[3] = array(
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_orders` ADD `finish_date` varchar(16) NOT NULL DEFAULT '0';"
|
||||
);
|
||||
|
||||
$install_queries[4] = array(
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_orders` ADD `extended` tinyint(1) NOT NULL;",
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_services` ADD `enabled` int(11) NOT NULL;"
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_carts` ADD `coupon_id` varchar(3) NOT NULL DEFAULT '0';"
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_orders` ADD `coupon_id` varchar(3) NOT NULL DEFAULT '0';"
|
||||
|
||||
);
|
||||
|
||||
|
||||
?>
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<navigation>
|
||||
<!-- User Side -->
|
||||
<page key="shop" file="shop.php" access="user,admin" />
|
||||
<page key="paid" file="paid.php" access="user,admin" />
|
||||
<page key="cart" file="cart.php" access="user,admin" />
|
||||
<page key="add_to_cart" file="add_to_cart.php" access="user,admin" />
|
||||
<page key="paypal" file="paypal.php" access="user,admin" />
|
||||
<!-- Admin Side -->
|
||||
<page key="shop_settings" file="settings.php" access="admin" />
|
||||
<page key="services" file="services.php" access="admin" />
|
||||
<page key="coupons" file="coupons.php" access="admin" />
|
||||
<!-- Billing -->
|
||||
<page key="orders" file="orders.php" access="user,admin" />
|
||||
<page key="paid" file="paid.php" access="user,admin" />
|
||||
<page key="bill" file="bill.php" access="user,admin" />
|
||||
<page key="create_servers" file="create_servers.php" access="user,admin" />
|
||||
<!-- Guest-->
|
||||
|
||||
|
||||
</navigation>
|
||||
|
|
@ -1,257 +0,0 @@
|
|||
<?php
|
||||
function exec_ogp_module()
|
||||
{
|
||||
error_reporting(E_ALL);
|
||||
|
||||
global $db,$settings;
|
||||
|
||||
if(isset($_POST['remove']))
|
||||
{
|
||||
$query_delete_order = $db->query("DELETE FROM OGP_DB_PREFIXbilling_orders WHERE cart_id=".$db->realEscapeSingle($_POST['cart_id']));
|
||||
$query_delete_order = $db->query("DELETE FROM OGP_DB_PREFIXbilling_carts WHERE cart_id=".$db->realEscapeSingle($_POST['cart_id']));
|
||||
}
|
||||
if(isset($_POST['paid']))
|
||||
{
|
||||
$query_set_as_paid = $db->query("UPDATE OGP_DB_PREFIXbilling_carts
|
||||
SET paid=1
|
||||
WHERE cart_id=".$db->realEscapeSingle($_POST['cart_id']));
|
||||
}
|
||||
$status_array = array ( "not_paid" => 0,
|
||||
"paid" => 1,
|
||||
"procesing_payment" => 2,
|
||||
"paid_and_installed" => 3
|
||||
);
|
||||
?>
|
||||
<style>
|
||||
h4 {
|
||||
width:250px;
|
||||
height:25px;
|
||||
background:#f5f5f5;
|
||||
border-top-style:solid;
|
||||
border-top-color:#afafaf;
|
||||
border-top-width:1px;
|
||||
border-style: solid;
|
||||
border-color: #CFCFCF;
|
||||
border-width: 1px;
|
||||
padding-top:8px;
|
||||
text-align: center;
|
||||
font-family:"Trebuchet MS";
|
||||
}
|
||||
</style>
|
||||
<h2><?php print_lang("orders");?></h2>
|
||||
<form method="post" action="?m=billing&p=shop">
|
||||
<input type="hidden" name="cart_id" value="<?php echo $order['cart_id'];?>">
|
||||
<input type="submit" value="<?php print_lang("shop");?>">
|
||||
</form>
|
||||
<?php
|
||||
|
||||
$isAdmin = $db->isAdmin( $_SESSION['user_id'] );
|
||||
$user_id = $_SESSION['user_id'];
|
||||
|
||||
//SHOW THE NUMBER OF SERVERS RENTED AND EXPECTED INCOME
|
||||
if($isAdmin)
|
||||
{
|
||||
echo "<h1>Accounting</h1>";
|
||||
$servercount = 0;
|
||||
$income = 0;
|
||||
$paidOrders = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE status > 0");
|
||||
foreach($paidOrders as $inc)
|
||||
{
|
||||
$servercount = $servercount +1;
|
||||
$income = $income + $inc['max_players'] * $inc['price'];
|
||||
|
||||
}
|
||||
echo "Total Rented Gameservers: $servercount<br>";
|
||||
echo "Total Income: $" . number_format( $income , 2 ) . "<br>";
|
||||
|
||||
}
|
||||
foreach($status_array as $status => $paid_value)
|
||||
if($isAdmin or $status == "paid_and_installed")
|
||||
{
|
||||
{
|
||||
if ($isAdmin){
|
||||
$carts = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXbilling_carts WHERE paid =" . $db->realEscapeSingle($paid_value) ." order by cart_id DESC");
|
||||
}else{
|
||||
$carts = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXbilling_carts WHERE paid=3 AND user_id = " . $user_id ." order by cart_id DESC");
|
||||
}
|
||||
if( $carts > 0 )
|
||||
{
|
||||
?>
|
||||
<h2><?php print_lang($status);?></h2><?php
|
||||
foreach($carts as $cart)
|
||||
{
|
||||
?>
|
||||
<center>
|
||||
<table style="width:100%;text-align:center;" class="center">
|
||||
<tr>
|
||||
<th style="width:25%"><?php print_lang("login");?></th>
|
||||
<th><?php print_lang("cart_id");?></th>
|
||||
<th><?php print_lang("order_id");?></th>
|
||||
<th>slot price</th>
|
||||
<th>Paid Date</th>
|
||||
<?php
|
||||
if($status == "paid_and_installed")
|
||||
{?>
|
||||
<th>Expiration dates</th>
|
||||
<?php
|
||||
}?>
|
||||
</tr>
|
||||
<?php
|
||||
$orders = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE cart_id=".$db->realEscapeSingle($cart['cart_id'])." order by order_id DESC" );
|
||||
$subtotal = 0;
|
||||
foreach($orders as $order)
|
||||
{
|
||||
if($order['qty'] > 1)
|
||||
$order['invoice_duration'] = $order['invoice_duration']."s";
|
||||
?>
|
||||
<tr class="tr">
|
||||
<td><a href="?m=user_admin&p=edit_user&user_id=<?php echo $order['user_id'];?>" ><?php $user = $db->getUserById($order['user_id']); echo $user['users_login'];?></a></td>
|
||||
<td><b class="success"><?php echo $order['cart_id'];?></b></td>
|
||||
<td><b class="success"><?php echo $order['order_id'];?></b></td>
|
||||
<td><?php echo "$".$order['price'].$cart['currency'];?></td>
|
||||
<td><?php echo $cart['date'];?></td>
|
||||
<?php
|
||||
if($status == "paid_and_installed")
|
||||
{
|
||||
$today = time();
|
||||
$order_status = "Unknown";
|
||||
$order_status = $order['status'] > '0' ? "<b style='color:green;'>".get_lang('active')."</b>":$order_status;
|
||||
$order_status = $order['status'] == '0' ? "<b style='color:yellow;'>".get_lang('unpaid')."</b>":$order_status;
|
||||
$order_status = $order['status'] == '-1' ? "<b style='color:yellow;'>".get_lang('invoice_due')."</b>":$order_status;
|
||||
$order_status = $order['status'] == '-2' ? "<b style='color:red;'>".get_lang('suspended')."</b>":$order_status;
|
||||
$order_status = $order['status'] == '-3' ? "<b style='color:green;'>".get_lang('renewed')."</b>":$order_status;
|
||||
$order_status = $order['status'] == '-99' ? "<b style='color:white;'>".get_lang('expired')."</b>":$order_status;
|
||||
$finish_date = date('d/M/Y H:i',$order['finish_date']);
|
||||
echo "<td>Status: <b>$order_status</b>";
|
||||
echo "<br>Expiration: <b>$finish_date</b></td>";
|
||||
}
|
||||
?>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr class="tr">
|
||||
<td><?php echo $order['home_name']?></td>
|
||||
<td><?php echo " [ ".$order['max_players']." ".get_lang('slots').", ".$order['qty']." ".get_lang($order['invoice_duration'])." ]";?>
|
||||
|
||||
</td></tr>
|
||||
|
||||
<?php
|
||||
$max_players = $order['max_players'];
|
||||
$qty = $order['qty'];
|
||||
$price = $order['price'];
|
||||
$subtotal += $order['price'] * $max_players * $qty;
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
if ($status == "not_paid")
|
||||
{
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<input type="hidden" name="cart_id" value="<?php echo $order['cart_id'];?>">
|
||||
<input name="paid" type="submit" value="<?php print_lang("set_as_paid");?>">
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
elseif($status == "paid")
|
||||
{
|
||||
|
||||
?>
|
||||
<form method="post" action="home.php?m=billing&p=create_servers">
|
||||
|
||||
<input type="hidden" name="cart_id" value="<?php echo $order['cart_id'];?>">
|
||||
<?php
|
||||
if($order['extended'] == "1")
|
||||
{
|
||||
?>
|
||||
<input name="enable_server" type="submit" value="<?php print_lang("enable_server");?>">
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<input name="create_server" type="submit" value="<?php print_lang("create_server");?>">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
elseif($status == "procesing_payment")
|
||||
{
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<input type="hidden" name="cart_id" value="<?php echo $order['cart_id'];?>">
|
||||
<input name="paid" type="submit" value="<?php print_lang("set_as_paid");?>">
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
elseif($status == "paid_and_installed")
|
||||
{
|
||||
?>
|
||||
<form method="post" action="?m=billing&p=bill">
|
||||
<input type="hidden" name="cart_id" value="<?php echo $order['cart_id'];?>">
|
||||
<input name="paid" type="submit" value="<?php print_lang("see_invoice");?>">
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tr><tr>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
echo get_lang('subtotal')." <b>$".number_format( $subtotal , 2 ). " " .$cart['currency']."</b></br>";
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
//obter as informações de cupom usadas neste pedido
|
||||
$coupon_savings = 0;
|
||||
if($cart['coupon_id']>0) {
|
||||
$result = $db->resultquery("SELECT * from OGP_DB_PREFIXbilling_coupons WHERE id = '". $cart['coupon_id'] . "'");
|
||||
foreach($result as $coupon){
|
||||
$coupon_savings = $subtotal * ($coupon['discount']/ 100);
|
||||
echo "Sub-total c/discount <b>$" .number_format( ($subtotal - $coupon_savings) , 2 ).$cart['currency']."</b></br><td>";
|
||||
echo "Coupon (".$coupon['code'].") <b>- $" .number_format( $coupon_savings , 2 ).$cart['currency']."</b></br>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($settings['tax_amount'] > 0){
|
||||
echo get_lang('tax')."<b>(".$settings['tax_amount']."%) + $".number_format( $settings['tax_amount']/100*$subtotal, 2 ).$cart['currency']."</b></br>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
//$total = $subtotal-$coupon_savings+($settings['tax_amount']/100*$subtotal);
|
||||
$total = ($subtotal - $coupon_savings) * ($settings['tax_amount'] / 100 + 1);
|
||||
echo get_lang('total')." <b>$".number_format( $total , 2 ). " " .$cart['currency']."</b>";
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
if($status == "paid_and_installed")
|
||||
{
|
||||
?>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
}//end foreach
|
||||
}
|
||||
?>
|
||||
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
<?php
|
||||
function exec_ogp_module()
|
||||
{
|
||||
global $db,$view,$settings;
|
||||
$loadpage = "?m=billing&p=paid";
|
||||
$count = $_POST['count'] + 1;
|
||||
|
||||
$result = $db->resultquery("SELECT * from OGP_DB_PREFIXbilling_carts WHERE cart_id= '". $_POST['cart_id'] . "'");
|
||||
foreach($result as $cartID){
|
||||
$paid = $cartID['paid'];
|
||||
}
|
||||
|
||||
echo "<h2>Processing your Payment Info ... </h2>";
|
||||
if($settings['debug']==1){
|
||||
echo "<br>";
|
||||
echo $_POST['count'];
|
||||
echo "<br>";
|
||||
echo $_POST['cart_id'];
|
||||
echo "<br>";
|
||||
echo $_POST['payment_status'];
|
||||
echo "<br>";
|
||||
}
|
||||
//check the DB and see if its been updated as paid
|
||||
if($paid > 0){
|
||||
$loadpage = "?m=billing&p=create_servers";
|
||||
|
||||
}
|
||||
|
||||
//waited too long .. go to orders page
|
||||
if($count > 5){
|
||||
$loadpage = "?m=billing&p=orders";
|
||||
echo "<h2>There was a Problem, Please contact Support ... </h2>";
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<form name='paid' action='<?php echo $loadpage?>' method='post'>
|
||||
<input type='hidden' name='cart_id' value='<?php echo $_POST["cart_id"]?>'>
|
||||
<input type='hidden' name='payment_status' value='<?php echo $_POST["payment_status"] ?>'>
|
||||
<input type='hidden' name='count' value='<?php echo $count?>'>
|
||||
</form>
|
||||
<script>
|
||||
var auto_refresh = setInterval(
|
||||
function()
|
||||
{
|
||||
submitform();
|
||||
}, 5000);
|
||||
function submitform()
|
||||
{
|
||||
document.paid.submit();
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
<?php
|
||||
function exec_ogp_module()
|
||||
{
|
||||
global $db,$view;
|
||||
$settings = $db->getSettings();
|
||||
function curPageName()
|
||||
{
|
||||
return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
|
||||
}
|
||||
|
||||
|
||||
if ( $settings['sandbox'] == 1) {
|
||||
$paypal_url = "https://www.sandbox.paypal.com/cgi-bin/webscr";
|
||||
$paypal_ipn_url = "https://ipnpb.sandbox.paypal.com/cgi-bin/webscr";
|
||||
}
|
||||
else {
|
||||
$paypal_url = "https://www.paypal.com/cgi-bin/webscr";
|
||||
$paypal_ipn_url = "https://ipnpb.paypal.com/cgi-bin/webscr";
|
||||
}
|
||||
|
||||
$s = ( isset($_SERVER['HTTPS']) and get_true_boolean($_SERVER['HTTPS']) ) ? "s" : "";
|
||||
$port = isset($_SERVER['SERVER_PORT']) & $_SERVER['SERVER_PORT'] != "80" ? ":".$_SERVER['SERVER_PORT'] : NULL ;
|
||||
$this_script = 'http'.$s.'://'.$_SERVER['SERVER_NAME'].$port.$_SERVER['SCRIPT_NAME'];
|
||||
$current_folder_url = str_replace( curPageName(), "", $this_script);
|
||||
$cart_id = $_GET['cart_id'];
|
||||
$debug = $settings['debug'];
|
||||
|
||||
|
||||
if(!empty($cart_id))
|
||||
{
|
||||
$orders = $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE cart_id=".$db->realEscapeSingle($cart_id));
|
||||
//get couponID then discount for this cart
|
||||
$result= $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_carts WHERE cart_id=".$db->realEscapeSingle($cart_id));
|
||||
foreach ($result as $cartDB){
|
||||
$coupon_id = $cartDB['id'];
|
||||
}
|
||||
|
||||
$coupon_discount = 0;
|
||||
$result = $db->resultQuery( "SELECT discount FROM ogp_billing_coupons WHERE id=".$db->realEscapeSingle($cartDB['coupon_id']));
|
||||
foreach ($result as $couponDB){
|
||||
$coupon_discount=$couponDB['discount'];
|
||||
}
|
||||
|
||||
$coupon_discount = $coupon_discount / 100;
|
||||
|
||||
if( !empty( $orders ) )
|
||||
{
|
||||
$cart['price'] = 0;
|
||||
foreach($orders as $order)
|
||||
{
|
||||
if( $order['qty'] > 1 )
|
||||
$order['invoice_duration'] = $order['invoice_duration']."s";
|
||||
$cart['price'] += ($order['price']*$order['max_players']*$order['qty']);
|
||||
|
||||
|
||||
if( !isset( $cart['name'] ) )
|
||||
$cart['name'] = $order['home_name']."(".$order['qty'].get_lang($order['invoice_duration']).",".$order['max_players'].get_lang('slots').")";
|
||||
else
|
||||
$cart['name'] .= ' + '.$order['home_name']."(".$order['qty'].get_lang($order['invoice_duration']).",".$order['max_players'].get_lang('slots').")";
|
||||
}
|
||||
//price minus coupon discount
|
||||
$cart['price'] = $cart['price'] - $cart['price']*$coupon_discount;
|
||||
$total = $cart['price']+($settings['tax_amount']/100*$cart['price']);
|
||||
if ($total === 0)
|
||||
{
|
||||
$db->query("UPDATE " . $table_prefix . "billing_carts
|
||||
SET paid=1
|
||||
WHERE cart_id=".$db->realEscapeSingle($cart_id));
|
||||
$view->refresh("home.php?m=billing&p=cart",0);
|
||||
}
|
||||
$total = number_format( $total , 2 );
|
||||
}
|
||||
}
|
||||
|
||||
// -- GENERATING THE PAYPAL ORDER BUTTON --
|
||||
?>
|
||||
<html><body <?php if ( $debug != 1) { ?>onload="form1.submit()"<?php } ?>>
|
||||
<form name="form1" action="<?php echo $paypal_url ?>" method="post">
|
||||
<input type="hidden" name="cmd" value="_xclick">
|
||||
<input type="hidden" name="business" value="<?php echo $settings['paypal_email']; ?>">
|
||||
<input type="hidden" name="item_name" value="<?php echo $cart['name']; ?>">
|
||||
<input type="hidden" name="item_number" value="<?php echo $cart_id; ?>">
|
||||
<input type="hidden" name="invoice" value="<?php echo $cart_id; ?>">
|
||||
<input type="hidden" name="amount" value="<?php echo $total; ?>">
|
||||
<input type="hidden" name="return" value="<?php echo $current_folder_url.'modules/billing/bounce.php';?>">
|
||||
<input type="hidden" name="cancel_return" value="<?php echo $this_script.'?m=billing&p=cart';?>">
|
||||
<input type="hidden" name="notify_url" value="<?php echo $current_folder_url.'modules/billing/ipn.php';?>">
|
||||
<input type="hidden" name="currency_code" value="<?php echo $settings['currency'];?>">
|
||||
<input type="hidden" name="rm" value="2">
|
||||
<?php
|
||||
if ( $debug == 1) { ?>
|
||||
<h3 align="center">Debug Mode<br>
|
||||
Post Data being sent to Paypal</h3>
|
||||
<?php
|
||||
echo "<br>Sandbox Enabled = " .$settings['sandbox'];
|
||||
echo "<br>Paypal Url = " .$paypal_url;
|
||||
echo "<br>";
|
||||
echo "<br>Paypal Email = ".$settings['paypal_email'];
|
||||
echo "<br>Item Name = ".$cart['name'];
|
||||
echo "<br>Item Number = ".$cart_id;
|
||||
echo "<br>Invoice ID = ".$cart_id;
|
||||
echo "<br>Amount = ".$total;
|
||||
echo "<br>Return Url = ". $current_folder_url."modules/billing/bounce.php";
|
||||
echo "<br>Cancel Url = ". $this_script."?m=billing&p=cart";
|
||||
echo "<br>Notify Url = ". $current_folder_url."modules/billing/ipn.php";
|
||||
echo "<br>Currency Code =". $settings['currency'];
|
||||
echo "<br><br>";
|
||||
echo "<input type='submit' value='Click To Proceed To Paypal'>";
|
||||
}
|
||||
echo "After payment, you must return to this site to CREATE YOUR SERVER<br>";
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,355 +0,0 @@
|
|||
<?php
|
||||
function exec_ogp_module()
|
||||
{
|
||||
global $db;
|
||||
|
||||
//Querying UPDATE a service FROM DB
|
||||
if (isset($_POST['service']) AND isset($_POST['new_enabled']))
|
||||
{
|
||||
$new_remote_server_id = $db->realEscapeSingle($_POST['new_remote_server_id']);
|
||||
$new_price_monthly = $db->realEscapeSingle($_POST['new_price_monthly']);
|
||||
$new_out_of_stock = $db->realEscapeSingle($_POST['new_out_of_stock']);
|
||||
$new_url = $db->realEscapeSingle($_POST['new_url']);
|
||||
$new_enabled = $db->realEscapeSingle($_POST['new_enabled']);
|
||||
$service = $db->realEscapeSingle($_POST['service']);
|
||||
|
||||
//Create UPDATE query
|
||||
$qry_change_url = "UPDATE OGP_DB_PREFIXbilling_services
|
||||
SET remote_server_id = '".$new_remote_server_id."',
|
||||
price_monthly ='".$new_price_monthly."',
|
||||
remote_server_id = '".$new_remote_server_id."',
|
||||
out_of_stock = '".$new_out_of_stock."',
|
||||
img_url ='".$new_url."',
|
||||
enabled = '".$new_enabled."'
|
||||
WHERE service_id=".$service;
|
||||
$db->query($qry_change_url);
|
||||
}
|
||||
|
||||
//Querying UPDATE enabled/disabled remote servers DB
|
||||
if (isset($_POST['update_remote_servers']))
|
||||
{
|
||||
$result = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXremote_servers");
|
||||
foreach($result as $rs)
|
||||
{
|
||||
$server_enabled = 0;
|
||||
//get the value from the checkbox
|
||||
if(isset($_POST[$rs['remote_server_id']]))
|
||||
{
|
||||
$server_enabled = 1;
|
||||
|
||||
}
|
||||
|
||||
//update the table with current value
|
||||
$query = "UPDATE OGP_DB_PREFIXremote_servers SET enabled = '".$server_enabled."' WHERE remote_server_id=".$rs['remote_server_id'];
|
||||
$db->query($query);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//end ENABLE REMOTE SERVERS
|
||||
|
||||
|
||||
|
||||
//Querying INSERT new service INTO DB
|
||||
if(isset($_POST['mod_cfg_id']) AND isset($_POST['remote_server_id']) AND isset($_POST['slot_max_qty']) AND isset($_POST['price_daily']) AND isset($_POST['price_monthly']) AND isset($_POST['price_year']))
|
||||
{
|
||||
//Sanitize the POST values
|
||||
$home_cfg_id = $db->realEscapeSingle($_POST['home_cfg_id']);
|
||||
$mod_cfg_id = $db->realEscapeSingle($_POST['mod_cfg_id']);
|
||||
$service_name = $db->realEscapeSingle($_POST['service_name']);
|
||||
foreach ($_POST['remote_server_id'] as $remote)
|
||||
{
|
||||
$remote_server_id = $remote_server_id . $remote . " ";
|
||||
}
|
||||
//echo $remote_servers_id;
|
||||
//$remote_server_id = $remote_servers_id;
|
||||
//$remote_server_id = $db->realEscapeSingle($_POST['remote_server_id']);
|
||||
$slot_max_qty = $db->realEscapeSingle($_POST['slot_max_qty']);
|
||||
$slot_min_qty = $db->realEscapeSingle($_POST['slot_min_qty']);
|
||||
$price_daily = $db->realEscapeSingle($_POST['price_daily']);
|
||||
$price_monthly = $db->realEscapeSingle($_POST['price_monthly']);
|
||||
$price_year = $db->realEscapeSingle($_POST['price_year']);
|
||||
$description = $db->realEscapeSingle($_POST['description']);
|
||||
$img_url = $db->realEscapeSingle($_POST['img_url']);
|
||||
$ftp = $db->realEscapeSingle($_POST['ftp']);
|
||||
$install_method = $db->realEscapeSingle($_POST['install_method']);
|
||||
$manual_url = $db->realEscapeSingle($_POST['manual_url']);
|
||||
$access_rights = "";
|
||||
$enabled = 1;
|
||||
if(isset($_POST['allow_updates']))$access_rights .= $db->realEscapeSingle($_POST['allow_updates']);
|
||||
if(isset($_POST['allow_file_management']))$access_rights .= $db->realEscapeSingle($_POST['allow_file_management']);
|
||||
if(isset($_POST['allow_parameter_usage']))$access_rights .= $db->realEscapeSingle($_POST['allow_parameter_usage']);
|
||||
if(isset($_POST['allow_extra_params']))$access_rights .= $db->realEscapeSingle($_POST['allow_extra_params']);
|
||||
if(isset($_POST['allow_ftp_usage']))$access_rights .= $db->realEscapeSingle($_POST['allow_ftp_usage']);
|
||||
if(isset($_POST['allow_custom_fields']))$access_rights .= $db->realEscapeSingle($_POST['allow_custom_fields']);
|
||||
|
||||
$qry_add_service = "INSERT INTO OGP_DB_PREFIXbilling_services(service_id, home_cfg_id, mod_cfg_id, service_name, remote_server_id, out_of_stock, slot_max_qty , slot_min_qty, price_daily, price_monthly, price_year, description, img_url, ftp, install_method, manual_url, access_rights,enabled) VALUES(NULL, '".$home_cfg_id."', '".$mod_cfg_id."', '".$service_name."', '".$remote_server_id."', 0,'".$slot_max_qty."', '".$slot_min_qty."', '".$price_daily."', '".$price_monthly."', '".$price_year."', '".$description."', '".$img_url."', '".$ftp."', '".$install_method."', '".$manual_url."', '".$access_rights."', '" . $enabled . "')";
|
||||
$db->query($qry_add_service);
|
||||
}
|
||||
|
||||
//Querying REMOVE service FROM DB
|
||||
if (isset($_POST['service_id']))
|
||||
{
|
||||
$db->query( "DELETE FROM OGP_DB_PREFIXbilling_services WHERE service_id=" . $db->realEscapeSingle($_POST['service_id']) );
|
||||
}
|
||||
|
||||
?>
|
||||
<h2><?php print_lang('add_service');?></h2>
|
||||
<form method="POST" action="">
|
||||
<table class="center">
|
||||
<!-- Part2 - Select MOD -->
|
||||
<?php
|
||||
if(isset($_POST['home_cfg_id']))
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<select name="modcfgid">
|
||||
<?php
|
||||
$mod_qry = $db->resultQuery("SELECT DISTINCT mod_cfg_id, mod_name, game_name FROM OGP_DB_PREFIXconfig_mods NATURAL JOIN OGP_DB_PREFIXconfig_homes WHERE home_cfg_id=" . $db->realEscapeSingle($_POST['home_cfg_id']));
|
||||
foreach($mod_qry as $array_mods)
|
||||
{
|
||||
if($array_mods['mod_name'] == "none")$array_mods['mod_name']=$array_mods['game_name'];
|
||||
?>
|
||||
<option value="<?php echo $array_mods['mod_cfg_id'];?>"><?php echo $array_mods['mod_name'];?></option>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<input type="hidden" name="homecfgid" value="<?php echo $_POST['home_cfg_id'];?>"/>
|
||||
<tr>
|
||||
<?php
|
||||
}
|
||||
else if (isset($_POST['modcfgid']) AND isset($_POST['homecfgid']))
|
||||
{
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php
|
||||
$result3 = $db->resultQuery("SELECT DISTINCT remote_server_id, remote_server_name, agent_ip, ogp_user FROM OGP_DB_PREFIXremote_servers");
|
||||
?>
|
||||
<td><?php print_lang('remote_server');?></td>
|
||||
<td>
|
||||
<select name="remote_server_id[]" multiple size="5">
|
||||
<?php
|
||||
foreach($result3 as $row3)
|
||||
{
|
||||
?>
|
||||
<option value="<?php echo $row3['remote_server_id']; ?>">(<?php echo $row3['remote_server_id']; ?>) - IP[<?php echo $row3['agent_ip']; ?>]</option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php
|
||||
$mods = $db->resultQuery("SELECT DISTINCT mod_cfg_id, mod_name, game_name FROM OGP_DB_PREFIXconfig_mods NATURAL JOIN OGP_DB_PREFIXconfig_homes WHERE mod_cfg_id=" . $db->realEscapeSingle($_POST['modcfgid']));
|
||||
foreach($mods as $mod)
|
||||
{
|
||||
?>
|
||||
<td><?php print_lang('service_name');?></td>
|
||||
<td><input name="service_name" type="text" size="61" value="<?php if($mod['mod_name']=="none")echo $mod['game_name']; else echo $mod['game_name']." - ".$mod['mod_name'];?>"/></td>
|
||||
<input name="mod_cfg_id" type="hidden" value="<?php echo $mod['mod_cfg_id'];}?>"/>
|
||||
<input name="home_cfg_id" type="hidden" value="<?php echo $_POST['homecfgid'];?>"/>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_lang('min_slot_qty');?></td>
|
||||
<td><input name="slot_min_qty" type="text" size="8" value="16"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_lang('max_slot_qty');?></td>
|
||||
<td><input name="slot_max_qty" type="text" size="8" value="64"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Price Daily</td>
|
||||
<td><input name="price_daily" type="text" size="8" value="0"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_lang('price_monthly');?></td>
|
||||
<td><input name="price_monthly" type="text" size="8" value="0"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_lang('price_year');?></td>
|
||||
<td><input name="price_year" type="text" size="8" value="0"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_lang('ftp_account');?></td>
|
||||
<td>
|
||||
<select name="ftp">
|
||||
<option value="enabled"><?php print_lang('enabled');?></option>
|
||||
<option value="disabled"><?php print_lang('disabled');?></option>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_lang('select_install_method');?></td>
|
||||
<td>
|
||||
<select name="install_method">
|
||||
<option value="steam"><?php print_lang('steam');?></option>
|
||||
<option value="rsync"><?php print_lang('rsync');?></option>
|
||||
<option value="manual"><?php print_lang('manual_from_url');?></option>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_lang('url_for_manual_install');?></td>
|
||||
<td><input name="manual_url" type="text" size="61"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_lang('description');?></td>
|
||||
<td><textarea name='description' cols='45' rows='5'></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_lang('image_url');?></td>
|
||||
<td><textarea name='img_url' cols='45' rows='1'>images/games/unknown.png</textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_lang('access_rights');?></td>
|
||||
<td>
|
||||
<input name="allow_updates" type="checkbox" value="u" checked="checked"/><?php print_lang('allow_update');?><br>
|
||||
<input name="allow_file_management" type="checkbox" value="f" checked="checked"/><?php print_lang('allow_file_management');?><br>
|
||||
<input name="allow_parameter_usage" type="checkbox" value="p" checked="checked"/><?php print_lang('allow_parameter_usage');?><br>
|
||||
<input name="allow_extra_params" type="checkbox" value="e" checked="checked"/><?php print_lang('allow_extra_parameters_usage');?><br>
|
||||
<input name="allow_ftp_usage" type="checkbox" value="t" checked="checked"/><?php print_lang('allow_ftp_usage');?><br>
|
||||
<input name="allow_custom_fields" type="checkbox" value="c" checked="checked"/><?php print_lang('allow_custom_fields');?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<!-- Part 1 - Select GAME -->
|
||||
<tr>
|
||||
<td><select name='home_cfg_id'>
|
||||
<?php
|
||||
global $db;
|
||||
$games = $db->getGameCfgs();
|
||||
foreach($games as $game)
|
||||
{
|
||||
echo "<option value='".$game['home_cfg_id']."'>".$game['game_name'];
|
||||
if ( preg_match("/linux/", $game['game_key']) )
|
||||
echo " (Linux) ";
|
||||
if ( preg_match("/win/", $game['game_key']) )
|
||||
echo " (Windows) ";
|
||||
if ( preg_match("/64/", $game['game_key']) )
|
||||
echo " (64bit) ";
|
||||
echo "</option>";
|
||||
|
||||
}
|
||||
?>
|
||||
</select></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<td><input type="submit" value="<?php print_lang('add_service');?>"/></td>
|
||||
</tr>
|
||||
</form>
|
||||
|
||||
<!-- Show Services on DB -->
|
||||
</table>
|
||||
<br>
|
||||
<h2>Enable/Disable Server Locations</h2>
|
||||
<?php
|
||||
//ENABLE OR DISABLE REMOTE SERVERS FOR GAMES
|
||||
$result = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXremote_servers");
|
||||
echo "<form method='post' action=''>";
|
||||
echo "<input type='hidden' name='update_remote_servers' value='update' />";
|
||||
foreach($result as $rs)
|
||||
{
|
||||
$checked = 'checked';
|
||||
if(!$rs['enabled'])
|
||||
{
|
||||
$checked = '';
|
||||
}
|
||||
echo "<div style='float:left; width:25%;'>";
|
||||
echo $rs['remote_server_id'] ;
|
||||
echo " <input type='checkbox' id='" . $rs['remote_server_id'] . "' name='" . $rs['remote_server_id'] ."' value='" .$rs['enabled'] . "' " . $checked . ">";
|
||||
echo $rs['remote_server_name'];
|
||||
echo "</div>";
|
||||
}
|
||||
echo "<br><input type='submit' value='Update Enabled Servers'>
|
||||
</form>
|
||||
<br><br>";
|
||||
//end ENABLE REMOTE SERVERS
|
||||
|
||||
$services = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXbilling_services ORDER BY service_name");
|
||||
if ($services > 0)
|
||||
{
|
||||
?>
|
||||
<h2><?php print_lang('current_services');?></h2>
|
||||
<table class="center" style='text-align:center;'>
|
||||
<tr>
|
||||
<th><?php print_lang('id');?></th>
|
||||
<th><?php print_lang('service_name');?></th>
|
||||
<th><?php print_lang('remote_server');?></th>
|
||||
<th><?php print_lang('unavailable');?></th>
|
||||
<th><?php print_lang('price_monthly');?></th>
|
||||
<th><?php print_lang('service_image_url');?></th>
|
||||
<th>Enabled</th>
|
||||
</tr>
|
||||
<?php
|
||||
foreach($services as $row)
|
||||
{
|
||||
?>
|
||||
<tr class="tr<?php $i = 0; echo($i++%2);?>">
|
||||
<td><b class="success" ><?php echo $row['service_id'];?></b></td>
|
||||
<td><?php echo $row['service_name'];?></td>
|
||||
|
||||
<form method="post" action="">
|
||||
<input name="service" type="hidden" value="<?php echo $row['service_id'];?>"/>
|
||||
<td><input name="new_remote_server_id" type="text" value="<?php echo $row['remote_server_id'];?>"/></td>
|
||||
<td><input name="new_out_of_stock" type="text" value="<?php echo $row['out_of_stock'];?>"/></td>
|
||||
<td><input name="new_price_monthly" type="text" value="<?php echo $row['price_monthly'];?>" size="6"/></td>
|
||||
<td><input name="new_url" type="text" value="<?php echo $row['img_url'];?>"/></td>
|
||||
<td><input name="new_enabled" type="text" value="<?php echo $row['enabled'];?>"/></td>
|
||||
|
||||
<td><input type="submit" value="<?php print_lang('update_settings');?>"/></td>
|
||||
</form>
|
||||
</tr>
|
||||
<?php
|
||||
if(isset($_POST['new_enabled']))
|
||||
{
|
||||
$Enabled ='1';
|
||||
}
|
||||
else
|
||||
{
|
||||
$Enabled ='0';
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="center">
|
||||
<tr>
|
||||
<tr>
|
||||
<td>
|
||||
<form action="" method="post">
|
||||
<select name="service_id">
|
||||
<?php
|
||||
foreach($services as $service)
|
||||
{
|
||||
?>
|
||||
<option value="<?php echo $service['service_id'];?>"><?php echo $service['service_name'];?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<input type="submit" value="<?php print_lang('remove_service');?>"/>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
<?php
|
||||
function curPageName()
|
||||
{
|
||||
return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
|
||||
}
|
||||
|
||||
function exec_ogp_module()
|
||||
{
|
||||
require('includes/config.inc.php');
|
||||
require_once('modules/settings/functions.php');
|
||||
require_once('includes/form_table_class.php');
|
||||
global $db,$view,$settings;
|
||||
|
||||
$currencies = Array (
|
||||
'AUD' => 'Australian Dollar',
|
||||
'BRL' => 'Brazilian Real',
|
||||
'CAD' => 'Canadian Dollar',
|
||||
'CZK' => 'Czech Koruna',
|
||||
'DKK' => 'Danish Krone',
|
||||
'EUR' => 'Euro',
|
||||
'HKD' => 'Hong Kong Dollar',
|
||||
'HUF' => 'Hungarian Forint',
|
||||
'ILS' => 'Israeli New Sheqel',
|
||||
'JPY' => 'Japanese Yen',
|
||||
'MYR' => 'Malaysian Ringgit',
|
||||
'MXN' => 'Mexican Peso',
|
||||
'NOK' => 'Norwegian Krone',
|
||||
'NZD' => 'New Zealand Dollar',
|
||||
'PHP' => 'Philippine Peso',
|
||||
'PLN' => 'Polish Zloty',
|
||||
'GBP' => 'Pound Sterling',
|
||||
'RUB' => 'Russian Ruble',
|
||||
'SGD' => 'Singapore Dollar',
|
||||
'SEK' => 'Swedish Krona',
|
||||
'CHF' => 'Swiss Franc',
|
||||
'TWD' => 'Taiwan New Dollar',
|
||||
'THB' => 'Thai Baht',
|
||||
'TRY' => 'Turkish Lira',
|
||||
'USD' => 'U.S. Dollar'
|
||||
);
|
||||
|
||||
asort($currencies);
|
||||
|
||||
|
||||
$settings['paypal'] = isset($settings['paypal']) ? $settings['paypal'] : "1";
|
||||
$settings['debug'] = isset($settings['debug']) ? $settings['debug'] : "1";
|
||||
$settings['sandbox'] = isset($settings['sandbox']) ? $settings['sandbox'] : "1";
|
||||
$settings['currency'] = isset($settings['currency']) ? $settings['currency'] : "EUR";
|
||||
$settings['daily'] = isset($settings['daily']) ? $settings['daily'] : 1;
|
||||
$settings['monthly'] = isset($settings['monthly']) ? $settings['monthly'] : 1;
|
||||
$settings['annually'] = isset($settings['annually']) ? $settings['annually'] : 1;
|
||||
$settings['tax_amount'] = isset($settings['tax_amount']) ? $settings['tax_amount'] : 7;
|
||||
$settings['webhookurl'] = isset($settings['webhookurl']) ? $settings['webhookurl'] : "https://discordapp.com/api/webhooks";
|
||||
$settings['checkbox'] = isset($settings['checkbox']) ? $settings['checkbox'] : "Terms and conditions";
|
||||
$settings['TOSpopup'] = isset($settings['TOSpopup']) ? $settings['TOSpopup'] : "Accept the TOS";
|
||||
$settings['display_free'] = isset($settings['display_free']) ? $settings['display_free'] : "1";
|
||||
|
||||
|
||||
$settings['paypal_email'] = isset($settings['paypal_email']) ? $settings['paypal_email'] : "Business@E-mail";
|
||||
function checked($value){
|
||||
global $settings;
|
||||
if( $settings[$value] == 1 )
|
||||
return 'checked="checked"';
|
||||
}
|
||||
|
||||
|
||||
if(isset($_POST['currency']))
|
||||
{
|
||||
$currency = $_REQUEST['currency'];
|
||||
}
|
||||
|
||||
if ( isset($_REQUEST['update_settings']) )
|
||||
{
|
||||
$settings = array(
|
||||
"paypal" => $_REQUEST['paypal'],
|
||||
"debug" => $_REQUEST['debug'],
|
||||
"sandbox" => $_REQUEST['sandbox'],
|
||||
"currency" => $currency,
|
||||
"daily" => @$_REQUEST['daily'],
|
||||
"monthly" => @$_REQUEST['monthly'],
|
||||
"annually" => @$_REQUEST['annually'],
|
||||
"tax_amount" => $_REQUEST['tax_amount'],
|
||||
"webhookurl" => $_REQUEST['webhookurl'],
|
||||
"checkbox" => $_REQUEST['checkbox'],
|
||||
"TOSpopup" => $_REQUEST['TOSpopup'],
|
||||
"display_free" =>$_REQUEST['display_free'],
|
||||
"paypal_email" => $_REQUEST['paypal_email']);
|
||||
|
||||
$db->setSettings($settings);
|
||||
print_success(get_lang('settings_updated'));
|
||||
$view->refresh("?m=billing&p=shop_settings");
|
||||
return;
|
||||
}
|
||||
|
||||
$s = ( isset($_SERVER['HTTPS']) and get_true_boolean($_SERVER['HTTPS']) ) ? "s" : "";
|
||||
$p = isset($_SERVER['SERVER_PORT']) & $_SERVER['SERVER_PORT'] != "80" ? ":".$_SERVER['SERVER_PORT'] : NULL ;
|
||||
$this_script = 'http'.$s.'://'.$_SERVER['SERVER_NAME'].$p.$_SERVER['SCRIPT_NAME'];
|
||||
$current_folder_url = str_replace( curPageName(), "", $this_script);
|
||||
|
||||
echo "<h2>".get_lang('shop_settings')."</h2>";
|
||||
|
||||
$ft = new FormTable();
|
||||
?>
|
||||
<form>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
</form>
|
||||
<?php
|
||||
$ft->start_form("?m=billing&p=shop_settings");
|
||||
$ft->start_table();
|
||||
echo "<tr><td colspan='2' ><h3>".get_lang('payment_gateway')."</h4></td></tr>";
|
||||
$ft->add_custom_field('paypal','<input type="checkbox" name="paypal" value="1" '.checked('paypal').'/>');
|
||||
$ft->add_custom_field('debug','<input type="checkbox" name="debug" value="1" '.checked('debug').'/>');
|
||||
$ft->add_custom_field('sandbox','<input type="checkbox" name="sandbox" value="1" '.checked('sandbox').'/>');
|
||||
$ft->add_field('string','paypal_email',$settings['paypal_email'],35);
|
||||
$ft->add_custom_field('currency',
|
||||
create_drop_box_from_array($currencies,"currency",$settings['currency'],false));
|
||||
echo "<tr><td colspan='2' ><h3>".get_lang('available_invoice_types')."</h4></td></tr>";
|
||||
$ft->add_custom_field('daily','<input type="checkbox" name="daily" value="1" '.checked('daily').'/>');
|
||||
$ft->add_custom_field('monthly','<input type="checkbox" name="monthly" value="1" '.checked('monthly').'/>');
|
||||
$ft->add_custom_field('annually','<input type="checkbox" name="annually" value="1" '.checked('annually').'/>');
|
||||
echo "<tr><td colspan='2' ><h3>Tax Amount</h4></td></tr>";
|
||||
$ft->add_field('string','tax_amount',$settings['tax_amount'],2);
|
||||
echo "<tr><td colspan='2' ><h3>Other Settings</h4></td></tr>";
|
||||
$ft->add_field('string','webhookurl',$settings['webhookurl'],2);
|
||||
$ft->add_field('string','checkbox',$settings['checkbox'],2);
|
||||
$ft->add_field('string','TOSpopup',$settings['TOSpopup'],2);
|
||||
$ft->add_custom_field('display_free','<input type="checkbox" name="display_free" value="1" '.checked('display_free').'/>');
|
||||
$ft->end_table();
|
||||
$ft->add_button("submit","update_settings",get_lang('update_settings'));
|
||||
$ft->end_form();
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,325 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2017 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
function exec_ogp_module()
|
||||
{
|
||||
global $db, $view;
|
||||
|
||||
$settings = $db->getSettings();
|
||||
|
||||
if (isset($_POST['save']))
|
||||
{
|
||||
$new_description = str_replace("\\r\\n", "<br>", $_POST['description']);
|
||||
$service = $_POST['service_id'];
|
||||
|
||||
$change_description = "UPDATE OGP_DB_PREFIXbilling_services
|
||||
SET description ='".$db->realEscapeSingle($new_description)."'
|
||||
WHERE service_id=".$db->realEscapeSingle($service);
|
||||
$save = $db->query($change_description);
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<a href="?m=billing&p=cart"><img SRC="images/cart.png" BORDER="0" WIDTH=22 HEIGHT=20/><?php print_lang('your_cart');?></a><br>
|
||||
<?PHP echo date('d-M-Y H:i a'); ?>
|
||||
<!-- ------------------------------------------------------------------------------
|
||||
THIS IS WHAT WE DISPLAY ON THE SHOP PAGE AT THE TOP
|
||||
-->
|
||||
<center><h5>We treat YOUR server like it was OUR server</h5></center>
|
||||
<br>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
// Shop Form
|
||||
if(intval($_REQUEST['service_id']) !==0) $where_service_id = " WHERE enabled = 1 and service_id=".intval($_REQUEST['service_id']); else $where_service_id = " where enabled = 1";
|
||||
$qry_services = "SELECT * FROM OGP_DB_PREFIXbilling_services".$where_service_id;
|
||||
$services = $db->resultQuery($qry_services);
|
||||
|
||||
if (isset($_REQUEST['service_id']) && $services === false) {
|
||||
$view->refresh('home.php?m=billing&p=shop');
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($services as $key => $row) {
|
||||
$service_id[$key] = $row['service_id'];
|
||||
$home_cfg_id[$key] = $row['home_cfg_id'];
|
||||
$mod_cfg_id[$key] = $row['mod_cfg_id'];
|
||||
$service_name[$key] = $row['service_name'];
|
||||
$remote_server_id[$key] = $row['remote_server_id'];
|
||||
$out_of_stock[$key] = $row['_out_of_stock'];
|
||||
$slot_max_qty[$key] = $row['slot_max_qty'];
|
||||
$slot_min_qty[$key] = $row['slot_min_qty'];
|
||||
$price_daily[$key] = $row['price_daily'];
|
||||
$price_monthly[$key] = $row['price_monthly'];
|
||||
$price_year[$key] = $row['price_year'];
|
||||
$description[$key] = $row['description'];
|
||||
$img_url[$key] = $row['img_url'];
|
||||
$ftp[$key] = $row['ftp'];
|
||||
$install_method[$key] = $row['install_method'];
|
||||
$manual_url[$key] = $row['manual_url'];
|
||||
$access_rights[$key] = $row['access_rights'];
|
||||
}
|
||||
array_multisort($service_name,
|
||||
$service_id,
|
||||
$home_cfg_id,
|
||||
$mod_cfg_id,
|
||||
$remote_server_id,
|
||||
$out_of_stock,
|
||||
$slot_max_qty,
|
||||
$slot_min_qty,
|
||||
$price_daily,
|
||||
$price_monthly,
|
||||
$price_year,
|
||||
$description,
|
||||
$img_url,
|
||||
$ftp,
|
||||
$install_method,
|
||||
$manual_url,
|
||||
$access_rights, SORT_DESC, $services);
|
||||
|
||||
echo "<div>";
|
||||
foreach($services as $row)
|
||||
{
|
||||
if(!isset($_REQUEST['service_id']))
|
||||
{
|
||||
?>
|
||||
<div style="
|
||||
float:left;
|
||||
padding-top: 30px;
|
||||
padding-right: 20px;
|
||||
padding-bottom: 30px;
|
||||
padding-left: 20px;">
|
||||
<div style = "text-align: center;">
|
||||
<img src="<?php echo $row['img_url'] ;?>" width=256 height=96 border=0 alt="cheap <?php echo $row['service_name'];?> Game Server">
|
||||
<br>
|
||||
<?php echo $row['service_name'];?>
|
||||
<br>
|
||||
<?php
|
||||
if ($row['price_monthly'] == 0.0) {
|
||||
echo "<span style='color:green'><b>FREE!</b></span>";
|
||||
} else {
|
||||
echo "<span style='color:grey'>Starting at $" . number_format(floatval($row['price_monthly']*$row['slot_min_qty']),2) ." each month<br> "
|
||||
. number_format(floatval($row['price_monthly']),2) ." per player slot<br>".$row['slot_min_qty'] ." to " . $row['slot_max_qty'] . " players</span><br>
|
||||
<a href='".$row['description']."' target='_blank'>More Info</a>";
|
||||
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
<form action="" method="POST">
|
||||
<input name="service_id" type="hidden" value="<?php echo $row['service_id'];?>" />
|
||||
|
||||
<input name="order_server" type="submit" value="ORDER HERE">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</>
|
||||
|
||||
|
||||
<div style="border-left:10px solid transparent;">
|
||||
|
||||
<?php
|
||||
} else
|
||||
{
|
||||
?>
|
||||
<div style="float:left; border: 4px solid transparent;border-bottom: 25px solid transparent;">
|
||||
<img src="<?php echo $row['img_url'] ;?>" width=256 height=96 border=0 alt="cheap <?php echo $row['service_name'];?> server">
|
||||
<center><b><?php echo $row['service_name']."</b>
|
||||
<br>
|
||||
</center>";
|
||||
$isAdmin = $db->isAdmin($_SESSION['user_id'] );
|
||||
|
||||
if($isAdmin)
|
||||
{
|
||||
if(!isset($_POST['edit']))
|
||||
{
|
||||
echo "<p style='color:gray;width:280px;' >$row[description]<p>";
|
||||
echo "<form action='' method='post'>".
|
||||
"<input type='hidden' name='service_id' value='$row[service_id]' />".
|
||||
"<input type='submit' name='edit' value='" . get_lang('edit') . "' />".
|
||||
"</form>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<form action='' method='post'>".
|
||||
"<textarea style='resize:none;width:280px;height:132px;' name='description' >".str_replace("<br>", "\r\n", $row['description'])."</textarea><br>".
|
||||
"<input type='hidden' name='service_id' value='$row[service_id]' />".
|
||||
"<input type='submit' name='save' value='" . get_lang('save') . "' />".
|
||||
"</form>";
|
||||
}
|
||||
}
|
||||
else
|
||||
echo "<center><a href='". $row[description]."' target='_blank'>More Info</a><br></center>";
|
||||
?>
|
||||
</div>
|
||||
<table style="width:420px;float:left;">
|
||||
<form method="post" action="?m=billing&p=add_to_cart<?php if(isset($_POST['service_id'])) echo "&service_id=".$_POST['service_id'];?>">
|
||||
<input type="hidden" name="remote_control_password" size="15" value="<?php echo genRandomString(10);?>">
|
||||
<input type="hidden" name="ftp_password" size="15" value="<?php echo genRandomString(10);?>">
|
||||
<tr>
|
||||
<td align="right"><?php print_lang('service_name');?> </td>
|
||||
<td align="left">
|
||||
<input type="text" name="home_name" size="40" value="<?php echo $row['service_name'];?>">
|
||||
</td>
|
||||
<tr>
|
||||
<td align="right">Location </td>
|
||||
<td align="left">
|
||||
<?php
|
||||
//loop through multiple remote server ID stored in services 'remote_server_ip' as text
|
||||
//change WHERE clause to IS IN clause
|
||||
$rsiArray = explode(" ", $row['remote_server_id']);
|
||||
$rsi = implode(",",$rsiArray);
|
||||
//get the out of stock into an array and see if the rsID is in that array
|
||||
$unavailable_Array = explode(" ", $row['out_of_stock']);
|
||||
$available_server = false;
|
||||
//loop through each of the assigned servers and see if its disabled
|
||||
foreach($rsiArray as $rsi)
|
||||
{
|
||||
$query = "SELECT * FROM OGP_DB_PREFIXremote_servers WHERE remote_server_id = ".$rsi;
|
||||
$result = $db->resultQuery($query);
|
||||
foreach($result as $rs)
|
||||
{
|
||||
|
||||
$rsID =$rs['remote_server_id'];
|
||||
$rsNAME = $rs['remote_server_name'];
|
||||
//echo "<option value='$rsID'>$rsNAME</option>";
|
||||
// add disabled to lable and input if $rsID is in out_of_stock
|
||||
$is_unavailable = "";
|
||||
$service_text_color = "";
|
||||
if (in_array($rsID,$unavailable_Array))
|
||||
{
|
||||
$is_unavailable = "disabled";
|
||||
$service_text_color = "red";
|
||||
|
||||
}
|
||||
|
||||
if($rs['enabled']==0)
|
||||
{
|
||||
$is_unavailable = "disabled";
|
||||
$service_text_color = "red";
|
||||
}
|
||||
if($is_unavailable == "")
|
||||
{
|
||||
$available_server = true;
|
||||
}
|
||||
|
||||
|
||||
//default radio button
|
||||
// //<input type='radio' $is_unavailable name='ip_id' id='$rsID' value='$rsID' >
|
||||
echo "<div>
|
||||
<input type='radio' $is_unavailable name='ip_id' id='$rsID' value='$rsID' required>
|
||||
<label for '$rsID' $is_unavailable ><span style='color:$service_text_color'>$rsNAME </span></label>
|
||||
</div>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><?php print_lang('max_players');?> </td>
|
||||
<td align="left">
|
||||
<select name="max_players">
|
||||
<?php
|
||||
$players=$row['slot_min_qty'];
|
||||
while($players<=$row['slot_max_qty'])
|
||||
{
|
||||
//echo "<option value='$players'>$players slots</option>";
|
||||
//displays the price
|
||||
echo "<option value='$players'>$players slots = $" . number_format(floatval($row['price_monthly'] * $players),2 ) . " per month</option>";
|
||||
$players++;
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><?php print_lang('invoice_duration');?> </td>
|
||||
<td align="left">
|
||||
<select name="qty">
|
||||
<?php
|
||||
$qty=1;
|
||||
while($qty<=12)
|
||||
{
|
||||
echo "<option value='$qty'>$qty months</option>";
|
||||
$qty++;
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<input type="hidden" name="invoice_duration" value="month" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" colspan="2">
|
||||
<input name="service_id" type="hidden" value="<?php echo $row['service_id'];?>"/>
|
||||
<?php
|
||||
if ($available_server)
|
||||
{
|
||||
?>
|
||||
<input type="submit" name="add_to_cart" value="<?php print_lang('add_to_cart');?>"/>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" colspan="2">
|
||||
<form action ="?m=billing&p=shop" method="POST">
|
||||
<button><< <?php print_lang('back_to_list');?></button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div style="clear: both; text-align:center" id="read_more" >
|
||||
<p style="color:yellow; text-align:center;">100% refund if you are not satisfied
|
||||
</p>
|
||||
Read our <a href="tos.php" target="_blank">Terms of Service</a> Here
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2017 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
chdir(realpath(dirname(__FILE__))); /* Change to the current file path */
|
||||
chdir("../.."); /* Base path to ogp web files */
|
||||
// Report all PHP errors
|
||||
error_reporting(E_ALL);
|
||||
// Path definitions
|
||||
define("CONFIG_FILE","includes/config.inc.php");
|
||||
//Requiere
|
||||
require_once("includes/functions.php");
|
||||
require_once("includes/helpers.php");
|
||||
require_once("includes/html_functions.php");
|
||||
require_once("modules/config_games/server_config_parser.php");
|
||||
require_once("includes/lib_remote.php");
|
||||
require_once CONFIG_FILE;
|
||||
// Connect to the database server and select database.
|
||||
$db = createDatabaseConnection($db_type, $db_host, $db_user, $db_pass, $db_name, $table_prefix);
|
||||
|
||||
$panel_settings = $db->getSettings();
|
||||
if( isset($panel_settings['time_zone']) && $panel_settings['time_zone'] != "" )
|
||||
date_default_timezone_set($panel_settings['time_zone']);
|
||||
|
||||
|
||||
//these dates are configured in the Shop Settings page
|
||||
$today=time();
|
||||
$invoice_date = strtotime('+ 7 days'); //this many days until the finish_date
|
||||
$suspend_date = $today; //suspend when overdue
|
||||
$removal_date = strtotime('+ 7 days'); //finish_date is passed 7 days ago
|
||||
$rundate = date('d/M/y G:i',$today);
|
||||
|
||||
|
||||
//THESE SERVERS HAVE REACHED THE DATE FOR INVOICE, FINISH_DATE - 7 (OR WHAT IS IN SETTINGS)
|
||||
//SET STATUS -1 MEANING INVOICED
|
||||
//LOOP THROUGH ALL SERVERS WITH STATUS = 1 (ACTIVE) -----------------------------------------------------------
|
||||
$settings = $db->getSettings();
|
||||
$subject = "Test Email";
|
||||
$emailto = "iaretechnician@gmail.com";
|
||||
$message = "WooHoo<br><br><br>Email Works<br>Thanks!<br>";
|
||||
$mail = mymail($emailto, $subject, $message, $settings);
|
||||
|
||||
|
||||
// END EMAIL
|
||||
|
||||
|
||||
|
|
@ -1,177 +0,0 @@
|
|||
<?php
|
||||
function exec_ogp_module()
|
||||
{
|
||||
//Include database connection details
|
||||
require('includes/config.inc.php');
|
||||
|
||||
global $db,$view,$settings;
|
||||
if(isset($_GET['type']) && $_GET['type'] == 'cleared')
|
||||
{
|
||||
echo '<body onload="window.print()" >';
|
||||
$view->setCharset(get_lang('lang_charset'));
|
||||
}
|
||||
|
||||
$user_id = $_SESSION['user_id'];
|
||||
$cart_id = $_POST['cart_id'];
|
||||
$cart_id = $db->realEscapeSingle($cart_id);
|
||||
$isAdmin = $db->isAdmin( $_SESSION['user_id'] );
|
||||
if ( $isAdmin )
|
||||
$orders = $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE cart_id=".$db->realEscapeSingle($cart_id) );
|
||||
else
|
||||
$orders = $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE cart_id=".$db->realEscapeSingle($cart_id)." AND user_id=".$db->realEscapeSingle($user_id) );
|
||||
|
||||
$cart = $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_carts WHERE cart_id=".$db->realEscapeSingle($cart_id) );
|
||||
$tempdate = date_create( $cart[0]['date']);
|
||||
$paid_date = date_format($tempdate,"d M Y H:m");
|
||||
|
||||
|
||||
|
||||
if( !empty($orders) )
|
||||
{
|
||||
?>
|
||||
<br><br>
|
||||
<table width="772" height="438" border="0" style="color:#000000" bgcolor="#FFFFFF">
|
||||
<tr bgcolor="#000000">
|
||||
<td colspan="7" align="center" style="color:white">
|
||||
<p style="font-size:18pt"><b><?php print_lang("invoice");?></b></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" >Paid: <?php echo $paid_date; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="150" height="21" align="left"><b><?php echo "<b>Xp Game Host</b><br/>
|
||||
3400 Laurel Rd<br/>
|
||||
Brunswick, OH 44212 "; ?></td>
|
||||
<td colspan="4" rowspan="3"> </td>
|
||||
<td align="center" colspan="2" rowspan="3" ><img src="images/xplogo.png"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="150" height="21" align="left">Email: <?php echo "<b>".$settings['panel_email_address']."</b>"; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="23" colspan="7"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="23" style="border: 2px solid #000000" bgcolor="#222222"><div align="center"><strong><?php print_lang("order");?></strong></div></td>
|
||||
<td height="23" style="border: 2px solid #000000" bgcolor="#222222"><div align="center"><strong>Server ID</strong></div></td>
|
||||
<td height="23" style="border: 2px solid #000000" bgcolor="#222222"><div align="center"><strong><?php print_lang("item");?></strong></div></td>
|
||||
<td height="23" style="border: 2px solid #000000" bgcolor="#222222"><div align="center"><strong><?php print_lang("invoice_duration");?></strong></div></td>
|
||||
<td height="23" style="border: 2px solid #000000" bgcolor="#222222"><div align="center"><strong><?php print_lang("slot_cost");?></strong></div></td>
|
||||
<td height="23" style="border: 2px solid #000000" bgcolor="#222222"><div align="center"><strong><?php print_lang("slot_quantity");?></strong></div></td>
|
||||
<td height="23" style="border: 2px solid #000000" bgcolor="#222222"><div align="center"><strong><?php print_lang("order_price");?></strong></div></td>
|
||||
<hr/></tr>
|
||||
<?php
|
||||
$subtotal = 0;
|
||||
foreach($orders as $order)
|
||||
{
|
||||
$order_id = $order['order_id'];
|
||||
$user_id = $order['user_id'];
|
||||
$service_id = $order['service_id'];
|
||||
$home_name = $order['home_name']." - ".$order_id;
|
||||
$ip = $order['ip'];
|
||||
$max_players = $order['max_players'];
|
||||
$qty = $order['qty'];
|
||||
$invoice_duration = $order['invoice_duration'];
|
||||
$price = $order['price'];
|
||||
$subtotal= $price * $max_players * $qty;
|
||||
$subtotal2 += $order['price'] * $max_players * $qty;
|
||||
$qry_service = "SELECT DISTINCT price_daily, price_monthly, price_year FROM ".$table_prefix."billing_services WHERE service_id=".$db->realEscapeSingle($service_id);
|
||||
$result_service = $db->resultQuery($qry_service);
|
||||
$row_service = $result_service[0];
|
||||
|
||||
//Calculating Costs
|
||||
|
||||
if ($invoice_duration == "day")
|
||||
{
|
||||
$price_slot=$row_service['price_daily'];
|
||||
}
|
||||
elseif ($invoice_duration == "month")
|
||||
{
|
||||
$price_slot=$row_service['price_monthly'];
|
||||
}
|
||||
elseif ($invoice_duration == "year")
|
||||
{
|
||||
$price_slot=$row_service['price_year']*12;
|
||||
}
|
||||
$duration = $invoice_duration > 1 ? $invoice_duration."s":$invoice_duration;
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td align="center" height="23"><?php echo $order_id; ?></td>
|
||||
<td align="center" height="23"><?php echo $order['home_id']; ?></td>
|
||||
<td align="center" height="23"><?php echo $order['home_name']; ?></td>
|
||||
<td align="center"><?php echo $qty." ".get_lang($duration); ?></td>
|
||||
<td align="center"><?php echo "$" . number_format(floatval(round(($price_slot),2 )),2)." ".$settings['currency']."/".get_lang($invoice_duration); ?></td>
|
||||
<td align="center"><?php echo $max_players; ?></td>
|
||||
<td align="center"><?php echo "$" . number_format(floatval(round(($subtotal),2 )),2)." ".$settings['currency']; ?></td>
|
||||
</tr><?php
|
||||
}
|
||||
|
||||
$coupon_savings = 0;
|
||||
if($cart[0]['coupon_id']>0) {
|
||||
$result = $db->resultquery("SELECT discount from OGP_DB_PREFIXbilling_coupons WHERE id = '". $cart[0]['coupon_id'] . "'");
|
||||
foreach($result as $coupon){
|
||||
$coupon_savings = $subtotal2 * ($coupon['discount'] / 100);
|
||||
}
|
||||
}
|
||||
|
||||
//$subtotal2 += $order['price'] * $max_players * $qty;
|
||||
//$total = $subtotal2+($cart[0]['tax_amount']/100*$subtotal2);
|
||||
$total = ($subtotal2 - $coupon_savings) * ($cart[0]['tax_amount'] / 100 + 1);
|
||||
?>
|
||||
<tr>
|
||||
<td height="24" colspan="5"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" rowspan="5"> </td>
|
||||
<td height="23" style="border: 2px solid #000000"><div align="right"><strong><?php print_lang("subtotal");?> : </strong></div></td>
|
||||
<td style="border: 2px solid #000000"><?php echo "$" . number_format(floatval(round(($subtotal2),2 )),2) . " ".$settings['currency']; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
if($cart[0]['coupon_id']>0) {
|
||||
echo '
|
||||
<tr>
|
||||
<td height="23" style="border: 2px solid #000000"><div align="right"><strong>Discount : </strong></div></td>
|
||||
<td style="border: 2px solid #000000">'. "$" . number_format(floatval(round((($subtotal2-$coupon_savings)-$subtotal2),2 )),2) . " ".$settings['currency'] .'</td>
|
||||
</tr>';
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td height="23" style="border: 2px solid #000000"><div align="right"><strong><?php print_lang("tax");?> : </strong></div></td>
|
||||
<td style="border: 2px solid #000000"><?php echo $cart[0]['tax_amount']."%"; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="23" style="border: 2px solid #000000" bgcolor="#222222"><div align="right"><strong><?php print_lang("total");?> : </strong></div></td>
|
||||
<td style="border: 2px solid #000000" bgcolor="#222222"><?php echo "$" . number_format(floatval(round(($total),2 )),2) ." ".$settings['currency']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="23" style="border: 2px solid #000000"><div align="right"><strong></strong></div></td>
|
||||
<td style="border: 2px solid #000000"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br><br>
|
||||
<form method='post' action='?m=billing&p=bill&type=cleared' >
|
||||
<input type="hidden" name="cart_id" value="<?php echo $_POST['cart_id'];?>">
|
||||
<input type="submit" value="<?php print_lang('print_invoice') ?>" />
|
||||
</form>
|
||||
<form method='post' action='?m=billing&p=<?php
|
||||
$isAdmin = $db->isAdmin($_SESSION['user_id']);
|
||||
if ($isAdmin)
|
||||
{
|
||||
echo 'orders';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'cart';
|
||||
}
|
||||
echo "'><input type='submit' value='";
|
||||
print_lang('back');
|
||||
?>'/>
|
||||
</form>
|
||||
<br><br><?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
$url = "https://";
|
||||
// Append the host(domain name, ip) to the URL.
|
||||
$url.= $_SERVER['HTTP_HOST'];
|
||||
// foreach($_POST as $key => $val) {
|
||||
// echo 'Field name : ' . $key . ' Value :' .$val .'<br>';
|
||||
// }
|
||||
|
||||
if (($_POST['payment_status']=="Completed")){
|
||||
echo "<title>Success</title><h4>Thank you for your order. <br> ... </h4><br>";
|
||||
echo "Processing your payment Information ..";
|
||||
$bounce_to = $url."/home.php?m=billing&p=paid";
|
||||
} else {
|
||||
echo "<title>Uh OH</title><h4>There was a problem, Please contact Support<br> ... </h4><br>";
|
||||
$bounce_to = $url."/home.php?m=billing&p=paid";
|
||||
//we can setup a "failed page" to redirect to. My sandbox payments are not marked completed for some reason
|
||||
|
||||
}
|
||||
?>
|
||||
<form name='paid' action='<?php echo $bounce_to?>' method='post'>
|
||||
<input type='hidden' name='cart_id' value='<?php echo $_POST["item_number"]?>'>
|
||||
<input type='hidden' name='payment_status' value='<?php echo $_POST["payment_status"] ?>'>
|
||||
</form>
|
||||
<script>
|
||||
var auto_refresh = setInterval(
|
||||
function()
|
||||
{
|
||||
submitform();
|
||||
}, 2000);
|
||||
function submitform()
|
||||
{
|
||||
document.paid.submit();
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,428 +0,0 @@
|
|||
<?php
|
||||
function saveOrderToDb($user_id,$service_id,$home_name,$ip,$max_players,$qty,$invoice_duration,$price,$remote_control_password,$ftp_password,$cart_id,$home_id = "0",$status,$finish_date,$extended = "0"){
|
||||
global $db;
|
||||
if(isset($_SESSION['coupon_id'])){
|
||||
$coupon_id = $_SESSION['coupon_id'];
|
||||
} else {
|
||||
$coupon_id = 0;
|
||||
}
|
||||
$fields['user_id'] = $user_id;
|
||||
$fields['service_id'] = $service_id;
|
||||
$fields['home_name'] = $home_name;
|
||||
$fields['ip'] = $ip;
|
||||
$fields['max_players'] = $max_players;
|
||||
$fields['qty'] = $qty;
|
||||
$fields['invoice_duration'] = $invoice_duration;
|
||||
$fields['price'] = $price;
|
||||
$fields['remote_control_password'] = $remote_control_password;
|
||||
$fields['ftp_password'] = $ftp_password;
|
||||
$fields['cart_id'] = $cart_id;
|
||||
$fields['home_id'] = $home_id;
|
||||
$fields['status'] = $status;
|
||||
$fields['finish_date'] = $finish_date;
|
||||
$fields['extended'] = $extended;
|
||||
$fields['coupon_id'] = $coupon_id;
|
||||
return $db->resultInsertId( 'billing_orders', $fields );
|
||||
}
|
||||
|
||||
|
||||
|
||||
function assignOrdersToCart($user_id,$tax_amount,$currency,$coupon_id){
|
||||
global $db;
|
||||
$fields['user_id'] = $user_id;
|
||||
$fields['paid'] = '0';
|
||||
$fields['tax_amount'] = $tax_amount;
|
||||
$fields['currency'] = $currency;
|
||||
//discount coupon
|
||||
if (!isset($coupon_id)) $coupon_id = "0";
|
||||
$fields['coupon_id'] = $coupon_id;
|
||||
$check_expired = $db->resultquery("SELECT id from OGP_DB_PREFIXbilling_coupons WHERE id = $fields[coupon_id] AND count > 0 AND expires >= NOW()");
|
||||
if ($check_expired <= 0) $fields['coupon_id'] = 0;
|
||||
return $db->resultInsertId( 'billing_carts', $fields );
|
||||
}
|
||||
|
||||
function exec_ogp_module()
|
||||
{
|
||||
error_reporting(E_ALL);
|
||||
|
||||
global $db,$view,$settings;
|
||||
$discounted_price = 0;
|
||||
|
||||
$user_id = $_SESSION['user_id'];
|
||||
if( isset( $_POST["buy"] ) or isset( $_POST["pay_paypal"] ) )
|
||||
{
|
||||
|
||||
$cart_id = $_POST['cart_id'];
|
||||
echo '<meta http-equiv="refresh" content="0;url=home.php?m=billing&p=create_servers&cart_id='.$cart_id.'" >';
|
||||
|
||||
|
||||
}
|
||||
|
||||
if( isset( $_POST["extend"] ) or isset( $_POST["extend_and_pay_paypal"] ))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['remove']))
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
<style>
|
||||
h4 {
|
||||
width:250px;
|
||||
height:25px;
|
||||
background:#f5f5f5;
|
||||
border-top-style:solid;
|
||||
border-top-color:#afafaf;
|
||||
border-top-width:1px;
|
||||
border-style: solid;
|
||||
border-color: #CFCFCF;
|
||||
border-width: 1px;
|
||||
padding-top:8px;
|
||||
text-align: center;
|
||||
font-family:"Trebuchet MS";
|
||||
}
|
||||
</style>
|
||||
<h2>Cart</h2>
|
||||
<!--
|
||||
SHOW ALL THE INVOICES FOR USER
|
||||
|
||||
<form method="post" action="?m=billing&p=orders">
|
||||
<input type="hidden" name="cart_id" value="<?php echo $order['cart_id'];?>">
|
||||
<input type="submit" value="All Orders">
|
||||
</form>
|
||||
-->
|
||||
<?php
|
||||
if( isset($_SESSION['CART']) and !empty($_SESSION['CART']) )
|
||||
{
|
||||
$carts[0] = $_SESSION['CART'];
|
||||
}
|
||||
|
||||
$user_carts = $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_carts WHERE user_id=".$db->realEscapeSingle($user_id) ." order by cart_id desc" );
|
||||
|
||||
|
||||
if( $user_carts >=1 )
|
||||
{
|
||||
|
||||
// SELECT WHAT KIND OF OLD INVOICES TO DISPLAY. WE NEED A BUTTON?
|
||||
foreach ( $user_carts as $user_cart )
|
||||
{
|
||||
$cart_id = $user_cart['cart_id'];
|
||||
|
||||
$carts[$cart_id] = $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_carts AS cart JOIN
|
||||
OGP_DB_PREFIXbilling_orders AS orders
|
||||
ON orders.cart_id=cart.cart_id
|
||||
WHERE orders.status IN (0, -1 , -2) AND (cart.cart_id=".$db->realEscapeSingle($cart_id). ") order by order_id asc");
|
||||
}
|
||||
}
|
||||
|
||||
if( empty( $carts ) )
|
||||
{
|
||||
print_failure( get_lang('there_are_no_orders_in_cart') );
|
||||
?>
|
||||
<a href="?m=billing&p=shop"><?php print_lang('back'); ?></a>
|
||||
<?php
|
||||
return;
|
||||
}
|
||||
foreach ( $carts as $orders )
|
||||
{
|
||||
if( !empty( $orders ) )
|
||||
{
|
||||
?>
|
||||
<center>
|
||||
<table style="width:95%;text-align:left;" class="center">
|
||||
<tr>
|
||||
<hr />
|
||||
|
||||
|
||||
<th>
|
||||
<?php print_lang("order_desc");?></th>
|
||||
<th>
|
||||
<?php print_lang("price");?>
|
||||
</th>
|
||||
<?php
|
||||
if(isset($orders[0]['paid']) and $orders[0]['paid'] == 3)
|
||||
{
|
||||
?>
|
||||
<th>
|
||||
<?php print_lang('expiration_date');?>
|
||||
</th>
|
||||
|
||||
<th>Status
|
||||
</th>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<th>
|
||||
</th>
|
||||
</tr>
|
||||
<?php
|
||||
$subtotal = 0;
|
||||
$total_orders = count($orders);
|
||||
$order_counter = 0;
|
||||
foreach($orders as $order)
|
||||
{
|
||||
$order_counter++;
|
||||
if ( $order['qty'] > 1 )
|
||||
$order['invoice_duration'] = $order['invoice_duration']."s";
|
||||
|
||||
$subtotal += ($order['price']* $order['max_players'] * $order['qty']);
|
||||
|
||||
?>
|
||||
<tr class="tr">
|
||||
|
||||
<td>
|
||||
<?php
|
||||
$rserver = $db->getRemoteServer($order['ip']);
|
||||
if($order['home_id'] == 0)
|
||||
{
|
||||
echo "Order# ".$order['order_id'] . " <b>".$order['home_name']."</b>";
|
||||
//**************************************************
|
||||
?>
|
||||
<form method="post" action="home.php?m=billing&p=create_servers" >
|
||||
<input type="hidden" name="cart_id" value="<?php echo $order['cart_id'];?>">
|
||||
<input name="buy" type="submit" value="Create Server" ><br>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
|
||||
//*************************************************
|
||||
}
|
||||
else{
|
||||
|
||||
echo "Order# ".$order['order_id'] . " <b>".$order['home_name']."</b> Server ID ".$order['home_id'] ;
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
echo "$" . number_format( $order['price'], 2 ). " " .$order['currency'] . " per slot<br>"
|
||||
|
||||
. $order['max_players'] . " Slots<br>"
|
||||
. $order['qty'] . " " . $order['invoice_duration'] ;
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
if($order['paid'] == 0 and ($order['extended'] == 0))
|
||||
{
|
||||
?>
|
||||
<td align="center">
|
||||
<form method="post" action="">
|
||||
<input type="hidden" name="cart_id" value="<?php echo $order['cart_id'];?>">
|
||||
<input type="hidden" name="order_id" value="<?php echo @$order['order_id'];?>">
|
||||
|
||||
</form>
|
||||
<?php if ($total_orders == $order_counter) {
|
||||
?>
|
||||
<!--checkbox -->
|
||||
<form method="post" action="" >
|
||||
<input type="hidden" name="cart_id" value="<?php echo $order['cart_id'];?>">
|
||||
<?php
|
||||
//check number of orders they have had or if user is an admin (to be able to create server)
|
||||
$isAdmin = $db->isAdmin( $_SESSION['user_id'] );
|
||||
$server_price = number_format( $order['price'], 2 );
|
||||
if(isset($settings['display_free'])) {
|
||||
$display_free = $settings['display_free'];
|
||||
}else {
|
||||
$display_free = false;
|
||||
}
|
||||
if($isAdmin)
|
||||
//if($display_free)
|
||||
{
|
||||
if($isAdmin)
|
||||
{
|
||||
//echo '<input name="buy" type="submit" value="Create Server" ><br>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
<?php } ?>
|
||||
</td><?php
|
||||
}
|
||||
|
||||
|
||||
if($order['paid'] == 3)
|
||||
{
|
||||
$today=time();
|
||||
$formated_finish_date = date('d/M/Y H:i A',$order['finish_date']);
|
||||
|
||||
//status has a date for invoice
|
||||
if($order['status'] > 0)
|
||||
{
|
||||
$status = "<b style='color:green;'>Active</b>" ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//status is -1, invoice has been created
|
||||
elseif($order['status'] == -1)
|
||||
{
|
||||
$status = "<b style='color:yellow;'>Invoice Due</b>";
|
||||
}
|
||||
//invoice was not paid, server is expired and suspended
|
||||
elseif($order['status'] == -2)
|
||||
{
|
||||
$status = "<b style='color:red;'>Suspended</b>";
|
||||
}
|
||||
|
||||
//display the expiration date and invoice button.
|
||||
if($order['status'] > 0){$warning_status = "<b style='color:green;'>". $formated_finish_date ."</b>";}
|
||||
if($order['status'] == -1){$warning_status ="<b style='color:yellow;'>". $formated_finish_date ."</b>";}
|
||||
if($order['status'] == -2){$warning_status ="<b style='color:red;'>". $formated_finish_date ."</b>" ;}
|
||||
|
||||
?>
|
||||
<td>
|
||||
<?php echo "$warning_status";?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo "$status";
|
||||
|
||||
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
}
|
||||
|
||||
if( isset( $order['status'] ) and $order['status'] == "0" or $order['status'] == "-1" or $order['status'] == "-2")
|
||||
{
|
||||
?>
|
||||
<td></td></tr><tr><td>
|
||||
|
||||
|
||||
</td><?php
|
||||
}
|
||||
?>
|
||||
</tr><?php
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<table style="width:95%;text-align:left;" class="center">
|
||||
<tr>
|
||||
<td>Amount</td>
|
||||
|
||||
<td>
|
||||
<?php
|
||||
echo "$" . number_format( $subtotal , 2 ). " " .$order['currency'];?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b><?php echo $coupon_name;?></b></td>
|
||||
<td>
|
||||
<?php
|
||||
//APPLY COUPON CODE HERE
|
||||
$coupon_discount_amt = $subtotal * ($coupon_discount / 100);
|
||||
echo "-$" . number_format($coupon_discount_amt,2);
|
||||
?></td><td>
|
||||
<table><tr>
|
||||
<form method="post" action="">
|
||||
<td class="child">
|
||||
<input type="text" name="coupon_code"size="5" value="<?php echo $coupon_code ?>"></input>
|
||||
</td>
|
||||
<td>
|
||||
<!--<input type="submit" name="Apply Code" value="Apply Code"></input>-->
|
||||
</td>
|
||||
</tr></table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Discounted Subtotal</td>
|
||||
<td><?php $subtotal = $subtotal-$coupon_discount_amt;echo "$" . number_format( $subtotal , 2 ). " " .$order['currency'];?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
Tax Amount</td>
|
||||
<td>
|
||||
<?php echo "$" . number_format($order['tax_amount']/100 * $subtotal,2);?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php print_lang("total");?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
$total = $subtotal+($order['tax_amount']/100*$subtotal);
|
||||
echo "$" . number_format( $total , 2 ). " " .$order['currency'];
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if($order['paid'] == 1)
|
||||
{
|
||||
?>
|
||||
<form method="post" action="home.php?m=billing&p=create_servers">
|
||||
<input type="hidden" name="cart_id" value="<?php echo $order['cart_id'];?>">
|
||||
<?php
|
||||
if($order['extended'] == "1")
|
||||
{
|
||||
?>
|
||||
<input name="enable_server" type="submit" value="<?php print_lang("enable_server");?>">
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<!-- <input name="create_server" type="submit" value="<?php print_lang("create_server");?>">-->
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
elseif($order['paid'] == 2)
|
||||
{
|
||||
echo get_lang_f("payment_is_pending_of_approval");
|
||||
}
|
||||
elseif($order['paid'] == 3)
|
||||
{
|
||||
?>
|
||||
<form method="post" action="?m=billing&p=bill">
|
||||
<input type="hidden" name="cart_id" value="<?php echo $order['cart_id'];?>">
|
||||
<input name="paid" type="submit" value="<?php print_lang("see_invoice");?>">
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</center>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<a href="?m=billing&p=shop"><?php print_lang('back'); ?></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
$test_id = 1362;
|
||||
$db->query( "DROP USER 'server_" .$test_id ."'@localhost'");
|
||||
mysql -uremoteuser -pDrV75Uyyxr9VFVVt -hmysql.iaregamer.com -e "DROP USER server_'${test_id}'"
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
<?php
|
||||
function exec_ogp_module()
|
||||
{
|
||||
global $db;
|
||||
|
||||
//Querying UPDATE a service FROM DB
|
||||
if (isset($_POST['update_coupon']) )
|
||||
{
|
||||
$new_code = $db->realEscapeSingle($_POST['new_code']);
|
||||
$new_name = $db->realEscapeSingle($_POST['new_name']);
|
||||
$new_discount = $db->realEscapeSingle($_POST['new_discount']);
|
||||
$new_count = $db->realEscapeSingle($_POST['new_count']);
|
||||
$new_expires = $db->realEscapeSingle($_POST['new_expires']);
|
||||
$id = $db->realEscapeSingle($_POST['id']);
|
||||
|
||||
//Create INSERT query
|
||||
$qry_change_url = "UPDATE OGP_DB_PREFIXbilling_coupons
|
||||
SET code ='".$new_code."',
|
||||
name = '".$new_name."',
|
||||
discount ='".$new_discount."',
|
||||
count = '".$new_count."',
|
||||
expires = '".$new_expires."'
|
||||
WHERE id=".$id;
|
||||
$db->query($qry_change_url);
|
||||
}
|
||||
|
||||
//Querying INSERT new coupon INTO DB
|
||||
if(isset($_POST['add_coupon']))
|
||||
{
|
||||
$id = $_POST['id'];
|
||||
$code = $_POST['code'];
|
||||
$name = $_POST['name'];
|
||||
$discount = $_POST['discount'];
|
||||
$count= $_POST['count'];
|
||||
$expires = $_POST['expires'];
|
||||
|
||||
|
||||
$query = "INSERT INTO OGP_DB_PREFIXbilling_coupons(code, name, discount, count, expires) VALUES('".$code."', '".$name."', '".$discount."', '".$count."', '".$expires."')";
|
||||
$db->query($query);
|
||||
}
|
||||
|
||||
//Querying REMOVE coupon FROM DB
|
||||
if (isset($_POST['del_coupon']))
|
||||
{
|
||||
$db->query( "DELETE FROM OGP_DB_PREFIXbilling_coupons WHERE id=" . $db->realEscapeSingle($_POST['id']) );
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<!-- Show Coupons on DB -->
|
||||
</table>
|
||||
<br>
|
||||
<?php
|
||||
$result = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXbilling_coupons");
|
||||
if ($result > 0)
|
||||
{
|
||||
?>
|
||||
<h2><?php print_lang('current_coupons');?></h2>
|
||||
<table class="center" style='text-align:center;'>
|
||||
<tr>
|
||||
|
||||
<th><?php print_lang('code');?></th>
|
||||
<th><?php print_lang('coupon_name');?></th>
|
||||
<th><?php print_lang('discount');?></th>
|
||||
<th><?php print_lang('count');?></th>
|
||||
<th><?php print_lang('expires');?></th>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
foreach($result as $row)
|
||||
{
|
||||
?>
|
||||
<tr class="tr<?php $i = 0; echo($i++%2);?>">
|
||||
<form method="post" action="">
|
||||
<input name="id" type="hidden" value="<?php echo $row['id'];?>"/></td>
|
||||
<td><input name="new_code" type="text" value="<?php echo $row['code'];?>"/></td>
|
||||
<td><input name="new_name" type="text" value="<?php echo $row['name'];?>" /></td>
|
||||
<td><input name="new_discount" type="text" value="<?php echo $row['discount'];?>"/></td>
|
||||
<td><input name="new_count"type="text" value="<?php echo $row['count'];?>"/></td>
|
||||
<td><input name="new_expires" type="text" value="<?php echo $row['expires'];?>"/></td>
|
||||
<td><input type="submit" name="update_coupon" value="<?php print_lang('update_settings');?>"/></td>
|
||||
<td><input type="submit" name="del_coupon" value="<?php print_lang('del_coupon');?>"/></td>
|
||||
|
||||
</form>
|
||||
</tr><?php
|
||||
}
|
||||
//add new row to insert
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<td><input name="code" type="text" value=""/></td>
|
||||
<td><input name="name" type="text" value="" /></td>
|
||||
<td><input name="discount" type="text" value="0"/></td>
|
||||
<td><input name="count"type="text" value="0"/></td>
|
||||
<td><input name="expires" type="datetime-local" data-date-format="YYYY MMMM DD" value=""/></td>
|
||||
<td><input type="submit" name="add_coupon" value="<?php print_lang('add_coupon');?>"/></td>
|
||||
</form></table>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
<?php
|
||||
function exec_ogp_module()
|
||||
{
|
||||
global $db;
|
||||
|
||||
//Querying UPDATE a service FROM DB
|
||||
if (isset($_POST['update_coupon']) )
|
||||
{
|
||||
$new_code = $db->realEscapeSingle($_POST['new_code']);
|
||||
$new_name = $db->realEscapeSingle($_POST['new_name']);
|
||||
$new_discount = $db->realEscapeSingle($_POST['new_discount']);
|
||||
$new_count = $db->realEscapeSingle($_POST['new_count']);
|
||||
$new_expires = $db->realEscapeSingle($_POST['new_expires']);
|
||||
$id = $db->realEscapeSingle($_POST['id']);
|
||||
|
||||
//Create INSERT query
|
||||
$qry_change_url = "UPDATE OGP_DB_PREFIXbilling_coupons
|
||||
SET code ='".$new_code."',
|
||||
name = '".$new_name."',
|
||||
discount ='".$new_discount."',
|
||||
count = '".$new_count."',
|
||||
expires = '".$new_expires."'
|
||||
WHERE id=".$id;
|
||||
$db->query($qry_change_url);
|
||||
}
|
||||
|
||||
//Querying INSERT new coupon INTO DB
|
||||
if(isset($_POST['add_coupon']))
|
||||
{
|
||||
$id = $_POST['id'];
|
||||
$code = $_POST['code'];
|
||||
$name = $_POST['name'];
|
||||
$discount = $_POST['discount'];
|
||||
$count= $_POST['count'];
|
||||
$expires = $_POST['expires'];
|
||||
|
||||
|
||||
$query = "INSERT INTO OGP_DB_PREFIXbilling_coupons(code, name, discount, count, expires) VALUES('".$code."', '".$name."', '".$discount."', '".$count."', '".$expires."')";
|
||||
$db->query($query);
|
||||
}
|
||||
|
||||
//Querying REMOVE coupon FROM DB
|
||||
if (isset($_POST['del_coupon']))
|
||||
{
|
||||
$db->query( "DELETE FROM OGP_DB_PREFIXbilling_coupons WHERE id=" . $db->realEscapeSingle($_POST['id']) );
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<!-- Show Coupons on DB -->
|
||||
</table>
|
||||
<br>
|
||||
<?php
|
||||
$result = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXbilling_coupons");
|
||||
if ($result > 0)
|
||||
{
|
||||
?>
|
||||
<h2><?php print_lang('current_coupons');?></h2>
|
||||
<table class="center" style='text-align:center;'>
|
||||
<tr>
|
||||
|
||||
<th><?php print_lang('code');?></th>
|
||||
<th><?php print_lang('coupon_name');?></th>
|
||||
<th><?php print_lang('discount');?></th>
|
||||
<th><?php print_lang('count');?></th>
|
||||
<th><?php print_lang('expires');?></th>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
foreach($result as $row)
|
||||
{
|
||||
?>
|
||||
<tr class="tr<?php $i = 0; echo($i++%2);?>">
|
||||
<form method="post" action="">
|
||||
<input name="id" type="hidden" value="<?php echo $row['id'];?>"/></td>
|
||||
<td><input name="new_code" type="text" value="<?php echo $row['code'];?>"/></td>
|
||||
<td><input name="new_name" type="text" value="<?php echo $row['name'];?>" /></td>
|
||||
<td><input name="new_discount" type="text" value="<?php echo $row['discount'];?>"/></td>
|
||||
<td><input name="new_count"type="text" value="<?php echo $row['count'];?>"/></td>
|
||||
<td><input name="new_expires" type="text" value="<?php echo $row['expires'];?>"/></td>
|
||||
<td><input type="submit" name="update_coupon" value="<?php print_lang('update_settings');?>"/></td>
|
||||
<td><input type="submit" name="del_coupon" value="<?php print_lang('del_coupon');?>"/></td>
|
||||
|
||||
</form>
|
||||
</tr><?php
|
||||
}
|
||||
//add new row to insert
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<td><input name="code" type="text" value=""/></td>
|
||||
<td><input name="name" type="text" value="" /></td>
|
||||
<td><input name="discount" type="text" value="0"/></td>
|
||||
<td><input name="count"type="text" value="0"/></td>
|
||||
<td><input name="expires" type="datetime-local" data-date-format="YYYY MMMM DD" value=""/></td>
|
||||
<td><input type="submit" name="add_coupon" value="<?php print_lang('add_coupon');?>"/></td>
|
||||
</form></table>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,317 +0,0 @@
|
|||
<?php
|
||||
require_once("includes/lib_remote.php");
|
||||
require_once("modules/config_games/server_config_parser.php");
|
||||
|
||||
function exec_ogp_module()
|
||||
{
|
||||
global $db,$view,$settings;
|
||||
$user_id = $_SESSION['user_id'];
|
||||
|
||||
$isAdmin = $db->isAdmin( $_SESSION['user_id'] );
|
||||
if ( $isAdmin ){
|
||||
$orders = $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE status = 'paid'" );
|
||||
} else {
|
||||
$orders = $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE status = 'paid' AND user_id=".$db->realEscapeSingle($user_id) );
|
||||
}
|
||||
if( !empty($orders) )
|
||||
{
|
||||
|
||||
foreach($orders as $order)
|
||||
{
|
||||
$order_id = $order['order_id'];
|
||||
$service_id = $order['service_id'];
|
||||
$home_name = $order['home_name'];
|
||||
$remote_control_password = $order['remote_control_password'];
|
||||
$ftp_password = $order['ftp_password'];
|
||||
$ip = $order['ip'];
|
||||
$max_players = $order['max_players'];
|
||||
$user_id = $order['user_id'];
|
||||
$extended = $order['extended'];
|
||||
//Query service info
|
||||
$service = $db->resultQuery( "SELECT *
|
||||
FROM OGP_DB_PREFIXbilling_services
|
||||
WHERE service_id=".$db->realEscapeSingle($service_id) );
|
||||
|
||||
if( !empty( $service[0] ) )
|
||||
{
|
||||
$home_cfg_id = $service[0]['home_cfg_id'];
|
||||
$mod_cfg_id = $service[0]['mod_cfg_id'];
|
||||
//remote_server_id has been stored in IP_ID
|
||||
//$remote_server_id = $service[0]['remote_server_id'];
|
||||
$remote_server_id = $order['ip'];
|
||||
|
||||
$ftp = $service[0]['ftp'];
|
||||
$install_method = $service[0]['install_method'];
|
||||
$manual_url = $service[0]['manual_url'];
|
||||
$access_rights = $service[0]['access_rights'];
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
// EXTENDED is when the server was suspended ? how to handle this from payment_success script?
|
||||
if($extended)
|
||||
{
|
||||
$home_id = $order['home_id'];
|
||||
|
||||
//Get The home info without mods in 1 array (Necesary for remote connection).
|
||||
$home_info = $db->getGameHomeWithoutMods($home_id);
|
||||
|
||||
//Create the remote connection
|
||||
$remote = new OGPRemoteLibrary($home_info['agent_ip'],$home_info['agent_port'],$home_info['encryption_key'],$home_info['timeout']);
|
||||
|
||||
//Reassign the server
|
||||
$db->assignHomeTo( "user", $user_id, $home_id, $access_rights );
|
||||
|
||||
//Reenable the FTP account
|
||||
if ($ftp == "enabled")
|
||||
{
|
||||
$remote->ftp_mgr("useradd", $home_info['home_id'], $home_info['ftp_password'], $home_info['home_path']);
|
||||
$db->changeFtpStatus('enabled',$home_info['home_id']);
|
||||
}
|
||||
echo "<h4>Server Installed, Check your Email for Details</h4><br>";
|
||||
|
||||
//Panel Log
|
||||
$db->logger( "RENEWED SERVER " . $home_id);
|
||||
// SEND EMAIL
|
||||
$settings = $db->getSettings();
|
||||
$subject = "Gameserver Renewel at " . $settings['panel_name'];
|
||||
$email = $db->resultQuery(" SELECT DISTINCT users_email
|
||||
FROM ogp_users, ogp_billing_orders
|
||||
WHERE ogp_users.user_id = $user_id")[0]["users_email"];
|
||||
|
||||
$message = "Your server, " . $home_name ." ID #". $home_id . " at " . $settings['panel_name'] . " has just been renewed.<br>
|
||||
Thank You for your continued support.<br>
|
||||
If you have any questions or requests, visit our website or contact us directly in our Discord Server.";
|
||||
|
||||
$mail = mymail($email, $subject, $message, $settings);
|
||||
$rundate = date('d/M/y G:i',$now);
|
||||
|
||||
if (!$mail)
|
||||
$db->logger( "Email FAILED - Server Renewed " . $home_id);
|
||||
// END EMAIL
|
||||
|
||||
//WEBHOOK Discord=======================================================================================
|
||||
|
||||
|
||||
$webhookurl = $settings['webhookurl'];
|
||||
|
||||
$msg = "The ". $home_name ." server ID #". $home_id . " has just been renewed.";
|
||||
$json_data = array ('content'=>"$msg");
|
||||
$make_json = json_encode($json_data);
|
||||
$ch = curl_init( $webhookurl );
|
||||
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
|
||||
curl_setopt( $ch, CURLOPT_POST, 1);
|
||||
curl_setopt( $ch, CURLOPT_POSTFIELDS, $make_json);
|
||||
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt( $ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
$response = curl_exec( $ch );
|
||||
//If you need to debug, or find out why you can't send message uncomment line below, and execute script.
|
||||
//echo $response;
|
||||
//end WEBHOOK Discord
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//OPTIONS, change it at your choice;
|
||||
$extra_params = "";//no extra params defined by default
|
||||
$cpu_affinity = "NA";//Affinity to one core/thread of the cpu by number, use NA to disable it
|
||||
$nice = "0";//Min priority=19 Max Priority=-19
|
||||
|
||||
//Add Game home to database
|
||||
//HARD CODE TO /home/gameserver/
|
||||
$rserver = $db->getRemoteServer($remote_server_id);
|
||||
$game_path = "/home/gameserver/";
|
||||
$home_id = $db->addGameHome( $remote_server_id, $user_id, $home_cfg_id, $game_path, $home_name, $remote_control_password, $ftp_password);
|
||||
|
||||
//Add IP:Port Pair to the Game Home
|
||||
//need to get the IP_ID for this remote server.
|
||||
$result = $db->resultQuery("SELECT ip_id FROM OGP_DB_PREFIXremote_server_ips WHERE remote_server_id=".$ip);
|
||||
foreach ($result as $rs)
|
||||
{
|
||||
$ip_id = $rs['ip_id'];
|
||||
}
|
||||
$add_port = $db->addGameIpPort( $home_id, $ip_id, $db->getNextAvailablePort($ip_id,$home_cfg_id) );
|
||||
|
||||
//Assign the Game Mod to the Game Home
|
||||
$mod_id = $db->addModToGameHome( $home_id, $mod_cfg_id );
|
||||
$db->updateGameModParams( $max_players, $extra_params, $cpu_affinity, $nice, $home_id, $mod_cfg_id );
|
||||
$db->assignHomeTo( "user", $user_id, $home_id, $access_rights );
|
||||
|
||||
//Get The home info without mods in 1 array (Necesary for remote connection).
|
||||
$home_info = $db->getGameHomeWithoutMods($home_id);
|
||||
|
||||
//Create the remote connection
|
||||
$remote = new OGPRemoteLibrary($home_info['agent_ip'],$home_info['agent_port'],$home_info['encryption_key'],$home_info['timeout']);
|
||||
|
||||
//Get Full home info in 1 array
|
||||
$home_info = $db->getGameHome($home_id);
|
||||
|
||||
//Read the Game Config from the XML file
|
||||
$server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$home_info['home_cfg_file']);
|
||||
|
||||
//Get Values from XML
|
||||
$modkey = $home_info['mods'][$mod_id]['mod_key'];
|
||||
$mod_xml = xml_get_mod($server_xml, $modkey);
|
||||
$installer_name = $mod_xml->installer_name;
|
||||
$mod_cfg_id = $home_info['mods'][$mod_id]['mod_cfg_id'];
|
||||
|
||||
//Get Preinstall commands from xml
|
||||
$precmd = $server_xml->pre_install;
|
||||
|
||||
|
||||
//Get Postinstall commands from xml
|
||||
$postcmd = $server_xml->post_install;
|
||||
|
||||
|
||||
//Enable FTP account in remote server
|
||||
if ($ftp == "enabled")
|
||||
{
|
||||
$remote->ftp_mgr("useradd", $home_info['home_id'], $home_info['ftp_password'], $home_info['home_path']);
|
||||
$db->changeFtpStatus('enabled',$home_info['home_id']);
|
||||
}
|
||||
|
||||
//Install files for this service in the remote server
|
||||
// -Steam
|
||||
$exec_folder_path = clean_path($home_info['home_path'] . "/" . $server_xml->exe_location );
|
||||
$exec_path = clean_path($exec_folder_path . "/" . $server_xml->server_exec_name );
|
||||
|
||||
if ($install_method == "steam")
|
||||
{
|
||||
if ( $server_xml->installer == "steamcmd" )
|
||||
{
|
||||
if( preg_match("/win32/", $server_xml->game_key) OR preg_match("/win64/", $server_xml->game_key) )
|
||||
$cfg_os = "windows";
|
||||
elseif( preg_match("/linux/", $server_xml->game_key) )
|
||||
$cfg_os = "linux";
|
||||
|
||||
// Some games like L4D2 require anonymous login
|
||||
if($mod_xml->installer_login){
|
||||
$login = $mod_xml->installer_login;
|
||||
$pass = '';
|
||||
}else{
|
||||
$login = $settings['steam_user'];
|
||||
$pass = $settings['steam_pass'];
|
||||
}
|
||||
|
||||
$modname = ( $installer_name == '90' and !preg_match("/(cstrike|valve)/", $modkey) ) ? $modkey : '';
|
||||
$betaname = isset($mod_xml->betaname) ? $mod_xml->betaname : '';
|
||||
$betapwd = isset($mod_xml->betapwd) ? $mod_xml->betapwd : '';
|
||||
$arch = isset($mod_xml->steam_bitness) ? $mod_xml->steam_bitness : '';
|
||||
|
||||
$remote->steam_cmd( $home_id,$home_info['home_path'],$installer_name,$modname,
|
||||
$betaname,$betapwd,$login,$pass,$settings['steam_guard'],
|
||||
$exec_folder_path,$exec_path,$precmd,$postcmd,$cfg_os,'',$arch);
|
||||
}
|
||||
}
|
||||
// -Rsync
|
||||
elseif ($install_method == "rsync")
|
||||
{
|
||||
|
||||
//Rsync Server
|
||||
$url = "files.iaregamer.com";
|
||||
//OS
|
||||
if( preg_match("/win32/", $server_xml->game_key) OR preg_match("/win64/", $server_xml->game_key) )
|
||||
$os = "windows";
|
||||
elseif( preg_match("/linux/", $server_xml->game_key) )
|
||||
$os = "linux";
|
||||
//Rsync Game Name
|
||||
//JUST SET RS_GNAME TO GAME xml NAME
|
||||
$rs_gname = $server_xml->game_key;
|
||||
|
||||
//Starting Sync
|
||||
$full_url = "$url/rsync_installer/$rs_gname/$os/";
|
||||
|
||||
|
||||
|
||||
$remote->start_rsync_install($home_id,$home_info['home_path'],"$full_url",$exec_folder_path,$exec_path,$precmd,$postcmd);
|
||||
}
|
||||
// -Manual
|
||||
elseif ($install_method == "manual")
|
||||
{
|
||||
// Start File Download and uncompress
|
||||
$filename = !empty($manual_url) ? substr($manual_url, -9) : "";
|
||||
$remote->start_file_download($manual_url,$home_info['home_path'],$filename,"uncompress");
|
||||
}
|
||||
echo "<h4><br><p>".get_lang('starting_installations')."</p></h4><br>";
|
||||
//PANEL LOG
|
||||
$db->logger( "CREATED NEW SERVER " . $home_id);
|
||||
// SEND EMAIL to new server only
|
||||
if($order['end_date'] == 0){
|
||||
$settings = $db->getSettings();
|
||||
$subject = "New Gameserver installed at " . $settings['panel_name'];
|
||||
$email = $db->resultQuery(" SELECT DISTINCT users_email
|
||||
FROM ogp_users, ogp_billing_orders
|
||||
WHERE ogp_users.user_id = $user_id")[0]["users_email"];
|
||||
|
||||
$message = "Your server, " . $home_name ." ID #". $home_id . " at " . $settings['panel_name'] . " has just been created.<br>
|
||||
Thank You for your continued support.<br>
|
||||
If you have any questions or requests, visit our website or contact us directly in our Discord Server.
|
||||
You can login to the Game Panel and click on Game Monitor to see your server. <br><br>
|
||||
Thank you!<br> ";
|
||||
$mail = mymail($email, $subject, $message, $settings);
|
||||
$rundate = date('d/M/y G:i',$now);
|
||||
|
||||
if (!$mail)
|
||||
$db->logger( "Email FAILED - Server Created " . $home_id);
|
||||
|
||||
|
||||
//WEBHOOK Discord=======================================================================================
|
||||
|
||||
$webhookurl = "https://discord.com/api/webhooks/710275918274363412/g5Tr-EUdEnLfFryOlscxJ6FuPiSJuE6EMKRYmh9UGMiqTUxU5-y9CQrBlDJW7znr0Tol";
|
||||
//$settings['webhookurl'];
|
||||
|
||||
|
||||
$msg = "A new server, ". $home_name ." ID #". $home_id . ", has just been created.";
|
||||
$json_data = array ('content'=>"$msg");
|
||||
$make_json = json_encode($json_data);
|
||||
$ch = curl_init( $webhookurl );
|
||||
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
|
||||
curl_setopt( $ch, CURLOPT_POST, 1);
|
||||
curl_setopt( $ch, CURLOPT_POSTFIELDS, $make_json);
|
||||
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt( $ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
$response = curl_exec( $ch );
|
||||
//If you need to debug, or find out why you can't send message uncomment line below, and execute script.
|
||||
//echo $response;
|
||||
//end WEBHOOK Discord
|
||||
}
|
||||
// END EMAIL
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// set order status
|
||||
$db->query("UPDATE OGP_DB_PREFIXbilling_orders
|
||||
SET status = 'active'
|
||||
WHERE order_id=".$db->realEscapeSingle($order_id));
|
||||
|
||||
|
||||
// Save home id created by this order
|
||||
$db->query("UPDATE OGP_DB_PREFIXbilling_orders
|
||||
SET home_id='" . $db->realEscapeSingle($home_id) . "' WHERE order_id=".$db->realEscapeSingle($order_id));
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Set payment/creation date
|
||||
//-------------------------------------------- change to create invoice -------------------------------------------------
|
||||
|
||||
|
||||
$db->query( "UPDATE OGP_DB_PREFIXgame_mods SET max_players= ".$order['max_players']." WHERE home_id=".$db->realEscapeSingle($home_id));
|
||||
|
||||
|
||||
//Refresh to Game Monitor.
|
||||
$view->refresh("home.php?m=gamemanager&p=game_monitor");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,375 +0,0 @@
|
|||
<?php
|
||||
require_once("includes/lib_remote.php");
|
||||
require_once("modules/config_games/server_config_parser.php");
|
||||
|
||||
function exec_ogp_module()
|
||||
{
|
||||
global $db,$view,$settings;
|
||||
$user_id = $_SESSION['user_id'];
|
||||
if (isset($_POST['cart_id'])) {
|
||||
$cart_id = $_POST['cart_id'];
|
||||
}
|
||||
if(isset($_GET['cart_id'])){
|
||||
$cart_id = $_GET['cart_id'];
|
||||
}
|
||||
$cart_paid = $db->resultQuery( "SELECT paid FROM OGP_DB_PREFIXbilling_carts WHERE cart_id=".$db->realEscapeSingle($cart_id) );
|
||||
$isAdmin = $db->isAdmin( $_SESSION['user_id'] );
|
||||
if ( $isAdmin ){
|
||||
$orders = $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE cart_id=".$db->realEscapeSingle($cart_id) );
|
||||
} else {
|
||||
$orders = $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE cart_id=".$db->realEscapeSingle($cart_id)." AND user_id=".$db->realEscapeSingle($user_id) );
|
||||
}
|
||||
if( !empty($orders) and !empty($cart_paid) )
|
||||
{
|
||||
|
||||
foreach($orders as $order)
|
||||
{
|
||||
$order_id = $order['order_id'];
|
||||
$service_id = $order['service_id'];
|
||||
$home_name = $order['home_name'];
|
||||
$remote_control_password = $order['remote_control_password'];
|
||||
$ftp_password = $order['ftp_password'];
|
||||
$ip = $order['ip'];
|
||||
$max_players = $order['max_players'];
|
||||
$user_id = $order['user_id'];
|
||||
$extended = $order['extended'] == "1" ? TRUE : FALSE;
|
||||
//Query service info
|
||||
$service = $db->resultQuery( "SELECT *
|
||||
FROM OGP_DB_PREFIXbilling_services
|
||||
WHERE service_id=".$db->realEscapeSingle($service_id) );
|
||||
|
||||
if( !empty( $service[0] ) )
|
||||
{
|
||||
$home_cfg_id = $service[0]['home_cfg_id'];
|
||||
$mod_cfg_id = $service[0]['mod_cfg_id'];
|
||||
//remote_server_id has been stored in IP_ID
|
||||
//$remote_server_id = $service[0]['remote_server_id'];
|
||||
$remote_server_id = $order['ip'];
|
||||
|
||||
$ftp = $service[0]['ftp'];
|
||||
$install_method = $service[0]['install_method'];
|
||||
$manual_url = $service[0]['manual_url'];
|
||||
$access_rights = $service[0]['access_rights'];
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
if($extended)
|
||||
{
|
||||
$home_id = $order['home_id'];
|
||||
|
||||
//Get The home info without mods in 1 array (Necesary for remote connection).
|
||||
$home_info = $db->getGameHomeWithoutMods($home_id);
|
||||
|
||||
//Create the remote connection
|
||||
$remote = new OGPRemoteLibrary($home_info['agent_ip'],$home_info['agent_port'],$home_info['encryption_key'],$home_info['timeout']);
|
||||
|
||||
//Reassign the server
|
||||
$db->assignHomeTo( "user", $user_id, $home_id, $access_rights );
|
||||
|
||||
//Reenable the FTP account
|
||||
if ($ftp == "enabled")
|
||||
{
|
||||
$remote->ftp_mgr("useradd", $home_info['home_id'], $home_info['ftp_password'], $home_info['home_path']);
|
||||
$db->changeFtpStatus('enabled',$home_info['home_id']);
|
||||
}
|
||||
echo "<h4>Server Installed, Check your Email for Details</h4><br>";
|
||||
|
||||
//Panel Log
|
||||
$db->logger( "RENEWED SERVER " . $home_id);
|
||||
// SEND EMAIL
|
||||
$settings = $db->getSettings();
|
||||
$subject = "Gameserver Renewel at " . $settings['panel_name'];
|
||||
$email = $db->resultQuery(" SELECT DISTINCT users_email
|
||||
FROM ogp_users, ogp_billing_orders
|
||||
WHERE ogp_users.user_id = $user_id")[0]["users_email"];
|
||||
|
||||
$message = "Your server, " . $home_name ." ID #". $home_id . " at " . $settings['panel_name'] . " has just been renewed.<br>
|
||||
Thank You for your continued support.<br>
|
||||
If you have any questions or requests, visit our website or contact us directly in our Discord Server.";
|
||||
|
||||
$mail = mymail($email, $subject, $message, $settings);
|
||||
$rundate = date('d/M/y G:i',$now);
|
||||
|
||||
if (!$mail)
|
||||
$db->logger( "Email FAILED - Server Renewed " . $home_id);
|
||||
// END EMAIL
|
||||
|
||||
//WEBHOOK Discord=======================================================================================
|
||||
|
||||
|
||||
$webhookurl = $settings['webhookurl'];
|
||||
|
||||
$msg = "The ". $home_name ." server ID #". $home_id . " has just been renewed.";
|
||||
$json_data = array ('content'=>"$msg");
|
||||
$make_json = json_encode($json_data);
|
||||
$ch = curl_init( $webhookurl );
|
||||
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
|
||||
curl_setopt( $ch, CURLOPT_POST, 1);
|
||||
curl_setopt( $ch, CURLOPT_POSTFIELDS, $make_json);
|
||||
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt( $ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
$response = curl_exec( $ch );
|
||||
//If you need to debug, or find out why you can't send message uncomment line below, and execute script.
|
||||
//echo $response;
|
||||
//end WEBHOOK Discord
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//OPTIONS, change it at your choice;
|
||||
$extra_params = "";//no extra params defined by default
|
||||
$cpu_affinity = "NA";//Affinity to one core/thread of the cpu by number, use NA to disable it
|
||||
$nice = "0";//Min priority=19 Max Priority=-19
|
||||
|
||||
//Add Game home to database
|
||||
//HARD CODE TO /home/gameserver/
|
||||
$rserver = $db->getRemoteServer($remote_server_id);
|
||||
$game_path = "/home/gameserver/";
|
||||
$home_id = $db->addGameHome( $remote_server_id, $user_id, $home_cfg_id, $game_path, $home_name, $remote_control_password, $ftp_password);
|
||||
|
||||
//Add IP:Port Pair to the Game Home
|
||||
//need to get the IP_ID for this remote server.
|
||||
$result = $db->resultQuery("SELECT ip_id FROM OGP_DB_PREFIXremote_server_ips WHERE remote_server_id=".$ip);
|
||||
foreach ($result as $rs)
|
||||
{
|
||||
$ip_id = $rs['ip_id'];
|
||||
}
|
||||
$add_port = $db->addGameIpPort( $home_id, $ip_id, $db->getNextAvailablePort($ip_id,$home_cfg_id) );
|
||||
|
||||
//Assign the Game Mod to the Game Home
|
||||
$mod_id = $db->addModToGameHome( $home_id, $mod_cfg_id );
|
||||
$db->updateGameModParams( $max_players, $extra_params, $cpu_affinity, $nice, $home_id, $mod_cfg_id );
|
||||
$db->assignHomeTo( "user", $user_id, $home_id, $access_rights );
|
||||
|
||||
//Get The home info without mods in 1 array (Necesary for remote connection).
|
||||
$home_info = $db->getGameHomeWithoutMods($home_id);
|
||||
|
||||
//Create the remote connection
|
||||
$remote = new OGPRemoteLibrary($home_info['agent_ip'],$home_info['agent_port'],$home_info['encryption_key'],$home_info['timeout']);
|
||||
|
||||
//Get Full home info in 1 array
|
||||
$home_info = $db->getGameHome($home_id);
|
||||
|
||||
//Read the Game Config from the XML file
|
||||
$server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$home_info['home_cfg_file']);
|
||||
|
||||
//Get Values from XML
|
||||
$modkey = $home_info['mods'][$mod_id]['mod_key'];
|
||||
$mod_xml = xml_get_mod($server_xml, $modkey);
|
||||
$installer_name = $mod_xml->installer_name;
|
||||
$mod_cfg_id = $home_info['mods'][$mod_id]['mod_cfg_id'];
|
||||
|
||||
//Get Preinstall commands from xml
|
||||
$precmd = $server_xml->pre_install;
|
||||
|
||||
|
||||
//Get Postinstall commands from xml
|
||||
$postcmd = $server_xml->post_install;
|
||||
|
||||
|
||||
//Enable FTP account in remote server
|
||||
if ($ftp == "enabled")
|
||||
{
|
||||
$remote->ftp_mgr("useradd", $home_info['home_id'], $home_info['ftp_password'], $home_info['home_path']);
|
||||
$db->changeFtpStatus('enabled',$home_info['home_id']);
|
||||
}
|
||||
|
||||
//Install files for this service in the remote server
|
||||
// -Steam
|
||||
$exec_folder_path = clean_path($home_info['home_path'] . "/" . $server_xml->exe_location );
|
||||
$exec_path = clean_path($exec_folder_path . "/" . $server_xml->server_exec_name );
|
||||
|
||||
if ($install_method == "steam")
|
||||
{
|
||||
if ( $server_xml->installer == "steamcmd" )
|
||||
{
|
||||
if( preg_match("/win32/", $server_xml->game_key) OR preg_match("/win64/", $server_xml->game_key) )
|
||||
$cfg_os = "windows";
|
||||
elseif( preg_match("/linux/", $server_xml->game_key) )
|
||||
$cfg_os = "linux";
|
||||
|
||||
// Some games like L4D2 require anonymous login
|
||||
if($mod_xml->installer_login){
|
||||
$login = $mod_xml->installer_login;
|
||||
$pass = '';
|
||||
}else{
|
||||
$login = $settings['steam_user'];
|
||||
$pass = $settings['steam_pass'];
|
||||
}
|
||||
|
||||
$modname = ( $installer_name == '90' and !preg_match("/(cstrike|valve)/", $modkey) ) ? $modkey : '';
|
||||
$betaname = isset($mod_xml->betaname) ? $mod_xml->betaname : '';
|
||||
$betapwd = isset($mod_xml->betapwd) ? $mod_xml->betapwd : '';
|
||||
$arch = isset($mod_xml->steam_bitness) ? $mod_xml->steam_bitness : '';
|
||||
|
||||
$remote->steam_cmd( $home_id,$home_info['home_path'],$installer_name,$modname,
|
||||
$betaname,$betapwd,$login,$pass,$settings['steam_guard'],
|
||||
$exec_folder_path,$exec_path,$precmd,$postcmd,$cfg_os,'',$arch);
|
||||
}
|
||||
}
|
||||
// -Rsync
|
||||
elseif ($install_method == "rsync")
|
||||
{
|
||||
|
||||
//Rsync Server
|
||||
$url = "files.iaregamer.com";
|
||||
//OS
|
||||
if( preg_match("/win32/", $server_xml->game_key) OR preg_match("/win64/", $server_xml->game_key) )
|
||||
$os = "windows";
|
||||
elseif( preg_match("/linux/", $server_xml->game_key) )
|
||||
$os = "linux";
|
||||
//Rsync Game Name
|
||||
//JUST SET RS_GNAME TO GAME xml NAME
|
||||
$rs_gname = $server_xml->game_key;
|
||||
|
||||
//Starting Sync
|
||||
$full_url = "$url/rsync_installer/$rs_gname/$os/";
|
||||
|
||||
|
||||
|
||||
$remote->start_rsync_install($home_id,$home_info['home_path'],"$full_url",$exec_folder_path,$exec_path,$precmd,$postcmd);
|
||||
}
|
||||
// -Manual
|
||||
elseif ($install_method == "manual")
|
||||
{
|
||||
// Start File Download and uncompress
|
||||
$filename = !empty($manual_url) ? substr($manual_url, -9) : "";
|
||||
$remote->start_file_download($manual_url,$home_info['home_path'],$filename,"uncompress");
|
||||
}
|
||||
echo "<h4><br><p>".get_lang('starting_installations')."</p></h4><br>";
|
||||
//PANEL LOG
|
||||
$db->logger( "CREATED NEW SERVER " . $home_id);
|
||||
// SEND EMAIL to new server only
|
||||
if($order['finish_date'] == 0){
|
||||
$settings = $db->getSettings();
|
||||
$subject = "New Gameserver installed at " . $settings['panel_name'];
|
||||
$email = $db->resultQuery(" SELECT DISTINCT users_email
|
||||
FROM ogp_users, ogp_billing_orders
|
||||
WHERE ogp_users.user_id = $user_id")[0]["users_email"];
|
||||
|
||||
$message = "Your server, " . $home_name ." ID #". $home_id . " at " . $settings['panel_name'] . " has just been created.<br>
|
||||
Thank You for your continued support.<br>
|
||||
If you have any questions or requests, visit our website or contact us directly in our Discord Server.
|
||||
You can login to the Game Panel and click on Game Monitor to see your server. <br><br>
|
||||
Thank you!<br> ";
|
||||
$mail = mymail($email, $subject, $message, $settings);
|
||||
$rundate = date('d/M/y G:i',$now);
|
||||
|
||||
if (!$mail)
|
||||
$db->logger( "Email FAILED - Server Created " . $home_id);
|
||||
|
||||
|
||||
//WEBHOOK Discord=======================================================================================
|
||||
|
||||
$webhookurl = $settings['webhookurl'];
|
||||
|
||||
|
||||
$msg = "A new server, ". $home_name ." ID #". $home_id . ", has just been created.";
|
||||
$json_data = array ('content'=>"$msg");
|
||||
$make_json = json_encode($json_data);
|
||||
$ch = curl_init( $webhookurl );
|
||||
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
|
||||
curl_setopt( $ch, CURLOPT_POST, 1);
|
||||
curl_setopt( $ch, CURLOPT_POSTFIELDS, $make_json);
|
||||
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt( $ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
$response = curl_exec( $ch );
|
||||
//If you need to debug, or find out why you can't send message uncomment line below, and execute script.
|
||||
//echo $response;
|
||||
//end WEBHOOK Discord
|
||||
}
|
||||
// END EMAIL
|
||||
|
||||
|
||||
}
|
||||
// Set expiration date in ogp database
|
||||
//End_date is when the invoice is printed.
|
||||
//finish_date the server will be suspended
|
||||
//in cron_shop the finish_date is used to delete the server
|
||||
//several days after being suspended
|
||||
if ($order['invoice_duration'] == "day")
|
||||
{
|
||||
|
||||
if($order['finish_date'] == 0){
|
||||
$finish_date = strtotime('+'.$order['qty'].' day');
|
||||
$end_date = strtotime('- 2 day',$finish_date);
|
||||
}
|
||||
else{
|
||||
//this is a renewel, start from end of previous order
|
||||
$finish_date = strtotime('+'.$order['qty'].' day',$order['finish_date']);
|
||||
$end_date = strtotime('- 6 hour', $finish_date);
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($order['invoice_duration'] == "month")
|
||||
{
|
||||
// this is a new order
|
||||
if($order['finish_date'] == 0){
|
||||
$finish_date = strtotime('+'.$order['qty'].' month');
|
||||
$end_date = strtotime('- 7 day',$finish_date);
|
||||
|
||||
}
|
||||
else{
|
||||
//this is a renewel, start from end of previous order
|
||||
$finish_date = strtotime('+'.$order['qty'].' month',$order['finish_date']);
|
||||
$end_date = strtotime('- 7 day',$finish_date);
|
||||
}
|
||||
}
|
||||
elseif ($order['invoice_duration'] == "year")
|
||||
{
|
||||
// this is a new order
|
||||
if($order['finish_date'] == 0){
|
||||
$finish_date = strtotime('+'.$order['qty'].' year');
|
||||
$end_date = strtotime('- 2 week',$finish_date);
|
||||
}
|
||||
else{
|
||||
//this is a renewel, start from end of previous order
|
||||
$finish_date = strtotime('+'.$order['qty'].' year',$order['finish_date']);
|
||||
$end_date = strtotime('- 2 week',$finish_date);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// set order expire date
|
||||
$db->query("UPDATE OGP_DB_PREFIXbilling_orders
|
||||
SET end_date='" . $db->realEscapeSingle($end_date) . "'
|
||||
WHERE order_id=".$db->realEscapeSingle($order_id));
|
||||
|
||||
$db->query("UPDATE OGP_DB_PREFIXbilling_orders
|
||||
SET finish_date='" . $db->realEscapeSingle($finish_date) . "'
|
||||
WHERE order_id=".$db->realEscapeSingle($order_id));
|
||||
|
||||
// Save home id created by this order
|
||||
$db->query("UPDATE OGP_DB_PREFIXbilling_orders
|
||||
SET home_id='" . $db->realEscapeSingle($home_id) . "' WHERE order_id=".$db->realEscapeSingle($order_id));
|
||||
|
||||
}
|
||||
|
||||
//Update Cart Payment Status as 3(paid and installed)
|
||||
$db->query("UPDATE OGP_DB_PREFIXbilling_carts
|
||||
SET paid=3
|
||||
WHERE cart_id=".$db->realEscapeSingle($cart_id));
|
||||
|
||||
// Set payment/creation date
|
||||
$date = date('d M Y');
|
||||
$db->query("UPDATE OGP_DB_PREFIXbilling_carts
|
||||
SET date='" . $db->realEscapeSingle($date) . "'
|
||||
WHERE cart_id=".$db->realEscapeSingle($cart_id));
|
||||
|
||||
$db->query( "UPDATE OGP_DB_PREFIXgame_mods SET max_players= ".$order['max_players']." WHERE home_id=".$db->realEscapeSingle($home_id));
|
||||
|
||||
|
||||
//Refresh to Game Monitor.
|
||||
$view->refresh("home.php?m=gamemanager&p=game_monitor");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,213 +0,0 @@
|
|||
<?php
|
||||
|
||||
|
||||
chdir(realpath(dirname(__FILE__))); /* Change to the current file path */
|
||||
chdir("../.."); /* Base path to ogp web files */
|
||||
// Report all PHP errors
|
||||
error_reporting(E_ALL);
|
||||
// Path definitions
|
||||
define("CONFIG_FILE","includes/config.inc.php");
|
||||
//Requiere
|
||||
require_once("includes/functions.php");
|
||||
require_once("includes/helpers.php");
|
||||
require_once("includes/html_functions.php");
|
||||
require_once("modules/config_games/server_config_parser.php");
|
||||
require_once("includes/lib_remote.php");
|
||||
require_once CONFIG_FILE;
|
||||
// Connect to the database server and select database.
|
||||
$db = createDatabaseConnection($db_type, $db_host, $db_user, $db_pass, $db_name, $table_prefix);
|
||||
|
||||
$panel_settings = $db->getSettings();
|
||||
if( isset($panel_settings['time_zone']) && $panel_settings['time_zone'] != "" )
|
||||
date_default_timezone_set($panel_settings['time_zone']);
|
||||
|
||||
|
||||
//these dates are configured in the Shop Settings page
|
||||
$today=time();
|
||||
$invoice_date = strtotime('+ 7 days'); //this many days until the finish_date
|
||||
$suspend_date = $today; //suspend when overdue
|
||||
//final date is 10th, we need to remove on 17th, so final date is > removal_date
|
||||
$removal_date = strtotime('- 7 days'); //finish_date is passed 7 days ago
|
||||
$rundate = date('d/M/y G:i',$today);
|
||||
$db->logger("AUTO-CLEAN: Server Cleanup running at ".$rundate);
|
||||
|
||||
|
||||
//STATUS VALUES in-cart, paid, active, suspended, renew, deleted
|
||||
|
||||
|
||||
/*
|
||||
THESE SERVERS HAVE REACHED THE DATE FOR INVOICE, FINISH_DATE - 7 (OR WHAT IS IN SETTINGS)
|
||||
|
||||
//LOOP THROUGH ALL SERVERS WITH STATUS = active
|
||||
//Send email and set status to renew
|
||||
----------------------------------------------------------- */
|
||||
$user_homes = $db->resultQuery( "SELECT *
|
||||
FROM " . $table_prefix . "billing_orders
|
||||
WHERE status = 'active' AND finish_date <" . $invoice_date);
|
||||
|
||||
if (!is_array($user_homes))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($user_homes as $user_home)
|
||||
{
|
||||
|
||||
$user_id = $user_home['user_id'];
|
||||
$home_id = $user_home['home_id'];
|
||||
|
||||
|
||||
// Reset the STATUS -1 so cart.php will create an invoice
|
||||
$db->query( "UPDATE " . $table_prefix . "billing_orders
|
||||
SET status = 'installed'
|
||||
WHERE order_id=".$db->realEscapeSingle($user_home['order_id']));
|
||||
|
||||
// SEND EMAIL
|
||||
$settings = $db->getSettings();
|
||||
$subject = "You have an INVOICE at ". $panel_settings['panel_name'];
|
||||
$email = $db->resultQuery(" SELECT DISTINCT users_email
|
||||
FROM " . $table_prefix . "users, " . $table_prefix . "billing_orders
|
||||
WHERE " . $table_prefix . "users.user_id = $user_id")[0]["users_email"];
|
||||
$message = "Your server with ID ". $home_id . " will expire soon. Please log in and VIEW INVOICES on the Dashboard to renew your server.<br><br><br>~<br>Thanks!<br>";
|
||||
$mail = mymail($email, $subject, $message, $settings);
|
||||
//logger
|
||||
$db->logger( "AUTO-CLEAN: INVOICE created for server " . $home_id);
|
||||
|
||||
if (!$mail)
|
||||
$db->logger( "AUTO-CLEAN: Email FAILED - Server Invoiced " . $home_id);
|
||||
|
||||
// END EMAIL
|
||||
$db->query( "UPDATE " . $table_prefix . "billing_orders
|
||||
SET status = 'renew'
|
||||
WHERE order_id=".$db->realEscapeSingle($user_home['order_id']));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//THESE ARE THE SERVERS THAT HAVE NOT BEEN PAID AND THE FINISH_DATE IS TODAY
|
||||
//THESE SERVERS GET SUSPENDED
|
||||
//LOOP THROUGH ALL ORDERS WITH STATUS 0 OR -1 (INACTIVE OR INVOICED)
|
||||
$user_homes = $db->resultQuery( "SELECT *
|
||||
FROM " . $table_prefix . "billing_orders
|
||||
WHERE status = 'renew' AND finish_date < ".$today);
|
||||
|
||||
if (!is_array($user_homes))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($user_homes as $user_home)
|
||||
{
|
||||
$user_id = $user_home['user_id'];
|
||||
$home_id = $user_home['home_id'];
|
||||
$home_info = $db->getGameHomeWithoutMods($home_id);
|
||||
$server_info = $db->getRemoteServerById($home_info['remote_server_id']);
|
||||
$remote = new OGPRemoteLibrary($server_info['agent_ip'], $server_info['agent_port'], $server_info['encryption_key'],$server_info['timeout']);
|
||||
$ftp_login = isset($home_info['ftp_login']) ? $home_info['ftp_login'] : $home_id;
|
||||
$remote->ftp_mgr("userdel", $ftp_login);
|
||||
$db->changeFtpStatus('disabled',$home_id);
|
||||
$server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$home_info['home_cfg_file']);
|
||||
if(isset($server_xml->control_protocol_type))$control_type = $server_xml->control_protocol_type; else $control_type = "";
|
||||
$addresses = $db->getHomeIpPorts($home_id);
|
||||
foreach($addresses as $address)
|
||||
{
|
||||
$remote->remote_stop_server($home_id,$address['ip'],$address['port'],$server_xml->control_protocol,$home_info['control_password'],$control_type,$home_info['home_path']);
|
||||
}
|
||||
$db->unassignHomeFrom("user", $user_id, $home_id);
|
||||
|
||||
// Reset the invoice end date and status to suspended
|
||||
// User can still RENEW server
|
||||
$db->query( "UPDATE " . $table_prefix . "billing_orders
|
||||
SET status = 'suspended'
|
||||
WHERE order_id=".$db->realEscapeSingle($user_home['order_id']));
|
||||
|
||||
//logger
|
||||
$db->logger( "AUTO-CLEAN: SUSPENDED server " . $home_id);
|
||||
|
||||
// SEND EMAIL
|
||||
$settings = $db->getSettings();
|
||||
$subject = "GameServer Suspended at ". $panel_settings['panel_name'];
|
||||
$email = $db->resultQuery(" SELECT DISTINCT users_email
|
||||
FROM " . $table_prefix . "users, " . $table_prefix . "billing_orders
|
||||
WHERE " . $table_prefix . "users.user_id = $user_id")[0]["users_email"];
|
||||
$message = "Your server with ID ". $home_id . " has expired and has been suspended. Please log in and VIEW INVOICES on the Dashboard to renew your server.<br>~<br>Thanks!<br>";
|
||||
$mail = mymail($email, $subject, $message, $settings);
|
||||
if (!$mail)
|
||||
$db->logger( "AUTO-CLEAN: Email FAILED - Server Suspended " . $home_id);
|
||||
// END EMAIL
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// end date = -2 (suspended) and its been suspended for $removal_date days
|
||||
//set removed servers as -99
|
||||
$user_homes = $db->resultQuery( "SELECT *
|
||||
FROM " . $table_prefix . "billing_orders
|
||||
WHERE status = 'suspended' AND finish_date < ".$removal_date );
|
||||
|
||||
if (!is_array($user_homes))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($user_homes as $user_home)
|
||||
{
|
||||
$user_id = $user_home['user_id'];
|
||||
$home_id = $user_home['home_id'];
|
||||
$home_info = $db->getGameHomeWithoutMods($home_id);
|
||||
$server_info = $db->getRemoteServerById($home_info['remote_server_id']);
|
||||
$remote = new OGPRemoteLibrary($server_info['agent_ip'], $server_info['agent_port'], $server_info['encryption_key'],$server_info['timeout']);
|
||||
|
||||
// Remove the game home from db
|
||||
$db->deleteGameHome($home_id);
|
||||
|
||||
// Remove the game home files from remote server
|
||||
$remote->remove_home($home_info['home_path']);
|
||||
|
||||
|
||||
|
||||
// Reset the invoice end date
|
||||
$db->query( "UPDATE " . $table_prefix . "billing_orders
|
||||
SET status = 'deleted'
|
||||
WHERE order_id=".$db->realEscapeSingle($user_home['order_id']));
|
||||
|
||||
|
||||
// Set order as not installed
|
||||
$db->query( "UPDATE " . $table_prefix . "billing_orders
|
||||
SET home_id=0
|
||||
WHERE cart_id=".$db->realEscapeSingle($user_home['cart_id']));
|
||||
|
||||
// remove userid and table from database
|
||||
$db->query( "DROP USER 'server_" .$home_id ."'@'%'");
|
||||
$db->query( "DROP USER 'server_" .$home_id ."'@'localhost'");
|
||||
$db->query( "DROP DATABASE server_" .$home_id);
|
||||
|
||||
//logger
|
||||
$db->logger( "AUTO-CLEAN: DELETED server " . $home_id);
|
||||
|
||||
|
||||
// SEND EMAIL
|
||||
$settings = $db->getSettings();
|
||||
$settings = $db->getSettings();
|
||||
$subject = "GameServer DELETED at ". $panel_settings['panel_name'];
|
||||
$email = $db->resultQuery(" SELECT DISTINCT users_email
|
||||
FROM " . $table_prefix . "users, " . $table_prefix . "billing_orders
|
||||
WHERE " . $table_prefix . "users.user_id = $user_id")[0]["users_email"];
|
||||
$message = "Your server with ID ". $home_id . " has been deleted<br><br>You did not renew the service and it was PERMANENTLY REMOVED today. If this was an error, if you contact us immediately we may be able to restore your server.<br>Thanks for being a customer and we hope we can provide a server for you again.<br><br>";
|
||||
$mail = mymail($email, $subject, $message, $settings);
|
||||
if (!$mail)
|
||||
$db->logger( "AUTO-CLEAN: Email FAILED - Server Deleted " . $home_id);
|
||||
// END EMAIL
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,116 +0,0 @@
|
|||
<?php
|
||||
|
||||
|
||||
chdir("../../"); /* It just makes life easier */
|
||||
|
||||
/* Includes */
|
||||
require_once("includes/helpers.php");
|
||||
require_once("includes/config.inc.php");
|
||||
require_once("includes/functions.php");
|
||||
require_once("includes/lib_remote.php");
|
||||
require_once("includes/lang.php");
|
||||
require_once("modules/config_games/server_config_parser.php");
|
||||
$db = createDatabaseConnection($db_type, $db_host, $db_user, $db_pass, $db_name, $table_prefix);
|
||||
$settings = $db->getSettings();
|
||||
$debug = $settings['debug'];
|
||||
$paypal_email = $settings['paypal_email']; // your paypal email address
|
||||
|
||||
|
||||
|
||||
$cart_id = $_POST['item_number'];
|
||||
|
||||
$fpx = fopen('modules/billing/ipnlog.txt', 'w');
|
||||
$header = "====================== CART ID " . $cart_id . " ========================\n";
|
||||
fwrite($fpx, $header);
|
||||
|
||||
|
||||
// STEP 1: read POST data
|
||||
// Reading POSTed data directly from $_POST causes serialization issues with array data in the POST.
|
||||
// Instead, read raw POST data from the input stream.
|
||||
$raw_post_data = file_get_contents('php://input');
|
||||
$raw_post_array = explode('&', $raw_post_data);
|
||||
$myPost = array();
|
||||
foreach ($raw_post_array as $keyval) {
|
||||
$keyval = explode ('=', $keyval);
|
||||
if (count($keyval) == 2)
|
||||
$myPost[$keyval[0]] = urldecode($keyval[1]);
|
||||
}
|
||||
// read the IPN message sent from PayPal and prepend 'cmd=_notify-validate'
|
||||
$req = 'cmd=_notify-validate';
|
||||
if (function_exists('get_magic_quotes_gpc')) {
|
||||
$get_magic_quotes_exists = true;
|
||||
}
|
||||
foreach ($myPost as $key => $value) {
|
||||
if ($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) {
|
||||
$value = urlencode(stripslashes($value));
|
||||
} else {
|
||||
$value = urlencode($value);
|
||||
}
|
||||
$req .= "&$key=$value";
|
||||
fwrite($fpx, "$key=$value\n");
|
||||
|
||||
}
|
||||
// Step 2: POST IPN data back to PayPal to validate
|
||||
if ( $settings['sandbox'] == 1) {
|
||||
$ch = curl_init('https://ipnpb.sandbox.paypal.com/cgi-bin/webscr');
|
||||
}else {
|
||||
$ch = curl_init('https://ipnpb.paypal.com/cgi-bin/webscr');
|
||||
}
|
||||
|
||||
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
||||
curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));
|
||||
// In wamp-like environments that do not come bundled with root authority certificates,
|
||||
// please download 'cacert.pem' from "https://curl.haxx.se/docs/caextract.html" and set
|
||||
// the directory path of the certificate as shown below:
|
||||
// curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem');
|
||||
if ( !($res = curl_exec($ch)) ) {
|
||||
// error_log("Got " . curl_error($ch) . " when processing IPN data");
|
||||
curl_close($ch);
|
||||
exit;
|
||||
}
|
||||
curl_close($ch);
|
||||
|
||||
|
||||
|
||||
// inspect IPN validation result and act accordingly
|
||||
if (strcmp ($res, "VERIFIED") == 0) {
|
||||
fwrite($fpx, "VERIFIED\n");
|
||||
// assign posted variables to local variables
|
||||
$item_name = $_POST['item_name'];
|
||||
$item_number = $_POST['item_number'];
|
||||
$payment_status = $_POST['payment_status'];
|
||||
$payment_amount = $_POST['mc_gross'];
|
||||
$payment_currency = $_POST['mc_currency'];
|
||||
$txn_id = $_POST['txn_id'];
|
||||
$receiver_email = $_POST['receiver_email'];
|
||||
$payer_email = $_POST['payer_email'];
|
||||
|
||||
$db->query("UPDATE OGP_DB_PREFIXbilling_carts
|
||||
SET paid=1
|
||||
WHERE cart_id=".$db->realEscapeSingle($cart_id));
|
||||
fwrite($fpx, "IPN Processed\n");
|
||||
|
||||
|
||||
// The IPN is verified, process it
|
||||
} else if (strcmp ($res, "INVALID") == 0) {
|
||||
// IPN invalid, log for manual investigation
|
||||
echo "The response from IPN was: <b>" .$res ."</b>";
|
||||
}
|
||||
|
||||
fclose($fpx);
|
||||
|
||||
// Reply with an empty 200 response to indicate to paypal the IPN was received correctly.
|
||||
//header("HTTP/1.1 200 OK");
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
====================== CART ID ========================
|
||||
|
|
@ -1,136 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2017 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
// Module general information
|
||||
$module_title = "billing";
|
||||
$module_version = "1";
|
||||
$db_version = 4;
|
||||
$module_required = FALSE;
|
||||
$module_menus = array(
|
||||
array( 'subpage' => 'orders', 'name'=>'Orders', 'group'=>'user,admin' ),
|
||||
array( 'subpage' => 'services', 'name'=>'Services', 'group'=>'admin' ),
|
||||
array( 'subpage' => 'shop_settings', 'name'=>'Shop Settings', 'group'=>'admin' ),
|
||||
array( 'subpage' => 'coupons', 'name'=>'Coupons', 'group'=>'admin' )
|
||||
);
|
||||
|
||||
$install_queries = array();
|
||||
$install_queries[0] = array(
|
||||
"DROP TABLE IF EXISTS `".OGP_DB_PREFIX."billing_services`;",
|
||||
"CREATE TABLE IF NOT EXISTS `".OGP_DB_PREFIX."billing_services` (
|
||||
`service_id` int(11) NOT NULL auto_increment,
|
||||
`home_cfg_id` int(11) NOT NULL,
|
||||
`mod_cfg_id` int(11) NOT NULL,
|
||||
`service_name` varchar(255) NOT NULL,
|
||||
`remote_server_id` varchar(255) NOT NULL,
|
||||
`slot_max_qty` int(11) NOT NULL,
|
||||
`slot_min_qty` int(11) NOT NULL,
|
||||
`price_daily` float(15,4) NOT NULL,
|
||||
`price_monthly` float(15,4) NOT NULL,
|
||||
`price_year` float(15,4) NOT NULL,
|
||||
`description` varchar(1000) NOT NULL,
|
||||
`img_url` varchar(255) NOT NULL,
|
||||
`ftp` varchar(255) NOT NULL,
|
||||
`install_method` varchar(255) NOT NULL,
|
||||
`manual_url` varchar(255) NOT NULL,
|
||||
`access_rights` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`service_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=UTF8;",
|
||||
|
||||
"DROP TABLE IF EXISTS `".OGP_DB_PREFIX."billing_orders`;",
|
||||
"CREATE TABLE IF NOT EXISTS `".OGP_DB_PREFIX."billing_orders` (
|
||||
`order_id` int(11) NOT NULL auto_increment,
|
||||
`user_id` int(11) NOT NULL,
|
||||
`service_id` int(11) NOT NULL,
|
||||
`home_path` varchar(255) NOT NULL,
|
||||
`home_name` varchar(255) NOT NULL,
|
||||
`ip` varchar(255) NOT NULL,
|
||||
`port` varchar(5) NOT NULL,
|
||||
`qty` int(11) NOT NULL,
|
||||
`invoice_duration` varchar(16) NOT NULL,
|
||||
`max_players` int(11) NOT NULL,
|
||||
`remote_control_password` varchar(10) NULL,
|
||||
`ftp_password` varchar(10) NULL,
|
||||
`subtotal` float(15,2) NOT NULL,
|
||||
`rate` int(11) NOT NULL,
|
||||
`total` float(15,2) NOT NULL,
|
||||
`date` varchar(10) NULL,
|
||||
PRIMARY KEY (`order_id`)
|
||||
) ENGINE=MyISAM;"
|
||||
);
|
||||
|
||||
$install_queries[1] = array(
|
||||
"DROP TABLE IF EXISTS `".OGP_DB_PREFIX."billing_carts`;",
|
||||
"CREATE TABLE IF NOT EXISTS `".OGP_DB_PREFIX."billing_carts` (
|
||||
`cart_id` int(11) NOT NULL auto_increment,
|
||||
`user_id` int(11) NOT NULL,
|
||||
`paid` int(11) NULL,
|
||||
PRIMARY KEY (`cart_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=UTF8;",
|
||||
|
||||
"DROP TABLE IF EXISTS `".OGP_DB_PREFIX."billing_orders`;",
|
||||
"CREATE TABLE IF NOT EXISTS `".OGP_DB_PREFIX."billing_orders` (
|
||||
`order_id` int(11) NOT NULL auto_increment,
|
||||
`user_id` int(11) NOT NULL,
|
||||
`service_id` int(11) NOT NULL,
|
||||
`home_path` varchar(255) NOT NULL,
|
||||
`home_name` varchar(255) NOT NULL,
|
||||
`ip` varchar(255) NOT NULL,
|
||||
`qty` int(11) NOT NULL,
|
||||
`invoice_duration` varchar(16) NOT NULL,
|
||||
`max_players` int(11) NOT NULL,
|
||||
`price` float(15,2) NOT NULL,
|
||||
`remote_control_password` varchar(10) NULL,
|
||||
`ftp_password` varchar(10) NULL,
|
||||
`paid` varchar(1) NULL,
|
||||
`date` varchar(10) NULL,
|
||||
`cart_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`order_id`)
|
||||
) ENGINE=MyISAM;"
|
||||
);
|
||||
|
||||
$install_queries[2] = array(
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_orders` DROP `date`;",
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_orders` DROP `home_path`;",
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_orders` DROP `paid`;",
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_orders` ADD `home_id` varchar(255) NOT NULL DEFAULT '0';",
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_orders` ADD `status` varchar(16) NOT NULL DEFAULT '0';",
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_carts` ADD `date` varchar(16) NOT NULL DEFAULT '0';",
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_carts` ADD `tax_amount` varchar(16) NOT NULL DEFAULT '0';",
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_carts` ADD `currency` varchar(3) NOT NULL DEFAULT '0';"
|
||||
);
|
||||
|
||||
$install_queries[3] = array(
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_orders` ADD `finish_date` varchar(16) NOT NULL DEFAULT '0';"
|
||||
);
|
||||
|
||||
$install_queries[4] = array(
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_orders` ADD `extended` tinyint(1) NOT NULL;",
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_services` ADD `enabled` int(11) NOT NULL;"
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_carts` ADD `coupon_id` varchar(3) NOT NULL DEFAULT '0';"
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."billing_orders` ADD `coupon_id` varchar(3) NOT NULL DEFAULT '0';"
|
||||
|
||||
);
|
||||
|
||||
|
||||
?>
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<navigation>
|
||||
<!-- User Side -->
|
||||
<page key="shop" file="shop.php" access="none" />
|
||||
<page key="paid" file="paid.php" access="none" />
|
||||
<page key="cart" file="cart.php" access="user,admin" />
|
||||
<page key="add_to_cart" file="add_to_cart.php" access="none" />
|
||||
<page key="paypal" file="paypal.php" access="none" />
|
||||
<!-- Admin Side -->
|
||||
<page key="shop_settings" file="settings.php" access="admin" />
|
||||
<page key="services" file="services.php" access="admin" />
|
||||
<page key="coupons" file="coupons.php" access="admin" />
|
||||
<!-- Billing -->
|
||||
<page key="orders" file="orders.php" access="user,admin" />
|
||||
<page key="paid" file="paid.php" access="none" />
|
||||
<page key="bill" file="bill.php" access="user,admin" />
|
||||
<page key="create_servers" file="create_servers.php" access="user,admin" />
|
||||
<!-- Guest-->
|
||||
|
||||
|
||||
</navigation>
|
||||
|
|
@ -1,265 +0,0 @@
|
|||
<?php
|
||||
function exec_ogp_module()
|
||||
{
|
||||
error_reporting(E_ALL);
|
||||
|
||||
global $db,$settings;
|
||||
|
||||
if(isset($_POST['remove']))
|
||||
{
|
||||
$query_delete_order = $db->query("DELETE FROM OGP_DB_PREFIXbilling_orders WHERE cart_id=".$db->realEscapeSingle($_POST['cart_id']));
|
||||
$query_delete_order = $db->query("DELETE FROM OGP_DB_PREFIXbilling_carts WHERE cart_id=".$db->realEscapeSingle($_POST['cart_id']));
|
||||
}
|
||||
if(isset($_POST['paid']))
|
||||
{
|
||||
$query_set_as_paid = $db->query("UPDATE OGP_DB_PREFIXbilling_carts
|
||||
SET paid=1
|
||||
WHERE cart_id=".$db->realEscapeSingle($_POST['cart_id']));
|
||||
}
|
||||
$status_array = array ( "not_paid" => 0,
|
||||
"paid" => 1,
|
||||
"procesing_payment" => 2,
|
||||
"paid_and_installed" => 3
|
||||
);
|
||||
?>
|
||||
<style>
|
||||
h4 {
|
||||
width:250px;
|
||||
height:25px;
|
||||
background:#f5f5f5;
|
||||
border-top-style:solid;
|
||||
border-top-color:#afafaf;
|
||||
border-top-width:1px;
|
||||
border-style: solid;
|
||||
border-color: #CFCFCF;
|
||||
border-width: 1px;
|
||||
padding-top:8px;
|
||||
text-align: center;
|
||||
font-family:"Trebuchet MS";
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
|
||||
$isAdmin = $db->isAdmin( $_SESSION['user_id'] );
|
||||
$user_id = $_SESSION['user_id'];
|
||||
|
||||
//SHOW THE NUMBER OF SERVERS RENTED AND EXPECTED INCOME
|
||||
if($isAdmin)
|
||||
{
|
||||
echo "<h1>Accounting</h1>";
|
||||
$servercount = 0;
|
||||
$income = 0;
|
||||
$paidOrders = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE status > 0");
|
||||
foreach($paidOrders as $inc)
|
||||
{
|
||||
$servercount = $servercount +1;
|
||||
$income = $income + $inc['max_players'] * $inc['price'];
|
||||
|
||||
}
|
||||
echo "Total Rented Gameservers: $servercount<br>";
|
||||
echo "Total Income: $" . number_format( $income , 2 ) . "<br>";
|
||||
|
||||
}
|
||||
foreach($status_array as $status => $paid_value)
|
||||
{
|
||||
if($isAdmin or $status > "not_paid")
|
||||
{
|
||||
if ($isAdmin){
|
||||
$carts = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXbilling_carts WHERE paid =" . $db->realEscapeSingle($paid_value) ." order by cart_id DESC");
|
||||
}else{
|
||||
$carts = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXbilling_carts WHERE paid =" . $db->realEscapeSingle($paid_value) ." AND user_id = " . $user_id ." order by cart_id DESC");
|
||||
}
|
||||
if( $carts > 0 )
|
||||
{
|
||||
if ($paid_value == 1)
|
||||
{?>
|
||||
<h2 style='color:yellow;'>Not Installed</h2>
|
||||
<?php }
|
||||
if ($paid_value > 1)
|
||||
{?>
|
||||
<h2 style='color:green;'><?php print_lang($status);?></h2>
|
||||
<?php }
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
foreach($carts as $cart)
|
||||
{
|
||||
?>
|
||||
<center>
|
||||
<table style="width:100%;text-align:center;" class="center">
|
||||
<tr>
|
||||
<th style="width:25%"><?php print_lang("login");?></th>
|
||||
<th><?php print_lang("cart_id");?></th>
|
||||
<th><?php print_lang("order_id");?></th>
|
||||
<th>slot price</th>
|
||||
<th>Paid Date</th>
|
||||
<?php
|
||||
if($status == "paid_and_installed")
|
||||
{?>
|
||||
<th>Expiration dates</th>
|
||||
<?php
|
||||
}?>
|
||||
</tr>
|
||||
<?php
|
||||
$orders = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE cart_id=".$db->realEscapeSingle($cart['cart_id'])." order by order_id DESC" );
|
||||
$subtotal = 0;
|
||||
foreach($orders as $order)
|
||||
{
|
||||
if($order['qty'] > 1)
|
||||
$order['invoice_duration'] = $order['invoice_duration']."s";
|
||||
?>
|
||||
<tr class="tr">
|
||||
<td><a href="?m=user_admin&p=edit_user&user_id=<?php echo $order['user_id'];?>" ><?php $user = $db->getUserById($order['user_id']); echo $user['users_login'];?></a></td>
|
||||
<td><b class="success"><?php echo $order['cart_id'];?></b></td>
|
||||
<td><b class="success"><?php echo $order['order_id'];?></b></td>
|
||||
<td><?php echo "$".$order['price'].$cart['currency'];?></td>
|
||||
<td><?php echo $cart['date'];?></td>
|
||||
<?php
|
||||
if($status == "paid_and_installed")
|
||||
{
|
||||
$today = time();
|
||||
$order_status = "Unknown";
|
||||
$order_status = $order['status'] > '0' ? "<b style='color:green;'>".get_lang('active')."</b>":$order_status;
|
||||
$order_status = $order['status'] == '0' ? "<b style='color:yellow;'>".get_lang('unpaid')."</b>":$order_status;
|
||||
$order_status = $order['status'] == '-1' ? "<b style='color:yellow;'>".get_lang('invoice_due')."</b>":$order_status;
|
||||
$order_status = $order['status'] == '-2' ? "<b style='color:red;'>".get_lang('suspended')."</b>":$order_status;
|
||||
$order_status = $order['status'] == '-3' ? "<b style='color:green;'>".get_lang('renewed')."</b>":$order_status;
|
||||
$order_status = $order['status'] == '-99' ? "<b style='color:white;'>".get_lang('expired')."</b>":$order_status;
|
||||
$finish_date = date('d/M/Y H:i',$order['finish_date']);
|
||||
echo "<td>Status: <b>$order_status</b>";
|
||||
echo "<br>Expiration: <b>$finish_date</b></td>";
|
||||
}
|
||||
?>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr class="tr">
|
||||
<td><?php echo $order['home_name']?></td>
|
||||
<td><?php echo " [ ".$order['max_players']." ".get_lang('slots').", ".$order['qty']." ".get_lang($order['invoice_duration'])." ]";?>
|
||||
|
||||
</td></tr>
|
||||
|
||||
<?php
|
||||
$max_players = $order['max_players'];
|
||||
$qty = $order['qty'];
|
||||
$price = $order['price'];
|
||||
$subtotal += $order['price'] * $max_players * $qty;
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
if ($status == "not_paid" && $isAdmin)
|
||||
{
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<input type="hidden" name="cart_id" value="<?php echo $order['cart_id'];?>">
|
||||
<input name="paid" type="submit" value="<?php print_lang("set_as_paid");?>">
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
elseif($status == "paid")
|
||||
{
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<form method="post" action="home.php?m=billing&p=create_servers">
|
||||
|
||||
<input type="hidden" name="cart_id" value="<?php echo $order['cart_id'];?>">
|
||||
|
||||
<?php
|
||||
if($order['extended'] == "1")
|
||||
{
|
||||
?>
|
||||
<input name="enable_server" type="submit" value="<?php print_lang("enable_server");?>">
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<input name="create_server" type="submit" value="<?php print_lang("create_server");?>">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
elseif($status == "procesing_payment" && $isAdmin)
|
||||
{
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<input type="hidden" name="cart_id" value="<?php echo $order['cart_id'];?>">
|
||||
<input name="paid" type="submit" value="<?php print_lang("set_as_paid");?>">
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
elseif($status == "paid_and_installed")
|
||||
{
|
||||
?>
|
||||
<form method="post" action="?m=billing&p=bill">
|
||||
<input type="hidden" name="cart_id" value="<?php echo $order['cart_id'];?>">
|
||||
<input name="paid" type="submit" value="<?php print_lang("see_invoice");?>">
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tr><tr>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
echo get_lang('subtotal')." <b>$".number_format( $subtotal , 2 ). " " .$cart['currency']."</b></br>";
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
//obter as informações de cupom usadas neste pedido
|
||||
$coupon_savings = 0;
|
||||
if($cart['coupon_id']>0) {
|
||||
$result = $db->resultquery("SELECT * from OGP_DB_PREFIXbilling_coupons WHERE id = '". $cart['coupon_id'] . "'");
|
||||
foreach($result as $coupon){
|
||||
$coupon_savings = $subtotal * ($coupon['discount']/ 100);
|
||||
echo "Sub-total c/discount <b>$" .number_format( ($subtotal - $coupon_savings) , 2 ).$cart['currency']."</b></br><td>";
|
||||
echo "Coupon (".$coupon['code'].") <b>- $" .number_format( $coupon_savings , 2 ).$cart['currency']."</b></br>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($settings['tax_amount'] > 0){
|
||||
echo get_lang('tax')."<b>(".$settings['tax_amount']."%) + $".number_format( $settings['tax_amount']/100*$subtotal, 2 ).$cart['currency']."</b></br>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
//$total = $subtotal-$coupon_savings+($settings['tax_amount']/100*$subtotal);
|
||||
$total = ($subtotal - $coupon_savings) * ($settings['tax_amount'] / 100 + 1);
|
||||
echo get_lang('total')." <b>$".number_format( $total , 2 ). " " .$cart['currency']."</b>";
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
if($status == "paid_and_installed")
|
||||
{
|
||||
?>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
}//end foreach
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
<?php
|
||||
function exec_ogp_module()
|
||||
{
|
||||
global $db,$view,$settings;
|
||||
$loadpage = "?m=billing&p=paid";
|
||||
$count = $_POST['count'] + 1;
|
||||
|
||||
$result = $db->resultquery("SELECT * from OGP_DB_PREFIXbilling_carts WHERE cart_id= '". $_POST['cart_id'] . "'");
|
||||
foreach($result as $cartID){
|
||||
$paid = $cartID['paid'];
|
||||
}
|
||||
|
||||
echo "<h2>Processing your Payment Info ... </h2>";
|
||||
if($settings['debug']==1){
|
||||
echo "<br>";
|
||||
echo $_POST['count'];
|
||||
echo "<br>";
|
||||
echo $_POST['cart_id'];
|
||||
echo "<br>";
|
||||
echo $_POST['payment_status'];
|
||||
echo "<br>";
|
||||
}
|
||||
//check the DB and see if its been updated as paid
|
||||
if($paid > 0){
|
||||
$loadpage = "?m=billing&p=create_servers";
|
||||
|
||||
}
|
||||
|
||||
//waited too long .. go to orders page
|
||||
if($count > 5){
|
||||
$loadpage = "?m=billing&p=orders";
|
||||
echo "<h2>There was a Problem, Please contact Support ... </h2>";
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<form name='paid' action='<?php echo $loadpage?>' method='post'>
|
||||
<input type='hidden' name='cart_id' value='<?php echo $_POST["cart_id"]?>'>
|
||||
<input type='hidden' name='payment_status' value='<?php echo $_POST["payment_status"] ?>'>
|
||||
<input type='hidden' name='count' value='<?php echo $count?>'>
|
||||
</form>
|
||||
<script>
|
||||
var auto_refresh = setInterval(
|
||||
function()
|
||||
{
|
||||
submitform();
|
||||
}, 5000);
|
||||
function submitform()
|
||||
{
|
||||
document.paid.submit();
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
<?php
|
||||
function exec_ogp_module()
|
||||
{
|
||||
global $db,$view;
|
||||
$settings = $db->getSettings();
|
||||
function curPageName()
|
||||
{
|
||||
return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
|
||||
}
|
||||
|
||||
|
||||
if ( $settings['sandbox'] == 1) {
|
||||
$paypal_url = "https://www.sandbox.paypal.com/cgi-bin/webscr";
|
||||
$paypal_ipn_url = "https://ipnpb.sandbox.paypal.com/cgi-bin/webscr";
|
||||
}
|
||||
else {
|
||||
$paypal_url = "https://www.paypal.com/cgi-bin/webscr";
|
||||
$paypal_ipn_url = "https://ipnpb.paypal.com/cgi-bin/webscr";
|
||||
}
|
||||
|
||||
$s = ( isset($_SERVER['HTTPS']) and get_true_boolean($_SERVER['HTTPS']) ) ? "s" : "";
|
||||
$port = isset($_SERVER['SERVER_PORT']) & $_SERVER['SERVER_PORT'] != "80" ? ":".$_SERVER['SERVER_PORT'] : NULL ;
|
||||
$this_script = 'http'.$s.'://'.$_SERVER['SERVER_NAME'].$port.$_SERVER['SCRIPT_NAME'];
|
||||
$current_folder_url = str_replace( curPageName(), "", $this_script);
|
||||
$cart_id = $_GET['cart_id'];
|
||||
$debug = $settings['debug'];
|
||||
|
||||
|
||||
if(!empty($cart_id))
|
||||
{
|
||||
$orders = $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE cart_id=".$db->realEscapeSingle($cart_id));
|
||||
//get couponID then discount for this cart
|
||||
$result= $db->resultQuery( "SELECT * FROM OGP_DB_PREFIXbilling_carts WHERE cart_id=".$db->realEscapeSingle($cart_id));
|
||||
foreach ($result as $cartDB){
|
||||
$coupon_id = $cartDB['id'];
|
||||
}
|
||||
|
||||
$coupon_discount = 0;
|
||||
$result = $db->resultQuery( "SELECT discount FROM ogp_billing_coupons WHERE id=".$db->realEscapeSingle($cartDB['coupon_id']));
|
||||
foreach ($result as $couponDB){
|
||||
$coupon_discount=$couponDB['discount'];
|
||||
}
|
||||
|
||||
$coupon_discount = $coupon_discount / 100;
|
||||
|
||||
if( !empty( $orders ) )
|
||||
{
|
||||
$cart['price'] = 0;
|
||||
foreach($orders as $order)
|
||||
{
|
||||
if( $order['qty'] > 1 )
|
||||
$order['invoice_duration'] = $order['invoice_duration']."s";
|
||||
$cart['price'] += ($order['price']*$order['max_players']*$order['qty']);
|
||||
|
||||
|
||||
if( !isset( $cart['name'] ) )
|
||||
$cart['name'] = $order['home_name']."(".$order['qty'].get_lang($order['invoice_duration']).",".$order['max_players'].get_lang('slots').")";
|
||||
else
|
||||
$cart['name'] .= ' + '.$order['home_name']."(".$order['qty'].get_lang($order['invoice_duration']).",".$order['max_players'].get_lang('slots').")";
|
||||
}
|
||||
//price minus coupon discount
|
||||
$cart['price'] = $cart['price'] - $cart['price']*$coupon_discount;
|
||||
$total = $cart['price']+($settings['tax_amount']/100*$cart['price']);
|
||||
if ($total === 0)
|
||||
{
|
||||
$db->query("UPDATE " . $table_prefix . "billing_carts
|
||||
SET paid=1
|
||||
WHERE cart_id=".$db->realEscapeSingle($cart_id));
|
||||
$view->refresh("home.php?m=billing&p=cart",0);
|
||||
}
|
||||
$total = number_format( $total , 2 );
|
||||
}
|
||||
}
|
||||
|
||||
// -- GENERATING THE PAYPAL ORDER BUTTON --
|
||||
?>
|
||||
<html><body <?php if ( $debug != 1) { ?>onload="form1.submit()"<?php } ?>>
|
||||
<form name="form1" action="<?php echo $paypal_url ?>" method="post">
|
||||
<input type="hidden" name="cmd" value="_xclick">
|
||||
<input type="hidden" name="business" value="<?php echo $settings['paypal_email']; ?>">
|
||||
<input type="hidden" name="item_name" value="<?php echo $cart['name']; ?>">
|
||||
<input type="hidden" name="item_number" value="<?php echo $cart_id; ?>">
|
||||
<input type="hidden" name="invoice" value="<?php echo $cart_id; ?>">
|
||||
<input type="hidden" name="amount" value="<?php echo $total; ?>">
|
||||
<input type="hidden" name="return" value="<?php echo $current_folder_url.'modules/billing/bounce.php';?>">
|
||||
<input type="hidden" name="cancel_return" value="<?php echo $this_script.'?m=billing&p=cart';?>">
|
||||
<input type="hidden" name="notify_url" value="<?php echo $current_folder_url.'modules/billing/ipn.php';?>">
|
||||
<input type="hidden" name="currency_code" value="<?php echo $settings['currency'];?>">
|
||||
<input type="hidden" name="rm" value="2">
|
||||
<?php
|
||||
if ( $debug == 1) { ?>
|
||||
<h3 align="center">Debug Mode<br>
|
||||
Post Data being sent to Paypal</h3>
|
||||
<?php
|
||||
echo "<br>Sandbox Enabled = " .$settings['sandbox'];
|
||||
echo "<br>Paypal Url = " .$paypal_url;
|
||||
echo "<br>";
|
||||
echo "<br>Paypal Email = ".$settings['paypal_email'];
|
||||
echo "<br>Item Name = ".$cart['name'];
|
||||
echo "<br>Item Number = ".$cart_id;
|
||||
echo "<br>Invoice ID = ".$cart_id;
|
||||
echo "<br>Amount = ".$total;
|
||||
echo "<br>Return Url = ". $current_folder_url."modules/billing/bounce.php";
|
||||
echo "<br>Cancel Url = ". $this_script."?m=billing&p=cart";
|
||||
echo "<br>Notify Url = ". $current_folder_url."modules/billing/ipn.php";
|
||||
echo "<br>Currency Code =". $settings['currency'];
|
||||
echo "<br><br>";
|
||||
echo "<input type='submit' value='Click To Proceed To Paypal'>";
|
||||
}
|
||||
echo "After payment, you must return to this site to CREATE YOUR SERVER<br>";
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,355 +0,0 @@
|
|||
<?php
|
||||
function exec_ogp_module()
|
||||
{
|
||||
global $db;
|
||||
|
||||
//Querying UPDATE a service FROM DB
|
||||
if (isset($_POST['service']) AND isset($_POST['new_enabled']))
|
||||
{
|
||||
$new_remote_server_id = $db->realEscapeSingle($_POST['new_remote_server_id']);
|
||||
$new_price_monthly = $db->realEscapeSingle($_POST['new_price_monthly']);
|
||||
$new_out_of_stock = $db->realEscapeSingle($_POST['new_out_of_stock']);
|
||||
$new_url = $db->realEscapeSingle($_POST['new_url']);
|
||||
$new_enabled = $db->realEscapeSingle($_POST['new_enabled']);
|
||||
$service = $db->realEscapeSingle($_POST['service']);
|
||||
|
||||
//Create UPDATE query
|
||||
$qry_change_url = "UPDATE OGP_DB_PREFIXbilling_services
|
||||
SET remote_server_id = '".$new_remote_server_id."',
|
||||
price_monthly ='".$new_price_monthly."',
|
||||
remote_server_id = '".$new_remote_server_id."',
|
||||
out_of_stock = '".$new_out_of_stock."',
|
||||
img_url ='".$new_url."',
|
||||
enabled = '".$new_enabled."'
|
||||
WHERE service_id=".$service;
|
||||
$db->query($qry_change_url);
|
||||
}
|
||||
|
||||
//Querying UPDATE enabled/disabled remote servers DB
|
||||
if (isset($_POST['update_remote_servers']))
|
||||
{
|
||||
$result = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXremote_servers");
|
||||
foreach($result as $rs)
|
||||
{
|
||||
$server_enabled = 0;
|
||||
//get the value from the checkbox
|
||||
if(isset($_POST[$rs['remote_server_id']]))
|
||||
{
|
||||
$server_enabled = 1;
|
||||
|
||||
}
|
||||
|
||||
//update the table with current value
|
||||
$query = "UPDATE OGP_DB_PREFIXremote_servers SET enabled = '".$server_enabled."' WHERE remote_server_id=".$rs['remote_server_id'];
|
||||
$db->query($query);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//end ENABLE REMOTE SERVERS
|
||||
|
||||
|
||||
|
||||
//Querying INSERT new service INTO DB
|
||||
if(isset($_POST['mod_cfg_id']) AND isset($_POST['remote_server_id']) AND isset($_POST['slot_max_qty']) AND isset($_POST['price_daily']) AND isset($_POST['price_monthly']) AND isset($_POST['price_year']))
|
||||
{
|
||||
//Sanitize the POST values
|
||||
$home_cfg_id = $db->realEscapeSingle($_POST['home_cfg_id']);
|
||||
$mod_cfg_id = $db->realEscapeSingle($_POST['mod_cfg_id']);
|
||||
$service_name = $db->realEscapeSingle($_POST['service_name']);
|
||||
foreach ($_POST['remote_server_id'] as $remote)
|
||||
{
|
||||
$remote_server_id = $remote_server_id . $remote . " ";
|
||||
}
|
||||
//echo $remote_servers_id;
|
||||
//$remote_server_id = $remote_servers_id;
|
||||
//$remote_server_id = $db->realEscapeSingle($_POST['remote_server_id']);
|
||||
$slot_max_qty = $db->realEscapeSingle($_POST['slot_max_qty']);
|
||||
$slot_min_qty = $db->realEscapeSingle($_POST['slot_min_qty']);
|
||||
$price_daily = $db->realEscapeSingle($_POST['price_daily']);
|
||||
$price_monthly = $db->realEscapeSingle($_POST['price_monthly']);
|
||||
$price_year = $db->realEscapeSingle($_POST['price_year']);
|
||||
$description = $db->realEscapeSingle($_POST['description']);
|
||||
$img_url = $db->realEscapeSingle($_POST['img_url']);
|
||||
$ftp = $db->realEscapeSingle($_POST['ftp']);
|
||||
$install_method = $db->realEscapeSingle($_POST['install_method']);
|
||||
$manual_url = $db->realEscapeSingle($_POST['manual_url']);
|
||||
$access_rights = "";
|
||||
$enabled = 1;
|
||||
if(isset($_POST['allow_updates']))$access_rights .= $db->realEscapeSingle($_POST['allow_updates']);
|
||||
if(isset($_POST['allow_file_management']))$access_rights .= $db->realEscapeSingle($_POST['allow_file_management']);
|
||||
if(isset($_POST['allow_parameter_usage']))$access_rights .= $db->realEscapeSingle($_POST['allow_parameter_usage']);
|
||||
if(isset($_POST['allow_extra_params']))$access_rights .= $db->realEscapeSingle($_POST['allow_extra_params']);
|
||||
if(isset($_POST['allow_ftp_usage']))$access_rights .= $db->realEscapeSingle($_POST['allow_ftp_usage']);
|
||||
if(isset($_POST['allow_custom_fields']))$access_rights .= $db->realEscapeSingle($_POST['allow_custom_fields']);
|
||||
|
||||
$qry_add_service = "INSERT INTO OGP_DB_PREFIXbilling_services(service_id, home_cfg_id, mod_cfg_id, service_name, remote_server_id, out_of_stock, slot_max_qty , slot_min_qty, price_daily, price_monthly, price_year, description, img_url, ftp, install_method, manual_url, access_rights,enabled) VALUES(NULL, '".$home_cfg_id."', '".$mod_cfg_id."', '".$service_name."', '".$remote_server_id."', 0,'".$slot_max_qty."', '".$slot_min_qty."', '".$price_daily."', '".$price_monthly."', '".$price_year."', '".$description."', '".$img_url."', '".$ftp."', '".$install_method."', '".$manual_url."', '".$access_rights."', '" . $enabled . "')";
|
||||
$db->query($qry_add_service);
|
||||
}
|
||||
|
||||
//Querying REMOVE service FROM DB
|
||||
if (isset($_POST['service_id']))
|
||||
{
|
||||
$db->query( "DELETE FROM OGP_DB_PREFIXbilling_services WHERE service_id=" . $db->realEscapeSingle($_POST['service_id']) );
|
||||
}
|
||||
|
||||
?>
|
||||
<h2><?php print_lang('add_service');?></h2>
|
||||
<form method="POST" action="">
|
||||
<table class="center">
|
||||
<!-- Part2 - Select MOD -->
|
||||
<?php
|
||||
if(isset($_POST['home_cfg_id']))
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<select name="modcfgid">
|
||||
<?php
|
||||
$mod_qry = $db->resultQuery("SELECT DISTINCT mod_cfg_id, mod_name, game_name FROM OGP_DB_PREFIXconfig_mods NATURAL JOIN OGP_DB_PREFIXconfig_homes WHERE home_cfg_id=" . $db->realEscapeSingle($_POST['home_cfg_id']));
|
||||
foreach($mod_qry as $array_mods)
|
||||
{
|
||||
if($array_mods['mod_name'] == "none")$array_mods['mod_name']=$array_mods['game_name'];
|
||||
?>
|
||||
<option value="<?php echo $array_mods['mod_cfg_id'];?>"><?php echo $array_mods['mod_name'];?></option>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<input type="hidden" name="homecfgid" value="<?php echo $_POST['home_cfg_id'];?>"/>
|
||||
<tr>
|
||||
<?php
|
||||
}
|
||||
else if (isset($_POST['modcfgid']) AND isset($_POST['homecfgid']))
|
||||
{
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php
|
||||
$result3 = $db->resultQuery("SELECT DISTINCT remote_server_id, remote_server_name, agent_ip, ogp_user FROM OGP_DB_PREFIXremote_servers");
|
||||
?>
|
||||
<td><?php print_lang('remote_server');?></td>
|
||||
<td>
|
||||
<select name="remote_server_id[]" multiple size="5">
|
||||
<?php
|
||||
foreach($result3 as $row3)
|
||||
{
|
||||
?>
|
||||
<option value="<?php echo $row3['remote_server_id']; ?>">(<?php echo $row3['remote_server_id']; ?>) - IP[<?php echo $row3['agent_ip']; ?>]</option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php
|
||||
$mods = $db->resultQuery("SELECT DISTINCT mod_cfg_id, mod_name, game_name FROM OGP_DB_PREFIXconfig_mods NATURAL JOIN OGP_DB_PREFIXconfig_homes WHERE mod_cfg_id=" . $db->realEscapeSingle($_POST['modcfgid']));
|
||||
foreach($mods as $mod)
|
||||
{
|
||||
?>
|
||||
<td><?php print_lang('service_name');?></td>
|
||||
<td><input name="service_name" type="text" size="61" value="<?php if($mod['mod_name']=="none")echo $mod['game_name']; else echo $mod['game_name']." - ".$mod['mod_name'];?>"/></td>
|
||||
<input name="mod_cfg_id" type="hidden" value="<?php echo $mod['mod_cfg_id'];}?>"/>
|
||||
<input name="home_cfg_id" type="hidden" value="<?php echo $_POST['homecfgid'];?>"/>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_lang('min_slot_qty');?></td>
|
||||
<td><input name="slot_min_qty" type="text" size="8" value="16"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_lang('max_slot_qty');?></td>
|
||||
<td><input name="slot_max_qty" type="text" size="8" value="64"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Price Daily</td>
|
||||
<td><input name="price_daily" type="text" size="8" value="0"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_lang('price_monthly');?></td>
|
||||
<td><input name="price_monthly" type="text" size="8" value="0"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_lang('price_year');?></td>
|
||||
<td><input name="price_year" type="text" size="8" value="0"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_lang('ftp_account');?></td>
|
||||
<td>
|
||||
<select name="ftp">
|
||||
<option value="enabled"><?php print_lang('enabled');?></option>
|
||||
<option value="disabled"><?php print_lang('disabled');?></option>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_lang('select_install_method');?></td>
|
||||
<td>
|
||||
<select name="install_method">
|
||||
<option value="steam"><?php print_lang('steam');?></option>
|
||||
<option value="rsync"><?php print_lang('rsync');?></option>
|
||||
<option value="manual"><?php print_lang('manual_from_url');?></option>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_lang('url_for_manual_install');?></td>
|
||||
<td><input name="manual_url" type="text" size="61"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_lang('description');?></td>
|
||||
<td><textarea name='description' cols='45' rows='5'></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_lang('image_url');?></td>
|
||||
<td><textarea name='img_url' cols='45' rows='1'>images/games/unknown.png</textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_lang('access_rights');?></td>
|
||||
<td>
|
||||
<input name="allow_updates" type="checkbox" value="u" checked="checked"/><?php print_lang('allow_update');?><br>
|
||||
<input name="allow_file_management" type="checkbox" value="f" checked="checked"/><?php print_lang('allow_file_management');?><br>
|
||||
<input name="allow_parameter_usage" type="checkbox" value="p" checked="checked"/><?php print_lang('allow_parameter_usage');?><br>
|
||||
<input name="allow_extra_params" type="checkbox" value="e" checked="checked"/><?php print_lang('allow_extra_parameters_usage');?><br>
|
||||
<input name="allow_ftp_usage" type="checkbox" value="t" checked="checked"/><?php print_lang('allow_ftp_usage');?><br>
|
||||
<input name="allow_custom_fields" type="checkbox" value="c" checked="checked"/><?php print_lang('allow_custom_fields');?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<!-- Part 1 - Select GAME -->
|
||||
<tr>
|
||||
<td><select name='home_cfg_id'>
|
||||
<?php
|
||||
global $db;
|
||||
$games = $db->getGameCfgs();
|
||||
foreach($games as $game)
|
||||
{
|
||||
echo "<option value='".$game['home_cfg_id']."'>".$game['game_name'];
|
||||
if ( preg_match("/linux/", $game['game_key']) )
|
||||
echo " (Linux) ";
|
||||
if ( preg_match("/win/", $game['game_key']) )
|
||||
echo " (Windows) ";
|
||||
if ( preg_match("/64/", $game['game_key']) )
|
||||
echo " (64bit) ";
|
||||
echo "</option>";
|
||||
|
||||
}
|
||||
?>
|
||||
</select></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<td><input type="submit" value="<?php print_lang('add_service');?>"/></td>
|
||||
</tr>
|
||||
</form>
|
||||
|
||||
<!-- Show Services on DB -->
|
||||
</table>
|
||||
<br>
|
||||
<h2>Enable/Disable Server Locations</h2>
|
||||
<?php
|
||||
//ENABLE OR DISABLE REMOTE SERVERS FOR GAMES
|
||||
$result = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXremote_servers");
|
||||
echo "<form method='post' action=''>";
|
||||
echo "<input type='hidden' name='update_remote_servers' value='update' />";
|
||||
foreach($result as $rs)
|
||||
{
|
||||
$checked = 'checked';
|
||||
if(!$rs['enabled'])
|
||||
{
|
||||
$checked = '';
|
||||
}
|
||||
echo "<div style='float:left; width:25%;'>";
|
||||
echo $rs['remote_server_id'] ;
|
||||
echo " <input type='checkbox' id='" . $rs['remote_server_id'] . "' name='" . $rs['remote_server_id'] ."' value='" .$rs['enabled'] . "' " . $checked . ">";
|
||||
echo $rs['remote_server_name'];
|
||||
echo "</div>";
|
||||
}
|
||||
echo "<br><input type='submit' value='Update Enabled Servers'>
|
||||
</form>
|
||||
<br><br>";
|
||||
//end ENABLE REMOTE SERVERS
|
||||
|
||||
$services = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXbilling_services ORDER BY service_name");
|
||||
if ($services > 0)
|
||||
{
|
||||
?>
|
||||
<h2><?php print_lang('current_services');?></h2>
|
||||
<table class="center" style='text-align:center;'>
|
||||
<tr>
|
||||
<th><?php print_lang('id');?></th>
|
||||
<th><?php print_lang('service_name');?></th>
|
||||
<th><?php print_lang('remote_server');?></th>
|
||||
<th><?php print_lang('unavailable');?></th>
|
||||
<th><?php print_lang('price_monthly');?></th>
|
||||
<th><?php print_lang('service_image_url');?></th>
|
||||
<th>Enabled</th>
|
||||
</tr>
|
||||
<?php
|
||||
foreach($services as $row)
|
||||
{
|
||||
?>
|
||||
<tr class="tr<?php $i = 0; echo($i++%2);?>">
|
||||
<td><b class="success" ><?php echo $row['service_id'];?></b></td>
|
||||
<td><?php echo $row['service_name'];?></td>
|
||||
|
||||
<form method="post" action="">
|
||||
<input name="service" type="hidden" value="<?php echo $row['service_id'];?>"/>
|
||||
<td><input name="new_remote_server_id" type="text" value="<?php echo $row['remote_server_id'];?>"/></td>
|
||||
<td><input name="new_out_of_stock" type="text" value="<?php echo $row['out_of_stock'];?>"/></td>
|
||||
<td><input name="new_price_monthly" type="text" value="<?php echo $row['price_monthly'];?>" size="6"/></td>
|
||||
<td><input name="new_url" type="text" value="<?php echo $row['img_url'];?>"/></td>
|
||||
<td><input name="new_enabled" type="text" value="<?php echo $row['enabled'];?>"/></td>
|
||||
|
||||
<td><input type="submit" value="<?php print_lang('update_settings');?>"/></td>
|
||||
</form>
|
||||
</tr>
|
||||
<?php
|
||||
if(isset($_POST['new_enabled']))
|
||||
{
|
||||
$Enabled ='1';
|
||||
}
|
||||
else
|
||||
{
|
||||
$Enabled ='0';
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="center">
|
||||
<tr>
|
||||
<tr>
|
||||
<td>
|
||||
<form action="" method="post">
|
||||
<select name="service_id">
|
||||
<?php
|
||||
foreach($services as $service)
|
||||
{
|
||||
?>
|
||||
<option value="<?php echo $service['service_id'];?>"><?php echo $service['service_name'];?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<input type="submit" value="<?php print_lang('remove_service');?>"/>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
<?php
|
||||
function curPageName()
|
||||
{
|
||||
return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
|
||||
}
|
||||
|
||||
function exec_ogp_module()
|
||||
{
|
||||
require('includes/config.inc.php');
|
||||
require_once('modules/settings/functions.php');
|
||||
require_once('includes/form_table_class.php');
|
||||
global $db,$view,$settings;
|
||||
|
||||
$currencies = Array (
|
||||
'AUD' => 'Australian Dollar',
|
||||
'BRL' => 'Brazilian Real',
|
||||
'CAD' => 'Canadian Dollar',
|
||||
'CZK' => 'Czech Koruna',
|
||||
'DKK' => 'Danish Krone',
|
||||
'EUR' => 'Euro',
|
||||
'HKD' => 'Hong Kong Dollar',
|
||||
'HUF' => 'Hungarian Forint',
|
||||
'ILS' => 'Israeli New Sheqel',
|
||||
'JPY' => 'Japanese Yen',
|
||||
'MYR' => 'Malaysian Ringgit',
|
||||
'MXN' => 'Mexican Peso',
|
||||
'NOK' => 'Norwegian Krone',
|
||||
'NZD' => 'New Zealand Dollar',
|
||||
'PHP' => 'Philippine Peso',
|
||||
'PLN' => 'Polish Zloty',
|
||||
'GBP' => 'Pound Sterling',
|
||||
'RUB' => 'Russian Ruble',
|
||||
'SGD' => 'Singapore Dollar',
|
||||
'SEK' => 'Swedish Krona',
|
||||
'CHF' => 'Swiss Franc',
|
||||
'TWD' => 'Taiwan New Dollar',
|
||||
'THB' => 'Thai Baht',
|
||||
'TRY' => 'Turkish Lira',
|
||||
'USD' => 'U.S. Dollar'
|
||||
);
|
||||
|
||||
asort($currencies);
|
||||
|
||||
|
||||
$settings['paypal'] = isset($settings['paypal']) ? $settings['paypal'] : "1";
|
||||
$settings['debug'] = isset($settings['debug']) ? $settings['debug'] : "1";
|
||||
$settings['sandbox'] = isset($settings['sandbox']) ? $settings['sandbox'] : "1";
|
||||
$settings['currency'] = isset($settings['currency']) ? $settings['currency'] : "EUR";
|
||||
$settings['daily'] = isset($settings['daily']) ? $settings['daily'] : 1;
|
||||
$settings['monthly'] = isset($settings['monthly']) ? $settings['monthly'] : 1;
|
||||
$settings['annually'] = isset($settings['annually']) ? $settings['annually'] : 1;
|
||||
$settings['tax_amount'] = isset($settings['tax_amount']) ? $settings['tax_amount'] : 7;
|
||||
$settings['webhookurl'] = isset($settings['webhookurl']) ? $settings['webhookurl'] : "https://discordapp.com/api/webhooks";
|
||||
$settings['checkbox'] = isset($settings['checkbox']) ? $settings['checkbox'] : "Terms and conditions";
|
||||
$settings['TOSpopup'] = isset($settings['TOSpopup']) ? $settings['TOSpopup'] : "Accept the TOS";
|
||||
$settings['display_free'] = isset($settings['display_free']) ? $settings['display_free'] : "1";
|
||||
|
||||
|
||||
$settings['paypal_email'] = isset($settings['paypal_email']) ? $settings['paypal_email'] : "Business@E-mail";
|
||||
function checked($value){
|
||||
global $settings;
|
||||
if( $settings[$value] == 1 )
|
||||
return 'checked="checked"';
|
||||
}
|
||||
|
||||
|
||||
if(isset($_POST['currency']))
|
||||
{
|
||||
$currency = $_REQUEST['currency'];
|
||||
}
|
||||
|
||||
if ( isset($_REQUEST['update_settings']) )
|
||||
{
|
||||
$settings = array(
|
||||
"paypal" => $_REQUEST['paypal'],
|
||||
"debug" => $_REQUEST['debug'],
|
||||
"sandbox" => $_REQUEST['sandbox'],
|
||||
"currency" => $currency,
|
||||
"daily" => @$_REQUEST['daily'],
|
||||
"monthly" => @$_REQUEST['monthly'],
|
||||
"annually" => @$_REQUEST['annually'],
|
||||
"tax_amount" => $_REQUEST['tax_amount'],
|
||||
"webhookurl" => $_REQUEST['webhookurl'],
|
||||
"checkbox" => $_REQUEST['checkbox'],
|
||||
"TOSpopup" => $_REQUEST['TOSpopup'],
|
||||
"display_free" =>$_REQUEST['display_free'],
|
||||
"paypal_email" => $_REQUEST['paypal_email']);
|
||||
|
||||
$db->setSettings($settings);
|
||||
print_success(get_lang('settings_updated'));
|
||||
$view->refresh("?m=billing&p=shop_settings");
|
||||
return;
|
||||
}
|
||||
|
||||
$s = ( isset($_SERVER['HTTPS']) and get_true_boolean($_SERVER['HTTPS']) ) ? "s" : "";
|
||||
$p = isset($_SERVER['SERVER_PORT']) & $_SERVER['SERVER_PORT'] != "80" ? ":".$_SERVER['SERVER_PORT'] : NULL ;
|
||||
$this_script = 'http'.$s.'://'.$_SERVER['SERVER_NAME'].$p.$_SERVER['SCRIPT_NAME'];
|
||||
$current_folder_url = str_replace( curPageName(), "", $this_script);
|
||||
|
||||
echo "<h2>".get_lang('shop_settings')."</h2>";
|
||||
|
||||
$ft = new FormTable();
|
||||
?>
|
||||
<form>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
</form>
|
||||
<?php
|
||||
$ft->start_form("?m=billing&p=shop_settings");
|
||||
$ft->start_table();
|
||||
echo "<tr><td colspan='2' ><h3>".get_lang('payment_gateway')."</h4></td></tr>";
|
||||
$ft->add_custom_field('paypal','<input type="checkbox" name="paypal" value="1" '.checked('paypal').'/>');
|
||||
$ft->add_custom_field('debug','<input type="checkbox" name="debug" value="1" '.checked('debug').'/>');
|
||||
$ft->add_custom_field('sandbox','<input type="checkbox" name="sandbox" value="1" '.checked('sandbox').'/>');
|
||||
$ft->add_field('string','paypal_email',$settings['paypal_email'],35);
|
||||
$ft->add_custom_field('currency',
|
||||
create_drop_box_from_array($currencies,"currency",$settings['currency'],false));
|
||||
echo "<tr><td colspan='2' ><h3>".get_lang('available_invoice_types')."</h4></td></tr>";
|
||||
$ft->add_custom_field('daily','<input type="checkbox" name="daily" value="1" '.checked('daily').'/>');
|
||||
$ft->add_custom_field('monthly','<input type="checkbox" name="monthly" value="1" '.checked('monthly').'/>');
|
||||
$ft->add_custom_field('annually','<input type="checkbox" name="annually" value="1" '.checked('annually').'/>');
|
||||
echo "<tr><td colspan='2' ><h3>Tax Amount</h4></td></tr>";
|
||||
$ft->add_field('string','tax_amount',$settings['tax_amount'],2);
|
||||
echo "<tr><td colspan='2' ><h3>Other Settings</h4></td></tr>";
|
||||
$ft->add_field('string','webhookurl',$settings['webhookurl'],2);
|
||||
$ft->add_field('string','checkbox',$settings['checkbox'],2);
|
||||
$ft->add_field('string','TOSpopup',$settings['TOSpopup'],2);
|
||||
$ft->add_custom_field('display_free','<input type="checkbox" name="display_free" value="1" '.checked('display_free').'/>');
|
||||
$ft->end_table();
|
||||
$ft->add_button("submit","update_settings",get_lang('update_settings'));
|
||||
$ft->end_form();
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,325 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2017 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
function exec_ogp_module()
|
||||
{
|
||||
global $db, $view;
|
||||
|
||||
$settings = $db->getSettings();
|
||||
|
||||
if (isset($_POST['save']))
|
||||
{
|
||||
$new_description = str_replace("\\r\\n", "<br>", $_POST['description']);
|
||||
$service = $_POST['service_id'];
|
||||
|
||||
$change_description = "UPDATE OGP_DB_PREFIXbilling_services
|
||||
SET description ='".$db->realEscapeSingle($new_description)."'
|
||||
WHERE service_id=".$db->realEscapeSingle($service);
|
||||
$save = $db->query($change_description);
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<a href="?m=billing&p=cart"><img SRC="images/cart.png" BORDER="0" WIDTH=22 HEIGHT=20/><?php print_lang('your_cart');?></a><br>
|
||||
<?PHP echo date('d-M-Y H:i a'); ?>
|
||||
<!-- ------------------------------------------------------------------------------
|
||||
THIS IS WHAT WE DISPLAY ON THE SHOP PAGE AT THE TOP
|
||||
-->
|
||||
<center><h5>We treat YOUR server like it was OUR server</h5></center>
|
||||
<br>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
// Shop Form
|
||||
if(intval($_REQUEST['service_id']) !==0) $where_service_id = " WHERE enabled = 1 and service_id=".intval($_REQUEST['service_id']); else $where_service_id = " where enabled = 1";
|
||||
$qry_services = "SELECT * FROM OGP_DB_PREFIXbilling_services".$where_service_id;
|
||||
$services = $db->resultQuery($qry_services);
|
||||
|
||||
if (isset($_REQUEST['service_id']) && $services === false) {
|
||||
$view->refresh('home.php?m=billing&p=shop');
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($services as $key => $row) {
|
||||
$service_id[$key] = $row['service_id'];
|
||||
$home_cfg_id[$key] = $row['home_cfg_id'];
|
||||
$mod_cfg_id[$key] = $row['mod_cfg_id'];
|
||||
$service_name[$key] = $row['service_name'];
|
||||
$remote_server_id[$key] = $row['remote_server_id'];
|
||||
$out_of_stock[$key] = $row['_out_of_stock'];
|
||||
$slot_max_qty[$key] = $row['slot_max_qty'];
|
||||
$slot_min_qty[$key] = $row['slot_min_qty'];
|
||||
$price_daily[$key] = $row['price_daily'];
|
||||
$price_monthly[$key] = $row['price_monthly'];
|
||||
$price_year[$key] = $row['price_year'];
|
||||
$description[$key] = $row['description'];
|
||||
$img_url[$key] = $row['img_url'];
|
||||
$ftp[$key] = $row['ftp'];
|
||||
$install_method[$key] = $row['install_method'];
|
||||
$manual_url[$key] = $row['manual_url'];
|
||||
$access_rights[$key] = $row['access_rights'];
|
||||
}
|
||||
array_multisort($service_name,
|
||||
$service_id,
|
||||
$home_cfg_id,
|
||||
$mod_cfg_id,
|
||||
$remote_server_id,
|
||||
$out_of_stock,
|
||||
$slot_max_qty,
|
||||
$slot_min_qty,
|
||||
$price_daily,
|
||||
$price_monthly,
|
||||
$price_year,
|
||||
$description,
|
||||
$img_url,
|
||||
$ftp,
|
||||
$install_method,
|
||||
$manual_url,
|
||||
$access_rights, SORT_DESC, $services);
|
||||
|
||||
echo "<div>";
|
||||
foreach($services as $row)
|
||||
{
|
||||
if(!isset($_REQUEST['service_id']))
|
||||
{
|
||||
?>
|
||||
<div style="
|
||||
float:left;
|
||||
padding-top: 30px;
|
||||
padding-right: 20px;
|
||||
padding-bottom: 30px;
|
||||
padding-left: 20px;">
|
||||
<div style = "text-align: center;">
|
||||
<img src="<?php echo $row['img_url'] ;?>" width=256 height=96 border=0 alt="cheap <?php echo $row['service_name'];?> Game Server">
|
||||
<br>
|
||||
<?php echo $row['service_name'];?>
|
||||
<br>
|
||||
<?php
|
||||
if ($row['price_monthly'] == 0.0) {
|
||||
echo "<span style='color:green'><b>FREE!</b></span>";
|
||||
} else {
|
||||
echo "<span style='color:grey'>Starting at $" . number_format(floatval($row['price_monthly']*$row['slot_min_qty']),2) ." each month<br> "
|
||||
. number_format(floatval($row['price_monthly']),2) ." per player slot<br>".$row['slot_min_qty'] ." to " . $row['slot_max_qty'] . " players</span><br>
|
||||
<a href='".$row['description']."' target='_blank'>More Info</a>";
|
||||
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
<form action="" method="POST">
|
||||
<input name="service_id" type="hidden" value="<?php echo $row['service_id'];?>" />
|
||||
|
||||
<input name="order_server" type="submit" value="ORDER HERE">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</>
|
||||
|
||||
|
||||
<div style="border-left:10px solid transparent;">
|
||||
|
||||
<?php
|
||||
} else
|
||||
{
|
||||
?>
|
||||
<div style="float:left; border: 4px solid transparent;border-bottom: 25px solid transparent;">
|
||||
<img src="<?php echo $row['img_url'] ;?>" width=256 height=96 border=0 alt="cheap <?php echo $row['service_name'];?> server">
|
||||
<center><b><?php echo $row['service_name']."</b>
|
||||
<br>
|
||||
</center>";
|
||||
$isAdmin = $db->isAdmin($_SESSION['user_id'] );
|
||||
|
||||
if($isAdmin)
|
||||
{
|
||||
if(!isset($_POST['edit']))
|
||||
{
|
||||
echo "<p style='color:gray;width:280px;' >$row[description]<p>";
|
||||
echo "<form action='' method='post'>".
|
||||
"<input type='hidden' name='service_id' value='$row[service_id]' />".
|
||||
"<input type='submit' name='edit' value='" . get_lang('edit') . "' />".
|
||||
"</form>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<form action='' method='post'>".
|
||||
"<textarea style='resize:none;width:280px;height:132px;' name='description' >".str_replace("<br>", "\r\n", $row['description'])."</textarea><br>".
|
||||
"<input type='hidden' name='service_id' value='$row[service_id]' />".
|
||||
"<input type='submit' name='save' value='" . get_lang('save') . "' />".
|
||||
"</form>";
|
||||
}
|
||||
}
|
||||
else
|
||||
echo "<center><a href='". $row[description]."' target='_blank'>More Info</a><br></center>";
|
||||
?>
|
||||
</div>
|
||||
<table style="width:420px;float:left;">
|
||||
<form method="post" action="?m=billing&p=add_to_cart<?php if(isset($_POST['service_id'])) echo "&service_id=".$_POST['service_id'];?>">
|
||||
<input type="hidden" name="remote_control_password" size="15" value="<?php echo genRandomString(10);?>">
|
||||
<input type="hidden" name="ftp_password" size="15" value="<?php echo genRandomString(10);?>">
|
||||
<tr>
|
||||
<td align="right"><?php print_lang('service_name');?> </td>
|
||||
<td align="left">
|
||||
<input type="text" name="home_name" size="40" value="<?php echo $row['service_name'];?>">
|
||||
</td>
|
||||
<tr>
|
||||
<td align="right">Location </td>
|
||||
<td align="left">
|
||||
<?php
|
||||
//loop through multiple remote server ID stored in services 'remote_server_ip' as text
|
||||
//change WHERE clause to IS IN clause
|
||||
$rsiArray = explode(" ", $row['remote_server_id']);
|
||||
$rsi = implode(",",$rsiArray);
|
||||
//get the out of stock into an array and see if the rsID is in that array
|
||||
$unavailable_Array = explode(" ", $row['out_of_stock']);
|
||||
$available_server = false;
|
||||
//loop through each of the assigned servers and see if its disabled
|
||||
foreach($rsiArray as $rsi)
|
||||
{
|
||||
$query = "SELECT * FROM OGP_DB_PREFIXremote_servers WHERE remote_server_id = ".$rsi;
|
||||
$result = $db->resultQuery($query);
|
||||
foreach($result as $rs)
|
||||
{
|
||||
|
||||
$rsID =$rs['remote_server_id'];
|
||||
$rsNAME = $rs['remote_server_name'];
|
||||
//echo "<option value='$rsID'>$rsNAME</option>";
|
||||
// add disabled to lable and input if $rsID is in out_of_stock
|
||||
$is_unavailable = "";
|
||||
$service_text_color = "";
|
||||
if (in_array($rsID,$unavailable_Array))
|
||||
{
|
||||
$is_unavailable = "disabled";
|
||||
$service_text_color = "red";
|
||||
|
||||
}
|
||||
|
||||
if($rs['enabled']==0)
|
||||
{
|
||||
$is_unavailable = "disabled";
|
||||
$service_text_color = "red";
|
||||
}
|
||||
if($is_unavailable == "")
|
||||
{
|
||||
$available_server = true;
|
||||
}
|
||||
|
||||
|
||||
//default radio button
|
||||
// //<input type='radio' $is_unavailable name='ip_id' id='$rsID' value='$rsID' >
|
||||
echo "<div>
|
||||
<input type='radio' $is_unavailable name='ip_id' id='$rsID' value='$rsID' required>
|
||||
<label for '$rsID' $is_unavailable ><span style='color:$service_text_color'>$rsNAME </span></label>
|
||||
</div>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><?php print_lang('max_players');?> </td>
|
||||
<td align="left">
|
||||
<select name="max_players">
|
||||
<?php
|
||||
$players=$row['slot_min_qty'];
|
||||
while($players<=$row['slot_max_qty'])
|
||||
{
|
||||
//echo "<option value='$players'>$players slots</option>";
|
||||
//displays the price
|
||||
echo "<option value='$players'>$players slots = $" . number_format(floatval($row['price_monthly'] * $players),2 ) . " per month</option>";
|
||||
$players++;
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><?php print_lang('invoice_duration');?> </td>
|
||||
<td align="left">
|
||||
<select name="qty">
|
||||
<?php
|
||||
$qty=1;
|
||||
while($qty<=12)
|
||||
{
|
||||
echo "<option value='$qty'>$qty months</option>";
|
||||
$qty++;
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<input type="hidden" name="invoice_duration" value="month" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" colspan="2">
|
||||
<input name="service_id" type="hidden" value="<?php echo $row['service_id'];?>"/>
|
||||
<?php
|
||||
if ($available_server)
|
||||
{
|
||||
?>
|
||||
<input type="submit" name="add_to_cart" value="<?php print_lang('add_to_cart');?>"/>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" colspan="2">
|
||||
<form action ="?m=billing&p=shop" method="POST">
|
||||
<button><< <?php print_lang('back_to_list');?></button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div style="clear: both; text-align:center" id="read_more" >
|
||||
<p style="color:yellow; text-align:center;">100% refund if you are not satisfied
|
||||
</p>
|
||||
Read our <a href="tos.php" target="_blank">Terms of Service</a> Here
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2017 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
chdir(realpath(dirname(__FILE__))); /* Change to the current file path */
|
||||
chdir("../.."); /* Base path to ogp web files */
|
||||
// Report all PHP errors
|
||||
error_reporting(E_ALL);
|
||||
// Path definitions
|
||||
define("CONFIG_FILE","includes/config.inc.php");
|
||||
//Requiere
|
||||
require_once("includes/functions.php");
|
||||
require_once("includes/helpers.php");
|
||||
require_once("includes/html_functions.php");
|
||||
require_once("modules/config_games/server_config_parser.php");
|
||||
require_once("includes/lib_remote.php");
|
||||
require_once CONFIG_FILE;
|
||||
// Connect to the database server and select database.
|
||||
$db = createDatabaseConnection($db_type, $db_host, $db_user, $db_pass, $db_name, $table_prefix);
|
||||
|
||||
$panel_settings = $db->getSettings();
|
||||
if( isset($panel_settings['time_zone']) && $panel_settings['time_zone'] != "" )
|
||||
date_default_timezone_set($panel_settings['time_zone']);
|
||||
|
||||
|
||||
//these dates are configured in the Shop Settings page
|
||||
$today=time();
|
||||
$invoice_date = strtotime('+ 7 days'); //this many days until the finish_date
|
||||
$suspend_date = $today; //suspend when overdue
|
||||
$removal_date = strtotime('+ 7 days'); //finish_date is passed 7 days ago
|
||||
$rundate = date('d/M/y G:i',$today);
|
||||
|
||||
|
||||
//THESE SERVERS HAVE REACHED THE DATE FOR INVOICE, FINISH_DATE - 7 (OR WHAT IS IN SETTINGS)
|
||||
//SET STATUS -1 MEANING INVOICED
|
||||
//LOOP THROUGH ALL SERVERS WITH STATUS = 1 (ACTIVE) -----------------------------------------------------------
|
||||
$settings = $db->getSettings();
|
||||
$subject = "Test Email";
|
||||
$emailto = "iaretechnician@gmail.com";
|
||||
$message = "WooHoo<br><br><br>Email Works<br>Thanks!<br>";
|
||||
$mail = mymail($emailto, $subject, $message, $settings);
|
||||
|
||||
|
||||
// END EMAIL
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue