Phase 1: Update database configuration and schema (OGP to GSP)
Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
parent
ea665c34d5
commit
7f19731158
82 changed files with 730 additions and 730 deletions
24
index.php
24
index.php
|
|
@ -42,7 +42,7 @@ $db = createDatabaseConnection($db_type, $db_host, $db_user, $db_pass, $db_name,
|
|||
// Load languages.
|
||||
include_once("includes/lang.php");
|
||||
|
||||
if (!$db instanceof OGPDatabase) {
|
||||
if (!$db instanceof GSPDatabase) {
|
||||
ogpLang();
|
||||
die(get_lang('no_db_connection'));
|
||||
}
|
||||
|
|
@ -216,10 +216,10 @@ function ogpHome()
|
|||
{
|
||||
$client_ip = getClientIPAddress();
|
||||
|
||||
$ban_list = $db->resultQuery("SHOW TABLES LIKE 'OGP_DB_PREFIXban_list';");
|
||||
$ban_list = $db->resultQuery("SHOW TABLES LIKE 'GSP_DB_PREFIXban_list';");
|
||||
if ( empty( $ban_list ) )
|
||||
{
|
||||
$db->query("CREATE TABLE IF NOT EXISTS `OGP_DB_PREFIXban_list` (
|
||||
$db->query("CREATE TABLE IF NOT EXISTS `GSP_DB_PREFIXban_list` (
|
||||
`client_ip` varchar(255) NOT NULL,
|
||||
`logging_attempts` int(11) NOT NULL DEFAULT '0',
|
||||
`banned_until` varchar(16) NOT NULL DEFAULT '0',
|
||||
|
|
@ -227,12 +227,12 @@ function ogpHome()
|
|||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
||||
}
|
||||
|
||||
$banlist_info = $db->resultQuery("SELECT logging_attempts, banned_until FROM `OGP_DB_PREFIXban_list` WHERE client_ip='".$client_ip."';");
|
||||
$banlist_info = $db->resultQuery("SELECT logging_attempts, banned_until FROM `GSP_DB_PREFIXban_list` WHERE client_ip='".$client_ip."';");
|
||||
$login_attempts = !$banlist_info ? 0 : $banlist_info['0']['logging_attempts'];
|
||||
|
||||
if( $banlist_info AND $banlist_info['0']['banned_until'] > 0 AND $banlist_info['0']['banned_until'] <= time() )
|
||||
{
|
||||
$db->query("DELETE FROM `OGP_DB_PREFIXban_list` WHERE client_ip='$client_ip';");
|
||||
$db->query("DELETE FROM `GSP_DB_PREFIXban_list` WHERE client_ip='$client_ip';");
|
||||
$login_attempts = 0;
|
||||
}
|
||||
|
||||
|
|
@ -308,9 +308,9 @@ function ogpHome()
|
|||
$_SESSION['users_api_key'] = $db->getApiToken($userInfo['user_id']);
|
||||
print_success( get_lang("logging_in") ."...");
|
||||
$db->logger( get_lang("logging_in") ."...");
|
||||
$db->query("DELETE FROM `OGP_DB_PREFIXban_list` WHERE client_ip='$client_ip';");
|
||||
$db->query("DELETE FROM `GSP_DB_PREFIXban_list` WHERE client_ip='$client_ip';");
|
||||
//find number of servers user has. if zero, then redirect to the shop page.
|
||||
$result = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE user_id='".$_SESSION['user_id']."' AND status < 1 ");
|
||||
$result = $db->resultQuery("SELECT * FROM GSP_DB_PREFIXbilling_orders WHERE user_id='".$_SESSION['user_id']."' AND status < 1 ");
|
||||
$servercount = 0;
|
||||
foreach($result as $servers)
|
||||
{
|
||||
|
|
@ -341,26 +341,26 @@ function ogpHome()
|
|||
$banned_until = time() + (array_key_exists("login_ban_time" , $settings) && !empty($settings["login_ban_time"]) && is_numeric($settings["login_ban_time"]) ? $settings["login_ban_time"] : 300); // Five minutes or user defined setting.
|
||||
|
||||
if( !$banlist_info )
|
||||
$db->query("INSERT INTO `OGP_DB_PREFIXban_list` (`client_ip`) VALUES('$client_ip');");
|
||||
$db->query("INSERT INTO `GSP_DB_PREFIXban_list` (`client_ip`) VALUES('$client_ip');");
|
||||
|
||||
$db->logger( get_lang("bad_login") . " ( Banned until " . date("r", $banned_until) . " ) [ " . login . ": $_POST[ulogin], " . password . ": ******** ]" );
|
||||
$db->query("UPDATE `OGP_DB_PREFIXban_list` SET logging_attempts='$login_attempts', banned_until='$banned_until' WHERE client_ip='$client_ip';");
|
||||
$db->query("UPDATE `GSP_DB_PREFIXban_list` SET logging_attempts='$login_attempts', banned_until='$banned_until' WHERE client_ip='$client_ip';");
|
||||
print_failure("Banned until " . date("r",$banned_until));
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !$banlist_info )
|
||||
$db->query("INSERT INTO `OGP_DB_PREFIXban_list` (`client_ip`) VALUES('$client_ip');");
|
||||
$db->query("INSERT INTO `GSP_DB_PREFIXban_list` (`client_ip`) VALUES('$client_ip');");
|
||||
|
||||
$db->logger( get_lang("bad_login") . " ( $login_attempts ) [ " . login . ": $_POST[ulogin], " . password . ": ******** ]" );
|
||||
$db->query("UPDATE `OGP_DB_PREFIXban_list` SET logging_attempts='$login_attempts' WHERE client_ip='$client_ip';");
|
||||
$db->query("UPDATE `GSP_DB_PREFIXban_list` SET logging_attempts='$login_attempts' WHERE client_ip='$client_ip';");
|
||||
$view->refresh("index.php",2);
|
||||
}
|
||||
}
|
||||
//ADD USERS IN BANNED GROUP TO BAN TABLE
|
||||
if($userInfo['users_role'] == "banned")
|
||||
{
|
||||
$db->query("INSERT INTO `OGP_DB_PREFIXban_list` (`client_ip`,`logging_attempts`) VALUES('$client_ip','-1');");
|
||||
$db->query("INSERT INTO `GSP_DB_PREFIXban_list` (`client_ip`,`logging_attempts`) VALUES('$client_ip','-1');");
|
||||
$db->logger("BANNED: Added IP ".$client_ip." to ban table of banned user " . $_POST[ulogin]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue