mirror of
https://github.com/easy-wi/developer.git
synced 2025-02-20 11:23:28 +08:00
Partial for ticket 17
Partial for https://github.com/easy-wi/developer/issues/17
This commit is contained in:
parent
6fb4e1a6a2
commit
076205ca41
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
define('EASYWIDIR', dirname(__FILE__));
|
||||
if (is_dir(EASYWIDIR.'/install')) die('Please remove the "install" folder');
|
||||
if (is_dir(EASYWIDIR . '/install')) die('Please remove the "install" folder');
|
||||
include(EASYWIDIR . '/stuff/functions.php');
|
||||
include(EASYWIDIR . '/stuff/class_validator.php');
|
||||
include(EASYWIDIR . '/stuff/vorlage.php');
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
|
||||
define('EASYWIDIR', dirname(__FILE__));
|
||||
if (is_dir(EASYWIDIR.'/install')) die('Please remove the "install" folder');
|
||||
if (is_dir(EASYWIDIR . '/install')) die('Please remove the "install" folder');
|
||||
$logininclude=true;
|
||||
include(EASYWIDIR . '/stuff/vorlage.php');
|
||||
include(EASYWIDIR . '/stuff/class_validator.php');
|
||||
|
771
web/images.php
771
web/images.php
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* File: images.php.
|
||||
* Author: Ulrich Block
|
||||
@ -44,274 +45,280 @@ include(EASYWIDIR . '/stuff/class_validator.php');
|
||||
include(EASYWIDIR . '/stuff/vorlage.php');
|
||||
include(EASYWIDIR . '/stuff/settings.php');
|
||||
if (isset($admin_id) and $ui->st('img','get')) {
|
||||
$pa=User_Permissions($admin_id);
|
||||
if ($ui->st('img','get')=='tr' and ($pa['traffic'] or $pa['root'])) {
|
||||
$values=array();
|
||||
$query=$sql->prepare("SELECT `multiplier`,`text_colour_1`,`text_colour_2`,`text_colour_3`,`barin_colour_1`,`barin_colour_2`,`barin_colour_3`,`barout_colour_1`,`barout_colour_2`,`barout_colour_3`,`bartotal_colour_1`,`bartotal_colour_2`,`bartotal_colour_3`,`bg_colour_1`,`bg_colour_2`,`bg_colour_3`,`border_colour_1`,`border_colour_2`,`border_colour_3`,`line_colour_1`,`line_colour_2`,`line_colour_3` FROM `traffic_settings` LIMIT 1");
|
||||
$pa = User_Permissions($admin_id);
|
||||
$multiplier = 1;
|
||||
if ($ui->st('img','get') == 'tr' and ($pa['traffic'] or $pa['root'])) {
|
||||
$values = array();
|
||||
$query = $sql->prepare("SELECT `multiplier`,`text_colour_1`,`text_colour_2`,`text_colour_3`,`barin_colour_1`,`barin_colour_2`,`barin_colour_3`,`barout_colour_1`,`barout_colour_2`,`barout_colour_3`,`bartotal_colour_1`,`bartotal_colour_2`,`bartotal_colour_3`,`bg_colour_1`,`bg_colour_2`,`bg_colour_3`,`border_colour_1`,`border_colour_2`,`border_colour_3`,`line_colour_1`,`line_colour_2`,`line_colour_3` FROM `traffic_settings` LIMIT 1");
|
||||
$query->execute();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$multiplier=$row['multiplier'];
|
||||
$text_colour_1=$row['text_colour_1'];
|
||||
$text_colour_2=$row['text_colour_2'];
|
||||
$text_colour_3=$row['text_colour_3'];
|
||||
$barin_colour_1=$row['barin_colour_1'];
|
||||
$barin_colour_2=$row['barin_colour_2'];
|
||||
$barin_colour_3=$row['barin_colour_3'];
|
||||
$barout_colour_1=$row['barout_colour_1'];
|
||||
$barout_colour_2=$row['barout_colour_2'];
|
||||
$barout_colour_3=$row['barout_colour_3'];
|
||||
$bartotal_colour_1=$row['bartotal_colour_1'];
|
||||
$bartotal_colour_2=$row['bartotal_colour_2'];
|
||||
$bartotal_colour_3=$row['bartotal_colour_3'];
|
||||
$bg_colour_1=$row['bg_colour_1'];
|
||||
$bg_colour_2=$row['bg_colour_2'];
|
||||
$bg_colour_3=$row['bg_colour_3'];
|
||||
$border_colour_1=$row['border_colour_1'];
|
||||
$border_colour_2=$row['border_colour_2'];
|
||||
$border_colour_3=$row['border_colour_3'];
|
||||
$line_colour_1=$row['line_colour_1'];
|
||||
$line_colour_2=$row['line_colour_2'];
|
||||
$line_colour_3=$row['line_colour_3'];
|
||||
$text_colour_1 = $row['text_colour_1'];
|
||||
$text_colour_2 = $row['text_colour_2'];
|
||||
$text_colour_3 = $row['text_colour_3'];
|
||||
$barin_colour_1 = $row['barin_colour_1'];
|
||||
$barin_colour_2 = $row['barin_colour_2'];
|
||||
$barin_colour_3 = $row['barin_colour_3'];
|
||||
$barout_colour_1 = $row['barout_colour_1'];
|
||||
$barout_colour_2 = $row['barout_colour_2'];
|
||||
$barout_colour_3 = $row['barout_colour_3'];
|
||||
$bartotal_colour_1 = $row['bartotal_colour_1'];
|
||||
$bartotal_colour_2 = $row['bartotal_colour_2'];
|
||||
$bartotal_colour_3 = $row['bartotal_colour_3'];
|
||||
$bg_colour_1 = $row['bg_colour_1'];
|
||||
$bg_colour_2 = $row['bg_colour_2'];
|
||||
$bg_colour_3 = $row['bg_colour_3'];
|
||||
$border_colour_1 = $row['border_colour_1'];
|
||||
$border_colour_2 = $row['border_colour_2'];
|
||||
$border_colour_3 = $row['border_colour_3'];
|
||||
$line_colour_1 = $row['line_colour_1'];
|
||||
$line_colour_2 = $row['line_colour_2'];
|
||||
$line_colour_3 = $row['line_colour_3'];
|
||||
}
|
||||
if (isset($server_id) and $list_gtype!="" and $start>0) {
|
||||
$i=0;
|
||||
if ($ui->id('id', 19, 'get') and $list_gtype != '' and $ui->id('p', 19, 'get') . '-' . $ui->port('po', 'get') . '-' . $ui->id('id',19, 'get') > 0) {
|
||||
$i = 0;
|
||||
$stop=$list_gtype;
|
||||
if ($d=="md" or $d=="da") {
|
||||
$starttime = strtotime("$start-$server_port-$server_id");
|
||||
} else if ($d=="mo") {
|
||||
$starttime = strtotime("$start-$server_port");
|
||||
} else if ($d=="ye") {
|
||||
$starttime = strtotime("$start");
|
||||
}
|
||||
while ($i<$stop) {
|
||||
if ($d=="md" or $d=="da") {
|
||||
$day1=date('Y-m-d',strtotime("+$i day",$starttime));
|
||||
} else if ($d=="mo") {
|
||||
$day1=date('Y-m',strtotime("+$i month",$starttime));
|
||||
} else if ($d=="ye") {
|
||||
$day1=date('Y',strtotime("+$i year",$starttime));
|
||||
}
|
||||
if ($day1<=date('Y-m-d')) {
|
||||
$like=$day1."%";
|
||||
if ($w=="mb") {
|
||||
$divisor=(1024 * 1024);
|
||||
$rounder=0;
|
||||
} else if ($w=="tb") {
|
||||
$divisor=(1024 * 1024 * 1024 * 1024);
|
||||
$rounder=6;
|
||||
if ($ui->st('d', 'get') == 'md' or $d== "da") {
|
||||
$starttime = strtotime($ui->id('p', 19, 'get') . '-' . $ui->port('po', 'get') . '-' . $ui->id('id',19, 'get'));
|
||||
} else if ($ui->st('d', 'get') == 'mo') {
|
||||
$starttime = strtotime($ui->id('p', 19, 'get') . '-' . $ui->port('po', 'get'));
|
||||
} else if ($ui->st('d', 'get') == 'ye') {
|
||||
$starttime = strtotime($ui->id('p', 19, 'get'));
|
||||
} else {
|
||||
$divisor=(1024 * 1024 * 1024);
|
||||
$rounder=2;
|
||||
$starttime = 0;
|
||||
}
|
||||
if ($d=="md" or $d=="ho") {
|
||||
$day2=date('d.m.Y H',strtotime($day1));
|
||||
} else if ($d=="da") {
|
||||
$day2=date('d.m.Y',strtotime($day1));
|
||||
} else if ($d=="mo") {
|
||||
$day2=date('m.Y',strtotime($day1));
|
||||
} else if ($d=="ye") {
|
||||
$day2=date('Y',strtotime($day1));
|
||||
while ($i < $stop) {
|
||||
if ($ui->st('d', 'get') == 'md' or $ui->st('d', 'get') == 'da') {
|
||||
$day1 = date('Y-m-d',strtotime("+$i day", $starttime));
|
||||
} else if ($ui->st('d', 'get') == 'mo') {
|
||||
$day1 = date('Y-m',strtotime("+$i month", $starttime));
|
||||
} else if ($ui->st('d', 'get') == 'ye') {
|
||||
$day1 = date('Y',strtotime("+$i year", $starttime));
|
||||
} else {
|
||||
$day1 = 0;
|
||||
}
|
||||
if ($reseller_id==0 and isset($get_shorten)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `serverid`=:get_shorten");
|
||||
$query->execute(array(':like' => $like,':get_shorten'=>$get_shorten));
|
||||
} else if ($reseller_id!=0 and isset($get_shorten)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `serverid`=:get_shorten AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like,':get_shorten'=>$get_shorten,':reseller_id'=>$reseller_id));
|
||||
} else if ($reseller_id==0 and isset($get_distro)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `userid`=:resellerid");
|
||||
$query->execute(array(':like' => $like,':resellerid' => $get_distro));
|
||||
} else if ($reseller_id!=0 and $reseller_id==$admin_id and isset($get_distro)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `userid`=:get_distro AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like,':get_distro' => $get_distro,':reseller_id'=>$reseller_id));
|
||||
} else if ($reseller_id==0 and isset($get_short)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `resellerid`=:get_short");
|
||||
$query->execute(array(':like' => $like,':get_short'=>$get_short));;
|
||||
} else if ($reseller_id!=0 and $reseller_id!=$admin_id and isset($server_ips)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `ip` LIKE :server_ips AND `userid`=:admin_id AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like,':server_ips' => $server_ips."%",':reseller_id'=>$reseller_id,':admin_id'=>$admin_id));
|
||||
} else if ($reseller_id!=0 and $reseller_id==$admin_id and isset($server_ips)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `ip` LIKE :server_ips AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like,':server_ips' => $server_ips."%",':reseller_id'=>$reseller_id));
|
||||
} else if ($reseller_id==0 and isset($server_ips)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `ip` LIKE :server_ips");
|
||||
$query->execute(array(':like' => $like,':server_ips'=>$server_ips."%"));
|
||||
} else if ($reseller_id!=0 and $reseller_id!=$admin_id and isset($server_ip)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `ip`=:server_ip AND `userid`=:admin_id AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like,':server_ip' => $server_ip,':admin_id'=>$admin_id,':reseller_id'=>$reseller_id));
|
||||
} else if ($reseller_id!=0 and $reseller_id==$admin_id and isset($server_ip)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `ip`=:server_ip AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like,':server_ip' => $server_ip,':reseller_id'=>$reseller_id));
|
||||
} else if ($reseller_id==0 and isset($server_ip)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `ip`=:server_ip");
|
||||
$query->execute(array(':like' => $like,':server_ip'=>$server_ip));
|
||||
} else if ($reseller_id!=0 and $reseller_id!=$admin_id) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `userid`=:admin_id AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like,':admin_id'=>$admin_id,':reseller_id'=>$reseller_id));
|
||||
} else if ($reseller_id!=0 and $reseller_id==$admin_id) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like,':reseller_id'=>$reseller_id));
|
||||
} else if ($reseller_id==0) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like");
|
||||
if ($day1 <= date('Y-m-d')) {
|
||||
$like = $day1 . '%';
|
||||
if ($ui->st('w', 'get') == 'mb') {
|
||||
$divisor = (1024 * 1024);
|
||||
$rounder = 0;
|
||||
} else if ($ui->st('w', 'get') == 'tb') {
|
||||
$divisor = (1024 * 1024 * 1024 * 1024);
|
||||
$rounder = 6;
|
||||
} else {
|
||||
$divisor = (1024 * 1024 * 1024);
|
||||
$rounder = 2;
|
||||
}
|
||||
if ($ui->st('d', 'get') == 'md' or $ui->st('d', 'get') == 'ho') {
|
||||
$day2 = date('d.m.Y H',strtotime($day1));
|
||||
} else if ($ui->st('d', 'get') == 'da') {
|
||||
$day2 = date('d.m.Y',strtotime($day1));
|
||||
} else if ($ui->st('d', 'get') == 'mo') {
|
||||
$day2 = date('m.Y',strtotime($day1));
|
||||
} else if ($ui->st('d', 'get') == 'ye') {
|
||||
$day2 = date('Y',strtotime($day1));
|
||||
} else {
|
||||
$day2 = 0;
|
||||
}
|
||||
if ($reseller_id == 0 and $ui->username('shorten', 50, 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `serverid`=:get_shorten");
|
||||
$query->execute(array(':like' => $like, ':get_shorten' => $ui->username('shorten', 50, 'get')));
|
||||
} else if ($reseller_id!=0 and $ui->username('shorten', 50, 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `serverid`=:get_shorten AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like, ':get_shorten' => $ui->username('shorten', 50, 'get'), ':reseller_id' => $reseller_id));
|
||||
} else if ($reseller_id == 0 and $ui->username('distro', 50, 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `userid`=:resellerid");
|
||||
$query->execute(array(':like' => $like, ':resellerid' => $ui->username('distro', 50, 'get')));
|
||||
} else if ($reseller_id!=0 and $reseller_id == $admin_id and $ui->username('distro', 50, 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `userid`=:get_distro AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like, ':get_distro' => $ui->username('distro', 50, 'get'), ':reseller_id' => $reseller_id));
|
||||
} else if ($reseller_id == 0 and $ui->username('short', 50, 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `resellerid`=:get_short");
|
||||
$query->execute(array(':like' => $like, ':get_short' => $ui->username('short', 50, 'get')));
|
||||
} else if ($reseller_id!=0 and $reseller_id != $admin_id and $ui->ips('ips', 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `ip` LIKE :server_ips AND `userid`=:admin_id AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like, ':server_ips' => $ui->ips('ips', 'get') . '%', ':reseller_id' => $reseller_id, ':admin_id' => $admin_id));
|
||||
} else if ($reseller_id!=0 and $reseller_id == $admin_id and $ui->ips('ips', 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `ip` LIKE :server_ips AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like, ':server_ips' => $ui->ips('ips', 'get') . '%', ':reseller_id' => $reseller_id));
|
||||
} else if ($reseller_id == 0 and $ui->ips('ips', 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `ip` LIKE :server_ips");
|
||||
$query->execute(array(':like' => $like, ':server_ips' => $ui->ips('ips', 'get') . '%'));
|
||||
} else if ($reseller_id!=0 and $reseller_id != $admin_id and $ui->ip('ip', 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `ip`=:server_ip AND `userid`=:admin_id AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like, ':server_ip' => $ui->ip('ip', 'get'), ':admin_id' => $admin_id, ':reseller_id' => $reseller_id));
|
||||
} else if ($reseller_id!=0 and $reseller_id == $admin_id and $ui->ip('ip', 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `ip`=:server_ip AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like, ':server_ip' => $server_ip, ':reseller_id' => $reseller_id));
|
||||
} else if ($reseller_id == 0 and $ui->ip('ip', 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `ip`=:server_ip");
|
||||
$query->execute(array(':like' => $like, ':server_ip' => $ui->ip('ip', 'get')));
|
||||
} else if ($reseller_id!=0 and $reseller_id != $admin_id) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `userid`=:admin_id AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like, ':admin_id' => $admin_id, ':reseller_id' => $reseller_id));
|
||||
} else if ($reseller_id!=0 and $reseller_id == $admin_id) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like, ':reseller_id' => $reseller_id));
|
||||
} else if ($reseller_id == 0) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data` WHERE `day` LIKE :like");
|
||||
$query->execute(array(':like' => $like));
|
||||
}
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if (isset($row['ingoing']) or isset($row['outgoing']) or isset($row['total'])) {
|
||||
if (!isset($row['ingoing'])) $ingoing="0";
|
||||
if (!isset($row['outgoing'])) $outgoing="0";
|
||||
if (!isset($row['total'])) $total="0";
|
||||
$ingoing=($multiplier * $row['ingoing']) / $divisor;
|
||||
$outgoing=($multiplier * $row['outgoing']) / $divisor;
|
||||
$total=($multiplier * $row['total']) / $divisor;
|
||||
$values[$day2]=array($ingoing,$outgoing,$total);
|
||||
$ingoing = (isset($row['ingoing'])) ? ($multiplier * $row['ingoing']) / $divisor : 0;
|
||||
$outgoing = (isset($row['outgoing'])) ? ($multiplier * $row['outgoing']) / $divisor : 0;
|
||||
$total = (isset($row['total'])) ? ($multiplier * $row['total']) / $divisor : 0;
|
||||
$values[$day2] = array($ingoing, $outgoing, $total);
|
||||
}
|
||||
}
|
||||
if ($reseller_id==0 and isset($get_shorten)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `serverid`=:get_shorten");
|
||||
$query->execute(array(':like' => $like,':get_shorten'=>$get_shorten));
|
||||
} else if ($reseller_id!=0 and isset($get_shorten)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `serverid`=:get_shorten AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like,':get_shorten'=>$get_shorten,':reseller_id'=>$reseller_id));
|
||||
} else if ($reseller_id==0 and isset($get_distro)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `userid`=:resellerid");
|
||||
$query->execute(array(':like' => $like,':resellerid' => $get_distro));
|
||||
} else if ($reseller_id!=0 and $reseller_id==$admin_id and isset($get_distro)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `userid`=:get_distro AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like,':get_distro' => $get_distro,':reseller_id'=>$reseller_id));
|
||||
} else if ($reseller_id==0 and isset($get_short)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `resellerid`=:get_short");
|
||||
$query->execute(array(':like' => $like,':get_short'=>$get_short));;
|
||||
} else if ($reseller_id!=0 and $reseller_id!=$admin_id and isset($server_ips)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `ip` LIKE :server_ips AND `userid`=:admin_id AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like,':server_ips' => $server_ips."%",':reseller_id'=>$reseller_id,':admin_id'=>$admin_id));
|
||||
} else if ($reseller_id!=0 and $reseller_id==$admin_id and isset($server_ips)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `ip` LIKE :server_ips AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like,':server_ips' => $server_ips."%",':reseller_id'=>$reseller_id));
|
||||
} else if ($reseller_id==0 and isset($server_ips)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `ip` LIKE :server_ips");
|
||||
$query->execute(array(':like' => $like,':server_ips'=>$server_ips."%"));
|
||||
} else if ($reseller_id!=0 and $reseller_id!=$admin_id and isset($server_ip)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `ip`=:server_ip AND `userid`=:admin_id AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like,':server_ip' => $server_ip,':admin_id'=>$admin_id,':reseller_id'=>$reseller_id));
|
||||
} else if ($reseller_id!=0 and $reseller_id==$admin_id and isset($server_ip)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `ip`=:server_ip AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like,':server_ip' => $server_ip,':reseller_id'=>$reseller_id));
|
||||
} else if ($reseller_id==0 and isset($server_ip)) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `ip`=:server_ip");
|
||||
$query->execute(array(':like' => $like,':server_ip'=>$server_ip));
|
||||
} else if ($reseller_id!=0 and $reseller_id!=$admin_id) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `userid`=:admin_id AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like,':admin_id'=>$admin_id,':reseller_id'=>$reseller_id));
|
||||
} else if ($reseller_id!=0 and $reseller_id==$admin_id) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like,':reseller_id'=>$reseller_id));
|
||||
} else if ($reseller_id==0) {
|
||||
$query=$sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like");
|
||||
if ($reseller_id == 0 and $ui->username('shorten', 50, 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `serverid`=:get_shorten");
|
||||
$query->execute(array(':like' => $like, ':get_shorten' => $ui->username('shorten', 50, 'get')));
|
||||
} else if ($reseller_id!=0 and $ui->username('shorten', 50, 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `serverid`=:get_shorten AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like, ':get_shorten' => $ui->username('shorten', 50, 'get'), ':reseller_id' => $reseller_id));
|
||||
} else if ($reseller_id == 0 and $ui->username('distro', 50, 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `userid`=:resellerid");
|
||||
$query->execute(array(':like' => $like, ':resellerid' => $ui->username('distro', 50, 'get')));
|
||||
} else if ($reseller_id!=0 and $reseller_id == $admin_id and $ui->username('distro', 50, 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `userid`=:get_distro AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like, ':get_distro' => $ui->username('distro', 50, 'get'), ':reseller_id' => $reseller_id));
|
||||
} else if ($reseller_id == 0 and $ui->username('short', 50, 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `resellerid`=:get_short");
|
||||
$query->execute(array(':like' => $like, ':get_short' => $ui->username('short', 50, 'get')));
|
||||
} else if ($reseller_id!=0 and $reseller_id != $admin_id and $ui->ips('ips', 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `ip` LIKE :server_ips AND `userid`=:admin_id AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like, ':server_ips' => $ui->ips('ips', 'get') . '%', ':reseller_id' => $reseller_id, ':admin_id' => $admin_id));
|
||||
} else if ($reseller_id!=0 and $reseller_id == $admin_id and $ui->ips('ips', 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `ip` LIKE :server_ips AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like, ':server_ips' => $ui->ips('ips', 'get') . '%', ':reseller_id' => $reseller_id));
|
||||
} else if ($reseller_id == 0 and $ui->ips('ips', 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `ip` LIKE :server_ips");
|
||||
$query->execute(array(':like' => $like, ':server_ips' => $ui->ips('ips', 'get') . '%'));
|
||||
} else if ($reseller_id!=0 and $reseller_id != $admin_id and $ui->ip('ip', 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `ip`=:server_ip AND `userid`=:admin_id AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like, ':server_ip' => $ui->ip('ip', 'get'), ':admin_id' => $admin_id, ':reseller_id' => $reseller_id));
|
||||
} else if ($reseller_id!=0 and $reseller_id == $admin_id and $ui->ip('ip', 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `ip`=:server_ip AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like, ':server_ip' => $ui->ip('ip', 'get'), ':reseller_id' => $reseller_id));
|
||||
} else if ($reseller_id == 0 and $ui->ip('ip', 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `ip`=:server_ip");
|
||||
$query->execute(array(':like' => $like, ':server_ip' => $ui->ip('ip', 'get')));
|
||||
} else if ($reseller_id!=0 and $reseller_id != $admin_id) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `userid`=:admin_id AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like, ':admin_id' => $admin_id, ':reseller_id' => $reseller_id));
|
||||
} else if ($reseller_id!=0 and $reseller_id == $admin_id) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':like' => $like, ':reseller_id' => $reseller_id));
|
||||
} else if ($reseller_id == 0) {
|
||||
$query = $sql->prepare("SELECT SUM(`in`) AS `ingoing`,SUM(`out`) AS `outgoing`,SUM(`in`)+SUM(`out`) AS `total` FROM `traffic_data_day` WHERE `day` LIKE :like");
|
||||
$query->execute(array(':like' => $like));
|
||||
}
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
$ingoing=($multiplier * $row2['ingoing']) / $divisor;
|
||||
$outgoing=($multiplier * $row2['outgoing']) / $divisor;
|
||||
$total=($multiplier * $row2['total']) / $divisor;
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$ingoing = ($multiplier * $row['ingoing']) / $divisor;
|
||||
$outgoing = ($multiplier * $row['outgoing']) / $divisor;
|
||||
$total = ($multiplier * $row['total']) / $divisor;
|
||||
if (isset($values[$day2])) {
|
||||
$ingoing=$ingoing+$values[$day2][0];
|
||||
$outgoing=$outgoing+$values[$day2][1];
|
||||
$total=$total+$values[$day2][2];
|
||||
$ingoing = $ingoing + $values[$day2][0];
|
||||
$outgoing = $outgoing + $values[$day2][1];
|
||||
$total = $total + $values[$day2][2];
|
||||
}
|
||||
$values[$day2]=array($ingoing,$outgoing,$total);
|
||||
$values[$day2] = array($ingoing, $outgoing, $total);
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
foreach($values as $value) {
|
||||
$max_values[]=max($value);
|
||||
$max_values[] = max($value);
|
||||
}
|
||||
$total_bars=count($max_values);
|
||||
if ($total_bars>0) {
|
||||
$img_width=725;
|
||||
$margintop=30;
|
||||
$marginbottom=30;
|
||||
$marginleft=100;
|
||||
$marginright=40;
|
||||
$bar_heigth=10;
|
||||
$spacing1=2;
|
||||
$spacing2=20;
|
||||
$textspacingleft=($marginleft / 10) + 2;
|
||||
$img_height=$margintop + $marginbottom + ($total_bars * 3 * $bar_heigth) + ((( $total_bars * 3 ) - $total_bars) * $spacing1 ) + ( ( $total_bars - 1 ) * $spacing2 );
|
||||
$graph_width=$img_width - ( $marginleft + $marginright );
|
||||
$img=imagecreate($img_width,$img_height);
|
||||
$text_color=imagecolorallocate($img,$text_colour_1,$text_colour_2,$text_colour_3);
|
||||
$bar_in=imagecolorallocate($img,$barin_colour_1,$barin_colour_2,$barin_colour_3);
|
||||
$bar_out=imagecolorallocate($img,$barout_colour_1,$barout_colour_2,$barout_colour_3);
|
||||
$bar_total=imagecolorallocate($img,$bartotal_colour_1,$bartotal_colour_2,$bartotal_colour_3);
|
||||
$background_color=imagecolorallocate($img,$bg_colour_1,$bg_colour_2,$bg_colour_3);
|
||||
$border_color=imagecolorallocate($img,$border_colour_1,$border_colour_2,$border_colour_3);
|
||||
$line_color=imagecolorallocate($img,$line_colour_1,$line_colour_2,$line_colour_3);
|
||||
$max_value=max($max_values);
|
||||
if ($max_value==0) {
|
||||
$max_value=0.000001;
|
||||
$total_bars = count($max_values);
|
||||
if ($total_bars > 0) {
|
||||
$img_width = 725;
|
||||
$margintop = 30;
|
||||
$marginbottom = 30;
|
||||
$marginleft = 100;
|
||||
$marginright = 40;
|
||||
$bar_heigth = 10;
|
||||
$spacing1 = 2;
|
||||
$spacing2 = 20;
|
||||
$textspacingleft = ($marginleft / 10) + 2;
|
||||
$img_height = $margintop + $marginbottom + ($total_bars * 3 * $bar_heigth) + ((( $total_bars * 3 ) - $total_bars) * $spacing1 ) + ( ( $total_bars - 1 ) * $spacing2 );
|
||||
$graph_width = $img_width - ( $marginleft + $marginright );
|
||||
$img = imagecreate($img_width, $img_height);
|
||||
$text_color = imagecolorallocate($img, $text_colour_1, $text_colour_2, $text_colour_3);
|
||||
$bar_in = imagecolorallocate($img, $barin_colour_1, $barin_colour_2, $barin_colour_3);
|
||||
$bar_out = imagecolorallocate($img, $barout_colour_1, $barout_colour_2, $barout_colour_3);
|
||||
$bar_total = imagecolorallocate($img, $bartotal_colour_1, $bartotal_colour_2, $bartotal_colour_3);
|
||||
$background_color = imagecolorallocate($img, $bg_colour_1, $bg_colour_2, $bg_colour_3);
|
||||
$border_color = imagecolorallocate($img, $border_colour_1, $border_colour_2, $border_colour_3);
|
||||
$line_color = imagecolorallocate($img, $line_colour_1, $line_colour_2, $line_colour_3);
|
||||
$max_value = max($max_values);
|
||||
if ($max_value == 0) {
|
||||
$max_value = 0.000001;
|
||||
}
|
||||
$ratio = $graph_width / $max_value;
|
||||
imagefilledrectangle($img,0,0,$img_width,$img_height,$background_color);
|
||||
$lines=10;
|
||||
$vertical_gap=$graph_width/$lines;
|
||||
imagefilledrectangle($img, 0, 0, $img_width, $img_height, $background_color);
|
||||
$lines = 10;
|
||||
$vertical_gap = $graph_width/$lines;
|
||||
$i=1;
|
||||
while($i<=$lines){
|
||||
if ($max_value>=10) {
|
||||
$key=round(($max_value / $lines ) * ($lines - $i));
|
||||
} else if ($max_value>=1 and $max_value<10) {
|
||||
$key=round(($max_value / $lines ) * ($lines - $i),1);
|
||||
} else if ($max_value<1 and $max_value>=0.01) {
|
||||
$key=round(($max_value / $lines ) * ($lines - $i),2);
|
||||
while($i <= $lines){
|
||||
if ($max_value >= 10) {
|
||||
$key = round(($max_value / $lines ) * ($lines - $i));
|
||||
} else if ($max_value >= 1 and $max_value<10) {
|
||||
$key = round(($max_value / $lines ) * ($lines - $i),1);
|
||||
} else if ($max_value<1 and $max_value >= 0.01) {
|
||||
$key = round(($max_value / $lines ) * ($lines - $i),2);
|
||||
} else if ($max_value<0.01) {
|
||||
$key=round(($max_value / $lines ) * ($lines - $i),4);
|
||||
$key = round(($max_value / $lines ) * ($lines - $i),4);
|
||||
} else {
|
||||
$key = 0;
|
||||
}
|
||||
$x=$img_width - $marginright - $vertical_gap * $i ;
|
||||
imageline($img,$x,$margintop,$x,$img_height-$marginbottom,$line_color);
|
||||
imagestring($img,$x,$x,$spacing1,$key,$border_color);
|
||||
imagestring($img,$x,$x,$img_height-$marginbottom+$spacing1,$key,$border_color);
|
||||
$v=intval($vertical_gap * $i /$ratio);
|
||||
$x = $img_width - $marginright - $vertical_gap * $i ;
|
||||
imageline($img, $x, $margintop, $x, $img_height - $marginbottom, $line_color);
|
||||
imagestring($img, $x, $x, $spacing1, $key, $border_color);
|
||||
imagestring($img, $x, $x, $img_height - $marginbottom+$spacing1, $key, $border_color);
|
||||
$v = intval($vertical_gap * $i / $ratio);
|
||||
$i++;
|
||||
}
|
||||
$i="0";
|
||||
$more="0";
|
||||
while ($i<$total_bars) {
|
||||
$i = 0;
|
||||
$more = 0;
|
||||
while ($i < $total_bars) {
|
||||
foreach ($values as $key=>$array) {
|
||||
$i2="0";
|
||||
$i2 = 0;
|
||||
foreach ($array as $amount) {
|
||||
$x1=$marginleft;
|
||||
$x2=$marginleft + $amount * $ratio ;
|
||||
$y1=$margintop + $i * $bar_heigth ;
|
||||
$y1new=$y1+$more;
|
||||
$y1=$y1new;
|
||||
$x1 = $marginleft;
|
||||
$x2 = $marginleft + $amount * $ratio ;
|
||||
$y1 = $margintop + $i * $bar_heigth ;
|
||||
$y1new = $y1+$more;
|
||||
$y1 = $y1new;
|
||||
$y2= $y1 + $bar_heigth;
|
||||
if ($i2>"0" and ($i/2)==($i/$i2)) {
|
||||
$morenew=$more+$spacing2;
|
||||
$more=$morenew;
|
||||
if ($i2>0 and ($i/2) == ($i/$i2)) {
|
||||
$morenew = $more+$spacing2;
|
||||
$more = $morenew;
|
||||
} else {
|
||||
$morenew=$more+$spacing1;
|
||||
$more=$morenew;
|
||||
$morenew = $more+$spacing1;
|
||||
$more = $morenew;
|
||||
}
|
||||
if ($amount>=10) {
|
||||
$display=round($amount);
|
||||
} else if ($amount>=1 and $amount<10) {
|
||||
$display=round($amount,1);
|
||||
} else if ($amount<1 and $amount>=0.01) {
|
||||
$display=round($amount,2);
|
||||
} else if ($amount<0.01) {
|
||||
$display=round($amount,4);
|
||||
if ($amount >= 10) {
|
||||
$display = round($amount);
|
||||
} else if ($amount >= 1 and $amount<10) {
|
||||
$display = round($amount,1);
|
||||
} else if ($amount < 1 and $amount >= 0.01) {
|
||||
$display = round($amount,2);
|
||||
} else if ($amount < 0.01) {
|
||||
$display = round($amount,4);
|
||||
}
|
||||
imagestring($img,0,$x2+5,$y1,$display,$text_color);
|
||||
if ($i2=="0") {
|
||||
imagestring($img,$y1+$spacing1+$bar_heigth,2,$y1+$spacing1+$bar_heigth,$key,$text_color);
|
||||
imagestring($img,0, $x2+5, $y1, $display, $text_color);
|
||||
if ($i2 == 0) {
|
||||
imagestring($img, $y1+$spacing1+$bar_heigth,2, $y1+$spacing1+$bar_heigth, $key, $text_color);
|
||||
}
|
||||
if ($i2=="0") {
|
||||
imagefilledrectangle($img,$x1,$y1,$x2,$y2,$bar_in);
|
||||
} else if ($i2=="1") {
|
||||
imagefilledrectangle($img,$x1,$y1,$x2,$y2,$bar_out);
|
||||
} else if ($i2=="2") {
|
||||
imagefilledrectangle($img,$x1,$y1,$x2,$y2,$bar_total);
|
||||
if ($i2 == 0) {
|
||||
imagefilledrectangle($img, $x1, $y1, $x2, $y2, $bar_in);
|
||||
} else if ($i2 == 1) {
|
||||
imagefilledrectangle($img, $x1, $y1, $x2, $y2, $bar_out);
|
||||
} else if ($i2 == "2") {
|
||||
imagefilledrectangle($img, $x1, $y1, $x2, $y2, $bar_total);
|
||||
}
|
||||
$i++;
|
||||
$i2++;
|
||||
@ -321,182 +328,160 @@ if (isset($admin_id) and $ui->st('img','get')) {
|
||||
header("Content-type:image/png");
|
||||
imagepng($img);
|
||||
}
|
||||
} else if ($ui->st('img','get')=='vo' and ($pa['voicemasterserver'] or $pa['voiceserver'] or $pa['root'])) {
|
||||
$values=array();
|
||||
$pselect=$sql->prepare("SELECT * FROM `voice_stats_settings` WHERE `resellerid`=? LIMIT 1");
|
||||
$pselect->execute(array($reseller_id));
|
||||
foreach ($pselect->fetchall() as $row) {
|
||||
$text_colour_1=$row['text_colour_1'];
|
||||
$text_colour_2=$row['text_colour_2'];
|
||||
$text_colour_3=$row['text_colour_3'];
|
||||
$barin_colour_1=$row['barin_colour_1'];
|
||||
$barin_colour_2=$row['barin_colour_2'];
|
||||
$barin_colour_3=$row['barin_colour_3'];
|
||||
$barout_colour_1=$row['barout_colour_1'];
|
||||
$barout_colour_2=$row['barout_colour_2'];
|
||||
$barout_colour_3=$row['barout_colour_3'];
|
||||
$bg_colour_1=$row['bg_colour_1'];
|
||||
$bg_colour_2=$row['bg_colour_2'];
|
||||
$bg_colour_3=$row['bg_colour_3'];
|
||||
$border_colour_1=$row['border_colour_1'];
|
||||
$border_colour_2=$row['border_colour_2'];
|
||||
$border_colour_3=$row['border_colour_3'];
|
||||
$line_colour_1=$row['line_colour_1'];
|
||||
$line_colour_2=$row['line_colour_2'];
|
||||
$line_colour_3=$row['line_colour_3'];
|
||||
} else if ($ui->st('img','get') == 'vo' and ($pa['voicemasterserver'] or $pa['voiceserver'] or $pa['root'])) {
|
||||
$values = array();
|
||||
$query = $sql->prepare("SELECT * FROM `voice_stats_settings` WHERE `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($reseller_id));
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$text_colour_1 = $row['text_colour_1'];
|
||||
$text_colour_2 = $row['text_colour_2'];
|
||||
$text_colour_3 = $row['text_colour_3'];
|
||||
$barin_colour_1 = $row['barin_colour_1'];
|
||||
$barin_colour_2 = $row['barin_colour_2'];
|
||||
$barin_colour_3 = $row['barin_colour_3'];
|
||||
$barout_colour_1 = $row['barout_colour_1'];
|
||||
$barout_colour_2 = $row['barout_colour_2'];
|
||||
$barout_colour_3 = $row['barout_colour_3'];
|
||||
$bg_colour_1 = $row['bg_colour_1'];
|
||||
$bg_colour_2 = $row['bg_colour_2'];
|
||||
$bg_colour_3 = $row['bg_colour_3'];
|
||||
$border_colour_1 = $row['border_colour_1'];
|
||||
$border_colour_2 = $row['border_colour_2'];
|
||||
$border_colour_3 = $row['border_colour_3'];
|
||||
$line_colour_1 = $row['line_colour_1'];
|
||||
$line_colour_2 = $row['line_colour_2'];
|
||||
$line_colour_3 = $row['line_colour_3'];
|
||||
}
|
||||
if (isset($server_id) and $list_gtype!="" and $start>0) {
|
||||
$i=0;
|
||||
if ($ui->id('id', 19, 'get') and $list_gtype != '' and $start>0) {
|
||||
$i = 0;
|
||||
$stop=$list_gtype;
|
||||
if ($d=="md" or $d=="to") {
|
||||
$stop=23;
|
||||
$starttime = strtotime("$start-$server_port-$server_id");
|
||||
$now=date('Y-m-d H');
|
||||
} else if ($d=="da") {
|
||||
$starttime = strtotime("$start-$server_port-$server_id");
|
||||
$now=date('Y-m-d');
|
||||
} else if ($d=="mo") {
|
||||
$starttime = strtotime("$start-$server_port");
|
||||
$now=date('Y-m-d');
|
||||
} else if ($d=="ye") {
|
||||
$starttime = strtotime("$start");
|
||||
$now=date('Y-m-d');
|
||||
if ($ui->st('d', 'get') == 'md' or $ui->st('d', 'get') == 'to') {
|
||||
$stop = 23;
|
||||
$starttime = strtotime($ui->id('p', 19, 'get') . '-' . $ui->port('po', 'get') . '-' . $ui->id('id',19, 'get'));
|
||||
$now = date('Y-m-d H');
|
||||
} else if ($ui->st('d', 'get') == 'da') {
|
||||
$starttime = strtotime($ui->id('p', 19, 'get') . '-' . $ui->port('po', 'get') . '-' . $ui->id('id',19, 'get'));
|
||||
$now = date('Y-m-d');
|
||||
} else if ($ui->st('d', 'get') == 'mo') {
|
||||
$starttime = strtotime($ui->id('p', 19, 'get') . '-' . $ui->port('po', 'get'));
|
||||
$now = date('Y-m-d');
|
||||
} else if ($ui->st('d', 'get') == 'ye') {
|
||||
$starttime = strtotime($ui->id('p', 19, 'get'));
|
||||
$now = date('Y-m-d');
|
||||
}
|
||||
while ($i<$stop) {
|
||||
if ($d=="md" or $d=="to") {
|
||||
$day1=date('Y-m-d H',strtotime("+$i hour",$starttime));
|
||||
} else if ($d=="da") {
|
||||
$day1=date('Y-m-d',strtotime("+$i day",$starttime));
|
||||
} else if ($d=="mo") {
|
||||
$day1=date('Y-m',strtotime("+$i month",$starttime));
|
||||
} else if ($d=="ye") {
|
||||
$day1=date('Y',strtotime("+$i year",$starttime));
|
||||
while ($i < $stop) {
|
||||
if ($ui->st('d', 'get') == 'md' or $ui->st('d', 'get') == 'to') {
|
||||
$day1 = date('Y-m-d H',strtotime("+$i hour", $starttime));
|
||||
} else if ($ui->st('d', 'get') == 'da') {
|
||||
$day1 = date('Y-m-d',strtotime("+$i day", $starttime));
|
||||
} else if ($ui->st('d', 'get') == 'mo') {
|
||||
$day1 = date('Y-m',strtotime("+$i month", $starttime));
|
||||
} else if ($ui->st('d', 'get') == 'ye') {
|
||||
$day1 = date('Y',strtotime("+$i year", $starttime));
|
||||
}
|
||||
if ($day1<=$now) {
|
||||
$like=$day1."%";
|
||||
if ($d=="md" or $d=="to") {
|
||||
$day2=date('H',strtotime($day1.':00:00')).':00:00';
|
||||
} else if ($d=="da") {
|
||||
$day2=date('d.m.Y',strtotime($day1));
|
||||
} else if ($d=="mo") {
|
||||
$day2=date('m.Y',strtotime($day1));
|
||||
} else if ($d=="ye") {
|
||||
$day2=date('Y',strtotime($day1));
|
||||
if ($day1 <= $now) {
|
||||
$like = $day1 . '%';
|
||||
if ($ui->st('d', 'get') == 'md' or $ui->st('d', 'get') == 'to') {
|
||||
$day2 = date('H',strtotime($day1.':00:00')).':00:00';
|
||||
} else if ($ui->st('d', 'get') == 'da') {
|
||||
$day2 = date('d.m.Y',strtotime($day1));
|
||||
} else if ($ui->st('d', 'get') == 'mo') {
|
||||
$day2 = date('m.Y',strtotime($day1));
|
||||
} else if ($ui->st('d', 'get') == 'ye') {
|
||||
$day2 = date('Y',strtotime($day1));
|
||||
}
|
||||
if (isset($get_shorten)) {
|
||||
$pselect=$sql->prepare("SELECT SUM(`used`)/COUNT(`sid`) AS `averageused`,SUM(`installed`)/COUNT(`sid`) AS `averageinstalled` FROM `voice_server_stats` WHERE `date` LIKE ? AND `sid`=? AND `resellerid`=?");
|
||||
$pselect->execute(array($like,$get_shorten,$reseller_id));
|
||||
} else if (isset($get_distro)) {
|
||||
$pselect=$sql->prepare("SELECT SUM(`used`)/COUNT(`sid`)*COUNT(DISTINCT(`sid`)) AS `averageused`,SUM(`installed`)/COUNT(`sid`)*COUNT(DISTINCT(`sid`)) AS `averageinstalled` FROM `voice_server_stats` WHERE `date` LIKE ? AND `uid`=? AND `resellerid`=?");
|
||||
$pselect->execute(array($like,$get_distro,$reseller_id));
|
||||
} else if (isset($get_short)) {
|
||||
$pselect=$sql->prepare("SELECT SUM(`used`)/COUNT(`sid`)*COUNT(DISTINCT(`sid`)) AS `averageused`,SUM(`installed`)/COUNT(`sid`)*COUNT(DISTINCT(`sid`)) AS `averageinstalled` FROM `voice_server_stats` WHERE `date` LIKE ? AND `mid`=? AND `resellerid`=?");
|
||||
$pselect->execute(array($like,$get_short,$reseller_id));
|
||||
if ($ui->username('shorten', 50, 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`used`)/COUNT(`sid`) AS `averageused`,SUM(`installed`)/COUNT(`sid`) AS `averageinstalled` FROM `voice_server_stats` WHERE `date` LIKE ? AND `sid`=? AND `resellerid`=?");
|
||||
$query->execute(array($like, $ui->username('shorten', 50, 'get'), $reseller_id));
|
||||
} else if ($ui->username('distro', 50, 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`used`)/COUNT(`sid`)*COUNT(DISTINCT(`sid`)) AS `averageused`,SUM(`installed`)/COUNT(`sid`)*COUNT(DISTINCT(`sid`)) AS `averageinstalled` FROM `voice_server_stats` WHERE `date` LIKE ? AND `uid`=? AND `resellerid`=?");
|
||||
$query->execute(array($like, $ui->username('distro', 50, 'get'), $reseller_id));
|
||||
} else if ($ui->username('short', 50, 'get')) {
|
||||
$query = $sql->prepare("SELECT SUM(`used`)/COUNT(`sid`)*COUNT(DISTINCT(`sid`)) AS `averageused`,SUM(`installed`)/COUNT(`sid`)*COUNT(DISTINCT(`sid`)) AS `averageinstalled` FROM `voice_server_stats` WHERE `date` LIKE ? AND `mid`=? AND `resellerid`=?");
|
||||
$query->execute(array($like, $ui->username('short', 50, 'get'), $reseller_id));
|
||||
} else {
|
||||
$pselect=$sql->prepare("SELECT SUM(`used`)/COUNT(`sid`)*COUNT(DISTINCT(`sid`)) AS `averageused`,SUM(`installed`)/COUNT(`sid`)*COUNT(DISTINCT(`sid`)) AS `averageinstalled` FROM `voice_server_stats` WHERE `date` LIKE ? AND `resellerid`=?");
|
||||
$pselect->execute(array($like,$reseller_id));
|
||||
$query = $sql->prepare("SELECT SUM(`used`)/COUNT(`sid`)*COUNT(DISTINCT(`sid`)) AS `averageused`,SUM(`installed`)/COUNT(`sid`)*COUNT(DISTINCT(`sid`)) AS `averageinstalled` FROM `voice_server_stats` WHERE `date` LIKE ? AND `resellerid`=?");
|
||||
$query->execute(array($like, $reseller_id));
|
||||
}
|
||||
foreach ($pselect->fetchall() as $row) {
|
||||
if (!isset($row['averageused'])) $averageused="0";
|
||||
else $averageused=round($row['averageused']);
|
||||
if (!isset($row['averageinstalled'])) $averageinstalled="0";
|
||||
else $averageinstalled=round($row['averageinstalled']);
|
||||
$values[$day2]=array($averageused,$averageinstalled);
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$averageused = (isset($row['averageused'])) ? round($row['averageused']) : 0;
|
||||
$averageinstalled = (isset($row['averageinstalled'])) ? round($row['averageinstalled']) : 0;
|
||||
$values[$day2] = array($averageused, $averageinstalled);
|
||||
}
|
||||
/*if (isset($get_shorten)) {
|
||||
$pselect=$sql->prepare("SELECT SUM(`used`)/COUNT(`id`) AS `averageused`,SUM(`installed`)/COUNT(`id`) AS `averageinstalled` FROM `voice_server_stats_hours` WHERE `date` LIKE ? AND `sid`=? AND `resellerid`=?");
|
||||
$pselect->execute(array($like,$get_shorten,$reseller_id));
|
||||
} else if (isset($get_distro)) {
|
||||
$pselect=$sql->prepare("SELECT SUM(`used`)/COUNT(`id`)*COUNT(DISTINCT(`sid`)) AS `averageused`,SUM(`installed`)/COUNT(`id`)*COUNT(DISTINCT(`sid`)) AS `averageinstalled` FROM `voice_server_stats_hours` WHERE `date` LIKE ? AND `uid`=? AND `resellerid`=?");
|
||||
$pselect->execute(array($like,$get_distro,$reseller_id));
|
||||
} else if (isset($get_short)) {
|
||||
$pselect=$sql->prepare("SELECT SUM(`used`)/COUNT(`id`)*COUNT(DISTINCT(`sid`)) AS `averageused`,SUM(`installed`)/COUNT(`id`)*COUNT(DISTINCT(`sid`)) AS `averageinstalled` FROM `voice_server_stats_hours` WHERE `date` LIKE ? AND `mid`=? AND `resellerid`=?");
|
||||
$pselect->execute(array($like,$get_short,$reseller_id));
|
||||
} else {
|
||||
$pselect=$sql->prepare("SELECT SUM(`used`)/COUNT(`id`)*COUNT(DISTINCT(`sid`)) AS `averageused`,SUM(`installed`)/COUNT(`id`)*COUNT(DISTINCT(`sid`)) AS `averageinstalled` FROM `voice_server_stats_hours` WHERE `date` LIKE ? AND `resellerid`=?");
|
||||
$pselect->execute(array($like,$reseller_id));
|
||||
}
|
||||
foreach ($pselect->fetchall() as $row) {
|
||||
if (!isset($row['averageused'])) $averageused="0";
|
||||
else $averageused=round($row['averageused']);
|
||||
if (!isset($row['averageinstalled'])) $averageinstalled="0";
|
||||
else $averageinstalled=round($row['averageinstalled']);
|
||||
$values[$day2]=array($averageused,$averageinstalled);
|
||||
}*/
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$max_values=array();
|
||||
$max_values = array();
|
||||
foreach($values as $value) {
|
||||
$max_values[]=max($value);
|
||||
$max_values[] = max($value);
|
||||
}
|
||||
$total_bars=count($max_values);
|
||||
$total_bars = count($max_values);
|
||||
if ($total_bars>0) {
|
||||
$img_width=725;
|
||||
$margintop=30;
|
||||
$marginbottom=30;
|
||||
$marginleft=100;
|
||||
$marginright=40;
|
||||
$bar_heigth=10;
|
||||
$spacing1=2;
|
||||
$spacing2=20;
|
||||
$textspacingleft=($marginleft / 10) + 2;
|
||||
$img_height=$margintop + $marginbottom + ($total_bars * 2 * $bar_heigth) + ((( $total_bars * 2 ) - $total_bars) * $spacing1 ) + ( ( $total_bars - 1 ) * $spacing2 );
|
||||
$graph_width=$img_width - ( $marginleft + $marginright );
|
||||
$img=imagecreate($img_width,$img_height);
|
||||
$text_color=imagecolorallocate($img,$text_colour_1,$text_colour_2,$text_colour_3);
|
||||
$bar_in=imagecolorallocate($img,$barin_colour_1,$barin_colour_2,$barin_colour_3);
|
||||
$bar_out=imagecolorallocate($img,$barout_colour_1,$barout_colour_2,$barout_colour_3);
|
||||
$background_color=imagecolorallocate($img,$bg_colour_1,$bg_colour_2,$bg_colour_3);
|
||||
$border_color=imagecolorallocate($img,$border_colour_1,$border_colour_2,$border_colour_3);
|
||||
$line_color=imagecolorallocate($img,$line_colour_1,$line_colour_2,$line_colour_3);
|
||||
$max_value=max($max_values);
|
||||
if ($max_value==0) {
|
||||
$img_width = 725;
|
||||
$margintop = 30;
|
||||
$marginbottom = 30;
|
||||
$marginleft = 100;
|
||||
$marginright = 40;
|
||||
$bar_heigth = 10;
|
||||
$spacing1 = 2;
|
||||
$spacing2 = 20;
|
||||
$textspacingleft = ($marginleft / 10) + 2;
|
||||
$img_height = $margintop + $marginbottom + ($total_bars * 2 * $bar_heigth) + ((( $total_bars * 2 ) - $total_bars) * $spacing1 ) + ( ( $total_bars - 1 ) * $spacing2 );
|
||||
$graph_width = $img_width - ($marginleft + $marginright);
|
||||
$img = imagecreate($img_width, $img_height);
|
||||
$text_color = imagecolorallocate($img, $text_colour_1, $text_colour_2, $text_colour_3);
|
||||
$bar_in = imagecolorallocate($img, $barin_colour_1, $barin_colour_2, $barin_colour_3);
|
||||
$bar_out = imagecolorallocate($img, $barout_colour_1, $barout_colour_2, $barout_colour_3);
|
||||
$background_color = imagecolorallocate($img, $bg_colour_1, $bg_colour_2, $bg_colour_3);
|
||||
$border_color = imagecolorallocate($img, $border_colour_1, $border_colour_2, $border_colour_3);
|
||||
$line_color = imagecolorallocate($img, $line_colour_1, $line_colour_2, $line_colour_3);
|
||||
$max_value = max($max_values);
|
||||
if ($max_value == 0) {
|
||||
$max_value=0.000001;
|
||||
}
|
||||
$ratio = $graph_width / $max_value;
|
||||
imagefilledrectangle($img,0,0,$img_width,$img_height,$background_color);
|
||||
$lines=10;
|
||||
$vertical_gap=$graph_width/$lines;
|
||||
imagefilledrectangle($img, 0, 0, $img_width, $img_height, $background_color);
|
||||
$lines = 10;
|
||||
$vertical_gap = $graph_width/$lines;
|
||||
$i=1;
|
||||
while ($i<=$lines) {
|
||||
$key=round(($max_value / $lines ) * ($lines - $i));
|
||||
$x=$img_width - $marginright - $vertical_gap * $i ;
|
||||
imageline($img,$x,$margintop,$x,$img_height-$marginbottom,$line_color);
|
||||
imagestring($img,$x,$x,$spacing1,$key,$border_color);
|
||||
imagestring($img,$x,$x,$img_height-$marginbottom+$spacing1,$key,$border_color);
|
||||
$v=intval($vertical_gap * $i /$ratio);
|
||||
while ($i <= $lines) {
|
||||
$key = round(($max_value / $lines ) * ($lines - $i));
|
||||
$x = $img_width - $marginright - $vertical_gap * $i ;
|
||||
imageline($img, $x, $margintop, $x, $img_height-$marginbottom, $line_color);
|
||||
imagestring($img, $x, $x, $spacing1, $key, $border_color);
|
||||
imagestring($img, $x, $x, $img_height-$marginbottom+$spacing1, $key, $border_color);
|
||||
$v = intval($vertical_gap * $i /$ratio);
|
||||
$i++;
|
||||
}
|
||||
$i="0";
|
||||
$more="0";
|
||||
while ($i<$total_bars) {
|
||||
$i = 0;
|
||||
$more = 0;
|
||||
while ($i < $total_bars) {
|
||||
foreach ($values as $key=>$array) {
|
||||
$i2="0";
|
||||
$i2 = 0;
|
||||
foreach ($array as $amount) {
|
||||
$x1=$marginleft;
|
||||
$x2=$marginleft + $amount * $ratio ;
|
||||
$y1=$margintop + $i * $bar_heigth ;
|
||||
$y1new=$y1+$more;
|
||||
$y1=$y1new;
|
||||
$x1 = $marginleft;
|
||||
$x2 = $marginleft + $amount * $ratio ;
|
||||
$y1 = $margintop + $i * $bar_heigth ;
|
||||
$y1new = $y1+$more;
|
||||
$y1 = $y1new;
|
||||
$y2= $y1 + $bar_heigth;
|
||||
if ($i2==1) {
|
||||
$morenew=$more+$spacing2;
|
||||
$more=$morenew;
|
||||
if ($i2 == 1) {
|
||||
$morenew = $more+$spacing2;
|
||||
$more = $morenew;
|
||||
} else {
|
||||
$morenew=$more+$spacing1;
|
||||
$more=$morenew;
|
||||
$morenew = $more+$spacing1;
|
||||
$more = $morenew;
|
||||
}
|
||||
$display=round($amount);
|
||||
imagestring($img,0,$x2+5,$y1,$display,$text_color);
|
||||
if ($i2=="0") {
|
||||
imagestring($img,$y1+$spacing1+$bar_heigth,2,$y1+$spacing1,$key,$text_color);
|
||||
$display = round($amount);
|
||||
imagestring($img,0, $x2+5, $y1, $display, $text_color);
|
||||
if ($i2 == 0) {
|
||||
imagestring($img, $y1+$spacing1+$bar_heigth,2, $y1+$spacing1, $key, $text_color);
|
||||
}
|
||||
if ($i2=="0") {
|
||||
imagefilledrectangle($img,$x1,$y1,$x2,$y2,$bar_in);
|
||||
} else if ($i2=="1") {
|
||||
imagefilledrectangle($img,$x1,$y1,$x2,$y2,$bar_out);
|
||||
if ($i2 == 0) {
|
||||
imagefilledrectangle($img, $x1, $y1, $x2, $y2, $bar_in);
|
||||
} else if ($i2 == 1) {
|
||||
imagefilledrectangle($img, $x1, $y1, $x2, $y2, $bar_out);
|
||||
}
|
||||
$i++;
|
||||
$i2++;
|
||||
@ -508,24 +493,24 @@ if (isset($admin_id) and $ui->st('img','get')) {
|
||||
}
|
||||
}
|
||||
} else if (!$ui->st('img','get')) {
|
||||
$randompass=passwordgenerate(4);
|
||||
$_SESSION['captcha']=md5($randompass);
|
||||
$captcha=$randompass;
|
||||
$bildhoehe=20;
|
||||
$bildbreite=40;
|
||||
$bild=imagecreate($bildbreite, $bildhoehe);
|
||||
$randompass = passwordgenerate(4);
|
||||
$_SESSION['captcha'] = md5($randompass);
|
||||
$captcha = $randompass;
|
||||
$bildhoehe = 20;
|
||||
$bildbreite = 40;
|
||||
$bild = imagecreate($bildbreite, $bildhoehe);
|
||||
imagecolorallocate($bild, 255, 255, 255);
|
||||
$text=imagecolorallocate($bild, 0, 0, 0);
|
||||
$font=20;
|
||||
$a=2;
|
||||
$x=floor($bildbreite/strlen($captcha))-0;
|
||||
for($b=0; $b < strlen($captcha); $b++) {
|
||||
$c=mt_rand(2,$bildhoehe-20);
|
||||
imagestring ($bild,$font,$a,$c, $captcha{$b}, $text);
|
||||
$a=$a+$x;
|
||||
$text = imagecolorallocate($bild, 0, 0, 0);
|
||||
$font = 20;
|
||||
$a = 2;
|
||||
$x = floor($bildbreite/strlen($captcha))-0;
|
||||
for($b = 0; $b < strlen($captcha); $b++) {
|
||||
$c = mt_rand(2, $bildhoehe-20);
|
||||
imagestring ($bild, $font, $a, $c, $captcha{$b}, $text);
|
||||
$a = $a + $x;
|
||||
}
|
||||
# get errors and throw away to ensure captcha display
|
||||
$errors=ob_get_clean();
|
||||
$errors = ob_get_clean();
|
||||
|
||||
header("Content-type: image/png");
|
||||
imagepng($bild);
|
||||
|
@ -48,9 +48,9 @@ if (isset ($page_active) and $page_active=='Y') {
|
||||
include(EASYWIDIR . '/stuff/init_page.php');
|
||||
if (isset($throw404)) {
|
||||
$template_file='page_404.tpl';
|
||||
} else if (isset($what_to_be_included_array[$s]) and is_file(EASYWIDIR.'/stuff/'.$what_to_be_included_array[$s])) {
|
||||
} else if (isset($what_to_be_included_array[$s]) and is_file(EASYWIDIR . '/stuff/'.$what_to_be_included_array[$s])) {
|
||||
include(EASYWIDIR . '/stuff/'.$what_to_be_included_array[$s]);
|
||||
} else if (isset($what_to_be_included_array[$s]) and is_file(EASYWIDIR.'/'.$what_to_be_included_array[$s])) {
|
||||
} else if (isset($what_to_be_included_array[$s]) and is_file(EASYWIDIR . '/'.$what_to_be_included_array[$s])) {
|
||||
include(EASYWIDIR . '/'.$what_to_be_included_array[$s]);
|
||||
} else if (isset($s) and !isset($what_to_be_included_array[$s])) {
|
||||
$template_file='page_404.tpl';
|
||||
|
41
web/lend.php
41
web/lend.php
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* File: lend.php.
|
||||
* Author: Ulrich Block
|
||||
@ -96,11 +97,11 @@ $query=$sql->prepare("SELECT *,AES_DECRYPT(`ftpuploadpath`,?) AS `decyptedftpupl
|
||||
$query->execute(array($aeskey,$reseller_id));
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$active=$row['active'];
|
||||
$activeGS=($row['activeGS']=='B' or ($row['activeGS']!='N' and (isset($admin_id) or ($row['activeGS']!='N' and isset($get_shorten) and $get_shorten=='api'))) or ($row['activeGS']=='R' and isset($user_id)) or ($row['activeGS']=='A' and !isset($user_id))) ? 'Y' : 'N';
|
||||
$activeVS=($row['activeVS']=='B' or ($row['activeVS']!='N' and (isset($admin_id) or ($row['activeVS']!='N' and isset($get_shorten) and $get_shorten=='api'))) or ($row['activeVS']=='R' and isset($user_id)) or ($row['activeVS']=='A' and !isset($user_id))) ? 'Y' : 'N';
|
||||
$ftpupload=($row['ftpupload']=='Y' or ($row['ftpupload']!='N' and (isset($admin_id) or ($row['ftpupload']!='N' and isset($get_shorten) and $get_shorten=='api'))) or ($row['ftpupload']=='R' and isset($user_id)) or ($row['ftpupload']=='A' and !isset($user_id))) ? 'Y' : 'N';
|
||||
$activeGS=($row['activeGS']=='B' or ($row['activeGS']!='N' and (isset($admin_id) or ($row['activeGS']!='N' and $ui->username('shorten', 50, 'get') == 'api'))) or ($row['activeGS']=='R' and isset($user_id)) or ($row['activeGS']=='A' and !isset($user_id))) ? 'Y' : 'N';
|
||||
$activeVS=($row['activeVS']=='B' or ($row['activeVS']!='N' and (isset($admin_id) or ($row['activeVS']!='N' and $ui->username('shorten', 50, 'get') == 'api'))) or ($row['activeVS']=='R' and isset($user_id)) or ($row['activeVS']=='A' and !isset($user_id))) ? 'Y' : 'N';
|
||||
$ftpupload=($row['ftpupload']=='Y' or ($row['ftpupload']!='N' and (isset($admin_id) or ($row['ftpupload']!='N' and $ui->username('shorten', 50, 'get') == 'api'))) or ($row['ftpupload']=='R' and isset($user_id)) or ($row['ftpupload']=='A' and !isset($user_id))) ? 'Y' : 'N';
|
||||
$ftpuploadpath=$row['decyptedftpuploadpath'];
|
||||
if ((isset($get_shorten) and $get_shorten=='api') or (in_array($row['activeGS'],array('B','R')) and (isset($user_id) or isset($admin_id)))) {
|
||||
if (($ui->username('shorten', 50, 'get') == 'api') or (in_array($row['activeGS'],array('B','R')) and (isset($user_id) or isset($admin_id)))) {
|
||||
$mintime=(int)$row['mintimeRegistered'];
|
||||
$time=(int)$row['mintimeRegistered'];
|
||||
$maxtime=(int)$row['maxtimeRegistered'];
|
||||
@ -119,7 +120,7 @@ foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$player=(int)$row['maxplayer'];
|
||||
$playersteps=(int)$row['playersteps'];
|
||||
}
|
||||
if ((isset($get_shorten) and $get_shorten=='api') or (in_array($row['activeVS'],array('B','R')) and (isset($user_id) or isset($admin_id)))) {
|
||||
if (($ui->username('shorten', 50, 'get') == 'api') or (in_array($row['activeVS'],array('B','R')) and (isset($user_id) or isset($admin_id)))) {
|
||||
$vomintime=(int)$row['vomintimeRegistered'];
|
||||
$votime=(int)$row['vomintimeRegistered'];
|
||||
$vomaxtime=(int)$row['vomaxtimeRegistered'];
|
||||
@ -171,7 +172,7 @@ foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($get_shorten) and $get_shorten=='api' and ($lendaccess==1 or $lendaccess==3)) $loguserip='';
|
||||
if ($ui->username('shorten', 50, 'get') == 'api' and ($lendaccess==1 or $lendaccess==3)) $loguserip='';
|
||||
$gsstillrunning=false;
|
||||
$vostillrunning=false;
|
||||
if (!isset($page_include) and $ui->id('xml',1,'post')==1) {
|
||||
@ -202,7 +203,9 @@ if ($activeGS=='Y' and ($w=='gs' or $d=='gs' or $ui->st('w','post')=='gs' or (is
|
||||
else if ($activeVS=='Y' and ($w=='vo' or $d=='vo' or $ui->st('w','post')=='vo' or (isset($page_name) and $page_name==strtolower(str_replace(" ",'-',$gsprache->voiceserver))))) $servertype='v';
|
||||
$volallowed=($vocount>0) ? true : false;
|
||||
$gslallowed=($gscount>0) ? true : false;
|
||||
if(!isset($servertype) and !isset($page_include) and (!isset($get_shorten) or ($get_shorten=='api') and !$ui->st('w','post'))) $servertype=($vocount>$gscount) ? 'v' : 'g';
|
||||
if(!isset($servertype) and !isset($page_include) and (!$ui->username('shorten', 50, 'get') or ($ui->username('shorten', 50, 'get') == 'api') and !$ui->st('w','post'))) {
|
||||
$servertype=($vocount>$gscount) ? 'v' : 'g';
|
||||
}
|
||||
if(isset($servertype)) {
|
||||
$query=$sql->prepare("SELECT `id`,`serverid`,`rcon`,`password`,`slots`,`started`,`lendtime` FROM `lendedserver` WHERE `lenderip`=? AND `servertype`=? AND `resellerid`=? LIMIT 1");
|
||||
$query1=$sql->prepare("SELECT s.`switchID`,g.`rootID` FROM `serverlist` s INNER JOIN `gsswitch` g ON s.`switchID`=g.`id` WHERE s.`id`=? AND s.`resellerid`=? LIMIT 1");
|
||||
@ -676,9 +679,9 @@ XML;
|
||||
$page_data->setCanonicalUrl($s);
|
||||
$template_file='page_lenddata.tpl';
|
||||
} else {
|
||||
if (is_file(EASYWIDIR.'/template/'.$template_to_use.'/lenddata.tpl')) {
|
||||
include(EASYWIDIR . '/template/'.$template_to_use.'/lenddata.tpl');
|
||||
} else if (is_file(EASYWIDIR.'/template/default/lenddata.tpl')) {
|
||||
if (is_file(EASYWIDIR . '/template/' . $template_to_use . '/lenddata.tpl')) {
|
||||
include(EASYWIDIR . '/template/' . $template_to_use . '/lenddata.tpl');
|
||||
} else if (is_file(EASYWIDIR . '/template/default/lenddata.tpl')) {
|
||||
include(EASYWIDIR . '/template/default/lenddata.tpl');
|
||||
} else {
|
||||
include(EASYWIDIR . '/template/lenddata.tpl');
|
||||
@ -706,9 +709,9 @@ XML;
|
||||
$page_data->setCanonicalUrl($s);
|
||||
$template_file='page_lend.tpl';
|
||||
} else {
|
||||
if (is_file(EASYWIDIR.'/template/'.$template_to_use.'/lend.tpl')) {
|
||||
include(EASYWIDIR . '/template/'.$template_to_use.'/lend.tpl');
|
||||
} else if (is_file(EASYWIDIR.'/template/default/lend.tpl')) {
|
||||
if (is_file(EASYWIDIR . '/template/' . $template_to_use . '/lend.tpl')) {
|
||||
include(EASYWIDIR . '/template/' . $template_to_use . '/lend.tpl');
|
||||
} else if (is_file(EASYWIDIR . '/template/default/lend.tpl')) {
|
||||
include(EASYWIDIR . '/template/default/lend.tpl');
|
||||
} else {
|
||||
include(EASYWIDIR . '/template/lend.tpl');
|
||||
@ -920,9 +923,9 @@ XML;
|
||||
$page_data->setCanonicalUrl($s);
|
||||
$template_file='page_lenddata.tpl';
|
||||
} else {
|
||||
if (is_file(EASYWIDIR.'/template/'.$template_to_use.'/lenddata.tpl')) {
|
||||
include(EASYWIDIR . '/template/'.$template_to_use.'/lenddata.tpl');
|
||||
} else if (is_file(EASYWIDIR.'/template/default/lenddata.tpl')) {
|
||||
if (is_file(EASYWIDIR . '/template/' . $template_to_use . '/lenddata.tpl')) {
|
||||
include(EASYWIDIR . '/template/' . $template_to_use . '/lenddata.tpl');
|
||||
} else if (is_file(EASYWIDIR . '/template/default/lenddata.tpl')) {
|
||||
include(EASYWIDIR . '/template/default/lenddata.tpl');
|
||||
} else {
|
||||
include(EASYWIDIR . '/template/lenddata.tpl');
|
||||
@ -945,9 +948,9 @@ XML;
|
||||
$page_data->setCanonicalUrl($s);
|
||||
$template_file='page_lend.tpl';
|
||||
} else {
|
||||
if (is_file(EASYWIDIR.'/template/'.$template_to_use.'/lend.tpl')) {
|
||||
include(EASYWIDIR . '/template/'.$template_to_use.'/lend.tpl');
|
||||
} else if (is_file(EASYWIDIR.'/template/default/lend.tpl')) {
|
||||
if (is_file(EASYWIDIR . '/template/' . $template_to_use . '/lend.tpl')) {
|
||||
include(EASYWIDIR . '/template/' . $template_to_use . '/lend.tpl');
|
||||
} else if (is_file(EASYWIDIR . '/template/default/lend.tpl')) {
|
||||
include(EASYWIDIR . '/template/default/lend.tpl');
|
||||
} else {
|
||||
include(EASYWIDIR . '/template/lend.tpl');
|
||||
|
@ -42,7 +42,7 @@ if (count($s)>1) {
|
||||
$ewInstallPath=implode('/',$s).'/';
|
||||
}
|
||||
define('EASYWIDIR', dirname(__FILE__));
|
||||
if (is_dir(EASYWIDIR.'/install')) die('Please remove the "install" folder');
|
||||
if (is_dir(EASYWIDIR . '/install')) die('Please remove the "install" folder');
|
||||
if ((!isset($ui->get['w']) and isset($ui->post['username'])) or (isset($ui->get['w']) and $ui->get['w']!='pr')) $logininclude=true;
|
||||
include(EASYWIDIR . '/stuff/vorlage.php');
|
||||
include(EASYWIDIR . '/stuff/class_validator.php');
|
||||
|
@ -36,129 +36,123 @@
|
||||
*/
|
||||
|
||||
if (isset($page_include)) {
|
||||
$default_language=$user_language;
|
||||
$reseller_id=0;
|
||||
if ($seo=='N') {
|
||||
$protection_link=$page_url.'/protectioncheck.php';
|
||||
} else {
|
||||
$protection_link=$page_url.'/'.$user_language.'/'.$page_category.'/';
|
||||
}
|
||||
$default_language = $user_language;
|
||||
$reseller_id = 0;
|
||||
$protection_link= ($seo == 'N') ? $page_url . '/protectioncheck.php' : $page_url . '/' . $user_language . '/' . $page_category . '/';
|
||||
} else {
|
||||
define('EASYWIDIR', dirname(__FILE__));
|
||||
if (is_dir(EASYWIDIR."/install")) die('Please remove the "install" folder');
|
||||
$logininclude=true;
|
||||
if (is_dir(EASYWIDIR."/install")) {
|
||||
die('Please remove the "install" folder');
|
||||
}
|
||||
$logininclude = true;
|
||||
include(EASYWIDIR . '/stuff/vorlage.php');
|
||||
include(EASYWIDIR . '/stuff/class_validator.php');
|
||||
include(EASYWIDIR . '/stuff/functions.php');
|
||||
include(EASYWIDIR . '/stuff/settings.php');
|
||||
$query="SELECT `language` FROM `settings` WHERE `resellerid`=0 LIMIT 1";
|
||||
foreach ($sql->query($query) as $row) {
|
||||
$default_language=$row['language'];
|
||||
if (!isset($user_language)) {
|
||||
$user_language = $rSA['language'];
|
||||
}
|
||||
if (!isset($user_language)) $user_language=$default_language;
|
||||
}
|
||||
if ($ui->escaped('email','post')!='') {
|
||||
if ($ui->escaped('email', 'post')!='') {
|
||||
$fullday=date('Y-m-d H:i:s',strtotime("+1 day"));
|
||||
$query=$sql->prepare("SELECT `id` FROM `badips` WHERE `badip`=? LIMIT 1");
|
||||
$query = $sql->prepare("SELECT `id` FROM `badips` WHERE `badip`=? LIMIT 1");
|
||||
$query->execute(array($loguserip));
|
||||
if ($query->rowCount()==0) {
|
||||
$query=$sql->prepare("INSERT INTO `badips` (`bantime`,`failcount`,`reason`,`badip`) VALUES (?,'1','bot',?)");
|
||||
$query = $sql->prepare("INSERT INTO `badips` (`bantime`,`failcount`,`reason`,`badip`) VALUES (?,'1','bot',?)");
|
||||
} else {
|
||||
$query=$sql->prepare("UPDATE `badips` SET `bantime`=?,`failcount`=`failcount`+1,`reason`='bot' WHERE `badip`=? LIMIT 1");
|
||||
$query = $sql->prepare("UPDATE `badips` SET `bantime`=?,`failcount`=`failcount`+1,`reason`='bot' WHERE `badip`=? LIMIT 1");
|
||||
}
|
||||
$query->execute(array($fullday,$loguserip));
|
||||
$query->execute(array($fullday, $loguserip));
|
||||
die('IP banned');
|
||||
}
|
||||
$sprache=getlanguagefile('gserver',$user_language,0);
|
||||
$ipvalue="111.111.111.111:27015";
|
||||
if ($ui->ipport('serveraddress','post') or (isset($server_ip) and isset($server_port))) {
|
||||
if ($ui->ipport('serveraddress','post')) {
|
||||
$serveraddress=$ui->ipport('serveraddress','post');
|
||||
$adresse_awk=explode(":",$serveraddress);
|
||||
$ip=$adresse_awk[0];
|
||||
$port=$adresse_awk[1];
|
||||
} else if (isset($server_ip) and isset($server_port)) {
|
||||
$ip=$server_ip;
|
||||
$port=$server_port;
|
||||
$serveraddress=$server_ip.":".$server_port;
|
||||
$sprache = getlanguagefile('gserver', $user_language, 0);
|
||||
$ipvalue = '111.111.111.111:27015';
|
||||
if ($ui->ipport('serveraddress', 'post') or ($ui->ip('ip', 'get') and $ui->port('po', 'get'))) {
|
||||
if ($ui->ipport('serveraddress', 'post')) {
|
||||
$serveraddress = $ui->ipport('serveraddress', 'post');
|
||||
$adresse_awk = explode(':', $serveraddress);
|
||||
$ip = $adresse_awk[0];
|
||||
$port = $adresse_awk[1];
|
||||
} else if ($ui->ip('ip', 'get') and $ui->port('po', 'get')) {
|
||||
$ip = $ui->ip('ip', 'get');
|
||||
$port = $ui->port('po', 'get');
|
||||
$serveraddress = $ip . ':' . $port;
|
||||
}
|
||||
if (isset($serveraddress)) $ipvalue=$serveraddress;
|
||||
if(isset($ip)) {
|
||||
$query=$sql->prepare("SELECT g.`protected`,g.`psince`,g.`queryName`,g.`queryNumplayers`,g.`queryMaxplayers`,g.`queryMap`,u.`cname`,t.`description` FROM `gsswitch` g INNER JOIN `userdata` u ON g.`userid`=u.`id` INNER JOIN `serverlist` s ON g.`serverid`=s.`id` INNER JOIN `servertypes` t ON s.`servertype`=t.`id` WHERE g.`serverip`=? AND g.`port`=? LIMIT 1");
|
||||
$query->execute(array($ip,$port));
|
||||
$logs=array();
|
||||
$xmllogs=array();
|
||||
if (isset($serveraddress)) {
|
||||
$ipvalue = $serveraddress;
|
||||
}
|
||||
if(isset($ip) and isset($port)) {
|
||||
$query = $sql->prepare("SELECT g.`protected`,g.`psince`,g.`queryName`,g.`queryNumplayers`,g.`queryMaxplayers`,g.`queryMap`,u.`cname`,t.`description` FROM `gsswitch` g INNER JOIN `userdata` u ON g.`userid`=u.`id` INNER JOIN `serverlist` s ON g.`serverid`=s.`id` INNER JOIN `servertypes` t ON s.`servertype`=t.`id` WHERE g.`serverip`=? AND g.`port`=? LIMIT 1");
|
||||
$query->execute(array($ip, $port));
|
||||
$logs = array();
|
||||
$xmllogs = array();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$protected=$row['protected'];
|
||||
$customer=$row['cname'];
|
||||
$psince=$row['psince'];
|
||||
$name=$row['queryName'];
|
||||
$numplayers=$row['queryNumplayers'];
|
||||
$maxplayers=$row['queryMaxplayers'];
|
||||
$map=$row['queryMap'];
|
||||
$type=$row['description'];
|
||||
$query=$sql->prepare("SELECT `useraction`,`logdate` FROM `userlog` WHERE `logdate`>? AND `username`=? AND `useraction` LIKE ?");
|
||||
$query->execute(array($psince,$customer,'%'.$serveraddress.'%'));
|
||||
$protected = $row['protected'];
|
||||
$customer = $row['cname'];
|
||||
$psince = $row['psince'];
|
||||
$name = $row['queryName'];
|
||||
$numplayers = $row['queryNumplayers'];
|
||||
$maxplayers = $row['queryMaxplayers'];
|
||||
$map = $row['queryMap'];
|
||||
$type = $row['description'];
|
||||
$query = $sql->prepare("SELECT `useraction`,`logdate` FROM `userlog` WHERE `logdate`>? AND `username`=? AND `useraction` LIKE ?");
|
||||
$query->execute(array($psince, $customer,'%'.$serveraddress.'%'));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$logentry=explode(" ", $row['useraction']);
|
||||
if (($logentry[1]=="%gserver%" or $logentry[1]=="%addon%") and ($logentry[0]!='%resync%' and $logentry[0]!='%mod%')) {
|
||||
if ($default_language=="de") {
|
||||
$logentry = explode(" ", $row['useraction']);
|
||||
if (($logentry[1] == '%gserver%' or $logentry[1] == '%addon%') and ($logentry[0]!='%resync%' and $logentry[0]!='%mod%')) {
|
||||
if ($default_language == 'de') {
|
||||
$time=explode(' ', $row['logdate']);
|
||||
$time2=explode('-', $time[0]);
|
||||
$time3=$time2[2].".".$time2[1].".".$time2[0]." ".$time[1];
|
||||
} else {
|
||||
$time3=$row['logdate'];
|
||||
}
|
||||
$placeholders1=array('%start%','%stop%'," $serveraddress",' %gserver%');
|
||||
$placeholders2=array('%start%','%stop%','%addon%','%del%','%add%',' %ok%'," $serveraddress",' %gserver%');
|
||||
$replace1=array('<img src="'.$page_url.'/images/16_restart.png" alt="start" />', '<img src="'.$page_url.'/images/16_stop.png" alt="stop" />','','');
|
||||
$replace2=array('(Re)Start','Stop','Addon','Delete','Add','','','');
|
||||
$replacedpics=str_replace($placeholders1,$replace1,$row['useraction']);
|
||||
$replacedwords=str_replace($placeholders2,$replace2,$row['useraction']);
|
||||
$placeholders1 = array('%start%', '%stop%', ' ' . $serveraddress, ' %gserver%');
|
||||
$placeholders2 = array('%start%', '%stop%', '%addon%', '%del%', '%add%', ' %ok%', ' ' . $serveraddress,' %gserver%');
|
||||
$replace1 = array('<img src="'.$page_url.'/images/16_restart.png" alt="start" />', '<img src="'.$page_url.'/images/16_stop.png" alt="stop" />', '', '');
|
||||
$replace2 = array('(Re)Start', 'Stop', 'Addon', 'Delete', 'Add', '', '', '');
|
||||
$replacedpics=str_replace($placeholders1, $replace1, $row['useraction']);
|
||||
$replacedwords=str_replace($placeholders2, $replace2, $row['useraction']);
|
||||
if (!empty($replacedpics)) {
|
||||
if ($logentry[1]=="%gserver%") {
|
||||
$logs[]="$replacedpics: $time3";
|
||||
if ($logentry[1] == '%gserver%') {
|
||||
$logs[] = $replacedpics . ': ' . $time3;
|
||||
}
|
||||
$xmllogs[$time3]="$replacedwords";
|
||||
$xmllogs[$time3] = $replacedwords;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($default_language=="de") {
|
||||
$since=date('d.m.Y H:i:s',strtotime($psince));
|
||||
} else {
|
||||
$since=$psince;
|
||||
}
|
||||
$since = ($default_language == 'de') ? date('d.m.Y H:i:s',strtotime($psince)) : $psince;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isset($protected)) {
|
||||
$imgName='64_protected_unknown';
|
||||
$imgAlt='unknown';
|
||||
} else if ($protected=="N") {
|
||||
$imgName='64_unprotected';
|
||||
$imgAlt='unprotected';
|
||||
} else if ($protected=="Y") {
|
||||
$imgName='64_protected';
|
||||
$imgAlt='protected';
|
||||
$imgName = '64_protected_unknown';
|
||||
$imgAlt = 'unknown';
|
||||
} else if ($protected == 'N') {
|
||||
$imgName = '64_unprotected';
|
||||
$imgAlt = 'unprotected';
|
||||
} else if ($protected == 'Y') {
|
||||
$imgName = '64_protected';
|
||||
$imgAlt = 'protected';
|
||||
}
|
||||
if ($ui->ipport('serveraddress','post')) {
|
||||
if ($ui->ipport('serveraddress', 'post')) {
|
||||
if (isset($page_include)) {
|
||||
$template_file='page_protectioncheck.tpl';
|
||||
$template_file = 'page_protectioncheck.tpl';
|
||||
} else {
|
||||
if (file_exists(EASYWIDIR . '/template/'.$template_to_use.'/protectioncheck.tpl')) {
|
||||
include(EASYWIDIR . '/template/'.$template_to_use.'/protectioncheck.tpl');
|
||||
if (file_exists(EASYWIDIR . '/template/' . $template_to_use . '/protectioncheck.tpl')) {
|
||||
include(EASYWIDIR . '/template/' . $template_to_use . '/protectioncheck.tpl');
|
||||
} else if (file_exists(EASYWIDIR . '/template/default/protectioncheck.tpl')) {
|
||||
include(EASYWIDIR . '/template/default/protectioncheck.tpl');
|
||||
} else {
|
||||
include(EASYWIDIR . '/template/protectioncheck.tpl');
|
||||
}
|
||||
}
|
||||
} else if (!isset($page_include) and isset($server_ip) and isset($server_port)) {
|
||||
if (isset($get_gamestring) and $get_gamestring == 'xml') {
|
||||
} else if (!isset($page_include) and $ui->ip('ip', 'get') and $ui->port('po', 'get')) {
|
||||
if ($ui->username('gamestring', 50, 'get') == 'xml') {
|
||||
if (!isset($protected)) {
|
||||
echo "unknown";
|
||||
} else if ($protected=="N") {
|
||||
$pstatus="no";
|
||||
echo 'unknown';
|
||||
} else if ($protected == 'N') {
|
||||
$pstatus = 'no';
|
||||
$xml=<<<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE status>
|
||||
@ -174,7 +168,7 @@ if ($ui->ipport('serveraddress','post')) {
|
||||
XML;
|
||||
header("Content-type: text/xml; charset=UTF-8");
|
||||
echo $xml;
|
||||
} else if ($protected=="Y") {
|
||||
} else if ($protected == 'Y') {
|
||||
$pstatus="yes";
|
||||
$xml='<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<!DOCTYPE status>
|
||||
@ -202,27 +196,27 @@ XML;
|
||||
}
|
||||
} else {
|
||||
if (!isset($protected)) {
|
||||
echo "unknown";
|
||||
} else if ($protected=="N") {
|
||||
echo "no";
|
||||
} else if ($protected=="Y") {
|
||||
echo "yes";
|
||||
echo 'unknown';
|
||||
} else if ($protected == 'N') {
|
||||
echo 'no';
|
||||
} else if ($protected == 'Y') {
|
||||
echo 'yes';
|
||||
}
|
||||
}
|
||||
} else if (isset($page_include)) {
|
||||
|
||||
// https://github.com/easy-wi/developer/issues/62
|
||||
$langLinks=array();
|
||||
$langLinks = array();
|
||||
foreach ($languages as $l) {
|
||||
$tempLanguage=getlanguagefile('page',$l,0);
|
||||
$langLinks[$l]=($page_data->seo=='Y') ? szrp($tempLanguage->$s) : '?s='.$s;
|
||||
$tempLanguage = getlanguagefile('page', $l, 0);
|
||||
$langLinks[$l] = ($page_data->seo=='Y') ? szrp($tempLanguage->$s) : '?s='.$s;
|
||||
}
|
||||
$page_data->langLinks($langLinks);
|
||||
|
||||
$template_file='page_protectioncheck.tpl';
|
||||
$template_file = 'page_protectioncheck.tpl';
|
||||
} else {
|
||||
if (file_exists(EASYWIDIR . '/template/'.$template_to_use.'/protectioncheck.tpl')) {
|
||||
include(EASYWIDIR . '/template/'.$template_to_use.'/protectioncheck.tpl');
|
||||
if (file_exists(EASYWIDIR . '/template/' . $template_to_use . '/protectioncheck.tpl')) {
|
||||
include(EASYWIDIR . '/template/' . $template_to_use . '/protectioncheck.tpl');
|
||||
} else if (file_exists(EASYWIDIR . '/template/default/protectioncheck.tpl')) {
|
||||
include(EASYWIDIR . '/template/default/protectioncheck.tpl');
|
||||
} else {
|
||||
|
@ -133,8 +133,8 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
||||
|
||||
# https://github.com/easy-wi/developer/issues/70
|
||||
$sshkey=removePub($row2['keyname']);
|
||||
$pubkey=EASYWIDIR.'/keys/'.$sshkey.'.pub';
|
||||
$key=EASYWIDIR.'/keys/'.$sshkey;
|
||||
$pubkey=EASYWIDIR . '/keys/'.$sshkey.'.pub';
|
||||
$key=EASYWIDIR . '/keys/'.$sshkey;
|
||||
|
||||
if (file_exists($pubkey) and file_exists($key)) {
|
||||
$ssh2= @ssh2_connect($queryip,$row2['decryptedssh2port'],array('hostkey'=>'ssh-rsa'));
|
||||
|
@ -58,16 +58,16 @@ if ($ui->smallletters('w',5,'get')=='check') {
|
||||
$return='bad';
|
||||
if ($ui->w('method',40,'get')) {
|
||||
$method=$ui->w('method',40,'get');
|
||||
if ($ui->id('length',255,'get') and $ui->$method('check',$ui->id('length',255,'get'),'get')) $return='ok';
|
||||
if ($ui->id('length',255,'get') and $ui->$method('check', $ui->id('length',255,'get'),'get')) $return='ok';
|
||||
else if ($ui->$method('check','get')) $return='ok';
|
||||
}
|
||||
echo $return;
|
||||
} else if ($die==true) {
|
||||
redirect('login.php');
|
||||
} else if ($ui->username('mapgroup','50','get')) {
|
||||
$sprache=getlanguagefile('gserver',$user_language,$reseller_id);
|
||||
$query=$sql->prepare("SELECT `mapGroup` FROM `servertypes` WHERE `shorten`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($ui->username('mapgroup','50','get'),$reseller_id));
|
||||
$sprache=getlanguagefile('gserver', $user_language, $reseller_id);
|
||||
$query = $sql->prepare("SELECT `mapGroup` FROM `servertypes` WHERE `shorten`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($ui->username('mapgroup','50','get'), $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if ($row['mapGroup']!=null) {
|
||||
$mapGroup=$row['mapGroup'];
|
||||
@ -75,12 +75,12 @@ if ($ui->smallletters('w',5,'get')=='check') {
|
||||
}
|
||||
}
|
||||
} else if ($ui->id('id',19,'get') and $ui->st('d','get')=="vs" and ($pa['addvserver'] or $pa['root'])) {
|
||||
$sprache=getlanguagefile('reseller',$user_language,$reseller_id);
|
||||
$sprache=getlanguagefile('reseller', $user_language, $reseller_id);
|
||||
if ($reseller_id!=0 and $admin_id!=$reseller_id) {
|
||||
$reseller_id=$admin_id;
|
||||
$notexclusive=true;
|
||||
}
|
||||
$query=$sql->prepare("SELECT `id`,`cpu`,`active`,`ip`,`esxi`,`description`,`cores`,`mhz`,`hdd`,`ram`,`maxserver`,`thin`,`thinquota` FROM `virtualhosts` WHERE `id`=?");
|
||||
$query = $sql->prepare("SELECT `id`,`cpu`,`active`,`ip`,`esxi`,`description`,`cores`,`mhz`,`hdd`,`ram`,`maxserver`,`thin`,`thinquota` FROM `virtualhosts` WHERE `id`=?");
|
||||
$query2=$sql->prepare("SELECT `cores`,`minmhz`,`hddsize`,`mountpoint`,`minram` FROM `virtualcontainer` WHERE hostid=?");
|
||||
$query->execute(array($ui->id('id',19,'get')));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
@ -165,8 +165,8 @@ if ($ui->smallletters('w',5,'get')=='check') {
|
||||
} else if ($ui->st('d','get')=="ui" and $ui->id('id',19,'get')) {
|
||||
foreach (freeips($ui->id('id',19,'get')) as $ip) echo $ip."<br />";
|
||||
} else if ($ui->st('d','get')=="my" and $ui->id('id',19,'get')) {
|
||||
$query=$sql->prepare("SELECT s.`ip`,s.`max_databases`,COUNT(d.`id`) AS `installed` FROM `mysql_external_servers` s LEFT JOIN `mysql_external_dbs` d ON s.`id`=d.`sid` WHERE s.`id`=? AND s.`active`='Y' AND s.`resellerid`=? LIMIT 1");
|
||||
$query->execute(array($ui->id('id',19,'get'),$reseller_id));
|
||||
$query = $sql->prepare("SELECT s.`ip`,s.`max_databases`,COUNT(d.`id`) AS `installed` FROM `mysql_external_servers` s LEFT JOIN `mysql_external_dbs` d ON s.`id`=d.`sid` WHERE s.`id`=? AND s.`active`='Y' AND s.`resellerid`=? LIMIT 1");
|
||||
$query->execute(array($ui->id('id',19,'get'), $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$installed=$row['installed'];
|
||||
$max_databases=$row['max_databases'];
|
||||
@ -179,14 +179,14 @@ if ($ui->smallletters('w',5,'get')=='check') {
|
||||
} else if ($ui->st('d','get')=="tr" and $ui->st('w','get')) {
|
||||
if ($ui->st('w','get')=="su") {
|
||||
if ($reseller_id==0) {
|
||||
$query=$sql->prepare("SELECT `ips` FROM `resellerdata`");
|
||||
$query = $sql->prepare("SELECT `ips` FROM `resellerdata`");
|
||||
$query->execute();
|
||||
} else if ($reseller_id==$admin_id) {
|
||||
$query=$sql->prepare("SELECT `ips` FROM `resellerdata` WHERE `resellersid`=?");
|
||||
$query = $sql->prepare("SELECT `ips` FROM `resellerdata` WHERE `resellersid`=?");
|
||||
$query->execute(array($reseller_id));
|
||||
} else {
|
||||
$query=$sql->prepare("SELECT `ips` FROM `resellerdata` WHERE `resellerid`=? AND c.`resellersid`=?");
|
||||
$query->execute(array($admin_id,$reseller_id));
|
||||
$query = $sql->prepare("SELECT `ips` FROM `resellerdata` WHERE `resellerid`=? AND c.`resellersid`=?");
|
||||
$query->execute(array($admin_id, $reseller_id));
|
||||
}
|
||||
$ips=array();
|
||||
$userips=array();
|
||||
@ -194,7 +194,7 @@ if ($ui->smallletters('w',5,'get')=='check') {
|
||||
unset($userips);
|
||||
$userips=ipstoarray($row['ips']);
|
||||
foreach ($userips as $ip) {
|
||||
$ip_ex=explode(".",$ip);
|
||||
$ip_ex=explode(".", $ip);
|
||||
$ips[]=$ip_ex[0].".".$ip_ex[1].".".$ip_ex[2].".";
|
||||
}
|
||||
}
|
||||
@ -205,16 +205,16 @@ if ($ui->smallletters('w',5,'get')=='check') {
|
||||
}
|
||||
} else if ($ui->st('w','get')=="rs") {
|
||||
if ($reseller_id==0) {
|
||||
$query=$sql->prepare("SELECT `id`,`cname` FROM `userdata` WHERE `accounttype`='r' AND `id`=`resellerid`");
|
||||
$query = $sql->prepare("SELECT `id`,`cname` FROM `userdata` WHERE `accounttype`='r' AND `id`=`resellerid`");
|
||||
$query->execute();
|
||||
}
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $data[]='<option value='.$row['id'].'>'.$row['cname'].'</option>';
|
||||
} else if ($ui->st('w','get')=="us") {
|
||||
if ($reseller_id==0) {
|
||||
$query=$sql->prepare("SELECT `id`,`cname` FROM `userdata` WHERE `accounttype`='r'");
|
||||
$query = $sql->prepare("SELECT `id`,`cname` FROM `userdata` WHERE `accounttype`='r'");
|
||||
$query->execute();
|
||||
} else if ($reseller_id==$admin_id) {
|
||||
$query=$sql->prepare("SELECT `id`,`cname` FROM `userdata` WHERE `accounttype`='r' AND `resellerid`=?");
|
||||
$query = $sql->prepare("SELECT `id`,`cname` FROM `userdata` WHERE `accounttype`='r' AND `resellerid`=?");
|
||||
$query->execute(array($reseller_id));
|
||||
}
|
||||
foreach ($pselect->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
@ -222,27 +222,27 @@ if ($ui->smallletters('w',5,'get')=='check') {
|
||||
}
|
||||
} else if ($ui->st('w','get')=="se") {
|
||||
if ($reseller_id==0) {
|
||||
$query=$sql->prepare("SELECT c.`id`,u.`cname` FROM `virtualcontainer` c LEFT JOIN `userdata` u ON c.`userid`=u.`id` ORDER BY u.`id`,c.`id`");
|
||||
$query = $sql->prepare("SELECT c.`id`,u.`cname` FROM `virtualcontainer` c LEFT JOIN `userdata` u ON c.`userid`=u.`id` ORDER BY u.`id`,c.`id`");
|
||||
$query->execute();
|
||||
} else if ($reseller_id==$admin_id){
|
||||
$query=$sql->prepare("SELECT c.`id`,u.`cname` FROM `virtualcontainer` c LEFT JOIN `userdata` u ON c.`userid`=u.`id` WHERE c.`resellerid`=? ORDER BY u.`id`,c.`id`");
|
||||
$query = $sql->prepare("SELECT c.`id`,u.`cname` FROM `virtualcontainer` c LEFT JOIN `userdata` u ON c.`userid`=u.`id` WHERE c.`resellerid`=? ORDER BY u.`id`,c.`id`");
|
||||
$query->execute(array($reseller_id));
|
||||
} else {
|
||||
$query=$sql->prepare("SELECT c.`id`,u.`cname` FROM `virtualcontainer` c LEFT JOIN `userdata` u ON c.`userid`=u.`id` WHERE c.`userid`=? AND c.`resellerid`=? ORDER BY u.`id`,c.`id`");
|
||||
$query->execute(array($admin_id,$reseller_id));
|
||||
$query = $sql->prepare("SELECT c.`id`,u.`cname` FROM `virtualcontainer` c LEFT JOIN `userdata` u ON c.`userid`=u.`id` WHERE c.`userid`=? AND c.`resellerid`=? ORDER BY u.`id`,c.`id`");
|
||||
$query->execute(array($admin_id, $reseller_id));
|
||||
}
|
||||
foreach ($pselect->fetchAll(PDO::FETCH_ASSOC) as $row) $data[]='<option value='.$row['id'].'>'.$row['cname'].'-'.$row['id'].'</option>';
|
||||
} else if ($ui->st('w','get')=="ip") {
|
||||
$userips=array();
|
||||
if ($reseller_id==0) {
|
||||
$query=$sql->prepare("SELECT `ips` FROM `resellerdata`");
|
||||
$query = $sql->prepare("SELECT `ips` FROM `resellerdata`");
|
||||
$query->execute();
|
||||
} else if ($reseller_id==$admin_id) {
|
||||
$query=$sql->prepare("SELECT `ips` FROM `resellerdata` WHERE `resellersid`=?");
|
||||
$query = $sql->prepare("SELECT `ips` FROM `resellerdata` WHERE `resellersid`=?");
|
||||
$query->execute(array($reseller_id));
|
||||
} else {
|
||||
$query=$sql->prepare("SELECT `ips` FROM `resellerdata` WHERE `resellerid`=? AND c.`resellersid`=?");
|
||||
$query->execute(array($admin_id,$reseller_id));
|
||||
$query = $sql->prepare("SELECT `ips` FROM `resellerdata` WHERE `resellerid`=? AND c.`resellersid`=?");
|
||||
$query->execute(array($admin_id, $reseller_id));
|
||||
}
|
||||
$ips=array();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
@ -255,25 +255,25 @@ if ($ui->smallletters('w',5,'get')=='check') {
|
||||
require_once IncludeTemplate($template_to_use,'ajax_admin_traffic.tpl');
|
||||
} else if ($ui->st('d','get')=="vu" and $ui->st('w','get')) {
|
||||
if ($ui->st('w','get')=="us") {
|
||||
$query=$sql->prepare("SELECT u.`id`,u.`cname`,u.`vname`,u.`name` FROM `userdata` u INNER JOIN `voice_server` v ON u.`id`=v.`userid` AND v.`active`='Y' WHERE u.`resellerid`=? GROUP BY u.`id`");
|
||||
$query = $sql->prepare("SELECT u.`id`,u.`cname`,u.`vname`,u.`name` FROM `userdata` u INNER JOIN `voice_server` v ON u.`id`=v.`userid` AND v.`active`='Y' WHERE u.`resellerid`=? GROUP BY u.`id`");
|
||||
$query->execute(array($reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $data[]='<option value='.$row['id'].'>'.trim($row['cname'].' '.$row['vname'].' '.$row['name']).'</option>';
|
||||
} else if ($ui->st('w','get')=="se") {
|
||||
$query=$sql->prepare("SELECT v.`id`,v.`ip`,v.`port`,v.`dns`,m.`usedns` FROM `voice_server` v LEFT JOIN `voice_masterserver` m ON v.`masterserver`=m.`id` WHERE v.`resellerid`=? ORDER BY v.`ip`,v.`port`");
|
||||
$query = $sql->prepare("SELECT v.`id`,v.`ip`,v.`port`,v.`dns`,m.`usedns` FROM `voice_server` v LEFT JOIN `voice_masterserver` m ON v.`masterserver`=m.`id` WHERE v.`resellerid`=? ORDER BY v.`ip`,v.`port`");
|
||||
$query->execute(array($reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$server=$row['ip'].':'.$row['port'];
|
||||
$data[]='<option value='.$row['id'].'>'.$server.'</option>';
|
||||
}
|
||||
} else if ($ui->st('w','get')=="ma") {
|
||||
$query=$sql->prepare("SELECT `id`,`ssh2ip` FROM `voice_masterserver` WHERE `resellerid`=? ORDER BY `ssh2ip`");
|
||||
$query = $sql->prepare("SELECT `id`,`ssh2ip` FROM `voice_masterserver` WHERE `resellerid`=? ORDER BY `ssh2ip`");
|
||||
$query->execute(array($reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $data[]='<option value='.$row['id'].'>'.$row['ssh2ip'].'</option>';
|
||||
}
|
||||
require_once IncludeTemplate($template_to_use,'ajax_admin_voice_stats.tpl');
|
||||
} else if ($ui->username('distro','50','get') and $ui->id('id',19,'get') and ($pa['vserversettings'] or $pa['root']) and $reseller_id==0) {
|
||||
$pselect=$sql->prepare("SELECT `pxeautorun` FROM `resellerimages` WHERE `bitversion`=? AND `distro`=?");
|
||||
$pselect->execute(array($ui->id('id',19,'get'),$ui->username('distro','50','get')));
|
||||
$pselect->execute(array($ui->id('id',19,'get'), $ui->username('distro','50','get')));
|
||||
$usedpxeautorun=array();
|
||||
foreach ($pselect->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$usedpxeautorun[]=$row['pxeautorun'];
|
||||
@ -297,19 +297,19 @@ if ($ui->smallletters('w',5,'get')=='check') {
|
||||
</select>
|
||||
<?php
|
||||
} else if (($ui->username('short','50','get') or $ui->username('shorten','50','get')) and $pa['restart']) {
|
||||
$sprache=getlanguagefile('gserver',$user_language,$reseller_id);
|
||||
$sprache=getlanguagefile('gserver', $user_language, $reseller_id);
|
||||
if ($reseller_id!=0 and $admin_id!=$reseller_id) {
|
||||
$reseller_id=$admin_id;
|
||||
}
|
||||
$get_shorten=$ui->username('shorten','50','get');
|
||||
if ($ui->username('short','50','get')) {
|
||||
$get_shorten=$ui->username('shorten', 50,'get');
|
||||
if ($ui->username('short', 50,'get')) {
|
||||
$get_shorten=$get_short;
|
||||
}
|
||||
$query=$sql->prepare("SELECT `id` FROM `eac` WHERE `active`='Y' AND `resellerid`=? LIMIT 1");
|
||||
$query = $sql->prepare("SELECT `id` FROM `eac` WHERE `active`='Y' AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($reseller_id));
|
||||
$count=$query->rowCount();
|
||||
$query2=$sql->prepare("SELECT `qstat` FROM `servertypes` WHERE `shorten`=? AND `resellerid`=? LIMIT 1");
|
||||
$query2->execute(array($get_shorten,$reseller_id));
|
||||
$query2->execute(array($get_shorten, $reseller_id));
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
$qstat=$row2['qstat'];
|
||||
if ($qstat=="a2s" or $qstat=="hla2s") {
|
||||
@ -339,23 +339,23 @@ if ($ui->smallletters('w',5,'get')=='check') {
|
||||
</select>
|
||||
<?php
|
||||
} else if ($ui->username('gamestring','50','get') and $ui->id('id',19,'get') and ($pa['roots'] or $pa['root'])) {
|
||||
$sprache=getlanguagefile('roots',$user_language,$reseller_id);
|
||||
$sprache=getlanguagefile('roots', $user_language, $reseller_id);
|
||||
if ($reseller_id!=0 and $admin_id!=$reseller_id) {
|
||||
$reseller_id=$admin_id;
|
||||
}
|
||||
include(EASYWIDIR . '/stuff/ssh_exec.php');
|
||||
include(EASYWIDIR . '/stuff/class_masterserver.php');
|
||||
include(EASYWIDIR . '/stuff/keyphrasefile.php');
|
||||
$rootServer=new masterServer($ui->id('id',10,'get'),$aeskey);
|
||||
$games=explode("_",$ui->username('gamestring','50','get'));
|
||||
$rootServer=new masterServer($ui->id('id',10,'get'), $aeskey);
|
||||
$games=explode("_", $ui->username('gamestring','50','get'));
|
||||
$i=1;
|
||||
$gamelist=array();
|
||||
$count=count($games);
|
||||
while ($i<$count) {
|
||||
if ($games[$i]!='' and !in_array($games[$i],$gamelist)) {
|
||||
if ($games[$i]!='' and !in_array($games[$i], $gamelist)) {
|
||||
$gamelist[]=$games[$i];
|
||||
$query=$sql->prepare("SELECT `id` FROM `servertypes` WHERE `shorten`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($games[$i],$reseller_id));
|
||||
$query = $sql->prepare("SELECT `id` FROM `servertypes` WHERE `shorten`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($games[$i], $reseller_id));
|
||||
$typeID=$query->fetchColumn();
|
||||
$rootServer->collectData($typeID,true);
|
||||
}
|
||||
@ -365,17 +365,17 @@ if ($ui->smallletters('w',5,'get')=='check') {
|
||||
if ($rootServer->sshcmd===null) {
|
||||
echo 'Nothing to update/sync!';
|
||||
} else {
|
||||
if (ssh2_execute('gs',$ui->id('id',10,'get'),$rootServer->sshcmd)===false) {
|
||||
echo $sprache->error_root_updatemaster." ( ".implode(", ",$gamelist)." ) ( $start )";
|
||||
if (ssh2_execute('gs', $ui->id('id',10,'get'), $rootServer->sshcmd)===false) {
|
||||
echo $sprache->error_root_updatemaster." ( ".implode(", ", $gamelist)." ) ( $start )";
|
||||
} else {
|
||||
$rootServer->setUpdating();
|
||||
echo $sprache->root_updatemaster." ( ".implode(", ",$gamelist)." )";
|
||||
echo $sprache->root_updatemaster." ( ".implode(", ", $gamelist)." )";
|
||||
}
|
||||
}
|
||||
} else if (($pa['voiceserver'] or $pa['voiceserver']) and $ui->st('d','get')=="vo" and $ui->id('id',19,'get')) {
|
||||
$sprache=getlanguagefile('voice',$user_language,$reseller_id);
|
||||
$query=$sql->prepare("SELECT m.`maxserver`,COUNT(v.`id`) AS `installedserver`,m.`maxslots`,SUM(v.`slots`) AS `installedslots`,SUM(v.`usedslots`) AS `uslots` FROM `voice_masterserver` m LEFT JOIN `voice_server` v ON m.`id`=v.`masterserver` WHERE m.`id`=? AND m.`resellerid`=? LIMIT 1");
|
||||
$query->execute(array($ui->id('id',19,'get'),$reseller_id));
|
||||
$sprache=getlanguagefile('voice', $user_language, $reseller_id);
|
||||
$query = $sql->prepare("SELECT m.`maxserver`,COUNT(v.`id`) AS `installedserver`,m.`maxslots`,SUM(v.`slots`) AS `installedslots`,SUM(v.`usedslots`) AS `uslots` FROM `voice_masterserver` m LEFT JOIN `voice_server` v ON m.`id`=v.`masterserver` WHERE m.`id`=? AND m.`resellerid`=? LIMIT 1");
|
||||
$query->execute(array($ui->id('id',19,'get'), $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if ($row['installedserver']==null) {
|
||||
$installedserver='0';
|
||||
@ -395,7 +395,7 @@ if ($ui->smallletters('w',5,'get')=='check') {
|
||||
require_once IncludeTemplate($template_to_use,'ajax_admin_voiceserver_usage.tpl');
|
||||
}
|
||||
} else if ($pa['gserver'] and $ui->st('d','get')!="vs" and $ui->st('d','get')!="vo" and ($ui->id('id',19,'get') or $ui->ip('ip','get'))) {
|
||||
$sprache=getlanguagefile('gserver',$user_language,$reseller_id);
|
||||
$sprache=getlanguagefile('gserver', $user_language, $reseller_id);
|
||||
if ($reseller_id!=0 and $admin_id!=$reseller_id) {
|
||||
$reseller_id=$admin_id;
|
||||
}
|
||||
@ -405,14 +405,14 @@ if ($ui->smallletters('w',5,'get')=='check') {
|
||||
$installedserver=0;
|
||||
$maxserver=0;
|
||||
$maxslots=0;
|
||||
$query=$sql->prepare("SELECT `maxslots`,`maxserver` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($ui->id('id',19,'get'),$reseller_id));
|
||||
$query = $sql->prepare("SELECT `maxslots`,`maxserver` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($ui->id('id',19,'get'), $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$maxslots=$row['maxslots'];
|
||||
$maxserver=$row['maxserver'];
|
||||
}
|
||||
$query=$sql->prepare("SELECT `slots`,`queryNumplayers` FROM `gsswitch` WHERE `rootID`=? AND `resellerid`=? AND `active`='Y'");
|
||||
$query->execute(array($ui->id('id',19,'get'),$reseller_id));
|
||||
$query = $sql->prepare("SELECT `slots`,`queryNumplayers` FROM `gsswitch` WHERE `rootID`=? AND `resellerid`=? AND `active`='Y'");
|
||||
$query->execute(array($ui->id('id',19,'get'), $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$used+=$row['queryNumplayers'];
|
||||
$max+=$row['slots'];
|
||||
@ -420,8 +420,8 @@ if ($ui->smallletters('w',5,'get')=='check') {
|
||||
}
|
||||
require_once IncludeTemplate($template_to_use,'ajax_admin_gserver_usage.tpl');
|
||||
} else if ($ui->ip('ip','get') and $ui->st('d','get')!="vs") {
|
||||
$query=$sql->prepare("SELECT `port`,`port2`,`port3`,`port4`,`port5` FROM `gsswitch` WHERE `serverip`=? AND `resellerid`=? ORDER BY `port`");
|
||||
$query->execute(array($ui->ip('ip','get'),$reseller_id));
|
||||
$query = $sql->prepare("SELECT `port`,`port2`,`port3`,`port4`,`port5` FROM `gsswitch` WHERE `serverip`=? AND `resellerid`=? ORDER BY `port`");
|
||||
$query->execute(array($ui->ip('ip','get'), $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if (port($row['port'])){
|
||||
$ports[]=$row['port'];
|
||||
@ -439,7 +439,7 @@ if ($ui->smallletters('w',5,'get')=='check') {
|
||||
$ports[]=$row['port5'];
|
||||
}
|
||||
}
|
||||
$query=$sql->prepare("SELECT `port` FROM `voice_server` WHERE `ip`=?");
|
||||
$query = $sql->prepare("SELECT `port` FROM `voice_server` WHERE `ip`=?");
|
||||
$query->execute(array($ui->ip('ip','get')));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if (port($row['port'])){
|
||||
@ -455,7 +455,7 @@ if ($ui->smallletters('w',5,'get')=='check') {
|
||||
}
|
||||
require_once IncludeTemplate($template_to_use,'ajax_admin_gserver_ports.tpl');
|
||||
}
|
||||
} else if (($pa['usertickets'] or $pa['usertickets']) and isset($server_port) and ($ui->st('d','get')=='ut' or $ui->st('d','get')=='rt')) {
|
||||
} else if (($pa['usertickets'] or $pa['usertickets']) and $ui->port('po', 'get') and ($ui->st('d','get')=='ut' or $ui->st('d','get')=='rt')) {
|
||||
if ($reseller_id!=0 and $admin_id==$reseller_id and $ui->st('d','get')=='rt') {
|
||||
$resellerid=0;
|
||||
} else if ($reseller_id!=0 and $admin_id!=$reseller_id and $ui->st('d','get')=='rt') {
|
||||
@ -465,24 +465,24 @@ if ($ui->smallletters('w',5,'get')=='check') {
|
||||
}
|
||||
$table=array();
|
||||
if (isset($resellerid)) {
|
||||
$query=$sql->prepare("SELECT `language` FROM `settings` WHERE `resellerid`=? LIMIT 1");
|
||||
$query = $sql->prepare("SELECT `language` FROM `settings` WHERE `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($resellerid));
|
||||
$default_language=$query->fetchColumn();
|
||||
$query=$sql->prepare("SELECT * FROM `ticket_topics` WHERE `maintopic`=? AND `maintopic`!=`id` AND `resellerid`=? ORDER BY `id`");
|
||||
$query->execute(array($server_port,$resellerid));
|
||||
$query = $sql->prepare("SELECT * FROM `ticket_topics` WHERE `maintopic`=? AND `maintopic`!=`id` AND `resellerid`=? ORDER BY `id`");
|
||||
$query->execute(array($ui->port('po', 'get'), $resellerid));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$topic='';
|
||||
$pselect3=$sql->prepare("SELECT `text` FROM `translations` WHERE `type`='ti' AND `lang`=? AND `transID`=? AND `resellerID`=? LIMIT 1");
|
||||
$pselect3->execute(array($user_language,$row['id'],$resellerid));
|
||||
$pselect3->execute(array($user_language, $row['id'], $resellerid));
|
||||
$topic=$pselect3->fetchColumn();
|
||||
if (empty($topic)) {
|
||||
$pselect3->execute(array($default_language,$row['id'],$resellerid));
|
||||
$pselect3->execute(array($default_language, $row['id'], $resellerid));
|
||||
$topic=$pselect3->fetchColumn();
|
||||
}
|
||||
if (empty($topic)) $topic=$row['topic'];
|
||||
$table[]=array('id'=>$row['id'],'topic'=>$topic);
|
||||
}
|
||||
$ticketTemplate=($ui->id('r',1,'get')!=1) ? 'ajax_userpanel_ticket_category.tpl' : 'ajax_admin_reseller_ticket_category.tpl';
|
||||
require_once IncludeTemplate($template_to_use,$ticketTemplate);
|
||||
require_once IncludeTemplate($template_to_use, $ticketTemplate);
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* File: serverlog.php.
|
||||
* Author: Ulrich Block
|
||||
@ -44,14 +45,14 @@ if (!isset($user_id) and !isset($admin_id)) {
|
||||
header('Location: login.php');
|
||||
die('Please allow redirection');
|
||||
}
|
||||
if (isset($server_id)) {
|
||||
if ($ui->id('id', 19, 'get')) {
|
||||
include(EASYWIDIR . '/stuff/keyphrasefile.php');
|
||||
if ($reseller_id!="0" and $admin_id!=$reseller_id) {
|
||||
$reseller_id=$admin_id;
|
||||
}
|
||||
if(isset($admin_id)) {
|
||||
$query=$sql->prepare("SELECT u.`id`,u.`cname` FROM `gsswitch` g LEFT JOIN `userdata` u ON g.`userid`=u.`id` WHERE g.`id`=? AND g.`resellerid`=? LIMIT 1");
|
||||
$query->execute(array($server_id,$reseller_id));
|
||||
$query->execute(array($ui->id('id', 19, 'get'),$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$username=$row['cname'];
|
||||
$user_id=$row['id'];
|
||||
|
@ -702,8 +702,8 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
||||
|
||||
# https://github.com/easy-wi/developer/issues/70
|
||||
$sshkey=removePub($vrow['keyname']);
|
||||
$pubkey=EASYWIDIR.'/keys/'.$sshkey.'.pub';
|
||||
$key=EASYWIDIR.'/keys/'.$sshkey;
|
||||
$pubkey=EASYWIDIR . '/keys/'.$sshkey.'.pub';
|
||||
$key=EASYWIDIR . '/keys/'.$sshkey;
|
||||
|
||||
$ssh2=(file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($queryip,$vrow['decryptedssh2port'],array('hostkey'=>'ssh-rsa')) : false;
|
||||
} else {
|
||||
|
@ -259,8 +259,8 @@ class rootServer {
|
||||
|
||||
# https://github.com/easy-wi/developer/issues/70
|
||||
$sshkey=removePub($v['keyname']);
|
||||
$pubkey=EASYWIDIR.'/keys/'.$sshkey.'.pub';
|
||||
$key=EASYWIDIR.'/keys/'.$sshkey;
|
||||
$pubkey=EASYWIDIR . '/keys/'.$sshkey.'.pub';
|
||||
$key=EASYWIDIR . '/keys/'.$sshkey;
|
||||
|
||||
$ssh2=(file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($v['ip'],$v['port'],array('hostkey'=>'ssh-rsa')) : false;
|
||||
} else {
|
||||
@ -321,8 +321,8 @@ class rootServer {
|
||||
|
||||
# https://github.com/easy-wi/developer/issues/70
|
||||
$sshkey=removePub($v['keyname']);
|
||||
$pubkey=EASYWIDIR.'/keys/'.$sshkey.'.pub';
|
||||
$key=EASYWIDIR.'/keys/'.$sshkey;
|
||||
$pubkey=EASYWIDIR . '/keys/'.$sshkey.'.pub';
|
||||
$key=EASYWIDIR . '/keys/'.$sshkey;
|
||||
|
||||
$ssh2=(file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($v['ip'],$v['port'],array('hostkey'=>'ssh-rsa')) : false;
|
||||
} else {
|
||||
@ -455,8 +455,8 @@ class rootServer {
|
||||
|
||||
# https://github.com/easy-wi/developer/issues/70
|
||||
$sshkey=removePub($this->vmwareHosts[$hID['hostID']]['vmIDs']['keyname']);
|
||||
$pubkey=EASYWIDIR.'/keys/'.$sshkey.'.pub';
|
||||
$key=EASYWIDIR.'/keys/'.$sshkey;
|
||||
$pubkey=EASYWIDIR . '/keys/'.$sshkey.'.pub';
|
||||
$key=EASYWIDIR . '/keys/'.$sshkey;
|
||||
|
||||
$ssh2=(file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($this->vmwareHosts[$hID]['vmIDs']['ip'],$this->vmwareHosts[$hID]['vmIDs']['dport'],array('hostkey'=>'ssh-rsa')) : false;
|
||||
} else {
|
||||
|
@ -591,8 +591,8 @@ function tsbackup ($action,$sship,$sshport,$sshuser,$keyuse,$sshkey,$sshpw,$noti
|
||||
if ($keyuse=="Y") {
|
||||
# https://github.com/easy-wi/developer/issues/70
|
||||
$sshkey=removePub($sshkey);
|
||||
$pubkey=EASYWIDIR.'/keys/'.$sshkey.'.pub';
|
||||
$key=EASYWIDIR.'/keys/'.$sshkey;
|
||||
$pubkey=EASYWIDIR . '/keys/'.$sshkey.'.pub';
|
||||
$key=EASYWIDIR . '/keys/'.$sshkey;
|
||||
|
||||
if (file_exists($pubkey) and file_exists($key)) {
|
||||
$ssh2= @ssh2_connect($sship,$sshport,array('hostkey'=>'ssh-rsa'));
|
||||
|
@ -263,13 +263,13 @@ if (!function_exists('passwordgenerate')) {
|
||||
$default_language=$row['language'];
|
||||
$template=$row['template'];
|
||||
if (file_exists(EASYWIDIR . '/languages/'.$template.'/'.$user_language.'/'.$filename.'.xml')) {
|
||||
$sprache=simplexml_load_file(EASYWIDIR.'/languages/'.$template.'/'.$user_language.'/'.$filename.'.xml');
|
||||
$sprache=simplexml_load_file(EASYWIDIR . '/languages/'.$template.'/'.$user_language.'/'.$filename.'.xml');
|
||||
} else if (file_exists(EASYWIDIR . '/languages/'.$template.'/'.$default_language.'/'.$filename.'.xml')) {
|
||||
$sprache=simplexml_load_file(EASYWIDIR.'/languages/'.$template.'/'.$default_language.'/'.$filename.'.xml');
|
||||
$sprache=simplexml_load_file(EASYWIDIR . '/languages/'.$template.'/'.$default_language.'/'.$filename.'.xml');
|
||||
} else if (file_exists(EASYWIDIR . '/languages/default/'.$user_language.'/'.$filename.'.xml')) {
|
||||
$sprache=simplexml_load_file(EASYWIDIR.'/languages/default/'.$user_language.'/'.$filename.'.xml');
|
||||
$sprache=simplexml_load_file(EASYWIDIR . '/languages/default/'.$user_language.'/'.$filename.'.xml');
|
||||
} else if (file_exists(EASYWIDIR . '/languages/default/'.$default_language.'/'.$filename.'.xml')) {
|
||||
$sprache=simplexml_load_file(EASYWIDIR.'/languages/default/'.$default_language.'/'.$filename.'.xml');
|
||||
$sprache=simplexml_load_file(EASYWIDIR . '/languages/default/'.$default_language.'/'.$filename.'.xml');
|
||||
} else if (file_exists(EASYWIDIR . '/languages/'.$user_language.'/'.$filename.'.xml')) {
|
||||
$sprache=simplexml_load_file(EASYWIDIR."/languages/$user_language/$filename.xml");
|
||||
} else if (file_exists(EASYWIDIR . '/languages/'.$default_language.'/'.$filename.'.xml')) {
|
||||
@ -947,12 +947,12 @@ if (!function_exists('passwordgenerate')) {
|
||||
}
|
||||
}
|
||||
function IncludeTemplate($use,$file) {
|
||||
if (is_file(EASYWIDIR.'/template/'.$use.'/'.$file) and preg_match('/^(.*)\.[\w]{1,}$/',$file)) {
|
||||
return EASYWIDIR.'/template/'.$use.'/'.$file;
|
||||
} else if (is_file(EASYWIDIR.'/template/default/'.$file) and preg_match('/^(.*)\.[\w]{1,}$/',$file)) {
|
||||
return EASYWIDIR.'/template/default/'.$file;
|
||||
if (is_file(EASYWIDIR . '/template/'.$use.'/'.$file) and preg_match('/^(.*)\.[\w]{1,}$/',$file)) {
|
||||
return EASYWIDIR . '/template/'.$use.'/'.$file;
|
||||
} else if (is_file(EASYWIDIR . '/template/default/'.$file) and preg_match('/^(.*)\.[\w]{1,}$/',$file)) {
|
||||
return EASYWIDIR . '/template/default/'.$file;
|
||||
} else if (preg_match('/^(.*)\.[\w]{1,}$/',$file)) {
|
||||
return EASYWIDIR.'/template/'.$file;
|
||||
return EASYWIDIR . '/template/'.$file;
|
||||
}
|
||||
}
|
||||
function User_Permissions($id) {
|
||||
|
@ -112,7 +112,7 @@ $query = $sql->prepare("SELECT * FROM `modules` WHERE `type` IN ('A','C')");
|
||||
$query2 = $sql->prepare("SELECT `text` FROM `translations` WHERE `type`='mo' AND `transID`=? AND `lang`=? LIMIT 1");
|
||||
$query->execute();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if ($row['active'] == 'Y' and $row['type'] == 'A' and is_file(EASYWIDIR.'/stuff/'.$row['file'])) {
|
||||
if ($row['active'] == 'Y' and $row['type'] == 'A' and is_file(EASYWIDIR . '/stuff/'.$row['file'])) {
|
||||
$query2->execute(array($row['id'], $user_language));
|
||||
$name = $query2->fetchColumn();
|
||||
if (strlen($name) == 0) {
|
||||
|
@ -113,7 +113,7 @@ $query = $sql->prepare("SELECT * FROM `modules` WHERE `type` IN ('U','C')");
|
||||
$query2 = $sql->prepare("SELECT `text` FROM `translations` WHERE `type`='mo' AND `transID`=? AND `lang`=? LIMIT 1");
|
||||
$query->execute();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if ($row['active'] == 'Y' and $row['type'] == 'U' and is_file(EASYWIDIR.'/stuff/'.$row['file'])) {
|
||||
if ($row['active'] == 'Y' and $row['type'] == 'U' and is_file(EASYWIDIR . '/stuff/'.$row['file'])) {
|
||||
$query2->execute(array($row['id'], $user_language));
|
||||
$name = $query2->fetchColumn();
|
||||
if (strlen($name) == 0) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* File: jobs_list.php.
|
||||
* Author: Ulrich Block
|
||||
@ -41,10 +42,10 @@ if ((!isset($admin_id) or $main!=1) or (isset($admin_id) and !$pa['jobs'])) {
|
||||
header('Location: admin.php');
|
||||
die('No acces');
|
||||
}
|
||||
$sprache=getlanguagefile('api',$user_language,$reseller_id);
|
||||
$sprache=getlanguagefile('api', $user_language, $reseller_id);
|
||||
if ($ui->w('action',4,'post') and !token(true)) {
|
||||
$template_file=$spracheResponse->token;
|
||||
} else if ($ui->w('action',4,'post')=='dl' and !isset($server_id)) {
|
||||
} else if ($ui->w('action',4,'post')=='dl' and !$ui->id('id', 19, 'get')) {
|
||||
$i=0;
|
||||
if ($ui->id('id',30,'post')) {
|
||||
foreach ($ui->id('id',30,'post') as $id) {
|
||||
@ -53,22 +54,22 @@ if ($ui->w('action',4,'post') and !token(true)) {
|
||||
$delete->execute(array($id));
|
||||
} else {
|
||||
$delete=$sql->prepare("DELETE FROM `jobs` WHERE `jobID`=? AND `resellerID`=? LIMIT 1");
|
||||
$delete->execute(array($id,$reseller_id));
|
||||
$delete->execute(array($id, $reseller_id));
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$template_file=$i.' '.$gsprache->jobs.' deleted';
|
||||
} else if (isset($server_id) and isid($server_id,'30')) {
|
||||
} else if ($ui->id('id', 19, 'get')) {
|
||||
if ($reseller_id==0) {
|
||||
$query=$sql->prepare("SELECT `text` FROM `mail_log` WHERE `id`=? LIMIT 1");
|
||||
$query->execute(array($server_id));
|
||||
$query->execute(array($ui->id('id', 19, 'get')));
|
||||
} else if ($reseller_id!=0 and $admin_id!=$reseller_id) {
|
||||
$query=$sql->prepare("SELECT `text` FROM `mail_log` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($server_id,$admin_id));
|
||||
$query->execute(array($ui->id('id', 19, 'get'), $admin_id));
|
||||
} else {
|
||||
$query=$sql->prepare("SELECT `text` FROM `mail_log` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($server_id,$reseller_id));
|
||||
$query->execute(array($ui->id('id', 19, 'get'), $reseller_id));
|
||||
}
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$text= @gzuncompress($row['text']);
|
||||
@ -208,6 +209,6 @@ if ($ui->w('action',4,'post') and !token(true)) {
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$pages=implode(', ',$pages);
|
||||
$pages=implode(', ', $pages);
|
||||
$template_file="admin_jobs_list.tpl";
|
||||
}
|
@ -136,7 +136,7 @@ if ($ui->w('action',4,'post') and !token(true)) {
|
||||
$exploded=explode('.',$_FILES["upload"]["name"]);
|
||||
$extension=$exploded[count($exploded)-1];
|
||||
if(isset($allowedTypes[$extension]) and ((is_array($allowedTypes[$extension]) and in_array($_FILES["upload"]["type"],$allowedTypes[$extension])) or (!is_array($allowedTypes[$extension]) and $_FILES["upload"]["type"]==$allowedTypes[$extension])) ) {
|
||||
if (move_uploaded_file($_FILES["upload"]["tmp_name"],EASYWIDIR.'/downloads/'.$id.'.'.$extension)) {
|
||||
if (move_uploaded_file($_FILES["upload"]["tmp_name"],EASYWIDIR . '/downloads/'.$id.'.'.$extension)) {
|
||||
$changed=true;
|
||||
$query=$sql->prepare("UPDATE `page_downloads` SET `fileExtension`=? WHERE `fileID`=? AND `resellerID`=?");
|
||||
$query->execute(array($extension,$id,$reseller_id));
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* File: settings.php.
|
||||
* Author: Ulrich Block
|
||||
@ -35,21 +36,23 @@
|
||||
* Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
if (isset($_SERVER['QUERY_STRING'])) {
|
||||
$queries=strtolower($_SERVER['QUERY_STRING']);
|
||||
$badcontent=array("http://","ftp://","delete ","from ","into ","userdata ","userdata(","userdata`","userpermissions ","userpermissions(","userpermissions`","select ","set ","where ","update ","union ","*",".ssh","~","chmod ","passwd","fclose","fopen","fwrite","getenv","locate","passthru","phpinfo","proc_close","proc_get_status","proc_nice","proc_open","proc_terminate","shell_exec(","system(");
|
||||
$check_bad=str_replace($badcontent,'bad',$queries);
|
||||
if($queries!=$check_bad) die();
|
||||
$queries = strtolower($_SERVER['QUERY_STRING']);
|
||||
$badcontent = array("http://", "ftp://", "https://", "ftps://", "delete ", "from ", "into ", "userdata ", "userdata(", "userdata`", "userpermissions ", "userpermissions(", "userpermissions`", "select ", "set ", "where ", "update ", "union ", "*", ".ssh", "~", "chmod ", "passwd", "fclose", "fopen", "fwrite", "getenv", "locate", "passthru", "phpinfo", "proc_close", "proc_get_status", "proc_nice", "proc_open", "proc_terminate", "shell_exec(", "system(");
|
||||
$check_bad = str_replace($badcontent, 'bad', $queries);
|
||||
if($queries != $check_bad) {
|
||||
die();
|
||||
}
|
||||
}
|
||||
$ui=new ValidateUserinput($_GET,$_POST,$_SERVER,array(),$_ENV);
|
||||
unset($_GET,$_POST,$_SERVER,$_ENV);
|
||||
$ui = new ValidateUserinput($_GET, $_POST, $_SERVER,array(), $_ENV);
|
||||
unset($_GET, $_POST, $_SERVER, $_ENV);
|
||||
include(EASYWIDIR . '/stuff/config.php');
|
||||
$ewCfg['captcha']=$captcha;
|
||||
$ewCfg['title']=$title;
|
||||
$ewCfg['captcha'] = $captcha;
|
||||
$ewCfg['title'] = $title;
|
||||
$dbConnect['type']=(!isset($type) or $type == '') ? 'mysql' : $type;
|
||||
$dbConnect['host']=$host;
|
||||
$dbConnect['user']=$user;
|
||||
$dbConnect['pwd']=$pwd;
|
||||
$dbConnect['db']=$db;
|
||||
$dbConnect['host'] = $host;
|
||||
$dbConnect['user'] = $user;
|
||||
$dbConnect['pwd'] = $pwd;
|
||||
$dbConnect['db'] = $db;
|
||||
if (isset($debug) and $debug==1) {
|
||||
$dbConnect['debug']=1;
|
||||
ini_set('display_errors',1);
|
||||
@ -57,124 +60,144 @@ if (isset($debug) and $debug==1) {
|
||||
}
|
||||
try {
|
||||
$dbConnect['connect']="${dbConnect['type']}:host=${dbConnect['host']};dbname=${dbConnect['db']}";
|
||||
$sql=($dbConnect['type']=='mysql') ? new PDO($dbConnect['connect'],$dbConnect['user'],$dbConnect['pwd'],array(PDO::MYSQL_ATTR_INIT_COMMAND=>"SET NAMES utf8")) : new PDO($dbConnect['connect'],$dbConnect['user'],$dbConnect['pwd']);
|
||||
if ($dbConnect['debug']==1) $sql->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$insertlog=$sql->prepare("INSERT INTO userlog (`userid`,`reseller`,`subuser`,`username`,`usertype`,`useraction`,`ip`,`hostname`,`logdate`,`resellerid`) VALUES (:userid,:reseller,:subuser,:username,:usertype,:useraction,:ip,:hostname,NOW(),:reseller_id)");
|
||||
$insertlog->bindParam(':userid',$loguserid);
|
||||
$insertlog->bindParam(':reseller',$logreseller);
|
||||
$insertlog->bindParam(':subuser',$logsubuser);
|
||||
$insertlog->bindParam(':username',$logusername);
|
||||
$insertlog->bindParam(':usertype',$logusertype);
|
||||
$insertlog->bindParam(':useraction',$loguseraction);
|
||||
$insertlog->bindParam(':ip',$loguserip);
|
||||
$insertlog->bindParam(':hostname',$userHostname);
|
||||
$insertlog->bindParam(':reseller_id',$reseller_id);
|
||||
$sql = ($dbConnect['type'] == 'mysql') ? new PDO($dbConnect['connect'], $dbConnect['user'], $dbConnect['pwd'],array(PDO::MYSQL_ATTR_INIT_COMMAND=>"SET NAMES utf8")) : new PDO($dbConnect['connect'], $dbConnect['user'], $dbConnect['pwd']);
|
||||
if ($dbConnect['debug'] == 1) {
|
||||
$sql->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
}
|
||||
$insertlog = $sql->prepare("INSERT INTO userlog (`userid`,`reseller`,`subuser`,`username`,`usertype`,`useraction`,`ip`,`hostname`,`logdate`,`resellerid`) VALUES (:userid,:reseller,:subuser,:username,:usertype,:useraction,:ip,:hostname,NOW(),:reseller_id)");
|
||||
$insertlog->bindParam(':userid', $loguserid);
|
||||
$insertlog->bindParam(':reseller', $logreseller);
|
||||
$insertlog->bindParam(':subuser', $logsubuser);
|
||||
$insertlog->bindParam(':username', $logusername);
|
||||
$insertlog->bindParam(':usertype', $logusertype);
|
||||
$insertlog->bindParam(':useraction', $loguseraction);
|
||||
$insertlog->bindParam(':ip', $loguserip);
|
||||
$insertlog->bindParam(':hostname', $userHostname);
|
||||
$insertlog->bindParam(':reseller_id', $reseller_id);
|
||||
if ($ui->ip('REMOTE_ADDR','server')) {
|
||||
$loguserip=$ui->ip('REMOTE_ADDR','server');
|
||||
$userHostname=@gethostbyaddr($ui->ip('REMOTE_ADDR','server'));
|
||||
$loguserip = $ui->ip('REMOTE_ADDR','server');
|
||||
$userHostname = @gethostbyaddr($ui->ip('REMOTE_ADDR','server'));
|
||||
} else {
|
||||
$loguserip='localhost';
|
||||
$userHostname='localhost';
|
||||
$loguserip = 'localhost';
|
||||
$userHostname = 'localhost';
|
||||
}
|
||||
}
|
||||
catch(PDOException $error) {
|
||||
die($error->getMessage());
|
||||
}
|
||||
$page_url=($ui->escaped ('HTTPS','server')) ? 'https://'.$ui->domain('HTTP_HOST','server') : 'http://'.$ui->domain('HTTP_HOST','server');
|
||||
$querystring='';
|
||||
if ($loguserip!="localhost") {
|
||||
if ($loguserip != 'localhost') {
|
||||
session_start();
|
||||
if (isset($_SESSION['userid']) and is_numeric($_SESSION['userid']) and isset($_SESSION['adminid']) and is_numeric($_SESSION['adminid'])) {
|
||||
$user_id=$_SESSION['userid'];
|
||||
$admin_id=$_SESSION['adminid'];
|
||||
$user_id = $_SESSION['userid'];
|
||||
$admin_id = $_SESSION['adminid'];
|
||||
} else if(isset($_SESSION['userid']) and is_numeric($_SESSION['userid'])) {
|
||||
$user_id=$_SESSION['userid'];
|
||||
$user_id = $_SESSION['userid'];
|
||||
} else if (isset($_SESSION['adminid']) and is_numeric($_SESSION['adminid'])) {
|
||||
$admin_id=$_SESSION['adminid'];
|
||||
$admin_id = $_SESSION['adminid'];
|
||||
}
|
||||
if (isset($_SESSION['resellerid']) and is_numeric($_SESSION['resellerid'])) {
|
||||
$reseller_id = $_SESSION['resellerid'];
|
||||
}
|
||||
if (isset($_SESSION['resellerid']) and is_numeric($_SESSION['resellerid'])) $reseller_id=$_SESSION['resellerid'];
|
||||
if (isset($_SESSION['HTTP_USER_AGENT']) and isset($_SESSION['REMOTE_ADDR'])){
|
||||
if ($_SESSION['HTTP_USER_AGENT']!=md5($ui->escaped('HTTP_USER_AGENT','server')) or $_SESSION['REMOTE_ADDR']!=md5($ui->ip('REMOTE_ADDR','server'))){
|
||||
session_unset();
|
||||
session_destroy();
|
||||
if (isset($page_include)) redirect('/');
|
||||
else redirect('login.php');
|
||||
if (isset($page_include)) {
|
||||
redirect('/');
|
||||
} else {
|
||||
redirect('login.php');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$_SESSION['REMOTE_ADDR']=md5($ui->ip('REMOTE_ADDR','server'));
|
||||
$_SESSION['HTTP_USER_AGENT']=md5($ui->escaped('HTTP_USER_AGENT','server'));
|
||||
$_SESSION['REMOTE_ADDR'] = md5($ui->ip('REMOTE_ADDR','server'));
|
||||
$_SESSION['HTTP_USER_AGENT'] = md5($ui->escaped('HTTP_USER_AGENT','server'));
|
||||
}
|
||||
}
|
||||
$rSA=array();
|
||||
if (isset($reseller_id)) {
|
||||
$query=$sql->prepare("SELECT * FROM `settings` WHERE `resellerid`=? LIMIT 1");
|
||||
$query = $sql->prepare("SELECT * FROM `settings` WHERE `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
foreach ($row as $k=>$v) $rSA[$k]=$v;
|
||||
foreach ($row as $k=>$v) {
|
||||
$rSA[$k] = $v;
|
||||
}
|
||||
$resellerstimezone=$rSA['timezone'];
|
||||
$template_to_use=$rSA['template'];
|
||||
$downChecks=$rSA['down_checks'];
|
||||
$logdate=date('Y-m-d H:i:s',strtotime("$resellerstimezone hour"));
|
||||
}
|
||||
$resellerstimezone = $rSA['timezone'];
|
||||
$template_to_use = $rSA['template'];
|
||||
$downChecks = $rSA['down_checks'];
|
||||
$logdate = date('Y-m-d H:i:s', strtotime($resellerstimezone .' hour'));
|
||||
if (isset($user_id) and !isset($admin_id)) {
|
||||
$lookupid=$reseller_id;
|
||||
$lookupid = $reseller_id;
|
||||
} else {
|
||||
$check_split=preg_split("/\//",$ui->escaped('SCRIPT_NAME','server'),-1,PREG_SPLIT_NO_EMPTY);
|
||||
$which_file=$check_split[count($check_split)-1];
|
||||
$check_split = preg_split("/\//", $ui->escaped('SCRIPT_NAME','server'),-1,PREG_SPLIT_NO_EMPTY);
|
||||
$which_file = $check_split[count($check_split)-1];
|
||||
if ($which_file=='userpanel.php') {
|
||||
$lookupid=$reseller_id;
|
||||
$lookupid = $reseller_id;
|
||||
} else {
|
||||
$lookupid=($reseller_id==$admin_id) ? 0 : $reseller_id;
|
||||
$lookupid = ($reseller_id == $admin_id) ? 0 : $reseller_id;
|
||||
}
|
||||
}
|
||||
$query=$sql->prepare("SELECT `supportnumber` FROM `settings` WHERE `resellerid`=? LIMIT 1");
|
||||
$query = $sql->prepare("SELECT `supportnumber` FROM `settings` WHERE `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($lookupid));
|
||||
$support_phonenumber=$query->fetchColumn();
|
||||
$support_phonenumber = $query->fetchColumn();
|
||||
} else {
|
||||
$query=$sql->prepare("SELECT * FROM `settings` WHERE `resellerid`=0 LIMIT 1");
|
||||
$query = $sql->prepare("SELECT * FROM `settings` WHERE `resellerid`=0 LIMIT 1");
|
||||
$query->execute();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
foreach ($row as $k=>$v) $rSA[$k]=$v;
|
||||
foreach ($row as $k=>$v) {
|
||||
$rSA[$k] = $v;
|
||||
}
|
||||
$template_to_use=$rSA['template'];
|
||||
$support_phonenumber=$rSA['supportnumber'];
|
||||
$logdate=date('Y-m-d H:i:s');
|
||||
}
|
||||
$template_to_use = $rSA['template'];
|
||||
$support_phonenumber = $rSA['supportnumber'];
|
||||
$logdate = date('Y-m-d H:i:s');
|
||||
}
|
||||
if ($loguserip!='localhost') {
|
||||
if (isset($_SESSION['language'])) $user_language=$_SESSION['language'];
|
||||
if (isset($_SESSION['language'])) $user_language = $_SESSION['language'];
|
||||
if (isset($page_include)) {
|
||||
$query=$sql->prepare("SELECT * FROM `page_settings` WHERE `resellerid`='0' LIMIT 1");
|
||||
$query = $sql->prepare("SELECT * FROM `page_settings` WHERE `resellerid`='0' LIMIT 1");
|
||||
$query->execute();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$page_active=$row['active'];
|
||||
$seo=$row['seo'];
|
||||
$rssfeed=$row['rssfeed'];
|
||||
$page_active = $row['active'];
|
||||
$seo = $row['seo'];
|
||||
$rssfeed = $row['rssfeed'];
|
||||
$maxnews=(isid($row['maxnews'],11)) ? $row['maxnews'] : 10;
|
||||
$page_default=$row['defaultpage'];
|
||||
$page_default = $row['defaultpage'];
|
||||
$pageurl=$row['pageurl'];
|
||||
if (!isurl($pageurl) and !isdomain($pageurl)) $pageurl=$page_url;
|
||||
$protectioncheck=$row['protectioncheck'];
|
||||
$maxnews_sidebar=$row['maxnews_sidebar'];
|
||||
$newssidebar_textlength=$row['newssidebar_textlength'];
|
||||
$spamFilter=$row['spamFilter'];
|
||||
$languageFilter=$row['languageFilter'];
|
||||
$blockLinks=$row['blockLinks'];
|
||||
$blockWords=$row['blockWords'];
|
||||
$mailRequired=$row['mailRequired'];
|
||||
$commentMinLength=$row['commentMinLength'];
|
||||
$commentsModerated=$row['commentsModerated'];
|
||||
$honeyPotKey=$row['honeyPotKey'];
|
||||
$protectioncheck = $row['protectioncheck'];
|
||||
$maxnews_sidebar = $row['maxnews_sidebar'];
|
||||
$newssidebar_textlength = $row['newssidebar_textlength'];
|
||||
$spamFilter = $row['spamFilter'];
|
||||
$languageFilter = $row['languageFilter'];
|
||||
$blockLinks = $row['blockLinks'];
|
||||
$blockWords = $row['blockWords'];
|
||||
$mailRequired = $row['mailRequired'];
|
||||
$commentMinLength = $row['commentMinLength'];
|
||||
$commentsModerated = $row['commentsModerated'];
|
||||
$honeyPotKey = $row['honeyPotKey'];
|
||||
}
|
||||
$ewInstallPath=EASYWIDIR;
|
||||
$elements=(!empty($ewInstallPath) and strpos($ui->escaped('REQUEST_URI','server'),$ewInstallPath)===false) ? preg_split('/\//',$ui->escaped('REQUEST_URI','server'),-1,PREG_SPLIT_NO_EMPTY) : preg_split('/\//',substr($ui->escaped('REQUEST_URI','server'),strlen($ewInstallPath)),-1,PREG_SPLIT_NO_EMPTY);
|
||||
$ewInstallPath = EASYWIDIR;
|
||||
$elements=(!empty($ewInstallPath) and strpos($ui->escaped('REQUEST_URI','server'), $ewInstallPath)===false) ? preg_split('/\//', $ui->escaped('REQUEST_URI','server'),-1,PREG_SPLIT_NO_EMPTY) : preg_split('/\//',substr($ui->escaped('REQUEST_URI','server'),strlen($ewInstallPath)),-1,PREG_SPLIT_NO_EMPTY);
|
||||
if (isset($seo) and $seo=='Y' and isset($elements[0])) {
|
||||
$page_detect_language=$elements[0];
|
||||
if (substr($ui->escaped('REQUEST_URI','server'),-1)!='/' and !$ui->w('site',50,'get')) $throw404=true;
|
||||
if (!preg_match('/^[a-z]{2}+$/',$elements[0]) and !$ui->w('site',50,'get')) $throw404=true;
|
||||
$page_detect_language = $elements[0];
|
||||
if (substr($ui->escaped('REQUEST_URI','server'),-1)!='/' and !$ui->w('site',50, 'get')) {
|
||||
$throw404 = true;
|
||||
}
|
||||
if (!preg_match('/^[a-z]{2}+$/', $elements[0]) and !$ui->w('site',50, 'get')) {
|
||||
$throw404 = true;
|
||||
}
|
||||
}
|
||||
if (isset($elements[1]) and $elements[1] != '') {
|
||||
$page_category=strtolower($elements[1]);
|
||||
}
|
||||
if (isset($elements[2]) and $elements[2] != '') {
|
||||
$page_name=strtolower($elements[2]);
|
||||
}
|
||||
if (isset($elements[3]) and $elements[3] != '') {
|
||||
$page_count=strtolower($elements[3]);
|
||||
}
|
||||
if (isset($elements[1]) and $elements[1]!='') $page_category=strtolower($elements[1]);
|
||||
if (isset($elements[2]) and $elements[2]!='') $page_name=strtolower($elements[2]);
|
||||
if (isset($elements[3]) and $elements[3]!='') $page_count=strtolower($elements[3]);
|
||||
}
|
||||
if (!isset($user_language) and isset($user_id) and isset($admin_id)) {
|
||||
$user_language=language($admin_id);
|
||||
@ -183,156 +206,114 @@ if ($loguserip!='localhost') {
|
||||
} else if (!isset($user_language) and isset($admin_id)) {
|
||||
$user_language=language($admin_id);
|
||||
}
|
||||
if (isset($page_detect_language) and preg_match('/^[a-z]{2}+$/',$page_detect_language) and ((isset($_SESSION['language']) and $page_detect_language!=$_SESSION['language']) or !isset($_SESSION['language']))){
|
||||
$language_changed=true;
|
||||
$user_language=$page_detect_language;
|
||||
if (isset($page_detect_language) and preg_match('/^[a-z]{2}+$/', $page_detect_language) and ((isset($_SESSION['language']) and $page_detect_language!=$_SESSION['language']) or !isset($_SESSION['language']))){
|
||||
$language_changed = true;
|
||||
$user_language = $page_detect_language;
|
||||
}
|
||||
if($ui->st('l','get') or isset($language_changed)) {
|
||||
if($ui->st('l','get')) $user_language=$ui->st('l','get');
|
||||
if($ui->st('l', 'get') or isset($language_changed)) {
|
||||
if($ui->st('l', 'get')) $user_language = $ui->st('l', 'get');
|
||||
|
||||
# https://github.com/easy-wi/developer/issues/2
|
||||
if (isset($_SESSION['sID'])) {
|
||||
$query=$sql->prepare("UPDATE `userdata_substitutes` SET `language`=? WHERE `sID`=? AND `resellerID`=? LIMIT 1");
|
||||
$query->execute(array($user_language,$_SESSION['sID'],$reseller_id));
|
||||
$query = $sql->prepare("UPDATE `userdata_substitutes` SET `language`=? WHERE `sID`=? AND `resellerID`=? LIMIT 1");
|
||||
$query->execute(array($user_language, $_SESSION['sID'], $reseller_id));
|
||||
} else if (isset($admin_id)) {
|
||||
$query=$sql->prepare("UPDATE `userdata` SET `language`=? WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($user_language,$admin_id,$reseller_id));
|
||||
$query = $sql->prepare("UPDATE `userdata` SET `language`=? WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($user_language, $admin_id, $reseller_id));
|
||||
} else if (isset($user_id)) {
|
||||
$query=$sql->prepare("UPDATE `userdata` SET `language`=? WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($user_language,$user_id,$reseller_id));
|
||||
$query = $sql->prepare("UPDATE `userdata` SET `language`=? WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($user_language, $user_id, $reseller_id));
|
||||
}
|
||||
}
|
||||
$default_language=(!empty($user_language)) ? $user_language : $rSA['language'];
|
||||
if (!isset($user_language) or empty($user_language)) $user_language=$default_language;
|
||||
$_SESSION['language']=$user_language;
|
||||
$gsprache=(isset($reseller_id)) ? getlanguagefile('general',$user_language,$reseller_id) : getlanguagefile('general',$user_language,0);
|
||||
$spracheResponse=(isset($reseller_id)) ? getlanguagefile('response',$user_language,$reseller_id) : getlanguagefile('response',$user_language,0);
|
||||
if (!isset($user_language) or empty($user_language)) {
|
||||
$user_language = $default_language;
|
||||
}
|
||||
$_SESSION['language'] = $user_language;
|
||||
$gsprache=(isset($reseller_id)) ? getlanguagefile('general', $user_language, $reseller_id) : getlanguagefile('general', $user_language, 0);
|
||||
$spracheResponse=(isset($reseller_id)) ? getlanguagefile('response', $user_language, $reseller_id) : getlanguagefile('response', $user_language, 0);
|
||||
}
|
||||
if (isset($logininclude) and $logininclude==true) {
|
||||
$query=$sql->prepare("DELETE FROM `badips` WHERE `bantime` <= ?");
|
||||
$query = $sql->prepare("DELETE FROM `badips` WHERE `bantime` <= ?");
|
||||
$query->execute(array($logdate));
|
||||
$query=$sql->prepare("SELECT `id` FROM `badips` WHERE `badip`=? AND reason='bot' LIMIT 1");
|
||||
$query = $sql->prepare("SELECT `id` FROM `badips` WHERE `badip`=? AND reason='bot' LIMIT 1");
|
||||
$query->execute(array($loguserip));
|
||||
if ($query->rowcount()>0) die();
|
||||
$query=$sql->prepare("SELECT `faillogins` FROM `settings` WHERE `resellerid`=0 LIMIT 1");
|
||||
if ($query->rowcount()>0) {
|
||||
die();
|
||||
}
|
||||
$query = $sql->prepare("SELECT `faillogins` FROM `settings` WHERE `resellerid`=0 LIMIT 1");
|
||||
$query->execute();
|
||||
$allowedfails=$query->fetchColumn();
|
||||
$query=$sql->prepare("SELECT `id` FROM `badips` WHERE `badip`=? AND `reason`='password' AND `failcount`>=? LIMIT 1");
|
||||
$query->execute(array($loguserip,$allowedfails));
|
||||
if ($query->rowCount()>0) die("Your IP is banned");
|
||||
}
|
||||
if ($ui->w('action',4,'post')) $action=$ui->w('action',4,'post');
|
||||
if($ui->st('r','get')) {
|
||||
$r=$ui->st('r','get');
|
||||
$pagename=$ui->escaped('SCRIPT_NAME','server');
|
||||
$header='<meta http-equiv="refresh" content="3; URL='.$pagename.'?w='.$r.'">';
|
||||
if (!isset($user_language)) $user_language=$rSA['language'];
|
||||
$rsprache=getlanguagefile('redirect',$user_language,0);
|
||||
$text=$rsprache->refresh;
|
||||
}
|
||||
if($ui->username('distro','50','get')) $get_distro=$ui->username('distro','50','get');
|
||||
if($ui->username('short','50','get')) $get_short=$ui->username('short','50','get');
|
||||
if($ui->username('shorten','50','get')) $get_shorten=$ui->username('shorten','50','get');
|
||||
if($ui->username('gamestring','50','get')) $get_gamestring=$ui->username('gamestring','50','get');
|
||||
if($ui->smallletters('site','50','get')) {
|
||||
$s=$ui->smallletters('site','50','get');
|
||||
$querystring="?site=".$s;
|
||||
}
|
||||
if($ui->st('w','get')) {
|
||||
$w=$ui->st('w','get');
|
||||
if (empty($querystring)) {
|
||||
$querystring="?w=$w";
|
||||
} else {
|
||||
$querystring .="&w=$w";
|
||||
$allowedfails = $query->fetchColumn();
|
||||
$query = $sql->prepare("SELECT `id` FROM `badips` WHERE `badip`=? AND `reason`='password' AND `failcount`>=? LIMIT 1");
|
||||
$query->execute(array($loguserip, $allowedfails));
|
||||
if ($query->rowCount()>0) {
|
||||
die('Your IP is banned');
|
||||
}
|
||||
}
|
||||
if($ui->st('r', 'get')) {
|
||||
$pagename = $ui->escaped('SCRIPT_NAME','server');
|
||||
$header = '<meta http-equiv="refresh" content="3; URL='.$pagename.'?w = '.$r.'">';
|
||||
if (!isset($user_language)) {
|
||||
$user_language = $rSA['language'];
|
||||
}
|
||||
$rsprache = getlanguagefile('redirect', $user_language, 0);
|
||||
$text = $rsprache->refresh;
|
||||
}
|
||||
if ($ui->w('action',4,'post')) {
|
||||
$action=$ui->w('action',4,'post');
|
||||
}
|
||||
if($ui->smallletters('site','50', 'get')) {
|
||||
$s = $ui->smallletters('site','50', 'get');
|
||||
}
|
||||
if($ui->st('w', 'get')) {
|
||||
$w = $ui->st('w', 'get');
|
||||
} else {
|
||||
$w='ho';
|
||||
$w = 'ho';
|
||||
}
|
||||
if($ui->st('d','get')) {
|
||||
$d=$ui->st('d','get');
|
||||
if (empty($querystring)) {
|
||||
$querystring="?d=$d";
|
||||
} else {
|
||||
$querystring .="&d=$d";
|
||||
}
|
||||
if($ui->st('d', 'get')) {
|
||||
$d = $ui->st('d', 'get');
|
||||
} else {
|
||||
$d='md';
|
||||
}
|
||||
if($ui->id('id',19,'get')) {
|
||||
$server_id=$ui->id('id',19,'get');
|
||||
if (empty($querystring)) {
|
||||
$querystring="?id=$server_id";
|
||||
} else {
|
||||
$querystring .="&id=$server_id";
|
||||
}
|
||||
}
|
||||
if($ui->ip('ip','get')) {
|
||||
$server_ip=$ui->ip('ip','get');
|
||||
if (isset($querystring)) {
|
||||
$querystring .="&ip=$server_ip";
|
||||
} else {
|
||||
$querystring="?ip=$server_ip";
|
||||
}
|
||||
}
|
||||
if($ui->ips('ips','get')) {
|
||||
$server_ips=$ui->ips('ips','get');
|
||||
$d = 'md';
|
||||
}
|
||||
|
||||
if($ui->id('po',5,'get')) {
|
||||
$server_port=$ui->id('po',5,'get');
|
||||
if (empty($querystring)) {
|
||||
$querystring="?po=$server_port";
|
||||
} else {
|
||||
$querystring .="&po=$server_port";
|
||||
}
|
||||
}
|
||||
|
||||
if($ui->smallletters('t','1','get')) {
|
||||
$list_type=$ui->smallletters('t','1','get');
|
||||
if($ui->smallletters('t','1', 'get')) {
|
||||
$list_type = $ui->smallletters('t','1', 'get');
|
||||
if ($list_type=="m") {
|
||||
$where="WHERE `type`='map'";
|
||||
} else if ($list_type=="t") {
|
||||
$where="WHERE `type`='tool'";
|
||||
} else {
|
||||
$list_type="a";
|
||||
$where='';
|
||||
$where = '';
|
||||
}
|
||||
} else {
|
||||
$list_type="a";
|
||||
$where='';
|
||||
$where = '';
|
||||
}
|
||||
if($ui->pregw('g','14','get')) {
|
||||
$list_gtype=$ui->pregw('g','14','get');
|
||||
if (!$where=='') {
|
||||
if($ui->pregw('g','14', 'get')) {
|
||||
$list_gtype = $ui->pregw('g','14', 'get');
|
||||
if ($where != '') {
|
||||
$where .=" AND shorten='$list_gtype'";
|
||||
} else {
|
||||
if ($w=="lo") {
|
||||
$where=$list_gtype;
|
||||
$where = $list_gtype;
|
||||
} else if ($list_gtype!='all') {
|
||||
$where="WHERE shorten='$list_gtype'";
|
||||
}
|
||||
}
|
||||
if (empty($querystring)) {
|
||||
$querystring="?g=$list_gtype";
|
||||
} else {
|
||||
$querystring .="&g=$list_gtype";
|
||||
}
|
||||
} else {
|
||||
$list_gtype='';
|
||||
$list_gtype = '';
|
||||
}
|
||||
if($ui->pregw('m','20','get')) {
|
||||
$list_gtype=$ui->pregw('m','20','get');
|
||||
if (!$where=='') {
|
||||
if($ui->pregw('m','20', 'get')) {
|
||||
$list_gtype = $ui->pregw('m','20', 'get');
|
||||
if ($where != '') {
|
||||
$where .=" AND (s.`shorten`='$list_gtype' OR s.`qstat`='$list_gtype')";
|
||||
} else if ($list_gtype!="all") {
|
||||
$where="WHERE (s.`shorten`='$list_gtype' OR s.`qstat`='$list_gtype')";
|
||||
}
|
||||
if (empty($querystring)) {
|
||||
$querystring="?m=$list_type";
|
||||
} else {
|
||||
$querystring .="&m=$list_type";
|
||||
}
|
||||
} else {
|
||||
$list_gtype='';
|
||||
$list_gtype = '';
|
||||
}
|
||||
if (empty($where) and $w!="lo" and $w!="rs" and ($w!="ma" and $d!="ud")) {
|
||||
$where="WHERE `resellerid`=:reseller_id";
|
||||
@ -343,54 +324,57 @@ if (empty($where) and $w!="lo" and $w!="rs" and ($w!="ma" and $d!="ud")) {
|
||||
} else if ($w!="lo" and ($w=="ma" and $d=="ud")) {
|
||||
$where .=" AND r.`resellerid`=:reseller_id";
|
||||
}
|
||||
if($ui->isinteger('a','get')) {
|
||||
$a=(int)$ui->isinteger('a','get');
|
||||
$amount=$a;
|
||||
if (empty($querystring)) $querystring="?a=$amount";
|
||||
else$querystring .="&a=$amount";
|
||||
$_SESSION['amount']=$a;
|
||||
if($ui->isinteger('a', 'get')) {
|
||||
$a = (int) $ui->isinteger('a', 'get');
|
||||
$amount = $a;
|
||||
$_SESSION['amount'] = $a;
|
||||
} else {
|
||||
$amount=(isset($_SESSION['amount']) and is_int($_SESSION['amount'])) ? $_SESSION['amount'] : 20;
|
||||
$amount = (isset($_SESSION['amount']) and is_int($_SESSION['amount'])) ? $_SESSION['amount'] : 20;
|
||||
}
|
||||
if($ui->id('p',19,'get')) {
|
||||
$start=$ui->id('p',19,'get');
|
||||
if (empty($querystring)) $querystring="?p=$start";
|
||||
else $querystring .="&p=$start";
|
||||
if($ui->id('p',19, 'get')) {
|
||||
$start = $ui->id('p',19, 'get');
|
||||
} else {
|
||||
$start=0;
|
||||
}
|
||||
$link=(isset($querystring) and $querystring!="") ? $querystring."&l=" : "?l=";
|
||||
$languages=array();
|
||||
$dir1=array();
|
||||
$dir2=array();
|
||||
$dir3=array();
|
||||
if (is_dir(EASYWIDIR."/languages/$template_to_use/")) $dir1=scandir(EASYWIDIR."/languages/$template_to_use/");
|
||||
if (is_dir(EASYWIDIR.'/languages/default/')) $dir2=scandir(EASYWIDIR.'/languages/default/');
|
||||
if (is_dir(EASYWIDIR.'/languages/')) $dir3=scandir(EASYWIDIR.'/languages/');
|
||||
$dirs_merge=array_merge($dir1,$dir2,$dir3);
|
||||
$dirs=array_unique($dirs_merge);
|
||||
$dirs=array();
|
||||
if (is_dir(EASYWIDIR . '/languages/'. $template_to_use . '/')) {
|
||||
$dirs = array_merge($dir, scandir(EASYWIDIR . '/languages/'. $template_to_use . '/'));
|
||||
}
|
||||
if (is_dir(EASYWIDIR . '/languages/default/')) {
|
||||
$dirs=array_merge($dir, scandir(EASYWIDIR . '/languages/default/'));
|
||||
}
|
||||
if (is_dir(EASYWIDIR . '/languages/')) {
|
||||
$dirs=array_merge($dir, scandir(EASYWIDIR . '/languages/'));
|
||||
}
|
||||
$dirs = array_unique($dirs);
|
||||
$languages = array();
|
||||
foreach ($dirs as $row) {
|
||||
if (small_letters_check($row,2)) $languages[]=$row;
|
||||
if (small_letters_check($row,2)) $languages[] = $row;
|
||||
}
|
||||
if ($w=="ma" and $d=="ud" and isset($action) and $action=="ud" and $ui->description('description','post') and $ui->id('id',19,'post')) {
|
||||
$query=$sql->prepare("SELECT s.`shorten` FROM `rservermasterg` r LEFT JOIN `servertypes` s ON r.`servertypeid`=s.`id` WHERE s.`description`=? AND r.`serverid`=? AND r.`installing`='N' AND r.`resellerid`=?");
|
||||
$ajaxonload='<script type="text/javascript">window.onload = function() {';
|
||||
$query = $sql->prepare("SELECT s.`shorten` FROM `rservermasterg` r LEFT JOIN `servertypes` s ON r.`servertypeid`=s.`id` WHERE s.`description`=? AND r.`serverid`=? AND r.`installing`='N' AND r.`resellerid`=?");
|
||||
$ajaxonload = '<script type="text/javascript">window.onload = function() {';
|
||||
foreach($ui->id('id',19,'post') as $id) {
|
||||
$i=0;
|
||||
$gamestring_buf='';
|
||||
$i = 0;
|
||||
$gamestring_buf = '';
|
||||
foreach($ui->description('description','post') as $description) {
|
||||
if ($reseller_id==0) $query->execute(array($description,$id,'0'));
|
||||
else $query->execute(array($description,$id,$admin_id));
|
||||
if ($reseller_id==0) {
|
||||
$query->execute(array($description, $id, 0));
|
||||
} else {
|
||||
$query->execute(array($description, $id, $admin_id));
|
||||
}
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$gamestring_buf .="_".$row['shorten'];
|
||||
$gamestring_buf .= '_'. $row['shorten'];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
if ($i>0) {
|
||||
$posted_gamestring=$i.$gamestring_buf;
|
||||
$ajaxonload .="onloaddata('serverallocation.php?gamestring=$posted_gamestring&id=','$id','$id');";
|
||||
$posted_gamestring = $i . $gamestring_buf;
|
||||
$ajaxonload .= "onloaddata('serverallocation.php?gamestring=$posted_gamestring&id = ','$id','$id');";
|
||||
}
|
||||
}
|
||||
$ajaxonload .='}</script>';
|
||||
}
|
||||
if ($ui->escaped('HTTP_REFERER','server')) $referrer=$ui->escaped('HTTP_REFERER','server');
|
||||
if ($ui->escaped('HTTP_REFERER','server')) {
|
||||
$referrer = $ui->escaped('HTTP_REFERER','server');
|
||||
}
|
@ -59,8 +59,8 @@ if (!function_exists('ssh2_execute')) {
|
||||
|
||||
# https://github.com/easy-wi/developer/issues/70
|
||||
$sshkey=removePub($row['keyname']);
|
||||
$pubkey=EASYWIDIR.'/keys/'.$sshkey.'.pub';
|
||||
$key=EASYWIDIR.'/keys/'.$sshkey;
|
||||
$pubkey=EASYWIDIR . '/keys/'.$sshkey.'.pub';
|
||||
$key=EASYWIDIR . '/keys/'.$sshkey;
|
||||
|
||||
$ssh2Socket=($ssh2Publickey=='Y') ? (file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($ssh2IP,$ssh2Port,array('hostkey'=>'ssh-rsa')) : false : @ssh2_connect($ssh2IP,$ssh2Port);
|
||||
if ($ssh2Socket==true) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* File: userpanel_backup.php.
|
||||
* Author: Ulrich Block
|
||||
@ -34,7 +35,7 @@
|
||||
* Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
|
||||
* Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
if ((!isset($user_id) or $main!=1) or (isset($user_id) and !$pa['ftpbackup']) or !isset($server_id)) {
|
||||
if ((!isset($user_id) or $main!=1) or (isset($user_id) and !$pa['ftpbackup']) or !$ui->id('id', 10, 'get')) {
|
||||
header('Location: userpanel.php');
|
||||
die;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ if (isset($admin_id)) {
|
||||
|
||||
if ($ui->st('d','get')=='ud' and $ui->id('id',19,'get') and (!isset($_SESSION['sID']) or in_array($ui->id('id',10,'get'),$substituteAccess['gs']))) {
|
||||
$serverid=(int)$ui->id('id',19,'get');
|
||||
require_once(EASYWIDIR.'/stuff/keyphrasefile.php');
|
||||
require_once(EASYWIDIR . '/stuff/keyphrasefile.php');
|
||||
$query=$sql->prepare("SELECT g.`rootID`,g.`masterfdl`,g.`mfdldata`,g.`serverip`,g.`port`,g.`newlayout`,s.`servertemplate`,t.`modfolder`,t.`shorten`,u.`fdlpath`,u.`cname` FROM `gsswitch` g LEFT JOIN `serverlist` s ON g.`serverid`=s.`id` LEFT JOIN `servertypes` t ON s.`servertype`=t.`id` LEFT JOIN `userdata` u ON g.`userid`=u.`id` WHERE g.`active`='Y' AND g.`id`=? AND g.`resellerid`=? LIMIT 1");
|
||||
$query->execute(array($serverid,$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
|
@ -39,7 +39,7 @@ if ((!isset($user_id) or !$main == "1") or (isset($user_id) and !$pa['voiceserve
|
||||
header('Location: userpanel.php');
|
||||
die('No acces');
|
||||
}
|
||||
$sprache=getlanguagefile('voice',$user_language,$reseller_id);
|
||||
$sprache=getlanguagefile('voice', $user_language, $reseller_id);
|
||||
$loguserid=$user_id;
|
||||
$logusername=getusername($user_id);
|
||||
$logusertype='user';
|
||||
@ -53,7 +53,7 @@ if (isset($admin_id)) {
|
||||
}
|
||||
include(EASYWIDIR . '/stuff/keyphrasefile.php');
|
||||
include(EASYWIDIR . '/stuff/class_voice.php');
|
||||
if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['sID']) or in_array($ui->id('id',10,'get'),$substituteAccess['vo']))) {
|
||||
if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['sID']) or in_array($ui->id('id',10,'get'), $substituteAccess['vo']))) {
|
||||
$id=$ui->id('id',10,'get');
|
||||
$query=$sql->prepare("SELECT v.`id`,v.`ip`,v.`port`,v.`dns`,v.`localserverid`,m.`type`,m.`queryport`,AES_DECRYPT(m.`querypassword`,:aeskey) AS `decryptedquerypassword`,m.`rootid`,m.`addedby`,m.`ssh2ip`,m.`type`,m.`usedns`,m.`publickey`,m.`ssh2ip`,AES_DECRYPT(m.`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(m.`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(m.`ssh2password`,:aeskey) AS `decryptedssh2password`,m.`serverdir`,m.`keyname`,m.`notified` FROM `voice_server` v LEFT JOIN `voice_masterserver` m ON v.`masterserver`=m.`id` WHERE v.`active`='Y' AND m.`active`='Y' AND v.`backup`='Y' AND v.`id`=:server_id AND v.`userid`=:user_id AND v.`resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':server_id'=>$id,':user_id'=>$user_id,':reseller_id'=>$reseller_id));
|
||||
@ -79,7 +79,7 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
$keyname=$row['keyname'];
|
||||
} else if ($addedby==1) {
|
||||
$query=$sql->prepare("SELECT `ip` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($row['rootid'],$reseller_id));
|
||||
$query->execute(array($row['rootid'], $reseller_id));
|
||||
$queryip=$query->fetchColumn();
|
||||
}
|
||||
}
|
||||
@ -87,31 +87,31 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
$query->execute(array($reseller_id));
|
||||
$voice_maxbackup=$query->fetchColumn();
|
||||
$query=$sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `voice_server_backup` WHERE `sid`=? AND `uid`=? AND `resellerid`=?");
|
||||
$query->execute(array($id,$user_id,$reseller_id));
|
||||
$query->execute(array($id, $user_id, $reseller_id));
|
||||
$backupcount=$query->fetchColumn();
|
||||
if (isset($server) and !$ui->smallletters('action',2,'post') and !isset($server_port)) {
|
||||
if (isset($server) and !$ui->smallletters('action',2,'post') and $ui->port('po', 'get')) {
|
||||
$table=array();
|
||||
$query2=$sql->prepare("SELECT `id`,`name`,`date` FROM `voice_server_backup` WHERE `sid`=? AND `uid`=? AND `resellerid`=? ORDER BY `date` DESC");
|
||||
$query2->execute(array($id,$user_id,$reseller_id));
|
||||
$query2->execute(array($id, $user_id, $reseller_id));
|
||||
foreach ($query2->fetchall(PDO::FETCH_ASSOC) as $row2) {
|
||||
$table[]=array('id'=>$row2['id'],'date'=>$row2['date'],'name'=>$row2['name']);
|
||||
}
|
||||
$template_file="userpanel_voiceserver_backup_list.tpl";
|
||||
} else if (isset($server) and !$ui->smallletters('action',2,'post') and isset($server_port) and $server_port=='1') {
|
||||
} else if (isset($server) and !$ui->smallletters('action',2,'post') and $ui->port('po', 'get') == 1) {
|
||||
$template_file="userpanel_voiceserver_backup_new.tpl";
|
||||
} else if (isset($server) and $ui->smallletters('action',2,'post')=='nb') {
|
||||
$name=($ui->names('name',50,'post')) ? $ui->names('name',50,'post') : 'New Backup';
|
||||
$toomuch=$backupcount+1-$voice_maxbackup;
|
||||
if ($toomuch>0) {
|
||||
$query=$sql->prepare("SELECT `id` FROM `voice_server_backup` WHERE `sid`=? AND `uid`=? AND `resellerid`=? ORDER BY `id` ASC LIMIT $toomuch");
|
||||
$query->execute(array($id,$user_id,$reseller_id));
|
||||
$query->execute(array($id, $user_id, $reseller_id));
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$delete=$sql->prepare("DELETE FROM `voice_server_backup` WHERE `id`=? AND `uid`=? AND `resellerid`=? LIMIT 1");
|
||||
$delete->execute(array($row['id'],$user_id,$reseller_id));
|
||||
tsbackup('delete',$queryip,$ssh2port,$ssh2user,$publickey,$keyname,$ssh2password,$notified,$serverdir,$volocalserverid,$row['id'],$reseller_id,$sql);
|
||||
$delete->execute(array($row['id'], $user_id, $reseller_id));
|
||||
tsbackup('delete', $queryip, $ssh2port, $ssh2user, $publickey, $keyname, $ssh2password, $notified, $serverdir, $volocalserverid, $row['id'], $reseller_id, $sql);
|
||||
}
|
||||
}
|
||||
$connection=new TS3($queryip,$queryport,'serveradmin',$querypassword);
|
||||
$connection=new TS3($queryip, $queryport,'serveradmin', $querypassword);
|
||||
$errorcode=$connection->errorcode;
|
||||
if (strpos($errorcode,'error id=0') === false) {
|
||||
$template_file=$spracheResponse->error_ts_query_connect.$errorcode;
|
||||
@ -126,14 +126,14 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
} else {
|
||||
$snapshot=gzcompress($rawsnapshot,9);
|
||||
$query=$sql->prepare("INSERT INTO `voice_server_backup` (`sid`,`uid`,`name`,`snapshot`,`channels`,`date`,`resellerid`) VALUES(?,?,?,?,?,NOW(),?)");
|
||||
$query->execute(array($id,$user_id,$name,$snapshot,$channelSnapshot,$reseller_id));
|
||||
$query->execute(array($id, $user_id, $name, $snapshot, $channelSnapshot, $reseller_id));
|
||||
$query=$sql->prepare("SELECT `id` FROM `voice_server_backup` WHERE `sid`=? AND `uid`=? AND `resellerid`=? ORDER BY `id` DESC LIMIT 1");
|
||||
$query->execute(array($id,$user_id,$reseller_id));
|
||||
$return=tsbackup('create',$queryip,$ssh2port,$ssh2user,$publickey,$keyname,$ssh2password,$notified,$serverdir,$volocalserverid,$sql->lastInsertId(),$reseller_id,$sql);
|
||||
$query->execute(array($id, $user_id, $reseller_id));
|
||||
$return=tsbackup('create', $queryip, $ssh2port, $ssh2user, $publickey, $keyname, $ssh2password, $notified, $serverdir, $volocalserverid, $sql->lastInsertId(), $reseller_id, $sql);
|
||||
$template_file=($return=='ok') ? $spracheResponse->ts_query_success.$return : $spracheResponse->error_ts_query.$return;
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row);
|
||||
$query=$sql->prepare("SELECT CONCAT(`ip`,':',`port`) AS `address` FROM `voice_server` WHERE `id`=? AND `userid`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($id,$user_id,$reseller_id));
|
||||
$query->execute(array($id, $user_id, $reseller_id));
|
||||
$address=$query->fetchColumn();
|
||||
$loguseraction="%add% %voserver% %backup% ${name} ${address}";
|
||||
$insertlog->execute();
|
||||
@ -142,40 +142,40 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
$connection->CloseConnection();
|
||||
} else if (isset($server) and $ui->smallletters('action',2,'post')=='md' and isset($ui->post['delete']) and $ui->id('id',10,'post')!=false) {
|
||||
$query=$sql->prepare("SELECT `name`,`sid` FROM `voice_server_backup` WHERE `id`=? AND `uid`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($ui->id('id',10,'post'),$user_id,$reseller_id));
|
||||
$query->execute(array($ui->id('id',10,'post'), $user_id, $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$name=$row['name'];
|
||||
$sid=$row['sid'];
|
||||
}
|
||||
$query=$sql->prepare("DELETE FROM `voice_server_backup` WHERE `id`=? AND `uid`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($ui->id('id',10,'post'),$user_id,$reseller_id));
|
||||
tsbackup('delete',$queryip,$ssh2port,$ssh2user,$publickey,$keyname,$ssh2password,$notified,$serverdir,$volocalserverid,$ui->id('id',10,'post'),$reseller_id,$sql);
|
||||
$query->execute(array($ui->id('id',10,'post'), $user_id, $reseller_id));
|
||||
tsbackup('delete', $queryip, $ssh2port, $ssh2user, $publickey, $keyname, $ssh2password, $notified, $serverdir, $volocalserverid, $ui->id('id',10,'post'), $reseller_id, $sql);
|
||||
$template_file=$spracheResponse->table_del;
|
||||
$query=$sql->prepare("SELECT CONCAT(`ip`,':',`port`) AS `address` FROM `voice_server` WHERE `id`=? AND `userid`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($sid,$user_id,$reseller_id));
|
||||
$query->execute(array($sid, $user_id, $reseller_id));
|
||||
$address=$query->fetchColumn();
|
||||
$loguseraction="%del% %voserver% %backup% ${name} ${address}";
|
||||
$insertlog->execute();
|
||||
} else if (isset($server) and $ui->smallletters('action',2,'post')=='md' and isset($ui->post['use']) and $ui->id('id',10,'post')!=false) {
|
||||
$query=$sql->prepare("SELECT `snapshot`,`name`,`sid`,`channels` FROM `voice_server_backup` WHERE `id`=? AND `uid`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($ui->id('id',10,'post'),$user_id,$reseller_id));
|
||||
$query->execute(array($ui->id('id',10,'post'), $user_id, $reseller_id));
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$snapshot= @gzuncompress($row['snapshot']);
|
||||
$connection=new TS3($queryip,$queryport,'serveradmin',$querypassword);
|
||||
$connection=new TS3($queryip, $queryport,'serveradmin', $querypassword);
|
||||
$errorcode=$connection->errorcode;
|
||||
if (strpos($errorcode,'error id=0') === false) {
|
||||
$template_file=$spracheResponse->error_ts_query_connect.$errorcode;
|
||||
} else {
|
||||
$connection->StartServer($volocalserverid);
|
||||
$reply=$connection->Snapshotdeploy($volocalserverid,$snapshot);
|
||||
$reply=$connection->Snapshotdeploy($volocalserverid, $snapshot);
|
||||
if (isset($reply[0]['id']) and $reply[0]['id']=='0') {
|
||||
$move=array();
|
||||
$channelListOld=@json_decode($row['channels']);
|
||||
$channelListDeployed=@json_decode($connection->channelList($volocalserverid));
|
||||
if (is_object($channelListDeployed) and is_object($channelListOld)) foreach ($channelListOld as $k=>$v) if (isset($channelListDeployed->$k)) $move[$v]=$channelListDeployed->$k;
|
||||
tsbackup('deploy',$queryip,$ssh2port,$ssh2user,$publickey,$keyname,$ssh2password,$notified,$serverdir,$volocalserverid,$ui->id('id',10,'post'),$reseller_id,$sql,$move);
|
||||
tsbackup('deploy', $queryip, $ssh2port, $ssh2user, $publickey, $keyname, $ssh2password, $notified, $serverdir, $volocalserverid, $ui->id('id',10,'post'), $reseller_id, $sql, $move);
|
||||
$query=$sql->prepare("SELECT CONCAT(`ip`,':',`port`) AS `address` FROM `voice_server` WHERE `id`=? AND `userid`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($row['sid'],$user_id,$reseller_id));
|
||||
$query->execute(array($row['sid'], $user_id, $reseller_id));
|
||||
$address=$query->fetchColumn();
|
||||
$loguseraction="%use% %voserver% %backup% ${row['name']} ${address}";
|
||||
$insertlog->execute();
|
||||
@ -187,10 +187,10 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
} else {
|
||||
$template_file=$spracheResponse->token;
|
||||
}
|
||||
} else if ($ui->st('d','get')=='pk' and $ui->id('id',10,'get') and (!isset($_SESSION['sID']) or in_array($ui->id('id',10,'get'),$substituteAccess['vo']))) {
|
||||
} else if ($ui->st('d','get')=='pk' and $ui->id('id',10,'get') and (!isset($_SESSION['sID']) or in_array($ui->id('id',10,'get'), $substituteAccess['vo']))) {
|
||||
$id=$ui->id('id',10,'get');
|
||||
$query=$sql->prepare("SELECT `masterserver`,`localserverid`,CONCAT(`ip`,':',`port`) AS `address` FROM `voice_server` WHERE `id`=? AND `userid`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($id,$user_id,$reseller_id));
|
||||
$query->execute(array($id, $user_id, $reseller_id));
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$masterserver=$row['masterserver'];
|
||||
$localserverid=$row['localserverid'];
|
||||
@ -208,19 +208,19 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
$queryip=$row['ssh2ip'];
|
||||
} else if ($addedby=='1') {
|
||||
$pselect3=$sql->prepare("SELECT `ip`,`bitversion` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$pselect3->execute(array($row['rootid'],$reseller_id));
|
||||
$pselect3->execute(array($row['rootid'], $reseller_id));
|
||||
foreach ($pselect3->fetchall(PDO::FETCH_ASSOC) as $row3) {
|
||||
$queryip=$row3['ip'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($masteractive) and $masteractive=='Y') {
|
||||
$connection=new TS3($queryip,$queryport,'serveradmin',$querypassword);
|
||||
$connection=new TS3($queryip, $queryport,'serveradmin', $querypassword);
|
||||
$errorcode=$connection->errorcode;
|
||||
if (strpos($errorcode,'error id=0') === false) {
|
||||
$template_file=$spracheResponse->error_ts_query_connect.$errorcode;
|
||||
} else {
|
||||
if (isset($server_port) and $server_port=='1') {
|
||||
if ($ui->port('po', 'get') == 1) {
|
||||
$servergroups=array();
|
||||
foreach($connection->ServerGroups($localserverid) as $servergroup) {
|
||||
if ($servergroup['type']=='1') {
|
||||
@ -228,12 +228,12 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
}
|
||||
}
|
||||
$template_file="userpanel_voiceserver_key_add.tpl";
|
||||
} else if (!$ui->smallletters('action',2,'post') and !isset($server_port)) {
|
||||
} else if (!$ui->smallletters('action',2,'post') and !$ui->port('po', 'get')) {
|
||||
$pklist=$connection->KeyList($localserverid);
|
||||
$template_file=(is_array($pklist)) ? "userpanel_voiceserver_key_list.tpl" : $spracheResponse->ts_query_success.$pklist;
|
||||
} else if ($ui->smallletters('action',2,'post')=='ad') {
|
||||
if ($ui->id('group',255,'post')) {
|
||||
$newkey=$connection->AddKey($localserverid,$ui->id('group',255,'post'));
|
||||
$newkey=$connection->AddKey($localserverid, $ui->id('group',255,'post'));
|
||||
$loguseraction="%add% %voserver% Token ${address}";
|
||||
$insertlog->execute();
|
||||
$template_file=$spracheResponse->ts_query_success.$newkey[0]['token'];
|
||||
@ -241,7 +241,7 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
} else if ($ui->smallletters('action',2,'post')=='dl') {
|
||||
$loguseraction="%del% %voserver% Token ${address}";
|
||||
$insertlog->execute();
|
||||
$del=$connection->DelKey($localserverid,$ui->post['token']);
|
||||
$del=$connection->DelKey($localserverid, $ui->post['token']);
|
||||
$template_file=$spracheResponse->ts_query_success.$del[0]['msg'];
|
||||
}
|
||||
}
|
||||
@ -252,10 +252,10 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
} else {
|
||||
$template_file='userpanel_404.tpl';
|
||||
}
|
||||
} else if ($ui->st('d','get')=='rs' and $ui->id('id',10,'get') and $ui->smallletters('action',2,'post')=='rs' and (!isset($_SESSION['sID']) or in_array($ui->id('id',10,'get'),$substituteAccess['vo']))) {
|
||||
} else if ($ui->st('d','get')=='rs' and $ui->id('id',10,'get') and $ui->smallletters('action',2,'post')=='rs' and (!isset($_SESSION['sID']) or in_array($ui->id('id',10,'get'), $substituteAccess['vo']))) {
|
||||
$id=$ui->id('id',10,'get');
|
||||
$query=$sql->prepare("SELECT v.*,m.`type`,m.`queryport`,AES_DECRYPT(m.`querypassword`,?) AS `decryptedquerypassword`,m.`rootid`,m.`addedby`,m.`ssh2ip`,m.`defaultname`,m.`defaultwelcome`,m.`defaulthostbanner_url`,m.`defaulthostbanner_gfx_url`,m.`defaulthostbutton_tooltip`,m.`defaulthostbutton_url`,m.`defaulthostbutton_gfx_url`,m.`usedns` FROM `voice_server` v LEFT JOIN `voice_masterserver` m ON v.`masterserver`=m.`id` WHERE v.`active`='Y' AND m.`active`='Y' AND v.`id`=? AND v.`userid`=? AND v.`resellerid`=? LIMIT 1");
|
||||
$query->execute(array($aeskey,$id,$user_id,$reseller_id));
|
||||
$query->execute(array($aeskey, $id, $user_id, $reseller_id));
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$addedby=$row['addedby'];
|
||||
$queryport=$row['queryport'];
|
||||
@ -282,20 +282,20 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
$queryip=$row['ssh2ip'];
|
||||
} else if ($addedby=='1') {
|
||||
$query=$sql->prepare("SELECT `ip` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($vrow['rootid'],$reseller_id));
|
||||
$query->execute(array($vrow['rootid'], $reseller_id));
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$queryip=$row['ip'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($queryip,$queryport,$querypassword)) {
|
||||
$connection=new TS3($queryip,$queryport,'serveradmin',$querypassword);
|
||||
if (isset($queryip, $queryport, $querypassword)) {
|
||||
$connection=new TS3($queryip, $queryport,'serveradmin', $querypassword);
|
||||
$errorcode=$connection->errorcode;
|
||||
if (strpos($errorcode,'error id=0') === false) {
|
||||
$template_file=$spracheResponse->error_ts_query_connect.$errorcode;
|
||||
} else {
|
||||
$connection->StartServer($volocalserverid);
|
||||
$connection->ModServer($volocalserverid,$slots,$voip,$voport,$password,$name,$welcome,$max_download_total_bandwidth,$max_upload_total_bandwidth,$banner_url,$banner_gfx,$button_url,$button_gfx,$tooltip);
|
||||
$connection->ModServer($volocalserverid, $slots, $voip, $voport, $password, $name, $welcome, $max_download_total_bandwidth, $max_upload_total_bandwidth, $banner_url, $banner_gfx, $button_url, $button_gfx, $tooltip);
|
||||
$reply=$connection->PermReset($volocalserverid);
|
||||
$loguseraction="%reinstall% %voserver% ${voip}:${voport}";
|
||||
$insertlog->execute();
|
||||
@ -323,10 +323,10 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
$addlist[]='i_needed_modify_power_virtualserver_modify_welcomemessage';
|
||||
}
|
||||
if (isset($addlist)) {
|
||||
$connection->AdminPermissions ($volocalserverid,'add',$addlist);
|
||||
$connection->AdminPermissions ($volocalserverid,'add', $addlist);
|
||||
}
|
||||
if (isset($removelist)) {
|
||||
$connection->AdminPermissions ($volocalserverid,'del',$removelist);
|
||||
$connection->AdminPermissions ($volocalserverid,'del', $removelist);
|
||||
}
|
||||
} else {
|
||||
$template_file=$spracheResponse->error_ts_query.$connection->errorcode;
|
||||
@ -336,11 +336,11 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
} else {
|
||||
$template_file='userpanel_404.tpl';
|
||||
}
|
||||
} else if ($ui->st('d','get')=='md' and $ui->id('id',10,'get') and (!isset($_SESSION['sID']) or in_array($ui->id('id',10,'get'),$substituteAccess['vo']))) {
|
||||
} else if ($ui->st('d','get')=='md' and $ui->id('id',10,'get') and (!isset($_SESSION['sID']) or in_array($ui->id('id',10,'get'), $substituteAccess['vo']))) {
|
||||
$id=$ui->id('id',10,'get');
|
||||
if (!$ui->smallletters('action',2,'post')) {
|
||||
$query=$sql->prepare("SELECT * FROM `voice_server` WHERE `id`=? AND `userid`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($id,$user_id,$reseller_id));
|
||||
$query->execute(array($id, $user_id, $reseller_id));
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$masterserver=$row['masterserver'];
|
||||
$ip=$row['ip'];
|
||||
@ -356,7 +356,7 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
$password=$row['password'];
|
||||
if ($active=='Y') {
|
||||
$query2=$sql->prepare("SELECT *,AES_DECRYPT(`querypassword`,?) AS `decryptedquerypassword` FROM `voice_masterserver` WHERE `id`=? AND (`resellerid`=? OR (`managedServer`='Y' AND `managedForID`=?)) LIMIT 1");
|
||||
$query2->execute(array($aeskey,$row['masterserver'],$reseller_id,$reseller_id));
|
||||
$query2->execute(array($aeskey, $row['masterserver'], $reseller_id, $reseller_id));
|
||||
foreach ($query2->fetchall(PDO::FETCH_ASSOC) as $row2) {
|
||||
$resellerToUse=$row2['resellerid'];
|
||||
$masteractive=$row2['active'];
|
||||
@ -371,7 +371,7 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
$queryip=$row2['ssh2ip'];
|
||||
} else if ($addedby=='1') {
|
||||
$query3=$sql->prepare("SELECT `ip`,`altips` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query3->execute(array($row2['rootid'],$resellerToUse));
|
||||
$query3->execute(array($row2['rootid'], $resellerToUse));
|
||||
foreach ($query3->fetchall(PDO::FETCH_ASSOC) as $row3) {
|
||||
$queryip=$row3['ip'];
|
||||
}
|
||||
@ -379,7 +379,7 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
}
|
||||
if (isset($tsdnsServerID) and isid($tsdnsServerID,10)) {
|
||||
$query2=$sql->prepare("SELECT `defaultdns` FROM `voice_tsdns` WHERE `active`='Y' AND `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query2->execute(array($tsdnsServerID,$resellerToUse));
|
||||
$query2->execute(array($tsdnsServerID, $resellerToUse));
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
if ($externalDefaultDNS=='Y') {
|
||||
$defaultdns=strtolower($id.'.'.$row2['defaultdns']);
|
||||
@ -389,7 +389,7 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
}
|
||||
}
|
||||
if ($masteractive=='Y' and $active=='Y') {
|
||||
$connection=new TS3($queryip,$queryport,'serveradmin',$querypassword);
|
||||
$connection=new TS3($queryip, $queryport,'serveradmin', $querypassword);
|
||||
$errorcode=$connection->errorcode;
|
||||
if (strpos($errorcode,'error id=0') === false) {
|
||||
$template_file=$spracheResponse->error_ts_query_connect.$errorcode."<br />";
|
||||
@ -419,7 +419,7 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
}
|
||||
} else if ($ui->smallletters('action',2,'post')=='md' and token(true)){
|
||||
$query=$sql->prepare("SELECT `active`,`ip`,`port`,`slots`,`dns`,`masterserver`,`localserverid`,`password`,`forceservertag`,`forcebanner`,`forcebutton`,`forcewelcome`,`max_download_total_bandwidth`,`max_upload_total_bandwidth` FROM `voice_server` WHERE `id`=? AND `userid`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($id,$user_id,$reseller_id));
|
||||
$query->execute(array($id, $user_id, $reseller_id));
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$active=$row['active'];
|
||||
$ip=$row['ip'];
|
||||
@ -462,7 +462,7 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
$bitversion=$row['bitversion'];
|
||||
} else if ($addedby=='1') {
|
||||
$query2=$sql->prepare("SELECT `ip`,`bitversion` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query2->execute(array($row['rootid'],$resellerToUse));
|
||||
$query2->execute(array($row['rootid'], $resellerToUse));
|
||||
foreach ($query2->fetchall(PDO::FETCH_ASSOC) as $row2) {
|
||||
$queryip=$row2['ip'];
|
||||
$bitversion=$row2['bitversion'];
|
||||
@ -473,7 +473,7 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
$error="Error:<br />";
|
||||
if ($masteractive=='N') $fail=1;
|
||||
$dns=strtolower($ui->domain('dns','post'));
|
||||
$dnsCheck=checkDNS($dns,$id,$user_id,$type='server');
|
||||
$dnsCheck=checkDNS($dns, $id, $user_id, $type='server');
|
||||
if ($fail!=1 and $usedns=='Y' and $dns!=$olddns and $dns!='' and $dnsCheck!==false) {
|
||||
if (isset($tsdnsServerID) and isid($tsdnsServerID,10) and isset($resellerToUse)) {
|
||||
$query=$sql->prepare("SELECT *,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_tsdns` WHERE `active`='Y' AND `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
@ -490,7 +490,7 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
$slots=$row['slots'];
|
||||
}
|
||||
}
|
||||
$return=tsdns('md',$queryip,$ssh2port,$ssh2user,$publickey,$keyname,$ssh2password,$mnotified,$serverdir,$bitversion,array($ip,$oldip),array($port,$oldport),array($dns,$olddns),$reseller_id,$sql);
|
||||
$return=tsdns('md', $queryip, $ssh2port, $ssh2user, $publickey, $keyname, $ssh2password, $mnotified, $serverdir, $bitversion,array($ip, $oldip),array($port, $oldport),array($dns, $olddns), $reseller_id, $sql);
|
||||
$template_file=($return=='ok') ? $spracheResponse->ts_query_success.$return : $spracheResponse->error_ts_query.$return;
|
||||
} else if ($usedns=='Y' and $dns!=$olddns and $dns!='' and $dnsCheck===false) {
|
||||
$error .=" DNS is not allowed<br />";
|
||||
@ -499,7 +499,7 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
if ($fail!=1) {
|
||||
$initialpassword=$ui->password('initialpassword',50,'post');
|
||||
$name=$ui->post['name'];
|
||||
$connection=new TS3($queryip,$queryport,'serveradmin',$querypassword);
|
||||
$connection=new TS3($queryip, $queryport,'serveradmin', $querypassword);
|
||||
$errorcode=$connection->errorcode;
|
||||
if (strpos($errorcode,'error id=0') === false) {
|
||||
$template_file=$spracheResponse->error_ts_query_connect.$errorcode;
|
||||
@ -533,12 +533,12 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
$virtualserver_needed_identity_security_level=$ui->id('virtualserver_needed_identity_security_level',255,'post');
|
||||
$virtualserver_reserved_slots=($ui->id('virtualserver_reserved_slots',4,'post') and $ui->id('virtualserver_reserved_slots',4,'post')<$slots) ? $ui->id('virtualserver_reserved_slots',4,'post') : 0;
|
||||
|
||||
$mod=$connection->ModServer($localserverid,$slots,$ip,$port,$initialpassword,$name,$welcome,$max_download_total_bandwidth,$max_upload_total_bandwidth,$banner_url,$banner_gfx,$button_url,$button_gfx,$tooltip,$virtualserver_reserved_slots,$virtualserver_needed_identity_security_level,$virtualserver_hostmessage_mode,$virtualserver_hostbanner_gfx_interval,$virtualserver_antiflood_points_tick_reduce,$virtualserver_antiflood_points_needed_command_block,$virtualserver_antiflood_points_needed_ip_block);
|
||||
$mod=$connection->ModServer($localserverid, $slots, $ip, $port, $initialpassword, $name, $welcome, $max_download_total_bandwidth, $max_upload_total_bandwidth, $banner_url, $banner_gfx, $button_url, $button_gfx, $tooltip, $virtualserver_reserved_slots, $virtualserver_needed_identity_security_level, $virtualserver_hostmessage_mode, $virtualserver_hostbanner_gfx_interval, $virtualserver_antiflood_points_tick_reduce, $virtualserver_antiflood_points_needed_command_block, $virtualserver_antiflood_points_needed_ip_block);
|
||||
$template_file=$spracheResponse->table_add.'<br />'.$spracheResponse->ts_query_success.$mod[0]['msg'];
|
||||
}
|
||||
$connection->CloseConnection();
|
||||
$query=$sql->prepare("UPDATE `voice_server` SET `dns`=?,`initialpassword`=? WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($dns,$initialpassword,$id,$reseller_id));
|
||||
$query->execute(array($dns, $initialpassword, $id, $reseller_id));
|
||||
$loguseraction="%mod% %voserver% ${ip}:${port}";
|
||||
$insertlog->execute();
|
||||
} else {
|
||||
@ -550,10 +550,10 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
} else {
|
||||
$template_file=$spracheResponse->token;
|
||||
}
|
||||
} else if ($ui->st('d','get')=='st' and $ui->id('id',10,'get') and $ui->smallletters('action',2,'post') and (!isset($_SESSION['sID']) or in_array($ui->id('id',10,'get'),$substituteAccess['vo']))) {
|
||||
} else if ($ui->st('d','get')=='st' and $ui->id('id',10,'get') and $ui->smallletters('action',2,'post') and (!isset($_SESSION['sID']) or in_array($ui->id('id',10,'get'), $substituteAccess['vo']))) {
|
||||
$id=$ui->id('id',10,'get');
|
||||
$query=$sql->prepare("SELECT v.`ip`,v.`port`,v.`localserverid`,m.`type`,m.`queryport`,AES_DECRYPT(m.`querypassword`,?) AS `decryptedquerypassword`,m.`rootid`,m.`addedby`,m.`ssh2ip` FROM `voice_server` v LEFT JOIN `voice_masterserver` m ON v.`masterserver`=m.`id` WHERE v.`active`='Y' AND m.`active`='Y' AND v.`id`=? AND v.`userid`=? AND v.`resellerid`=? LIMIT 1");
|
||||
$query->execute(array($aeskey,$id,$user_id,$reseller_id));
|
||||
$query->execute(array($aeskey, $id, $user_id, $reseller_id));
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$addedby=$row['addedby'];
|
||||
$queryport=$row['queryport'];
|
||||
@ -563,12 +563,12 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
$queryip=$row['ssh2ip'];
|
||||
} else if ($addedby=='1') {
|
||||
$query=$sql->prepare("SELECT `ip` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($row['rootid'],$reseller_id));
|
||||
$query->execute(array($row['rootid'], $reseller_id));
|
||||
$queryip=$query->fetchColumn();
|
||||
}
|
||||
}
|
||||
if (isset($queryip)) {
|
||||
$connection=new TS3($queryip,$queryport,'serveradmin',$querypassword);
|
||||
$connection=new TS3($queryip, $queryport,'serveradmin', $querypassword);
|
||||
$errorcode=$connection->errorcode;
|
||||
if (strpos($errorcode,'error id=0') === false) {
|
||||
$template_file=$spracheResponse->error_ts_query_connect.$errorcode;
|
||||
@ -587,7 +587,7 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
}
|
||||
if (isset($reply)) {
|
||||
$query=$sql->prepare("UPDATE `voice_server` SET `uptime`=? WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($uptime,$id,$reseller_id));
|
||||
$query->execute(array($uptime, $id, $reseller_id));
|
||||
$template_file=$spracheResponse->ts_query_success.$reply[0]['msg'];
|
||||
} else {
|
||||
$template_file='Unknown Error';
|
||||
@ -626,9 +626,9 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
|
||||
}
|
||||
$table=array();
|
||||
$query=$sql->prepare("SELECT v.*,m.`type`,m.`usedns` FROM `voice_server` v INNER JOIN `voice_masterserver` m ON v.`masterserver`=m.`id` WHERE v.`active`='Y' AND m.`active`='Y' AND v.`userid`=? AND v.`resellerid`=? ORDER BY $orderby");
|
||||
$query->execute(array($user_id,$reseller_id));
|
||||
$query->execute(array($user_id, $reseller_id));
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
if (!isset($_SESSION['sID']) or in_array($row['id'],$substituteAccess['vo'])) {
|
||||
if (!isset($_SESSION['sID']) or in_array($row['id'], $substituteAccess['vo'])) {
|
||||
$dns=$row['dns'];
|
||||
if ($row['type']=='ts3') {
|
||||
$type=$sprache->ts3;
|
||||
|
@ -85,21 +85,21 @@ if ($ui->st('d','get')=='ud' and $reseller_id==0 and $pa['updateEW'] and ($ewVer
|
||||
}
|
||||
}
|
||||
$response=new UpdateResponse();
|
||||
if (!is_dir(EASYWIDIR.'/tmp')) {
|
||||
@mkdir(EASYWIDIR.'/tmp');
|
||||
if (!is_dir(EASYWIDIR . '/tmp')) {
|
||||
@mkdir(EASYWIDIR . '/tmp');
|
||||
}
|
||||
if (is_dir(EASYWIDIR.'/tmp')) {
|
||||
if (is_dir(EASYWIDIR . '/tmp')) {
|
||||
$response->add('Creating tempfolder <b>tmp/</b>');
|
||||
$opts=stream_context_create(array('http'=>array('method'=>'GET','header'=>"Accept-language: en\r\nUser-Agent: ".$ui->server['HTTP_HOST']."\r\n")));
|
||||
$fp=@fopen('http://update.easy-wi.com/ew/'.$licenceDetails['v'].'.zip','rb',false,$opts);
|
||||
$zip=@fopen(EASYWIDIR.'/tmp/'.$licenceDetails['v'].'.zip','wb');
|
||||
$zip=@fopen(EASYWIDIR . '/tmp/'.$licenceDetails['v'].'.zip','wb');
|
||||
if ($fp==true and $zip==true) {
|
||||
while (!feof($fp)){
|
||||
fwrite($zip,fread($fp,8192));
|
||||
}
|
||||
fclose($fp);
|
||||
fclose($zip);
|
||||
$zo=@zip_open(EASYWIDIR.'/tmp/'.$licenceDetails['v'].'.zip');
|
||||
$zo=@zip_open(EASYWIDIR . '/tmp/'.$licenceDetails['v'].'.zip');
|
||||
if (is_resource($zo)) {
|
||||
while ($ze=zip_read($zo)) {
|
||||
$name=zip_entry_name($ze);
|
||||
@ -114,16 +114,16 @@ if ($ui->st('d','get')=='ud' and $reseller_id==0 and $pa['updateEW'] and ($ewVer
|
||||
else $checkfolder=$folders[$i];
|
||||
$i++;
|
||||
}
|
||||
if (isset($checkfolder) and $checkfolder!='' and !is_dir(EASYWIDIR.'/'.$checkfolder) and !is_file(EASYWIDIR.'/'.$checkfolder)) {
|
||||
if (isset($checkfolder) and $checkfolder!='' and !is_dir(EASYWIDIR . '/'.$checkfolder) and !is_file(EASYWIDIR . '/'.$checkfolder)) {
|
||||
@mkdir($checkfolder);
|
||||
if (is_dir(EASYWIDIR.'/'.$checkfolder)) $response->add('Creating new folder: '.$checkfolder);
|
||||
else $response->addError('Cannot create the folder <b>'.EASYWIDIR.'/'.$checkfolder.'</b>');
|
||||
if (is_dir(EASYWIDIR . '/'.$checkfolder)) $response->add('Creating new folder: '.$checkfolder);
|
||||
else $response->addError('Cannot create the folder <b>'.EASYWIDIR . '/'.$checkfolder.'</b>');
|
||||
|
||||
}
|
||||
} else if (!is_dir(EASYWIDIR.'/'.$name) and !is_file(EASYWIDIR.'/'.$name)) {
|
||||
@mkdir(EASYWIDIR.'/'.$name);
|
||||
if (is_dir(EASYWIDIR.'/'.$name)) $response->add('Creating new folder: '.$name);
|
||||
else $response->addError('Cannot create the folder <b>'.EASYWIDIR.'/'.$name.'</b>');
|
||||
} else if (!is_dir(EASYWIDIR . '/'.$name) and !is_file(EASYWIDIR . '/'.$name)) {
|
||||
@mkdir(EASYWIDIR . '/'.$name);
|
||||
if (is_dir(EASYWIDIR . '/'.$name)) $response->add('Creating new folder: '.$name);
|
||||
else $response->addError('Cannot create the folder <b>'.EASYWIDIR . '/'.$name.'</b>');
|
||||
}
|
||||
if (preg_match('/^(.*)\.[\w]{1,}$/',$name) and $zeo) {
|
||||
$nf=fopen($name,'w');
|
||||
@ -155,12 +155,12 @@ if ($ui->st('d','get')=='ud' and $reseller_id==0 and $pa['updateEW'] and ($ewVer
|
||||
} else {
|
||||
$response->add('Error: could not retrieve the update');
|
||||
}
|
||||
$dircontent=scandir(EASYWIDIR.'/tmp/');
|
||||
$dircontent=scandir(EASYWIDIR . '/tmp/');
|
||||
foreach ($dircontent as $c) {
|
||||
if ($c!='.' and $c!='..') rmr(EASYWIDIR.'/tmp/'.$c);
|
||||
if ($c!='.' and $c!='..') rmr(EASYWIDIR . '/tmp/'.$c);
|
||||
}
|
||||
rmr(EASYWIDIR.'/install/');
|
||||
if (is_file(EASYWIDIR.'/tmp/'.$licenceDetails['v'].'.zip')) $response->addError('Cannot remove the content from tempfolder <b>tmp/</b>');
|
||||
rmr(EASYWIDIR . '/install/');
|
||||
if (is_file(EASYWIDIR . '/tmp/'.$licenceDetails['v'].'.zip')) $response->addError('Cannot remove the content from tempfolder <b>tmp/</b>');
|
||||
else $response->add('Removed temporary files from tempfolder');
|
||||
} else {
|
||||
$response->addError('Cannot create the tempfolder <b>tmp/</b>');
|
||||
|
@ -452,8 +452,8 @@ if ($ui->w('action',4,'post') and !token(true)) {
|
||||
|
||||
# https://github.com/easy-wi/developer/issues/70
|
||||
$sshkey=removePub($row['keyname']);
|
||||
$pubkey=EASYWIDIR.'/keys/'.$sshkey.'.pub';
|
||||
$key=EASYWIDIR.'/keys/'.$sshkey;
|
||||
$pubkey=EASYWIDIR . '/keys/'.$sshkey.'.pub';
|
||||
$key=EASYWIDIR . '/keys/'.$sshkey;
|
||||
|
||||
if (file_exists($pubkey) and file_exists($key)) {
|
||||
$ssh2= @ssh2_connect($queryip,$row['decryptedssh2port'],array('hostkey'=>'ssh-rsa'));
|
||||
|
@ -40,51 +40,55 @@ include(EASYWIDIR . '/stuff/functions.php');
|
||||
include(EASYWIDIR . '/stuff/class_validator.php');
|
||||
include(EASYWIDIR . '/stuff/vorlage.php');
|
||||
include(EASYWIDIR . '/stuff/settings.php');
|
||||
$pa=User_Permissions($admin_id);
|
||||
if ((isset($admin_id) and !$pa['user'] and !$pa['gserver'] and !$pa['root']) or !isset($admin_id)) {
|
||||
if (!isset($admin_id) or !isset($reseller_id)) {
|
||||
die('No access');
|
||||
}
|
||||
if ($reseller_id!=0 and isset($admin_id) and $admin_id!=$reseller_id) {
|
||||
$reseller_id=$admin_id;
|
||||
$pa = User_Permissions($admin_id);
|
||||
if (!$pa['user'] and !$pa['gserver'] and !$pa['root']) {
|
||||
die('No access');
|
||||
}
|
||||
if (isset($server_id)) {
|
||||
$referrer=explode('/', str_replace(array('http://','https://'),'',strtolower($ui->escaped('HTTP_REFERER','server'))));
|
||||
$refstring=explode('?',$referrer[1]);
|
||||
if ($reseller_id != 0 and isset($admin_id) and $admin_id != $reseller_id) {
|
||||
$reseller_id = $admin_id;
|
||||
}
|
||||
if ($ui->id('id', 19, 'get')) {
|
||||
$referrer = explode('/', str_replace(array('http://','https://'), '', strtolower($ui->escaped('HTTP_REFERER','server'))));
|
||||
$refstring = explode('?',$referrer[1]);
|
||||
if (isset($refstring[1])) {
|
||||
$from=explode('&',$refstring[1]);
|
||||
$from = explode('&',$refstring[1]);
|
||||
}
|
||||
$query=$sql->prepare("SELECT `resellerid`,`accounttype` FROM `userdata` WHERE `id`=? LIMIT 1");
|
||||
$query->execute(array($server_id));
|
||||
$query = $sql->prepare("SELECT `resellerid`,`accounttype` FROM `userdata` WHERE `id`=? LIMIT 1");
|
||||
$query->execute(array($ui->id('id', 19, 'get')));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$resellerid=$row['resellerid'];
|
||||
$accounttype=$row['accounttype'];
|
||||
$resellerid = $row['resellerid'];
|
||||
$accounttype = $row['accounttype'];
|
||||
}
|
||||
if ($reseller_id!=0 and $resellerid!=$reseller_id) {
|
||||
$sql=null;
|
||||
if ($reseller_id != 0 and $resellerid != $reseller_id) {
|
||||
header('Location: login.php');
|
||||
die('Please allow redirection');
|
||||
}
|
||||
if (isset($accounttype) and $accounttype=='u') {
|
||||
$_SESSION['userid']=$server_id;
|
||||
if (isset($from) and $from[0]=="w=gs") {
|
||||
if (isset($accounttype) and $accounttype == 'u') {
|
||||
$_SESSION['userid'] = $ui->id('id', 19, 'get');
|
||||
if (isset($from) and $from[0] == "w=gs") {
|
||||
header('Location: userpanel.php?w=gs');
|
||||
die('Please allow redirection');
|
||||
} else if (isset($from) and $from[0]=="w=vo") {
|
||||
} else if (isset($from) and $from[0] == "w=vo") {
|
||||
header('Location: userpanel.php?w=vo');
|
||||
die('Please allow redirection');
|
||||
} else if (isset($from) and $from[0]=="w=my") {
|
||||
} else if (isset($from) and $from[0] == "w=my") {
|
||||
header('Location: userpanel.php?w=my');
|
||||
die('Please allow redirection');
|
||||
} else {
|
||||
header('Location: userpanel.php');
|
||||
die('Please allow redirection');
|
||||
}
|
||||
} else if (isset($accounttype) and $accounttype=='r' and isset($resellerid)) {
|
||||
$_SESSION['oldid']=$admin_id;
|
||||
$_SESSION['oldresellerid']=$reseller_id;
|
||||
$_SESSION['adminid']=$server_id;
|
||||
$_SESSION['resellerid']=$resellerid;
|
||||
if ($reseller_id==0) {
|
||||
$_SESSION['oldadminid']=$admin_id;
|
||||
} else if (isset($accounttype) and $accounttype == 'r' and isset($resellerid)) {
|
||||
$_SESSION['oldid'] = $admin_id;
|
||||
$_SESSION['oldresellerid'] = $reseller_id;
|
||||
$_SESSION['adminid'] = $ui->id('id', 19, 'get');
|
||||
$_SESSION['resellerid'] = $resellerid;
|
||||
if ($reseller_id == 0) {
|
||||
$_SESSION['oldadminid'] = $admin_id;
|
||||
}
|
||||
header('Location: admin.php');
|
||||
die('Please allow redirection');
|
||||
@ -93,7 +97,7 @@ if (isset($server_id)) {
|
||||
die('Please allow redirection');
|
||||
}
|
||||
} else {
|
||||
$sql=null;
|
||||
header('Location: login.php');
|
||||
die('Please allow redirection');
|
||||
}
|
||||
$sql=null;
|
@ -37,7 +37,7 @@
|
||||
|
||||
$main=1;
|
||||
define('EASYWIDIR', dirname(__FILE__));
|
||||
if (is_dir(EASYWIDIR.'/install')) die('Please remove the "install" folder');
|
||||
if (is_dir(EASYWIDIR . '/install')) die('Please remove the "install" folder');
|
||||
include(EASYWIDIR . '/stuff/functions.php');
|
||||
include(EASYWIDIR . '/stuff/class_validator.php');
|
||||
include(EASYWIDIR . '/stuff/vorlage.php');
|
||||
|
Loading…
x
Reference in New Issue
Block a user