<?php
$mysqli = new mysqli("", "", "", "");
$mysqli->query("SET NAMES 'utf8'");
if (mysqli_connect_errno()) {
echo json_encode(array('mysqli' => 'Failed to connect to MySQL: ' . mysqli_connect_error()));
exit;
}
$resultDir = 'result/';
$main_ip = '192.168.0.1';
$proxy_ip = array(
'comp-1' => '192.168.2.54',
'comp-2' => '192.168.2.247',
'comp-3' => '192.168.2.94',
'comp-4' => '192.168.2.99',
'comp-5' => '192.168.2.172',
'comp-6' => '192.168.2.91'
);
$num = [
'7304',
'7299',
'7335',
'72558',
'75257',
'540',
'48'
];
$clients = [
'tickets' => '300.192.1.156'
];
ob_start();
head();
reg();
proxy();
client();
sip();
o_sip(0);
oper_sip();
footer();
$main_config = ob_get_contents();
ob_clean();
file_put_contents("$resultDir/config_main.conf", $main_config);
echo "Конфиг для сервера готов!<br>";
$count = 1;
foreach ($proxy_ip AS $name => $ip) {
ob_start();
proxy_header();
o_sip($count);
$proxy_config = ob_get_contents();
ob_clean();
file_put_contents("$resultDir/$name.conf", $proxy_config);
echo "Конфиг для $name готов!<br>";
$count++;
}
function head() {
echo '[general]
много сторок в формате
ключ=значение
ключ=значени
';
}
function beeline_reg() {
global $sims;
foreach ($sims as $sim) {
echo "create=>$sim@19.11\n";
}
}
function trank_proxy() {
global $proxy_ip;
foreach ($proxy_ip as $name => $ip) {
echo "
[$name]
host=$ip
итд
";
}
}
....
много сторок в формате
ключ=$IP$
ключ=$PROXY$
[$name]
<?php if ($ip): ?>
host= <?= $ip ?>
<?php endif ?>
<?php foreach ($proxies as $proxy): ?>
proxy= <?= $proxy ?>
<?php endforeach ?>
итд