2025-07-10 20:01:56 +03:00
<? php
include 'session.php' ;
include 'functions.php' ;
if ( checkPermissions ()) {
} else {
goHome ();
}
if ( isset ( CoreUtilities :: $rRequest [ 'id' ]) && ( $rServerArr = $rProxyServers [ CoreUtilities :: $rRequest [ 'id' ]] || $rServerArr [ 'server_type' ] != 1 )) {
} else {
goHome ();
}
$rCountries = array ( array ( 'id' => 'ALL' , 'name' => 'All Countries' ), array ( 'id' => 'A1' , 'name' => 'Anonymous Proxy' ), array ( 'id' => 'A2' , 'name' => 'Satellite Provider' ), array ( 'id' => 'O1' , 'name' => 'Other Country' ), array ( 'id' => 'AF' , 'name' => 'Afghanistan' ), array ( 'id' => 'AX' , 'name' => 'Aland Islands' ), array ( 'id' => 'AL' , 'name' => 'Albania' ), array ( 'id' => 'DZ' , 'name' => 'Algeria' ), array ( 'id' => 'AS' , 'name' => 'American Samoa' ), array ( 'id' => 'AD' , 'name' => 'Andorra' ), array ( 'id' => 'AO' , 'name' => 'Angola' ), array ( 'id' => 'AI' , 'name' => 'Anguilla' ), array ( 'id' => 'AQ' , 'name' => 'Antarctica' ), array ( 'id' => 'AG' , 'name' => 'Antigua And Barbuda' ), array ( 'id' => 'AR' , 'name' => 'Argentina' ), array ( 'id' => 'AM' , 'name' => 'Armenia' ), array ( 'id' => 'AW' , 'name' => 'Aruba' ), array ( 'id' => 'AU' , 'name' => 'Australia' ), array ( 'id' => 'AT' , 'name' => 'Austria' ), array ( 'id' => 'AZ' , 'name' => 'Azerbaijan' ), array ( 'id' => 'BS' , 'name' => 'Bahamas' ), array ( 'id' => 'BH' , 'name' => 'Bahrain' ), array ( 'id' => 'BD' , 'name' => 'Bangladesh' ), array ( 'id' => 'BB' , 'name' => 'Barbados' ), array ( 'id' => 'BY' , 'name' => 'Belarus' ), array ( 'id' => 'BE' , 'name' => 'Belgium' ), array ( 'id' => 'BZ' , 'name' => 'Belize' ), array ( 'id' => 'BJ' , 'name' => 'Benin' ), array ( 'id' => 'BM' , 'name' => 'Bermuda' ), array ( 'id' => 'BT' , 'name' => 'Bhutan' ), array ( 'id' => 'BO' , 'name' => 'Bolivia' ), array ( 'id' => 'BA' , 'name' => 'Bosnia And Herzegovina' ), array ( 'id' => 'BW' , 'name' => 'Botswana' ), array ( 'id' => 'BV' , 'name' => 'Bouvet Island' ), array ( 'id' => 'BR' , 'name' => 'Brazil' ), array ( 'id' => 'IO' , 'name' => 'British Indian Ocean Territory' ), array ( 'id' => 'BN' , 'name' => 'Brunei Darussalam' ), array ( 'id' => 'BG' , 'name' => 'Bulgaria' ), array ( 'id' => 'BF' , 'name' => 'Burkina Faso' ), array ( 'id' => 'BI' , 'name' => 'Burundi' ), array ( 'id' => 'KH' , 'name' => 'Cambodia' ), array ( 'id' => 'CM' , 'name' => 'Cameroon' ), array ( 'id' => 'CA' , 'name' => 'Canada' ), array ( 'id' => 'CV' , 'name' => 'Cape Verde' ), array ( 'id' => 'KY' , 'name' => 'Cayman Islands' ), array ( 'id' => 'CF' , 'name' => 'Central African Republic' ), array ( 'id' => 'TD' , 'name' => 'Chad' ), array ( 'id' => 'CL' , 'name' => 'Chile' ), array ( 'id' => 'CN' , 'name' => 'China' ), array ( 'id' => 'CX' , 'name' => 'Christmas Island' ), array ( 'id' => 'CC' , 'name' => 'Cocos (Keeling) Islands' ), array ( 'id' => 'CO' , 'name' => 'Colombia' ), array ( 'id' => 'KM' , 'name' => 'Comoros' ), array ( 'id' => 'CG' , 'name' => 'Congo' ), array ( 'id' => 'CD' , 'name' => 'Congo, Democratic Republic' ), array ( 'id' => 'CK' , 'name' => 'Cook Islands' ), array ( 'id' => 'CR' , 'name' => 'Costa Rica' ), array ( 'id' => 'CI' , 'name' => "Cote D'Ivoire" ), array ( 'id' => 'HR' , 'name' => 'Croatia' ), array ( 'id' => 'CU' , 'name' => 'Cuba' ), array ( 'id' => 'CY' , 'name' => 'Cyprus' ), array ( 'id' => 'CZ' , 'name' => 'Czech Republic' ), array ( 'id' => 'DK' , 'name' => 'Denmark' ), array ( 'id' => 'DJ' , 'name' => 'Djibouti' ), array ( 'id' => 'DM' , 'name' => 'Dominica' ), array ( 'id' => 'DO' , 'name' => 'Dominican Republic' ), array ( 'id' => 'EC' , 'name' => 'Ecuador' ), array ( 'id' => 'EG' , 'name' => 'Egypt' ), array ( 'id' => 'SV' , 'name' => 'El Salvador' ), array ( 'id' => 'GQ' , 'name' => 'Equatorial Guinea' ), array ( 'id' => 'ER' , 'name' => 'Eritrea' ), array ( 'id' => 'EE' , 'name' => 'Estonia' ), array ( 'id' => 'ET' , 'name' => 'Ethiopia' ), array ( 'id' => 'FK' , 'name' => 'Falkland Islands (Malvinas)' ), array ( 'id' => 'FO' , 'name' => 'Faroe Islands' ), array ( 'id' => 'FJ' , 'name' => 'Fiji' ), array ( 'id' => 'FI' , 'name' => 'Finland' ), array ( 'id' => 'FR' , 'name' => 'France' ), array ( 'id' => 'GF' , 'name' => 'French Guiana' ), array ( 'id' => 'PF' , 'name' => 'French Polynesia' ), array ( 'id' => 'TF' , 'name' => 'French Southern Territories' ), array ( 'id' => 'MK' , 'name' => 'Fyrom' ), array ( 'id' => 'GA' , 'name' => 'Gabon' ), array ( 'id' => 'GM' , 'name' => 'Gambia' ), array ( 'id' => 'GE' , 'name' => 'Georgia' ), array ( 'id' => 'DE' , 'name' => 'Germany' ), array ( 'id' => 'GH' , 'name' => 'Ghana' ), array ( 'id' => 'GI' , 'name' => 'Gibraltar' ), array ( 'id' => 'GR' , 'name' => 'Greece' ), array ( 'id' => 'GL' , 'name' => 'Greenland' ), array (
$_TITLE = 'Edit Proxy' ;
include 'header.php' ; ?>
<div class="wrapper boxed-layout" <?php if (empty($_SERVER['HTTP_X_REQUESTED_WITH']) || strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') {
} else {
echo ' style="display: none;"';
} ?>>
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<?php include 'topbar.php'; ?>
</div>
<h4 class="page-title">Edit Proxy</h4>
</div>
</div>
</div>
<div class="row">
<div class="col-xl-12">
<div class="card">
<div class="card-body">
<form action="#" method="POST" data-parsley-validate="">
<input type="hidden" name="edit" value="<?php echo $rServerArr['id']; ?>" />
<div id="basicwizard">
<ul class="nav nav-pills bg-light nav-justified form-wizard-header mb-4">
<li class="nav-item">
<a href="#server-details" data-toggle="tab" class="nav-link rounded-0 pt-2 pb-2">
<i class="mdi mdi-account-card-details-outline mr-1"></i>
<span class="d-none d-sm-inline">Details</span>
</a>
</li>
<li class="nav-item">
<a href="#additional_ips" data-toggle="tab" class="nav-link rounded-0 pt-2 pb-2">
<i class="mdi mdi-web"></i>
<span class="d-none d-sm-inline">Domains & IP's</span>
</a>
</li>
<li class="nav-item">
<a href="#advanced-options" data-toggle="tab" class="nav-link rounded-0 pt-2 pb-2">
<i class="mdi mdi-folder-alert-outline mr-1"></i>
<span class="d-none d-sm-inline">Advanced</span>
</a>
</li>
</ul>
<div class="tab-content b-0 mb-0 pt-0">
<div class="tab-pane" id="server-details">
<div class="row">
<div class="col-12">
<div class="form-group row mb-4">
<label class="col-md-4 col-form-label" for="server_name">Server Name</label>
<div class="col-md-8">
<input type="text" class="form-control" id="server_name" name="server_name" value="<?php echo htmlspecialchars($rServerArr['server_name']); ?>" required data-parsley-trigger="change">
</div>
</div>
<div class="form-group row mb-4">
<label class="col-md-4 col-form-label" for="server_ip">Server IP <i title="This IP will be used for internal connections as well as broadcast if no domains are allocated." class="tooltip text-secondary far fa-circle"></i></label>
<div class="col-md-8">
<input type="text" class="form-control" id="server_ip" name="server_ip" value="<?php echo htmlspecialchars($rServerArr['server_ip']); ?>" required data-parsley-trigger="change">
</div>
</div>
<div class="form-group row mb-4">
<label class="col-md-4 col-form-label" for="total_clients">Max Clients <i title="Maximum number of simultaneous connections to allow on this server." class="tooltip text-secondary far fa-circle"></i></label>
<div class="col-md-2">
<input type="text" class="form-control text-center" id="total_clients" name="total_clients" value="<?php echo htmlspecialchars($rServerArr['total_clients']); ?>" required data-parsley-trigger="change">
</div>
<label class="col-md-4 col-form-label" for="enabled">Enabled <i title="Utilise this server for connections and streams." class="tooltip text-secondary far fa-circle"></i></label>
<div class="col-md-2">
<input name="enabled" id="enabled" type="checkbox" <?php if ($rServerArr['enabled'] == 1) {
echo 'checked ';
} ?>data-plugin="switchery" class="js-switch" data-color="#039cfd" />
</div>
</div>
</div>
</div>
<ul class="list-inline wizard mb-0">
<li class="nextb list-inline-item float-right">
<a href="javascript: void(0);" class="btn btn-secondary">Next</a>
</li>
</ul>
</div>
<div class="tab-pane" id="additional_ips">
<div class="row">
<div class="col-12">
<div class="alert alert-info alert-dismissible fade show" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
By default, clients will be directed to the Server IP on the Details tab. You can add IP's or Domain Names here to force clients to be directed to those instead. If random IP / domain is selected, each client will be directed to a random entry in the list, otherwise the first entry in the list will be used to serve content.
</div>
<div class="form-group row mb-4">
<label class="col-md-4 col-form-label" for="ip_field">Domains & IP's</label>
<div class="col-md-8 input-group">
<input type="text" id="ip_field" class="form-control" value="">
<div class="input-group-append">
<a href="javascript:void(0)" id="add_ip" class="btn btn-primary waves-effect waves-light"><i class="mdi mdi-plus"></i></a>
</div>
</div>
</div>
<div class="form-group row mb-4">
<label class="col-md-4 col-form-label" for="domain_name"> </label>
<div class="col-md-8">
<select id="domain_name" name="domain_name[]" size=6 class="form-control" multiple="multiple">
<?php foreach (explode(',', $rServerArr['domain_name']) as $rIP) {
if (strlen($rIP) > 0) { ?>
<option value="<?= $rIP; ?>"><?= $rIP; ?></option>
<?php }
} ?>
</select>
</div>
</div>
<div class="form-group row mb-4">
<label class="col-md-4 col-form-label" for="random_ip">Serve Random IP / Domain</label>
<div class="col-md-2">
<input name="random_ip" id="random_ip" type="checkbox" <?php if ($rServerArr['random_ip'] == 1) {
echo 'checked ';
} ?>data-plugin="switchery" class="js-switch" data-color="#039cfd" />
</div>
<div class="col-md-6" align="right">
<ul class="list-inline wizard mb-0">
<li class="list-inline-item">
<a href="javascript: void(0);" onClick="MoveUp()" class="btn btn-secondary"><i class="mdi mdi-chevron-up"></i></a>
<a href="javascript: void(0);" onClick="MoveDown()" class="btn btn-secondary"><i class="mdi mdi-chevron-down"></i></a>
<a href="javascript: void(0)" id="remove_ip" class="btn btn-danger waves-effect waves-light"><i class="mdi mdi-close"></i></a>
</li>
</ul>
</div>
</div>
</div>
</div>
<ul class="list-inline wizard mb-0">
<li class="prevb list-inline-item">
<a href="javascript: void(0);" class="btn btn-secondary">Previous</a>
</li>
<li class="nextb list-inline-item float-right">
<a href="javascript: void(0);" class="btn btn-secondary">Next</a>
</li>
</ul>
</div>
<div class="tab-pane" id="advanced-options">
<div class="row">
<div class="col-12">
<div class="form-group row mb-4">
<label class="col-md-4 col-form-label" for="http_broadcast_port">HTTP Port <i title="Modifying this will not change the port on the proxy end, you would need to do this manually." class="tooltip text-secondary far fa-circle"></i></label>
<div class="col-md-2">
<input type="text" class="form-control text-center" id="http_broadcast_port" name="http_broadcast_port" value="<?= htmlspecialchars($rServerArr['http_broadcast_port']); ?>" required data-parsley-trigger="change">
</div>
<label class="col-md-4 col-form-label" for="https_broadcast_port">HTTPS Ports <i title="Modifying this will not change the port on the proxy end, you would need to do this manually." class="tooltip text-secondary far fa-circle"></i></label>
<div class="col-md-2">
<input type="text" class="form-control text-center" id="https_broadcast_port" name="https_broadcast_port" value="<?= htmlspecialchars($rServerArr['https_broadcast_port']); ?>" required data-parsley-trigger="change">
</div>
</div>
<div class="form-group row mb-4">
<label class="col-md-4 col-form-label" for="network_guaranteed_speed">Network Speed - Mbps <i title="Port speed to consider when connecting clients." class="tooltip text-secondary far fa-circle"></i></label>
<div class="col-md-2">
<input type="text" class="form-control text-center" id="network_guaranteed_speed" name="network_guaranteed_speed" value="<?= htmlspecialchars($rServerArr['network_guaranteed_speed']); ?>" required data-parsley-trigger="change">
</div>
<label class="col-md-4 col-form-label" for="enable_https">Enable SSL <i title="Allow HTTPS connections. You will have to configure this on the server manually." class="tooltip text-secondary far fa-circle"></i></label>
<div class="col-md-2">
<input name="enable_https" id="enable_https" type="checkbox" <?php if ($rServerArr['enable_https'] == 1) {
echo 'checked ';
} ?>data-plugin="switchery" class="js-switch" data-color="#039cfd" />
</div>
</div>
<div class="form-group row mb-4">
<label class="col-md-4 col-form-label" for="enable_geoip">GeoIP Load Balancing <i title="Route connections to the nearest server based on the location of the client." class="tooltip text-secondary far fa-circle"></i></label>
<div class="col-md-2">
<input name="enable_geoip" id="enable_geoip" type="checkbox" <?php if ($rServerArr['enable_geoip'] == 1) {
echo 'checked ';
} ?>data-plugin="switchery" class="js-switch" data-color="#039cfd" />
</div>
<div class="col-md-6">
<select name="geoip_type" id="geoip_type" class="form-control select2" data-toggle="select2">
<?php foreach (array('high_priority' => 'High Priority', 'low_priority' => 'Low Priority', 'strict' => 'Strict') as $rType => $rText) { ?>
<option value="<?= $rType; ?>" <?php if ($rServerArr['geoip_type'] == $rType) {
echo 'selected';
} ?>><?= $rText; ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="form-group row mb-4">
<label class="col-md-4 col-form-label" for="geoip_countries">GeoIP Countries <i title="Select which countries should be prioritised to this server." class="tooltip text-secondary far fa-circle"></i></label>
<div class="col-md-8">
<select name="geoip_countries[]" id="geoip_countries" class="form-control select2 select2-multiple" data-toggle="select2" multiple="multiple" data-placeholder="Choose...">
<?php $rSelected = json_decode($rServerArr['geoip_countries'], true);
foreach ($rCountries as $rCountry) { ?>
<option value="<?= $rCountry['id']; ?>" <?php if (in_array($rCountry['id'], $rSelected)) {
echo 'selected';
} ?>><?= $rCountry['name']; ?></option>
<?php } ?>
</select>
</div>
</div>
</div>
</div>
<ul class="list-inline wizard mb-0">
<li class="prevb list-inline-item">
<a href="javascript: void(0);" class="btn btn-secondary"></a>
</li>
<li class="nextb list-inline-item float-right">
<input name="submit_server" id="submit_button" type="submit" class="btn btn-primary" value="Save" />
</li>
</ul>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
2025-08-28 21:24:03 +03:00
<?php include 'footer.php'; ?>
<script id="scripts">
<?php
echo ' ' . "\r\n\t\t" . 'function MoveUp() {' . "\r\n\t\t\t" . "var rSelected = \$('#domain_name option:selected');" . "\r\n\t\t\t" . 'if (rSelected.length) {' . "\r\n\t\t\t\t" . 'var rPrevious = rSelected.first().prev()[0];' . "\r\n\t\t\t\t" . "if (\$(rPrevious).html() != '') {" . "\r\n\t\t\t\t\t" . 'rSelected.first().prev().before(rSelected);' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '}' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function MoveDown() {' . "\r\n\t\t\t" . "var rSelected = \$('#domain_name option:selected');" . "\r\n\t\t\t" . 'if (rSelected.length) {' . "\r\n\t\t\t\t" . 'rSelected.last().next().after(rSelected);' . "\r\n\t\t\t" . '}' . "\r\n\t\t" . '}' . "\r\n\t\t" . '$(document).ready(function() {' . "\r\n\t\t\t" . "\$('.select2').select2({width: '100%'})" . "\r\n\t\t\t" . '$("#add_ip").click(function() {' . "\r\n\t\t\t\t" . 'if (($("#ip_field").val()) && ((isValidIP($("#ip_field").val())) || (isValidDomain($("#ip_field").val())))) {' . "\r\n\t\t\t\t\t" . 'var o = new Option($("#ip_field").val(), $("#ip_field").val());' . "\r\n\t\t\t\t\t" . '$("#domain_name").append(o);' . "\r\n\t\t\t\t\t" . '$("#ip_field").val("");' . "\r\n\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t" . '$.toast("Please enter a valid IP address or domain name.");' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#remove_ip").click(function() {' . "\r\n\t\t\t\t" . "\$('#domain_name option:selected').remove();" . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#total_clients").inputFilter(function(value) { return /^\\d*$/.test(value); });' . "\r\n\t\t\t" . '$("#http_broadcast_port").inputFilter(function(value) { return /^\\d*$/.test(value) && (value === "" || parseInt(value) <= 65535); });' . "\r\n" . ' $("#https_broadcast_port").inputFilter(function(value) { return /^\\d*$/.test(value) && (value === "" || parseInt(value) <= 65535); });' . "\r\n" . ' $("#network_guaranteed_speed").inputFilter(function(value) { return /^\\d*$/.test(value); });' . "\r\n" . ' $("form").submit(function(e){' . "\r\n" . ' e.preventDefault();' . "\r\n\t\t\t\t" . "\$(\"#domain_name option\").prop('selected', true);" . "\r\n" . " \$(':input[type=\"submit\"]').prop('disabled', true);" . "\r\n" . ' submitForm(window.rCurrentPage, new FormData($("form")[0]));' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t";
?>
</script>
<script src="assets/js/listings.js"></script>
</body>
</html>