Partial for ticket 17

Partial for https://github.com/easy-wi/developer/issues/17
This commit is contained in:
Ulrich Block 2013-09-28 13:12:29 +02:00
parent 6fb4e1a6a2
commit 076205ca41
27 changed files with 909 additions and 936 deletions

View File

@ -1,4 +1,5 @@
<?php
/**
* File: images.php.
* Author: Ulrich Block
@ -45,6 +46,7 @@ include(EASYWIDIR . '/stuff/vorlage.php');
include(EASYWIDIR . '/stuff/settings.php');
if (isset($admin_id) and $ui->st('img','get')) {
$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");
@ -73,78 +75,84 @@ if (isset($admin_id) and $ui->st('img','get')) {
$line_colour_2 = $row['line_colour_2'];
$line_colour_3 = $row['line_colour_3'];
}
if (isset($server_id) and $list_gtype!="" and $start>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");
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 {
$starttime = 0;
}
while ($i < $stop) {
if ($d=="md" or $d=="da") {
if ($ui->st('d', 'get') == 'md' or $ui->st('d', 'get') == 'da') {
$day1 = date('Y-m-d',strtotime("+$i day", $starttime));
} else if ($d=="mo") {
} else if ($ui->st('d', 'get') == 'mo') {
$day1 = date('Y-m',strtotime("+$i month", $starttime));
} else if ($d=="ye") {
} else if ($ui->st('d', 'get') == 'ye') {
$day1 = date('Y',strtotime("+$i year", $starttime));
} else {
$day1 = 0;
}
if ($day1 <= date('Y-m-d')) {
$like=$day1."%";
if ($w=="mb") {
$like = $day1 . '%';
if ($ui->st('w', 'get') == 'mb') {
$divisor = (1024 * 1024);
$rounder = 0;
} else if ($w=="tb") {
} else if ($ui->st('w', 'get') == 'tb') {
$divisor = (1024 * 1024 * 1024 * 1024);
$rounder = 6;
} else {
$divisor = (1024 * 1024 * 1024);
$rounder = 2;
}
if ($d=="md" or $d=="ho") {
if ($ui->st('d', 'get') == 'md' or $ui->st('d', 'get') == 'ho') {
$day2 = date('d.m.Y H',strtotime($day1));
} else if ($d=="da") {
} else if ($ui->st('d', 'get') == 'da') {
$day2 = date('d.m.Y',strtotime($day1));
} else if ($d=="mo") {
} else if ($ui->st('d', 'get') == 'mo') {
$day2 = date('m.Y',strtotime($day1));
} else if ($d=="ye") {
} else if ($ui->st('d', 'get') == 'ye') {
$day2 = date('Y',strtotime($day1));
} else {
$day2 = 0;
}
if ($reseller_id==0 and isset($get_shorten)) {
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'=>$get_shorten));
} else if ($reseller_id!=0 and isset($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'=>$get_shorten,':reseller_id'=>$reseller_id));
} else if ($reseller_id==0 and isset($get_distro)) {
$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' => $get_distro));
} else if ($reseller_id!=0 and $reseller_id==$admin_id and isset($get_distro)) {
$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' => $get_distro,':reseller_id'=>$reseller_id));
} else if ($reseller_id==0 and isset($get_short)) {
$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'=>$get_short));;
} else if ($reseller_id!=0 and $reseller_id!=$admin_id and isset($server_ips)) {
$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' => $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->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' => $server_ips."%",':reseller_id'=>$reseller_id));
} else if ($reseller_id==0 and isset($server_ips)) {
$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'=>$server_ips."%"));
} else if ($reseller_id!=0 and $reseller_id!=$admin_id and isset($server_ip)) {
$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' => $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->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 isset($server_ip)) {
} 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'=>$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));
@ -157,48 +165,45 @@ if (isset($admin_id) and $ui->st('img','get')) {
}
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;
$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)) {
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'=>$get_shorten));
} else if ($reseller_id!=0 and isset($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'=>$get_shorten,':reseller_id'=>$reseller_id));
} else if ($reseller_id==0 and isset($get_distro)) {
$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' => $get_distro));
} else if ($reseller_id!=0 and $reseller_id==$admin_id and isset($get_distro)) {
$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' => $get_distro,':reseller_id'=>$reseller_id));
} else if ($reseller_id==0 and isset($get_short)) {
$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'=>$get_short));;
} else if ($reseller_id!=0 and $reseller_id!=$admin_id and isset($server_ips)) {
$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' => $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->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' => $server_ips."%",':reseller_id'=>$reseller_id));
} else if ($reseller_id==0 and isset($server_ips)) {
$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'=>$server_ips."%"));
} else if ($reseller_id!=0 and $reseller_id!=$admin_id and isset($server_ip)) {
$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' => $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->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' => $server_ip,':reseller_id'=>$reseller_id));
} else if ($reseller_id==0 and isset($server_ip)) {
$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'=>$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));
@ -209,10 +214,10 @@ if (isset($admin_id) and $ui->st('img','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");
$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];
@ -266,6 +271,8 @@ if (isset($admin_id) and $ui->st('img','get')) {
$key = round(($max_value / $lines ) * ($lines - $i),2);
} else if ($max_value<0.01) {
$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);
@ -274,11 +281,11 @@ if (isset($admin_id) and $ui->st('img','get')) {
$v = intval($vertical_gap * $i / $ratio);
$i++;
}
$i="0";
$more="0";
$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 ;
@ -286,7 +293,7 @@ if (isset($admin_id) and $ui->st('img','get')) {
$y1new = $y1+$more;
$y1 = $y1new;
$y2= $y1 + $bar_heigth;
if ($i2>"0" and ($i/2)==($i/$i2)) {
if ($i2>0 and ($i/2) == ($i/$i2)) {
$morenew = $more+$spacing2;
$more = $morenew;
} else {
@ -303,12 +310,12 @@ if (isset($admin_id) and $ui->st('img','get')) {
$display = round($amount,4);
}
imagestring($img,0, $x2+5, $y1, $display, $text_color);
if ($i2=="0") {
if ($i2 == 0) {
imagestring($img, $y1+$spacing1+$bar_heigth,2, $y1+$spacing1+$bar_heigth, $key, $text_color);
}
if ($i2=="0") {
if ($i2 == 0) {
imagefilledrectangle($img, $x1, $y1, $x2, $y2, $bar_in);
} else if ($i2=="1") {
} else if ($i2 == 1) {
imagefilledrectangle($img, $x1, $y1, $x2, $y2, $bar_out);
} else if ($i2 == "2") {
imagefilledrectangle($img, $x1, $y1, $x2, $y2, $bar_total);
@ -323,9 +330,9 @@ if (isset($admin_id) and $ui->st('img','get')) {
}
} 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) {
$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'];
@ -345,84 +352,62 @@ if (isset($admin_id) and $ui->st('img','get')) {
$line_colour_2 = $row['line_colour_2'];
$line_colour_3 = $row['line_colour_3'];
}
if (isset($server_id) and $list_gtype!="" and $start>0) {
if ($ui->id('id', 19, 'get') and $list_gtype != '' and $start>0) {
$i = 0;
$stop=$list_gtype;
if ($d=="md" or $d=="to") {
if ($ui->st('d', 'get') == 'md' or $ui->st('d', 'get') == 'to') {
$stop = 23;
$starttime = strtotime("$start-$server_port-$server_id");
$starttime = strtotime($ui->id('p', 19, 'get') . '-' . $ui->port('po', 'get') . '-' . $ui->id('id',19, 'get'));
$now = date('Y-m-d H');
} else if ($d=="da") {
$starttime = strtotime("$start-$server_port-$server_id");
} 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 ($d=="mo") {
$starttime = strtotime("$start-$server_port");
} 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 ($d=="ye") {
$starttime = strtotime("$start");
} 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") {
if ($ui->st('d', 'get') == 'md' or $ui->st('d', 'get') == 'to') {
$day1 = date('Y-m-d H',strtotime("+$i hour", $starttime));
} else if ($d=="da") {
} else if ($ui->st('d', 'get') == 'da') {
$day1 = date('Y-m-d',strtotime("+$i day", $starttime));
} else if ($d=="mo") {
} else if ($ui->st('d', 'get') == 'mo') {
$day1 = date('Y-m',strtotime("+$i month", $starttime));
} else if ($d=="ye") {
} 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") {
$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 ($d=="da") {
} else if ($ui->st('d', 'get') == 'da') {
$day2 = date('d.m.Y',strtotime($day1));
} else if ($d=="mo") {
} else if ($ui->st('d', 'get') == 'mo') {
$day2 = date('m.Y',strtotime($day1));
} else if ($d=="ye") {
} 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']);
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++;
}
@ -469,11 +454,11 @@ if (isset($admin_id) and $ui->st('img','get')) {
$v = intval($vertical_gap * $i /$ratio);
$i++;
}
$i="0";
$more="0";
$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 ;
@ -490,12 +475,12 @@ if (isset($admin_id) and $ui->st('img','get')) {
}
$display = round($amount);
imagestring($img,0, $x2+5, $y1, $display, $text_color);
if ($i2=="0") {
if ($i2 == 0) {
imagestring($img, $y1+$spacing1+$bar_heigth,2, $y1+$spacing1, $key, $text_color);
}
if ($i2=="0") {
if ($i2 == 0) {
imagefilledrectangle($img, $x1, $y1, $x2, $y2, $bar_in);
} else if ($i2=="1") {
} else if ($i2 == 1) {
imagefilledrectangle($img, $x1, $y1, $x2, $y2, $bar_out);
}
$i++;

View File

@ -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");

View File

@ -38,24 +38,20 @@
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.'/';
}
$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');
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')!='') {
$fullday=date('Y-m-d H:i:s',strtotime("+1 day"));
@ -70,20 +66,22 @@ if ($ui->escaped('email','post')!='') {
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))) {
$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);
$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;
} 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)) {
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();
@ -101,43 +99,39 @@ if ($ui->ipport('serveraddress','post') or (isset($server_ip) and isset($server_
$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") {
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%');
$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") {
} else if ($protected == 'N') {
$imgName = '64_unprotected';
$imgAlt = 'unprotected';
} else if ($protected=="Y") {
} else if ($protected == 'Y') {
$imgName = '64_protected';
$imgAlt = 'protected';
}
@ -153,12 +147,12 @@ if ($ui->ipport('serveraddress','post')) {
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,11 +196,11 @@ 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)) {

View File

@ -301,8 +301,8 @@ if ($ui->smallletters('w',5,'get')=='check') {
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");
@ -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') {
@ -469,7 +469,7 @@ if ($ui->smallletters('w',5,'get')=='check') {
$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->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");

View File

@ -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'];

View File

@ -1,4 +1,5 @@
<?php
/**
* File: jobs_list.php.
* Author: Ulrich Block
@ -44,7 +45,7 @@ if ((!isset($admin_id) or $main!=1) or (isset($admin_id) and !$pa['jobs'])) {
$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) {
@ -59,16 +60,16 @@ if ($ui->w('action',4,'post') and !token(true)) {
}
}
$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']);

View File

@ -1,4 +1,5 @@
<?php
/**
* File: settings.php.
* Author: Ulrich Block
@ -36,9 +37,11 @@
*/
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(");
$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();
if($queries != $check_bad) {
die();
}
}
$ui = new ValidateUserinput($_GET, $_POST, $_SERVER,array(), $_ENV);
unset($_GET, $_POST, $_SERVER, $_ENV);
@ -58,7 +61,9 @@ 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);
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);
@ -81,8 +86,7 @@ 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'];
@ -92,13 +96,18 @@ if ($loguserip!="localhost") {
} else if (isset($_SESSION['adminid']) and is_numeric($_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'));
@ -110,12 +119,14 @@ if (isset($reseller_id)) {
$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"));
$logdate = date('Y-m-d H:i:s', strtotime($resellerstimezone .' hour'));
if (isset($user_id) and !isset($admin_id)) {
$lookupid = $reseller_id;
} else {
@ -134,7 +145,9 @@ if (isset($reseller_id)) {
$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'];
@ -169,12 +182,22 @@ if ($loguserip!='localhost') {
$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;
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);
@ -189,6 +212,7 @@ if ($loguserip!='localhost') {
}
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");
@ -202,7 +226,9 @@ if ($loguserip!='localhost') {
}
}
$default_language=(!empty($user_language)) ? $user_language : $rSA['language'];
if (!isset($user_language) or empty($user_language)) $user_language=$default_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);
@ -212,79 +238,44 @@ if (isset($logininclude) and $logininclude==true) {
$query->execute(array($logdate));
$query = $sql->prepare("SELECT `id` FROM `badips` WHERE `badip`=? AND reason='bot' LIMIT 1");
$query->execute(array($loguserip));
if ($query->rowcount()>0) die();
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 ($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'];
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->w('action',4,'post')) {
$action=$ui->w('action',4,'post');
}
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 .="&amp;w=$w";
}
} else {
$w = 'ho';
}
if($ui->st('d', 'get')) {
$d = $ui->st('d', 'get');
if (empty($querystring)) {
$querystring="?d=$d";
} else {
$querystring .="&amp;d=$d";
}
} 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 .="&amp;id=$server_id";
}
}
if($ui->ip('ip','get')) {
$server_ip=$ui->ip('ip','get');
if (isset($querystring)) {
$querystring .="&amp;ip=$server_ip";
} else {
$querystring="?ip=$server_ip";
}
}
if($ui->ips('ips','get')) {
$server_ips=$ui->ips('ips','get');
}
if($ui->id('po',5,'get')) {
$server_port=$ui->id('po',5,'get');
if (empty($querystring)) {
$querystring="?po=$server_port";
} else {
$querystring .="&amp;po=$server_port";
}
}
if($ui->smallletters('t','1', 'get')) {
$list_type = $ui->smallletters('t','1', 'get');
@ -302,7 +293,7 @@ if($ui->smallletters('t','1','get')) {
}
if($ui->pregw('g','14', 'get')) {
$list_gtype = $ui->pregw('g','14', 'get');
if (!$where=='') {
if ($where != '') {
$where .=" AND shorten='$list_gtype'";
} else {
if ($w=="lo") {
@ -311,26 +302,16 @@ if($ui->pregw('g','14','get')) {
$where="WHERE shorten='$list_gtype'";
}
}
if (empty($querystring)) {
$querystring="?g=$list_gtype";
} else {
$querystring .="&amp;g=$list_gtype";
}
} else {
$list_gtype = '';
}
if($ui->pregw('m','20', 'get')) {
$list_gtype = $ui->pregw('m','20', 'get');
if (!$where=='') {
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 .="&amp;m=$list_type";
}
} else {
$list_gtype = '';
}
@ -346,29 +327,27 @@ if (empty($where) and $w!="lo" and $w!="rs" and ($w!="ma" and $d!="ud")) {
if($ui->isinteger('a', 'get')) {
$a = (int) $ui->isinteger('a', 'get');
$amount = $a;
if (empty($querystring)) $querystring="?a=$amount";
else$querystring .="&amp;a=$amount";
$_SESSION['amount'] = $a;
} else {
$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 .="&amp;p=$start";
} else {
$start=0;
}
$link=(isset($querystring) and $querystring!="") ? $querystring."&amp;l=" : "?l=";
$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();
$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);
foreach ($dirs as $row) {
if (small_letters_check($row,2)) $languages[] = $row;
}
@ -379,10 +358,13 @@ if ($w=="ma" and $d=="ud" and isset($action) and $action=="ud" and $ui->descript
$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++;
}
}
@ -393,4 +375,6 @@ if ($w=="ma" and $d=="ud" and isset($action) and $action=="ud" and $ui->descript
}
$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');
}

View File

@ -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;
}

View File

@ -89,7 +89,7 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
$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));
$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));
@ -97,7 +97,7 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
$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';
@ -220,7 +220,7 @@ if ($ui->st('d','get')=='bu' and $ui->id('id',10,'get') and (!isset($_SESSION['s
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,7 +228,7 @@ 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') {

View File

@ -40,31 +40,35 @@ include(EASYWIDIR . '/stuff/functions.php');
include(EASYWIDIR . '/stuff/class_validator.php');
include(EASYWIDIR . '/stuff/vorlage.php');
include(EASYWIDIR . '/stuff/settings.php');
if (!isset($admin_id) or !isset($reseller_id)) {
die('No access');
}
$pa = User_Permissions($admin_id);
if ((isset($admin_id) and !$pa['user'] and !$pa['gserver'] and !$pa['root']) or !isset($admin_id)) {
if (!$pa['user'] and !$pa['gserver'] and !$pa['root']) {
die('No access');
}
if ($reseller_id != 0 and isset($admin_id) and $admin_id != $reseller_id) {
$reseller_id = $admin_id;
}
if (isset($server_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]);
}
$query = $sql->prepare("SELECT `resellerid`,`accounttype` FROM `userdata` WHERE `id`=? LIMIT 1");
$query->execute(array($server_id));
$query->execute(array($ui->id('id', 19, 'get')));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$resellerid = $row['resellerid'];
$accounttype = $row['accounttype'];
}
$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;
$_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');
@ -81,7 +85,7 @@ if (isset($server_id)) {
} else if (isset($accounttype) and $accounttype == 'r' and isset($resellerid)) {
$_SESSION['oldid'] = $admin_id;
$_SESSION['oldresellerid'] = $reseller_id;
$_SESSION['adminid']=$server_id;
$_SESSION['adminid'] = $ui->id('id', 19, 'get');
$_SESSION['resellerid'] = $resellerid;
if ($reseller_id == 0) {
$_SESSION['oldadminid'] = $admin_id;
@ -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;