| Server IP : 208.122.213.31 / Your IP : 216.73.216.45 Web Server : Apache System : Linux msd6191.mjhst.com 4.18.0-553.137.1.el8_10.x86_64 #1 SMP Wed Jun 24 11:40:24 UTC 2026 x86_64 User : WHMCS_MIA_382 ( 1001) PHP Version : 7.4.33 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/httpd/html/cms.classicscash.com/public_html/EmblemAVS/ |
Upload File : |
<?php
// Update to your ElevatedX cms_admin path:
define('ELXCMS_ADMIN_PATH', '/home/httpd/html/classicscash.com/htdocs/cms_admin/');
function getConfigFile( $site_id = 0 ){
$config_path = rtrim(ELXCMS_ADMIN_PATH, '/') . '/config';
$config_file = rtrim($config_path, '/') . '/config' . $site_id . '.php';
return $config_file;
}
function dbConnect( $site_id = 0 ){
require(getConfigFile($site_id));
$dbhost = $r_conf['mysql']['host'];
$dbuser = $r_conf['mysql']['user'];
$dbpass = $r_conf['mysql']['pass'];
$dbname = $r_conf['mysql']['db'];
// Create PDO connection with optimized options for speed
$dsn = "mysql:host=$dbhost;dbname=$dbname;charset=utf8mb4";
$options = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => false, // Disable buffering for speed
];
$pdo = new PDO($dsn, $dbuser, $dbpass, $options);
return $pdo;
}
function getSitesList(){
$siteslist_path = rtrim(ELXCMS_ADMIN_PATH, '/') . '/config/sitelist.php';
$sites = [];
if( file_exists($siteslist_path) ){
require($siteslist_path);
// The variable name is called $lst in sitelist.php
if( isset($lst) && is_array($lst) ){
foreach($lst as $site_id => $site){
$sites[$site_id] = '(' . 'ID: ' . $site_id . ') ' . $site['domain'];
}
}
}
return $sites;
}
function getSiteName($site_id){
$sites = getSitesList();
if( isset($sites[$site_id]) ){
return $sites[$site_id];
}
return 'Unknown Site ID';
}
function getUserTrack($site_id = 0, $username = ''){
// Connect to the database
$pdo = dbConnect( $site_id );
$sql = "SELECT * FROM usertrack WHERE LOWER(UserName) = LOWER(:username) LIMIT 1";
$stmt = $pdo->prepare($sql);
$stmt->execute(['username' => $username]);
$usertrack = $stmt->fetch();
return $usertrack;
}
function changeAVSStatus($site_id = 0, $username = '', $current_status = 0){
// Let's include the site config file to get Memcached details:
require(getConfigFile($site_id));
// Connect to the database
$pdo = dbConnect( $site_id );
// Determine new status
$new_status = ($current_status == 1) ? 0 : 1;
$sql = "UPDATE usertrack SET AVS_Verified = :new_status WHERE LOWER(UserName) = LOWER(:username)";
$stmt = $pdo->prepare($sql);
$result = $stmt->execute(['new_status' => $new_status, 'username' => $username]);
// Now that we have the clean URL, redirect the user to it, but before lets flush Memcached
if ( $r_conf['memcached']['enabled'] == "1" && class_exists('Memcached') ) {
$memcached = new Memcached();
$memcached_server = $r_conf['memcached']['serverlist'];
$exploded_memcached = explode(':', $memcached_server);
$memcached->addServer($exploded_memcached[0], $exploded_memcached[1]);
$memcached->flush();
}
return [
'success' => $result,
'new_status' => $new_status,
'rows_affected' => $stmt->rowCount()
];
}
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ELX AVS Status Override</title>
<!-- Bootstrap 5 CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card">
<div class="card-header">
<h4 class="mb-0">ELX AVS Status Override</h4>
<p>Change the AVS Verified status of a Username</p>
</div>
<div class="card-body">
<?php
$sites = getSitesList();
?>
<?php if( !isset($_POST) || empty($_POST) ){ ?>
<form method="POST" action="">
<input type="hidden" name="step" value="step2">
<!-- Site ID Dropdown -->
<div class="mb-3">
<label for="site_id" class="form-label">Site <span class="text-danger">*</span></label>
<select class="form-select" id="site_id" name="site_id" required>
<option value="">Choose a site...</option>
<?php foreach ($sites as $site_id => $site_name): ?>
<option value="<?php echo htmlspecialchars($site_id); ?>"
<?php echo (isset($_POST['site_id']) && $_POST['site_id'] == $site_id) ? 'selected' : ''; ?>>
<?php echo htmlspecialchars($site_name); ?>
</option>
<?php endforeach; ?>
</select>
<div class="form-text">Please select the site location.</div>
</div>
<!-- Username Input -->
<div class="mb-3">
<label for="username" class="form-label">Username <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="username" name="username" placeholder="Enter username" value="<?php echo isset($_POST['username']) ? htmlspecialchars($_POST['username']) : ''; ?>" required>
<div class="form-text">Enter a username you want to lookup.</div>
</div>
<!-- Submit Button -->
<div class="d-grid">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</form>
<?php } ?>
<?php if( !empty($_POST) && $_POST['step'] == 'step2' ){ ?>
<?php
// Get Usertrack details
$usertrack = getUserTrack( (int)$_POST['site_id'], trim($_POST['username']) );
?>
<form method="POST" action="">
<input type="hidden" name="step" value="step3">
<input type="hidden" name="site_id" value="<?php echo (isset($_POST['site_id']) && $_POST['site_id'] != '') ? htmlspecialchars($_POST['site_id']) : '' ?>" />
<input type="hidden" name="username" value="<?php echo (isset($_POST['username']) && !empty($_POST['username'])) ? htmlspecialchars($_POST['username']) : '' ?>" />
<?php if( !empty($usertrack) ){ ?>
<input type="hidden" name="avs_verified" value="<?php echo (int)$usertrack['AVS_Verified'] ?>" />
<?php } ?>
<!-- Site ID -->
<div class="mb-3">
<label for="site_id" class="form-label">Selected Site</label>
<input type="text" class="form-control" id="site_id" value="<?php echo (isset($_POST['site_id']) && $_POST['site_id'] != '') ? htmlspecialchars(getSiteName($_POST['site_id'])) : '' ?>" readonly disabled>
</div>
<!-- Username Input -->
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input type="text" class="form-control" id="username" value="<?php echo (isset($_POST['username']) && !empty($_POST['username'])) ? htmlspecialchars($_POST['username']) : '' ?>" readonly disabled>
</div>
<?php if( !empty($usertrack) ){ ?>
<?php
$avs_verified = $usertrack['AVS_Verified'];
?>
<div class="alert <?php echo ( $avs_verified === 1 ) ? 'alert-success' : 'alert-danger'; ?>" role="alert">
Current AVS Verified status for <strong><?php echo htmlspecialchars($usertrack['UserName']); ?></strong> is:
<strong><?php echo ($usertrack['AVS_Verified'] == 1) ? '1 (Verified)' : '0 (Not Verified)'; ?></strong>
</div>
<?php } else { ?>
<div class="alert alert-warning" role="alert">
<strong>Warning!</strong> Username <strong><?php echo htmlspecialchars($_POST['username']); ?></strong> not found in usertrack table for the selected Site ID <strong><?php echo htmlspecialchars(getSiteName($_POST['site_id'])); ?></strong>.
</div>
<?php } ?>
<!-- Submit Button -->
<div class="d-grid">
<button type="submit" class="btn btn-success mb-2">Change AVS Status</button>
<a href="EmblemAVS.Overrider.php" class="btn btn-outline-secondary">Start Over</a>
</div>
</form>
<?php } ?>
<?php if( !empty($_POST) && $_POST['step'] == 'step3' ){ ?>
<?php
// Change AVS Verified status
$avs_change_status = changeAVSStatus( (int)$_POST['site_id'], trim($_POST['username']), (int)$_POST['avs_verified'] );
// Get Usertrack details
$usertrack = getUserTrack( (int)$_POST['site_id'], trim($_POST['username']) );
?>
<form method="POST" action="">
<input type="hidden" name="step" value="step3">
<input type="hidden" name="site_id" value="<?php echo (isset($_POST['site_id']) && $_POST['site_id'] != '') ? htmlspecialchars($_POST['site_id']) : '' ?>" />
<input type="hidden" name="username" value="<?php echo (isset($_POST['username']) && !empty($_POST['username'])) ? htmlspecialchars($_POST['username']) : '' ?>" />
<input type="hidden" name="avs_verified" value="<?php echo (isset($_POST['avs_verified']) && !empty($_POST['avs_verified'])) ? htmlspecialchars($_POST['avs_verified']) : (int)$usertrack['AVS_Verified'] ?>" />
<!-- Site ID -->
<div class="mb-3">
<label for="site_id" class="form-label">Selected Site</label>
<input type="text" class="form-control" id="site_id" value="<?php echo (isset($_POST['site_id']) && $_POST['site_id'] != '') ? htmlspecialchars(getSiteName($_POST['site_id'])) : '' ?>" readonly disabled>
</div>
<!-- Username Input -->
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input type="text" class="form-control" id="username" value="<?php echo (isset($_POST['username']) && !empty($_POST['username'])) ? htmlspecialchars($_POST['username']) : '' ?>" readonly disabled>
</div>
<?php if( !empty($usertrack) ){ ?>
<?php
$avs_verified = $usertrack['AVS_Verified'];
?>
<div class="alert <?php echo ( $avs_verified === 1 ) ? 'alert-success' : 'alert-danger'; ?>" role="alert">
Current AVS Verified status for <strong><?php echo htmlspecialchars($usertrack['UserName']); ?></strong> is:
<strong><?php echo ($usertrack['AVS_Verified'] == 1) ? '1 (Verified)' : '0 (Not Verified)'; ?></strong>
</div>
<?php } else { ?>
<div class="alert alert-warning" role="alert">
<strong>Warning!</strong> Username <strong><?php echo htmlspecialchars($_POST['username']); ?></strong> not found in usertrack table for the selected Site ID <strong><?php echo htmlspecialchars(getSiteName($_POST['site_id'])); ?></strong>.
</div>
<?php } ?>
<!-- Submit Button -->
<div class="d-grid">
<a href="EmblemAVS.Overrider.php" class="btn btn-outline-secondary">Start Over</a>
</div>
</form>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
<!-- Bootstrap 5 JS Bundle -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>