HEX
Server: Apache/2.4.65 (Debian)
System: Linux srv39710 6.1.0-41-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.158-1 (2025-11-09) x86_64
User: root (0)
PHP: 8.4.11
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Upload Files
File: /var/www/www-root/data/www/peeer.click/tds/files/group.php
<?php
if(!defined("INDEX")){header('HTTP/1.1 403 Forbidden'); die('403 Forbidden');}
$g_uniq_time = $g_uniq_time / 3600;
$g_f_time = $g_f_time / 3600;
if(empty($s) && $q != 's_create' && $q != 'editor' && $q != 'countries' && $q != 'sources' && $q != 'pb' && $q != 'conf' && $q != 'keys'&& $q != 'global'){
	if(!empty($error)){
		echo '<div class="align_center red bold indt_10">'.$error.'</div>';
	}
	if(empty($g_id)){
		echo '<div class="align_center bold indt_10">'.$trans['group']['g1'].'</div>';
	}
	if(!empty($_GET['g'])){
		$g_get = $_GET['g'];
	}
	else{
		$g_get = '';
	}
	if(!empty($g_id) && empty($error)){
		$db = new SQLite3($folder_log.'/'.$g_id.'.db');
		$db->busyTimeout($timeout_2);
		$db->exec("PRAGMA journal_mode = WAL;");
		$dx = '';
		$lp = $period_log;
		$v_total = $h_total = 0;
		while(true){
			$table_temp = strtotime(date("Y-m-d", strtotime('-'.$lp.' day')));
			if($db->querySingle("SELECT name FROM sqlite_master WHERE type = 'table' AND name = '$table_temp';")){
				$dx = date('Y-m-d', $table_temp);
				$dx = explode("-", $dx);
				if(!empty($dx[2])){
					$dx = $dx[2];
				}
				else{
					$dx = date("d", strtotime('-'.$lp.' day'));
				}
				$query = "SELECT COUNT (*) FROM '$table_temp' WHERE bot = '$empty'";
				$ch_visitors = $db->querySingle("$query;");
				$v_total = $v_total + $ch_visitors;
				$ch_hosts = $db->querySingle("$query AND uniq = 'yes';");
				$h_total = $h_total + $ch_hosts;
				$ch_wap = $db->querySingle("$query AND operator != '$empty' AND uniq = 'yes';");
				if($chart_bots == 1){
					$ch_bots = $db->querySingle("SELECT COUNT (*) FROM '$table_temp' WHERE bot != '$empty' AND uniq = 'yes';");
				}
				else{
					$ch_bots = 0;
				}
				if(empty($dg_stats)){
					$dg_stats = '[\''.$dx.'\','.$ch_visitors.','.$ch_hosts.','.$ch_wap.','.$ch_bots.']';
				}
				else{
					$dg_stats = $dg_stats.',[\''.$dx.'\','.$ch_visitors.','.$ch_hosts.','.$ch_wap.','.$ch_bots.']';
				}
				if($charts['se'] == 1){
					$ch_google = $db->querySingle("$query AND se = 'google' AND uniq = 'yes';");
					$ch_yandex = $db->querySingle("$query AND se = 'yandex' AND uniq = 'yes';");
					$ch_mail = $db->querySingle("$query AND se = 'mail' AND uniq = 'yes';");
					$ch_yahoo = $db->querySingle("$query AND se = 'yahoo' AND uniq = 'yes';");
					$ch_bing = $db->querySingle("$query AND se = 'bing' AND uniq = 'yes';");
					$ch_baidu = $db->querySingle("$query AND se = 'baidu' AND uniq = 'yes';");
					if($ch_google != 0 || $ch_yandex != 0 || $ch_mail != 0 || $ch_yahoo != 0 || $ch_bing != 0 || $ch_baidu != 0){
						$ch_se_view = 1;
					}
					if(empty($dg_se)){
						$dg_se = '[\''.$dx.'\','.$ch_google.','.$ch_yandex.','.$ch_mail.','.$ch_yahoo.','.$ch_bing.','.$ch_baidu.']';
					}
					else{
						$dg_se = $dg_se.',[\''.$dx.'\','.$ch_google.','.$ch_yandex.','.$ch_mail.','.$ch_yahoo.','.$ch_bing.','.$ch_baidu.']';
					}
				}
			}
			else{
				if(empty($dg_stats)){
					$dg_stats = '[\''.date("d", strtotime('-'.$lp.' day')).'\',0,0,0,0]';
				}
				else{
					$dg_stats = $dg_stats.',[\''.date("d", strtotime('-'.$lp.' day')).'\',0,0,0,0]';
				}
				if(empty($dg_se)){
					$dg_se = '[\''.date("d", strtotime('-'.$lp.' day')).'\',0,0,0,0,0,0]';
				}
				else{
					$dg_se = $dg_se.',[\''.date("d", strtotime('-'.$lp.' day')).'\',0,0,0,0,0,0]';
				}
			}
			if($lp == 0){
				break;
			}
			$lp--;
		}
		if($charts['unique'] == 1){
			if(!empty($_GET['t'])){
				$table = $_GET['t'];
			}
			else{
				$table = $db->querySingle("SELECT name FROM sqlite_master WHERE type = 'table' ORDER BY name DESC;");
			}
			$ch_today = array();
			$date_today = $ch_time = date('Y-m-d', $table);
			if($db->querySingle("SELECT name FROM sqlite_master WHERE type = 'table' AND name = '$table';")){
				$ch_start = $table;
				$ch_time = '';
				$query = "SELECT COUNT (*) FROM '$table' WHERE bot = '$empty'";
				while($ch_time != '00'){
					$ch_end = $ch_start + 3600;
					$ch_time = date('H', $ch_end);
					$ch_hosts_today = $db->querySingle("$query AND uniq = 'yes' AND strtotime >= $ch_start AND strtotime < $ch_end;");
					$ch_today[$ch_time] = $ch_hosts_today;
					$ch_start = $ch_end;
					if($ch_hosts_today != 0){
						$ch_unique_view = 1;
					}
				}
			}
			$ch_yesterday = array();
			$table_yesterday = $table - 86400;
			$date_yesterday = $ch_time = date('Y-m-d', $table_yesterday);
			if($db->querySingle("SELECT name FROM sqlite_master WHERE type = 'table' AND name = '$table_yesterday';")){
				$ch_start = $table_yesterday;
				$ch_time = '';
				$query = "SELECT COUNT (*) FROM '$table_yesterday' WHERE bot = '$empty'";
				while($ch_time != '00'){
					$ch_end = $ch_start + 3600;
					$ch_time = date('H', $ch_end);
					$ch_hosts_yesterday = $db->querySingle("$query AND uniq = 'yes' AND strtotime >= $ch_start AND strtotime < $ch_end;");
					$ch_yesterday[$ch_time] = $ch_hosts_yesterday;
					$ch_start = $ch_end;
					if($ch_hosts_yesterday != 0){
						$ch_unique_view = 1;
					}
				}
			}
			$ch_t = array('01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','00');
			$h = date('H');
			foreach($ch_t as $v){
				if(!empty($ch_today[$v]) || ($table != strtotime(date("Y-m-d")) && isset($ch_today[$v]))){
					$x = $ch_today[$v];
					$x = ",$x";
				}
				else{
					if($v == '00' || $h < $v){
						$x = ',null';
					}
					else{
						$x = ',0';
					}
				}
				if(!empty($ch_yesterday[$v])){
					$y = $ch_yesterday[$v];
					$y = ",$y";
				}
				else{
					$y = ',0';
				}
				if(empty($dg_unique)){
					$dg_unique = '[\''.$v.'\''.$y.$x.']';
				}
				else{
					$dg_unique = $dg_unique.',[\''.$v.'\''.$y.$x.']';
				}
			}
		}
		$db->close();
		echo '<div class="align_center bold indt_10">'.$trans['group']['g2'].': '.$g_name.'</div>';
	}
	echo '<div id="curve_chart_stats" class="chart indt_20"></div>';
	if($charts['se'] == 1 && $ch_se_view == 1){
		echo '<div id="curve_chart_se" class="chart indt_10"></div>';
	}
	if($charts['unique'] == 1 && $ch_unique_view == 1){
		echo '<div id="curve_chart_unique" class="chart indt_20"></div>';
	}
	echo '<set>
<div class="indt_20"><a class="mobile bold pm" href="#" id="pull_setting">Setting</a></div>
<mob>
<form method="post" action="'.$admin_page.'">
<div class="block">
<div class="item">'.$trans['group']['g3'].'<br><input class="i150" name="g_name" type="text" value="'.$g_name.'" maxlength="30"></div>
<div class="item">'.$trans['group']['g4'].'<br><input class="i150" name="g_id" type="text" value="'.$g_id.'" maxlength="15"></div>
<div class="item">'.$trans['group']['g6'].'<br><textarea class="ta_conf" name="g_aliases" rows="1">'.$g_aliases.'</textarea></div>
<div class="item"><span>'.$trans['group']['g5'].'</span> <select name="g_mode" size = "1">';
	if(empty($g_id)){echo '
<option'; if($g_mode == 'api'){echo ' selected="selected"';} echo ' value="api">API</option>
<option'; if($g_mode == 'javascript'){echo ' selected="selected"';} echo ' value="javascript">JavaScript</option>
<option'; if($g_mode == 'redirect'){echo ' selected="selected"';} echo ' value="redirect">Redirect</option>';
	}
	elseif($g_mode == 'api'){echo '<option selected="selected" value="api">API</option>';}
	elseif($g_mode == 'javascript'){echo '<option selected="selected" value="javascript">JavaScript</option>';}
	else{echo '<option selected="selected" value="redirect">Redirect</option>';}
	echo '
</select></div>
<div class="item"><span>Geo</span> <select name="g_geo" size = "1">
<option'; if($g_geo == 'geolite2'){echo ' selected="selected"';} echo ' value="geolite2">GeoLite2</option>
<option'; if($g_geo == 'sypex'){echo ' selected="selected"';} echo ' value="sypex">Sypex Geo</option>
<option'; if($g_geo == 'cf'){echo ' selected="selected"';} echo ' value="cf">Cloudflare</option>
</select></div>
<div class="item"><span>'.$trans['group']['g7'].'</span> <select name="g_uniq_method" size = "1">
<option'; if($g_uniq_method == '0'){echo ' selected="selected"';} echo ' value="0">Cookies</option>
<option'; if($g_uniq_method == '1'){echo ' selected="selected"';} echo ' value="1">IP</option>
<option'; if($g_uniq_method == '2'){echo ' selected="selected"';} echo ' value="2">Key</option>
</select></div>
<div class="item"><span>'.$trans['group']['g8'].'</span> <input class="i40" name="g_uniq_time" type="number" value="'.$g_uniq_time.'" size="1" maxlength="20"> <span>h.</span></div>
<div class="item"><input class="checkbox" type="checkbox"'; if($g_firewall == 1){echo ' checked="checked"';} echo ' name="g_firewall"> <span>'.$trans['group']['g14'].'</span> <input class="i50" name="g_f_queries" type="number" value="'.$g_f_queries.'" size="1" maxlength="20"> <span>'.$trans['group']['g10'].'</span> <input class="i40" name="g_f_time" type="number" value="'.$g_f_time.'" size="1" maxlength="20"> <span>h.</span></div>
<div class="item"><input class="checkbox" type="checkbox"'; if($g_save_keys == 1){echo ' checked="checked"';} echo ' name="g_save_keys"> <span>'.$trans['group']['g9'].'</span></div>
<div class="item"><input class="checkbox" type="checkbox"'; if($g_save_keys_se == 1){echo ' checked="checked"';} echo ' name="g_save_keys_se"> <span>'.$trans['group']['g13'].'</span></div>
<div class="item"><input class="checkbox" type="checkbox"'; if($g_status == 1){echo ' checked="checked"';} echo ' name="g_status"> <span>'.$trans['group']['g11'].'</span></div>
<div class="item">
'.$trans['group']['g12'].'<br>
<textarea name="g_comment" rows="4">'.$g_comment.'</textarea>
</div>
<div class="align_center">
<input class="button" type="submit" name="button" value="Submit">
</div>
<input name="g_get" type="hidden" value="'.$g_get.'">
</div>
</form>
</mob>
</set>';
}
?>