local edits
This commit is contained in:
parent
3ab7aeb19e
commit
ea75fef77b
10 changed files with 136 additions and 44 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,5 +1,8 @@
|
|||
# Ignore database configuration files with sensitive credentials
|
||||
modules/billing/includes/config.inc.php
|
||||
includes/config.inc.php
|
||||
status/api/config.php
|
||||
status_api_local.php
|
||||
|
||||
# Ignore logs
|
||||
modules/billing/logs/*.log
|
||||
|
|
|
|||
15
includes/config.inc.php.example
Normal file
15
includes/config.inc.php.example
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
###############################################
|
||||
# Site configuration
|
||||
# Copy this file to config.inc.php and fill in
|
||||
# your actual database credentials.
|
||||
# config.inc.php is excluded from version control.
|
||||
###############################################
|
||||
$db_host="your_db_host";
|
||||
$db_port="3306";
|
||||
$db_user="your_db_user";
|
||||
$db_pass="your_db_password";
|
||||
$db_name="your_db_name";
|
||||
$table_prefix="gsp_";
|
||||
$db_type="mysql";
|
||||
?>
|
||||
|
|
@ -69,13 +69,40 @@ Make sure if you install a MOD, you list the name here or else it wont get loade
|
|||
|
||||
mkdir -p ./cfg
|
||||
touch ./cfg/dayz_arma2co_win32.xml.txt
|
||||
wget http://files.iaregamer.com/addons/dayz-mod-1.9.tar.gz .
|
||||
tar -xzvf dayz-mod-1.9.tar.gz
|
||||
chmod +x setup_db.sh
|
||||
./setup_db.sh
|
||||
rm *.sh
|
||||
rm *.sql
|
||||
rm *.gz
|
||||
|
||||
wget http://files.iaregamer.com/gamefiles/arma2Addons.tar
|
||||
tar -xzvf arma2Addons.tar
|
||||
rm -f arma2Addons.tar
|
||||
|
||||
wget http://files.iaregamer.com/gamefiles/dayzmod1.9.0.tar
|
||||
tar -xzvf dayzmod1.9.0.tar
|
||||
rm -f dayzmod1.9.0.tar
|
||||
|
||||
|
||||
#Create Database ---------------------------------------
|
||||
|
||||
dbPass=$(</dev/urandom tr -dc _A-Z-a-z-0-9 | head -c8)
|
||||
srvID=${PWD##*/}
|
||||
dbID=server_${srvID}
|
||||
|
||||
# sed -i "s/dayz_dayzmod/${dbID}/g" 1.9.0_fresh.sql
|
||||
|
||||
sed -i "s/Host = .*/Host = mysql.iaregamer.com/g" cfg/hiveext.ini
|
||||
sed -i "s/Database = .*/Database = ${dbID}/g" cfg/hiveext.ini
|
||||
sed -i "s/Username = .*/Username = ${dbID}/g" cfg/hiveext.ini
|
||||
sed -i "s/Password = .*/Password = ${dbPass}/g" cfg/hiveext.ini
|
||||
|
||||
mysql -uremoteuser -pPkloyn7yvpht! -hmysql.iaregamer.com -e "CREATE DATABASE IF NOT EXISTS ${dbID}"
|
||||
mysql -uremoteuser -pPkloyn7yvpht! -hmysql.iaregamer.com -e "GRANT ALL ON ${dbID}.* TO '${dbID}'@'localhost' IDENTIFIED BY '${dbPass}'"
|
||||
mysql -uremoteuser -pPkloyn7yvpht! -hmysql.iaregamer.com -e "GRANT ALL ON ${dbID}.* TO 'dayzhivemind'@'%' IDENTIFIED BY 'Pkloyn7yvpht!'"
|
||||
mysql -uremoteuser -pPkloyn7yvpht! -hmysql.iaregamer.com -e "GRANT ALL ON ${dbID}.* TO '${dbID}'@'%' IDENTIFIED BY '${dbPass}'"
|
||||
mysql -uremoteuser -pPkloyn7yvpht! -hmysql.iaregamer.com -e "FLUSH PRIVILEGES;"
|
||||
mysql -uremoteuser -pPkloyn7yvpht! -hmysql.iaregamer.com -D ${dbID} < 1.9.0_fresh.sql
|
||||
|
||||
mysql -uremoteuser -pPkloyn7yvpht! -hmysql.iaregamer.com -e "DELETE FROM panel.ogp_mysql_databases WHERE db_user = '${dbID}'"
|
||||
mysql -uremoteuser -pPkloyn7yvpht! -hmysql.iaregamer.com -e "INSERT INTO panel.ogp_mysql_databases(mysql_server_id, home_id, db_user, db_passwd, db_name, enabled) VALUES (1,${srvID},'${dbID}','${dbPass}','${dbID}',1)"
|
||||
|
||||
# Create alsoRun.bat -----------------------------------
|
||||
|
||||
printf '%s\r\n' \
|
||||
'@echo off' \
|
||||
|
|
|
|||
|
|
@ -55,12 +55,12 @@ function mods($dbname) {
|
|||
}
|
||||
|
||||
function dbConnect($dbname){
|
||||
$servername = "localhost";
|
||||
$username = "localuser";
|
||||
$password = "Pkloyn7yvpht!";
|
||||
// Create connection
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
if (!$conn) {die("Connection failed: " . mysqli_connect_error());}
|
||||
$config = __DIR__ . '/../../includes/config.inc.php';
|
||||
if (!file_exists($config)) { die("Database configuration not found."); }
|
||||
require_once $config; // sets $db_host, $db_user, $db_pass
|
||||
// Create connection — $dbname parameter overrides the DB name from config
|
||||
$conn = new mysqli($db_host, $db_user, $db_pass, $dbname);
|
||||
if (!$conn) { die("Connection failed: " . mysqli_connect_error()); }
|
||||
return $conn;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,11 @@ function exec_ogp_module()
|
|||
"use_authorized_hosts" => $_REQUEST['use_authorized_hosts'],
|
||||
"allow_setting_cpu_affinity" => $_REQUEST['allow_setting_cpu_affinity'],
|
||||
"regex_invalid_file_name_chars" => addslashes($_REQUEST['regex_invalid_file_name_chars']),
|
||||
"login_ban_time" => $_REQUEST['login_ban_time']
|
||||
"login_ban_time" => $_REQUEST['login_ban_time'],
|
||||
// Discord Integration
|
||||
"discord_invite_url" => $_REQUEST['discord_invite_url'],
|
||||
"discord_webhook_main" => $_REQUEST['discord_webhook_main'],
|
||||
"discord_webhook_admin" => $_REQUEST['discord_webhook_admin']
|
||||
);
|
||||
|
||||
$db->setSettings($settings);
|
||||
|
|
@ -192,6 +196,11 @@ function exec_ogp_module()
|
|||
// Add regex setting for file manager
|
||||
$ft->add_field('string','regex_invalid_file_name_chars',(@empty($row['regex_invalid_file_name_chars']) ? htmlentities('/[\^\$\*\+\?\(\)\[\{\\\\\\|\]!@#%&=~`,\\\'<>"}\s]/i', ENT_COMPAT | ENT_HTML401 | ENT_QUOTES) : htmlentities(@$row['regex_invalid_file_name_chars'], ENT_COMPAT | ENT_HTML401 | ENT_QUOTES)));
|
||||
|
||||
// Discord Integration
|
||||
$ft->add_field('string','discord_invite_url',@$row['discord_invite_url']);
|
||||
$ft->add_field('string','discord_webhook_main',@$row['discord_webhook_main']);
|
||||
$ft->add_field('string','discord_webhook_admin',@$row['discord_webhook_admin']);
|
||||
|
||||
// Add option to reset game server order to default
|
||||
$ft->add_field('checkbox','reset_game_server_order','0');
|
||||
|
||||
|
|
|
|||
|
|
@ -47,17 +47,16 @@ function exec_ogp_module() {
|
|||
$db->logger( "TICKET SUBMITTED by " . $_SESSION['user_id']);
|
||||
|
||||
|
||||
// URL FROM DISCORD WEBHOOK SETUP
|
||||
$webhook = "https://discordapp.com/api/webhooks/710275918274363412/g5Tr-EUdEnLfFryOlscxJ6FuPiSJuE6EMKRYmh9UGMiqTUxU5-y9CQrBlDJW7znr0Tol";
|
||||
$msg = json_decode('
|
||||
{
|
||||
"username":"I Are Gamer",
|
||||
"content":"SUPPORT TICKET CREATED: Login with the userid and password http://privateemail.com"
|
||||
|
||||
// Post to Discord support webhook (configured in Admin > Settings)
|
||||
$webhook = !empty($settings['discord_webhook_main']) ? $settings['discord_webhook_main'] : '';
|
||||
if (!empty($webhook)) {
|
||||
$panel_name = !empty($settings['panel_name']) ? $settings['panel_name'] : 'GSP';
|
||||
$msg = array(
|
||||
'username' => $panel_name,
|
||||
'content' => 'SUPPORT TICKET: [' . htmlspecialchars($subject, ENT_QUOTES) . '] from ' . htmlspecialchars($_SESSION['users_login'] ?? '', ENT_QUOTES),
|
||||
);
|
||||
discordmsg($msg, $webhook);
|
||||
}
|
||||
', true);
|
||||
|
||||
discordmsg($msg, $webhook);
|
||||
//end discord
|
||||
|
||||
$content = get_lang_f('support_email_content', $user['users_login'], $email, $gameserver, $message);
|
||||
|
|
@ -72,7 +71,20 @@ discordmsg($msg, $webhook);
|
|||
<?php
|
||||
}
|
||||
} // End else
|
||||
echo '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha512-DTOQO9RWCH3ppGqcWaEA1BIZOC6xxalwEsw9c2QQeAIftl+Vegovlnee1c9QX4TctnWMn13TZye+giMm8e2LwA==" crossorigin="anonymous" referrerpolicy="no-referrer" />';
|
||||
echo "<h2>".get_lang('support')."</h2>";
|
||||
echo '
|
||||
<div style="background:#5865F2;border-radius:8px;padding:14px 20px;margin:0 auto 20px auto;max-width:600px;display:flex;align-items:center;gap:16px;box-shadow:0 2px 8px rgba(0,0,0,0.18);">
|
||||
<i class="fa-brands fa-discord" style="font-size:2.4em;color:#fff;flex-shrink:0;"></i>
|
||||
<div style="flex:1;">
|
||||
<div style="color:#fff;font-size:1.1em;font-weight:bold;margin-bottom:4px;">Need help faster?</div>
|
||||
<div style="color:#dde0ff;font-size:0.95em;">Join our Discord server and post in the support channel for quick assistance from our team and community.</div>
|
||||
</div>
|
||||
<a href="' . (!empty($settings['discord_invite_url']) ? htmlspecialchars($settings['discord_invite_url'], ENT_QUOTES) : 'https://discord.com') . '" target="_blank"
|
||||
style="background:#fff;color:#5865F2;font-weight:bold;padding:8px 18px;border-radius:6px;text-decoration:none;white-space:nowrap;font-size:0.97em;flex-shrink:0;">
|
||||
<i class="fa-brands fa-discord"></i> Join Discord
|
||||
</a>
|
||||
</div>';
|
||||
echo '<center><form class="contactForm" name="contactForm" action="" method="post"><p style="font-size:12px;text-align:center;">'.get_lang('please_describe_your_issue_below').'</p>';
|
||||
echo get_lang('select_server').":<br /><select name='gameserver' id='gameserver'>";
|
||||
foreach ((array)$server_homes as $server_home)
|
||||
|
|
|
|||
|
|
@ -2,17 +2,12 @@
|
|||
// stats_aggregate.php — call: ?machine=HOSTNAME_OR_ID[&format=html]
|
||||
|
||||
/********** CONFIG (panel DB) **********/
|
||||
$db = [
|
||||
'host' => 'localhost',
|
||||
'user' => 'localuser',
|
||||
'pass' => 'Pkloyn7yvpht!',
|
||||
'name' => 'panel'
|
||||
];
|
||||
$TABLE_PREFIX = 'gsp_';
|
||||
require_once __DIR__ . '/includes/config.inc.php'; // sets $db_host, $db_user, $db_pass, $db_name, $table_prefix
|
||||
$TABLE_PREFIX = $table_prefix ?? 'gsp_';
|
||||
$AUTO_REFRESH_SECONDS = 30; // set 0 to disable auto-refresh
|
||||
/***************************************/
|
||||
|
||||
$mysqli = @new mysqli($db['host'], $db['user'], $db['pass'], $db['name']);
|
||||
$mysqli = @new mysqli($db_host, $db_user, $db_pass, $db_name);
|
||||
if ($mysqli->connect_errno) {
|
||||
http_response_code(500);
|
||||
echo "<pre>DB connect failed: " . htmlspecialchars($mysqli->connect_error) . "</pre>";
|
||||
|
|
|
|||
24
status/api/config.php.example
Normal file
24
status/api/config.php.example
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
// Copy this file to config.php and fill in real values.
|
||||
// config.php is git-ignored — never commit the real copy.
|
||||
return [
|
||||
// SQLite DB (auto-created)
|
||||
'db_path' => __DIR__ . '/../status.sqlite',
|
||||
|
||||
// Shared secret the machines use when POSTing
|
||||
'ingest_token' => 'CHANGE_ME_LONG_RANDOM_HEX',
|
||||
|
||||
// Set if you want Discord alerts (or leave empty to disable)
|
||||
'discord_webhook' => '',
|
||||
|
||||
// Host considered UP if last sample newer than this many seconds
|
||||
'up_grace_seconds' => 10*60, // 10 minutes
|
||||
|
||||
// Alert rules (machine DOWN when no sample for 3 intervals @5min)
|
||||
'down_consecutive_threshold' => 3, // 3 missed = DOWN alert
|
||||
'network_issue_failures' => 2, // 2 fails in last window => NETWORK ISSUE
|
||||
'network_issue_window' => 20, // last 20 intervals (~100 minutes)
|
||||
|
||||
// CORS for summary API (public site pulls from panel). Adjust to your domain or leave '' to disable CORS.
|
||||
'cors_allow_origin' => '',
|
||||
];
|
||||
|
|
@ -11,18 +11,13 @@ require_once __DIR__.'/includes/lib_remote.php'; // OGPRemoteLibrary
|
|||
require_once __DIR__.'/includes/classes/db.php'; // $db
|
||||
|
||||
/* ========== CONFIG ========== */
|
||||
$PUBLIC_TOKEN = 'CHANGE_ME_LONG_RANDOM'; // set a random token and pass ?token=... from the website
|
||||
$CACHE_TTL = 30; // seconds
|
||||
$LOCATION_MAP = [ // optional: map hostnames/IPs to friendly names
|
||||
'nyc.iaregamer.com' => 'NYC',
|
||||
'kc.iaregamer.com' => 'KC',
|
||||
'kc2.iaregamer.com' => 'KC2',
|
||||
'la.iaregamer.com' => 'LA',
|
||||
'france.iaregamer.com' => 'France',
|
||||
'ireland.iaregamer.com' => 'Ireland',
|
||||
'atl.iaregamer.com' => 'Atlanta',
|
||||
'lab.iaregamer.com' => 'Lab',
|
||||
];
|
||||
$PUBLIC_TOKEN = 'CHANGE_ME_LONG_RANDOM'; // overridden in status_api_local.php
|
||||
$CACHE_TTL = 30; // seconds
|
||||
$LOCATION_MAP = []; // hostname => friendly name; overridden in status_api_local.php
|
||||
// Load site-specific token + location map — this file is git-ignored (copy from status_api_local.php.example)
|
||||
$_local_cfg = __DIR__ . '/status_api_local.php';
|
||||
if (file_exists($_local_cfg)) { require $_local_cfg; }
|
||||
unset($_local_cfg);
|
||||
/* ============================ */
|
||||
|
||||
if (!isset($_GET['token']) || $_GET['token'] !== $PUBLIC_TOKEN) {
|
||||
|
|
|
|||
12
status_api_local.php.example
Normal file
12
status_api_local.php.example
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
// Copy this file to status_api_local.php and fill in real values.
|
||||
// status_api_local.php is git-ignored — never commit the real copy.
|
||||
|
||||
// A long random string; pass as ?token=... from the website
|
||||
$PUBLIC_TOKEN = 'CHANGE_ME_LONG_RANDOM_STRING';
|
||||
|
||||
// Optional: map OGP agent hostnames/IPs to friendly location names
|
||||
$LOCATION_MAP = [
|
||||
'agent1.example.com' => 'Location 1',
|
||||
'agent2.example.com' => 'Location 2',
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue