diff --git a/Panel/modules/reseller/account_details.php b/Panel/modules/reseller/account_details.php new file mode 100755 index 00000000..a2a1b785 --- /dev/null +++ b/Panel/modules/reseller/account_details.php @@ -0,0 +1,185 @@ + +isAdmin($_SESSION['user_id']); + + echo "
| + | + | + | + | + |
|---|---|---|---|---|
| getUserById($account['user_id']); echo $user['users_login'];?> | ++ | + 0) + { + ?> + + () + + + | resultQuery($qry_services); + $service = $services[0]; + $invoice_duration = $account['qty'] > 1 ? $account['invoice_duration']."s" : $account['invoice_duration']; + echo $service['service_name']." [ ".$service['slot_max_qty']." ".get_lang('slots').", ".$account['qty']." ".get_lang($invoice_duration)." ]";?> | ++ |
| + + + + + + + + | ++ + | ++ ".number_format( $subtotal , 2 ).$carts[0]['currency'].""; ?> + | ++ ".$cart['tax_amount']."% (".number_format( $cart['tax_amount']/100*$subtotal, 2 ).$carts[0]['currency'].")"; ?> + | ++ ".number_format( $total , 2 ).$carts[0]['currency'].""; ?> + | +
".get_lang('no_remote_servers_configured')."
+".get_lang('add_remote_server')."
"; + + return; + } + + $game_cfgs = $db->getGameCfgs(); + $users = $db->getUserList(); + + if ( $game_cfgs === FALSE ) + { + echo "".get_lang('no_game_configurations_found')." ".get_lang('game_configurations')."
"; + return; + } + + $selections = array( "allow_updates" => "u", + "allow_file_management" => "f", + "allow_parameter_usage" => "p", + "allow_extra_params" => "e", + "allow_ftp" => "t"); + + if ( isset($_REQUEST['add_game_server']) ) + { + $rserver_id = $_POST['rserver_id']; + $home_cfg_id = $_POST['home_cfg_id']; + $mod_cfg_id = $_POST['mod_cfg_id']; + $max_players = $_POST['max_players']; + $web_user_id = trim($_POST['web_user_id']); + $qry_accounts = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXreseller_accounts WHERE account_id=".$_POST['account_id']); + $account = $qry_accounts[0]; + $qry_service = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXreseller_services WHERE service_id=".$account['service_id']); + $service = $qry_service[0]; + $max_access_rights = $service['max_access_rights']; + $start_port = $service['start_port']; + $end_port = $service['end_port']; + $post_months = $_POST['invoice_duration'] == "month" ? 1 : 12; + $assigned_months = $post_months * $_POST['qty']; + $account_months = $account['invoice_duration'] == "month" ? 1 : 12; + $account_total_months = $account_months * $account['qty']; + + if( $account['available_months'] >= $assigned_months AND $account['available_slots'] >= $max_players ) + { + $control_password = genRandomString(8); + $access_rights = ""; + + $ftp = FALSE; + foreach ($selections as $selection => $flag) + { + if (isset($_POST[$selection])) + { + if( preg_match( "/$flag/", $max_access_rights ) ) + { + $access_rights .= $flag; + if ($flag == "t") + { + $ftp = TRUE; + } + } + } + } + + if ( empty( $web_user_id ) ) + { + print_failure(get_lang('bad_user_name')); + } + else + { + foreach ( $game_cfgs as $cfg ) + { + if($cfg['home_cfg_id'] == $home_cfg_id) $server_name = $cfg['game_name']; + } + foreach ( $remote_servers as $server ) + { + if($server['remote_server_id'] == $rserver_id) $ogp_user = $server['ogp_user']; + } + foreach ( $users as $user ) + { + if($user['user_id'] == $web_user_id) $web_user = $user['users_login']; + } + $ftppassword = genRandomString(8); + $game_path = "/home/".$ogp_user."/"; + if ( ( $new_home_id = $db->addGameHome($rserver_id,$web_user_id,$home_cfg_id, + clean_path($game_path),$server_name,$control_password,$ftppassword) )!== FALSE ) + { + $db->assignHomeTo("user",$web_user_id,$new_home_id,$access_rights); + $home_info = $db->getGameHomeWithoutMods($new_home_id); + require_once('includes/lib_remote.php'); + $remote = new OGPRemoteLibrary($home_info['agent_ip'],$home_info['agent_port'],$home_info['encryption_key']); + if($ftp) + { + $host_stat = $remote->status_chk(); + if( $host_stat === 1) + { + $remote->ftp_mgr("useradd", $home_info['home_id'], $home_info['ftp_password'], $home_info['home_path']); + $db->changeFtpStatus('enabled',$home_info['home_id']); + } + } + + $home_id = $new_home_id; + + $remote_server_ips = $db->getRemoteServerIPs($rserver_id); + + $max_id = count($remote_server_ips) - 1; + $ip_id = ( count($remote_server_ips) > 1 ) ? $remote_server_ips[rand(0,$max_id)]['ip_id'] : $remote_server_ips['0']['ip_id']; + + $add_port = $db->addGameIpPort( $home_id, $ip_id, $db->getNextAvailablePort($ip_id,$home_cfg_id) ); + + $mod_id = $db->addModToGameHome($home_id,$mod_cfg_id); + + if ( $mod_id === FALSE ) + { + print_failure(get_lang_f('failed_to_assing_mod_to_home',$mod_cfg_id)); + unset($_POST); + } + else + { + $cliopts = ""; + $cpus = "NA"; + $nice = "0"; + if ( $db->updateGameModParams($max_players,$cliopts,$cpus,$nice,$home_id,$mod_cfg_id) === FALSE ) + { + print_failure(get_lang_f('failed_to_assing_mod_to_home',$mod_cfg_id)); + unset($_POST); + } + else + { + $update_available_slots = $account['available_slots'] - $max_players; + $db->query("UPDATE OGP_DB_PREFIXreseller_accounts SET available_slots=".$update_available_slots." WHERE account_id=".$account['account_id']); + + $status = "ADDDATE(DATE(NOW() + INTERVAL ".$assigned_months." MONTH), 1)"; + + $query = sprintf('INSERT INTO `%1$sreseller_homes` (`home_id`, `user_id`, `account_id`, `assigned_slots`, `status`) + VALUES(\'%2$s\', \'%3$s\', \'%4$s\', \'%5$s\', %6$s) + ON DUPLICATE KEY UPDATE + user_id=VALUES(user_id), + account_id=VALUES(account_id), + assigned_slots=VALUES(assigned_slots), + status=VALUES(status);', + 'OGP_DB_PREFIX', + $db->real_escape_string($home_id), + $db->real_escape_string($web_user_id), + $db->real_escape_string($account['account_id']), + $db->real_escape_string($max_players), + $db->real_escape_string($status)); + + $db->query($query); + + if ($_POST['installation'] == "manual") + { + print_success(get_lang('server_added_successfully_needs_manual_install')); + unset($_POST); + } + else + { + // Getting pre and post commands + $game_mod_precmd = $db->resultQuery("SELECT DISTINCT precmd FROM OGP_DB_PREFIXgame_mods WHERE mod_id='$mod_id'"); + if($game_mod_precmd[0]['precmd'] === NULL OR empty($game_mod_precmd[0]['precmd'])) + { + $config_mod_precmd = $db->resultQuery("SELECT DISTINCT def_precmd FROM OGP_DB_PREFIXconfig_mods WHERE mod_cfg_id='$mod_cfg_id'"); + if ($config_mod_precmd[0]['def_precmd'] === NULL OR empty($config_mod_precmd[0]['def_precmd'])) + $precmd = ""; + else + $precmd = $config_mod_precmd[0]['def_precmd']; + } + else + $precmd = $game_mod_precmd[0]['precmd']; + + + $game_mod_postcmd = $db->resultQuery("SELECT DISTINCT postcmd FROM OGP_DB_PREFIXgame_mods WHERE mod_id='$mod_id'"); + if($game_mod_postcmd[0]['postcmd'] === NULL OR empty($game_mod_postcmd[0]['postcmd'])) + { + $config_mod_postcmd = $db->resultQuery("SELECT DISTINCT def_postcmd FROM OGP_DB_PREFIXconfig_mods WHERE mod_cfg_id='$mod_cfg_id'"); + if ($config_mod_postcmd[0]['def_postcmd'] === NULL OR empty($config_mod_postcmd[0]['def_postcmd'])) + $postcmd = ""; + else + $postcmd = $config_mod_postcmd[0]['def_postcmd']; + } + else + $postcmd = $game_mod_postcmd[0]['postcmd']; + + $home_info = $db->getGameHome($home_id); + $server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$home_info['home_cfg_file']); + $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 ); + // Starting Game server installation + if( $_POST['installation'] == "steam" OR $_POST['installation'] == "steamcmd" ) + { + $mod_xml = xml_get_mod($server_xml, $home_info['mods'][$mod_id]['mod_key']); + $installer_name = $mod_xml->installer_name; + $modkey = $home_info['mods'][$mod_id]['mod_key']; + // 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 : ''; + preg_match("/(win|linux)(32|64)?$/", $server_xml->game_key, $matches); + $os = strtolower($matches[1]) == 'linux'? 'linux':'windows'; + $arch = isset($matches[2])?$matches[2]:'32'; + + if($precmd == "") + { + $preInstallCMD = ""; + if(isset($server_xml->post_install)) + $preInstallCMD .= $server_xml->pre_install; + } + else + $preInstallCMD = $precmd; + + if($postcmd == "") + { + $postInstallCMD = ""; + if(isset($server_xml->post_install)) + $postInstallCMD .= $server_xml->post_install; + } + else + $postInstallCMD = $postcmd; + + $postInstallCMD .= "\n{OGP_LOCK_FILE} " . $home_info['home_path'] . "/" . ($server_xml->exe_location ? $server_xml->exe_location . "/" : "") . $server_xml->server_exec_name; + + $remote->steam_cmd($home_info['home_id'],$home_info['home_path'],$installer_name,$modname, + $betaname,$betapwd,$login,$pass,$settings['steam_guard'], + $exec_folder_path,$exec_path,$preInstallCMD,$postInstallCMD,$os,'',$arch); + print_success(get_lang('server_added_successfully_installing')); + unset($_POST); + } + elseif($_POST['installation'] == "rsync") + { + if( isset($server_xml->lgsl_query_name) ) + $rs_name = $server_xml->lgsl_query_name; + elseif( isset($server_xml->gameq_query_name) ) + $rs_name = $server_xml->gameq_query_name; + elseif( isset($server_xml->protocol) ) + $rs_name = $server_xml->protocol; + else + $rs_name = $server_xml->mods->mod['key']; + $url = "rsync.opengamepanel.org"; + + 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"; + + $full_url = "$url/ogp_game_installer/$rs_name/$os/"; + $remote->start_rsync_install($home_id,$home_info['home_path'],"$full_url",$exec_folder_path,$exec_path,$precmd,$postcmd); + print_success(get_lang('server_added_successfully_installing')); + unset($_POST); + } + } + } + + } + } + else + { + print_failure(get_lang_f("failed_to_add_home_to_db",$db->getError())); + unset($_POST); + } + } + } + else + { + if( $account['available_months'] < $assigned_months ) + print_failure( get_lang_f('you_assigned_months_this_amount_exceeds_the_available_months_in_this_reseller_account', $assigned_months, $account['available_months']) ); + elseif( $account['available_slots'] < $max_players ) + print_failure( get_lang_f('you_assigned_max_players_this_amount_exceeds_the_available_slots_in_this_reseller_account', $max_players, $account['available_slots']) ); + $view->refresh('home.php?m=reseller&p=rs_assign_server', 5); + } + } + + + if( isset($_POST['account_id']) ) + { + $qry_accounts = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXreseller_accounts WHERE user_id=".$_SESSION['user_id']." AND account_id=".$_POST['account_id']); + $account = $qry_accounts[0]; + $qry_service = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXreseller_services WHERE service_id=".$account['service_id']); + $service = $qry_service[0]; + $invoice_duration_string = $account['qty'] > 1 ? $account['invoice_duration']."s" : $account['invoice_duration']; + echo "|
+ + |
+ ||||
| + | ||||
| : ".$settings['panel_name'].""; ?> |
+ + | ![]() |
+ ||
| : ".$settings['paypal_email'].""; ?> |
+ ||||
| + | ||||
| + | + | + | % | ++ |
| + | ||||
| + | : |
+ + | ||
: |
+ + | |||
: |
+ + | |||
: |
+ + | |||
: |
+ + | |||
| + | ||||
| + | ++ + | ++ + | ++ + | ++ + | +
|---|---|---|---|---|
| + ".$service_info[0]['service_name']." [".$account['qty']." ".get_lang($invoice_duration).", ".$service_info[0]['slot_max_qty']." ".get_lang('slots')."]" ; + ?> + | ++ + | ++ + | ++ + | ++ + + + + 0 ) + { + ?> + + + | +
| + | ++ + | +|
| + | ++ % + | +|
| + + | ++ + | ++ + + + + + + + + + + | +
Payment process is pending
"; + } + else if (isset($_POST['payment_status']) AND ($_POST['payment_status']=="Reversed" OR $_POST['payment_status']=="Refunded" OR $_POST['payment_status']=="Denied" OR $_POST['payment_status']=="Expired" OR $_POST['payment_status']=="Failed" OR $_POST['payment_status']=="Voided")) + { + echo "| Field Name | +Value | +
| $key | ".urldecode($value)." |

| + | + |
| + | + + | +
| + | % | +
| + | + |
| + | |
| + | + | + | + |
|---|---|---|---|
| + | % | ++ | + |
|
+ |
+
|
+ |
+ + [+] + | +
| + + | +|
| + + | +|
+ $row[description]
"; + echo "
$row[description]
"; + ?> +
| :: | ++ + | +
| :: | ++ + | +
| :: | ++ + + | +
| + + + + | +|
|
+ |
+ |