ÿØÿà JFIF ` ` ÿþxØ
| Server IP : 109.234.164.53 / Your IP : 216.73.216.110 Web Server : Apache System : Linux cervelle.o2switch.net 4.18.0-553.32.1.lve.el8.x86_64 #1 SMP Thu Dec 19 13:14:03 UTC 2024 x86_64 User : computer3 ( 1098) PHP Version : 7.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/computer3/amper-formance.fr/seo-mailing/settings/ |
Upload File : |
<?php
if(!isset($_SESSION['logs'])){
$logs_array = array();
$result = mysqli_query($db,"SELECT * FROM ".$INFO['sql_tbl_prefix']."system_logs_type");
while($log = mysqli_fetch_array($result)){
$logs_array['id_type'][$log['id']]['name'] = strtolower($log['name']);
$logs_array['id_type'][$log['id']]['val'] = 1;
}
$logs_array['ddate'] = '1';
$_SESSION['logs'] = serialize($logs_array);
}
if(count($_POST)){
$logs = unserialize($_SESSION['logs']);
$ses_array = array('id_type'=>array(),'ddate'=>$_POST['ddate']);
foreach($logs['id_type'] as $key=>$val){
if($key != 'ddate' && array_key_exists($key,$_POST['id_type'])){
$ses_array['id_type'][$key]['name'] = strtolower($val['name']);
$ses_array['id_type'][$key]['val'] = 1;
}elseif($key != 'ddate' && !array_key_exists($key,$_POST['id_type'])){
$ses_array['id_type'][$key]['name'] = strtolower($val['name']);
$ses_array['id_type'][$key]['val'] = 0;
}
}
$_SESSION['logs'] = serialize($ses_array);
}
$logs = unserialize($_SESSION['logs']);
$where = "WHERE ";
$tr = array();
if(is_array($logs['id_type'])){
foreach($logs['id_type'] as $key=>$val){
if($key != 'ddate' && $val['val'] == 1){
$tr[] = $key;
}
}
}
if(count($tr) > 0){
$where .= "id_type IN (";
foreach($logs['id_type'] as $key=>$val){
if($key != 'ddate' && $val['val'] == 1)$where .= $key.",";
}
$where = substr($where,0,-1);
$where .= ") AND ";
}else{
$where .= "id_type IN (1,2,3,4,5,6) AND ";
}
$time = time();
/* '1' => 'today',
'2' => 'Yesterday',
'3' => 'Last 7 Days,'
'4' => 'Last 30 Days,'
'5' => 'Last 90 Days,'
'6' => 'Previous Month',
'7' => 'Month to Date',
'8' => 'Year to Date',
*/
if($logs['ddate'] == 1){ $where .= " ddate > ".strtotime(date("d.m.Y"),time());}
elseif($logs['ddate'] == 2){
$where .= " ddate > ".strtotime(date("d.m.Y 00:00:01", strtotime('-1 day',time())))." AND ddate < " .strtotime(date("d.m.Y 23:59:59", strtotime('-1 day',time())));
}
elseif($logs['ddate'] == 3){
$where .= " ddate > ".strtotime(date("d.m.Y 00:00:01", strtotime('-7 day',time())));
}
elseif($logs['ddate'] == 4){
$where .= " ddate > ".strtotime(date("d.m.Y 00:00:01", strtotime('-30 day',time())));
}
elseif($logs['ddate'] == 5){
$where .= " ddate > ".strtotime(date("d.m.Y 00:00:01", strtotime('-90 day',time())));
}
elseif($logs['ddate'] == 6){
$where .= " ddate > ".strtotime(date("1.m.Y 00:00:01", strtotime('-1 month',time())))." AND ddate <".strtotime(date("t.m.Y 00:00:01", strtotime('-1 month',time())));
}
elseif($logs['ddate'] == 7){
$where .= " ddate >= ".strtotime(date("1.m.Y 00:00:01", time()));
}
elseif($logs['ddate'] == 8){
$where .= " ddate >= ".strtotime(date("1.01.Y 00:00:01", time()));
}
?>
<div class="page-header">
<h1><i class="icon-book icon-large"></i> <?php echo __('System Logs');?></h1>
</div>
<?php if(!isset($_GET['reg'])){?>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['geochart']});
function drawVisualization() {
var data = google.visualization.arrayToDataTable([
['Country', 'Request'],
<?php $query = "SELECT count(*) as pop, country, countryCode, city FROM ".$INFO['sql_tbl_prefix']."system_logs {$where} GROUP by country";
$result = mysqli_query($db,$query) or exit("insert error" . mysqli_error()."<br>".$query);
while($log = mysqli_fetch_array($result)){
if(!empty($log['country'])){
$country = explode(',',$log['country']);
$log['country'] = $country[0];
$sity = explode(' - ', $log['city']);
$c_array[$log['pop']][] = $log['countryCode']."|||".$log['country']."|||".$sity[0]."|||".$sity[1];
?>
['<?php echo $log['country']?>',<?php echo $log['pop']?>],
<?php } }?>
]);
var options = {
colorAxis: {colors: ['#04abff', '#023671']},
width: 700
};
var geochart = new google.visualization.GeoChart(
document.getElementById('visualization'));
geochart.draw(data, options);
}
google.setOnLoadCallback(drawVisualization);
</script>
<?php }else{?>
<script type='text/javascript'>
google.load('visualization', '1', {'packages': ['geochart']});
google.setOnLoadCallback(drawMarkersMap);
function drawMarkersMap() {
var data = google.visualization.arrayToDataTable([
['City', 'Population'],
<?php
$where .= " AND countryCode = '".$_GET['reg']."'";
$i = 0;
$query = "SELECT COUNT(*) AS pop, SUBSTRING_INDEX(city,' - ',-1) AS ccity FROM ".$INFO['sql_tbl_prefix']."system_logs {$where} GROUP by ccity";
$result = mysql_query($query) or exit("insert error" . mysql_error()."<br>".$query);
while($log = mysql_fetch_array($result, MYSQL_ASSOC)){
if(strlen($log['ccity']) > 0){
$c_array[$i][] = $log['pop'];
$c_array[$i][] = $log['ccity'];
$i++;
?>
['<?php echo $log['ccity']?>',<?php echo $log['pop']?>],
<?php }
}?>
]);
var options = {
region: '<?php echo $_GET['reg']?>',
displayMode: 'markers',
colorAxis: {colors: ['#04abff', '#023671']},
width: 700
};
var chart = new google.visualization.GeoChart(document.getElementById('visualization'));
chart.draw(data, options);
};
</script>
<?php }?>
<div style="position:relative">
<?php
require_once('country_array.php');
if(isset($_GET['reg'])){?>
<h4><a href="?systemlogs">World</a> > <a href="?systemlogs®=<?php echo $_GET['reg']?>"><img src='' class='flag flag-<?php echo strtolower($_GET['reg'])?>' style="margin-right:3px; margin-top:-3px"/><?php echo $country[$_GET['reg']]?></a></h4>
<?php }?>
<div id="visualization" style="height:440px"></div>
<div class="span3" style="position:absolute; background:#fff; right:10px; top:<?php if(!isset($_GET['reg'])){?>0<?php }else{?>35<?php }?>px; height:430px; overflow:scroll; overflow-x:hidden; display:block">
<ul class="nav nav-tabs nav-stacked">
<?php
if(!isset($_GET['reg']) && isset($c_array) && is_array($c_array)){
krsort($c_array); $i = 0;
foreach($c_array as $key=>$val){
$i++;
foreach($val as $v){
$vv = explode("|||", $v);
echo "<li><a href='?systemlogs®=".$vv[0]."'><img src='' class='flag flag-".strtolower($vv[0])."'/> - {$vv[1]} ({$key})</a></li>";
}
}
}elseif(isset($c_array) && is_array($c_array)){
krsort($c_array); $i = 0;
foreach($c_array as $key=>$val){
if($val[0] != '')echo "<li><a href='#'>{$val[1]} (".($val[0]!=0 ?$val[0]:0).")</a></li>";
}
}
?></ul></div>
</div>
<div class="row-fluid">
<div class="well">
<form action="" method="post">
<?php
foreach($logs['id_type'] as $key=>$val){
if($key != 'ddate'){?>
<label class="pull-left" style="margin-right:10px; margin-top:-4px"><?php echo ucfirst($val['name'])?>
<div class="switch switch-small" tabindex="0">
<input type="checkbox" name="id_type[<?php echo $key?>]" <?php if($val['val'] == 1){?> checked="checked" <?php }?>>
</div>
</label>
<?php }}?>
<div class="pull-left">
<div class="input-append" style="margin-top:-4px">
<select name="ddate">
<option value="1" <?php if($logs['ddate'] == 1){?> selected="selected"<?php }?>><?php echo __('Today');?></option>
<option value="2" <?php if($logs['ddate'] == 2){?> selected="selected"<?php }?>><?php echo __('Yesterday');?></option>
<option value="3" <?php if($logs['ddate'] == 3){?> selected="selected"<?php }?>><?php echo __('Last 7 Days');?></option>
<option value="4" <?php if($logs['ddate'] == 4){?> selected="selected"<?php }?>><?php echo __('Last 30 Days');?></option>
<option value="5" <?php if($logs['ddate'] == 5){?> selected="selected"<?php }?>><?php echo __('Last 90 Days');?></option>
<option value="6" <?php if($logs['ddate'] == 6){?> selected="selected"<?php }?>><?php echo __('Previous Month');?></option>
<option value="7" <?php if($logs['ddate'] == 7){?> selected="selected"<?php }?>><?php echo __('Month to Date');?></option>
<option value="8" <?php if($logs['ddate'] == 8){?> selected="selected"<?php }?>><?php echo __('Year to Date');?></option>
</select>
<button type="submit" class="btn btn-primary">Ok</button>
</div>
</div>
</form>
</div>
<div class="clearfix"></div>
</div>
<?php
$query = "SELECT *,
(SELECT name FROM ".$INFO['sql_tbl_prefix']."system_logs_type WHERE ".$INFO['sql_tbl_prefix']."system_logs_type.id = ".$INFO['sql_tbl_prefix']."system_logs.id_type LIMIT 1) as type_name,
(SELECT name FROM ".$INFO['sql_tbl_prefix']."user WHERE ".$INFO['sql_tbl_prefix']."user.id = ".$INFO['sql_tbl_prefix']."system_logs.id_user LIMIT 1) as user_name
FROM ".$INFO['sql_tbl_prefix']."system_logs {$where} ORDER by ddate DESC";
$result = mysqli_query($db,$query) or exit("insert error" . mysqli_error()."<br>".$query);
$class_tr = array(
'1' => '',
'2' => '',
'3' => 'success',
'4' => 'warning',
'5' => 'error',
'6' => 'error'
);
if(mysql_num_rows($result) > 0){?>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="span2"><?php echo __('Time');?></th>
<th class="span1"><?php echo __('Type');?></th>
<th><?php echo __('User');?></th>
<th class="span1"><?php echo __('IP');?></th>
<th class="span3"><?php echo __('Country');?></th>
<th class="span3"><?php echo __('City');?></th>
<th><?php echo __('URL');?></th>
<th><?php echo __('Description');?></th>
</tr>
</thead>
<tbody>
<?php while($log = mysqli_fetch_array($result)){ ?>
<tr class="font11 <?php echo $class_tr[$log['id_type']]?>">
<td><?php echo date("H:i:s d.m.Y",$log['ddate'])?></td>
<td><?php echo $log['type_name']?></td>
<td><?php echo $log['user_name']?></td>
<td><?php echo $log['ip'];
if(strlen($log['country']) < 2 || strlen($log['city']) < 2 || strlen($log['countryCode']) == 0){
$ip_array = explode(",",$log['ip']);
if(count($ip_array)==1){
$query = IPAPI::query($ip_array[0]);
$query_up = "UPDATE ".$INFO['sql_tbl_prefix']."system_logs SET
country = '".$query->country."',
countryCode = '".$query->countryCode."',
city= '".$query->regionName." - ".$query->city."'
WHERE id = {$log['id']} LIMIT 1 ";
mysql_query($query_up);
}
}
?></td>
<td><?php if(strlen($log['country']) > 0){?><img src="" class="flag flag-<?php echo strtolower($log['countryCode'])?>" alt="" title="<?php echo $log['country']?>" /><?php }?> <?php echo $log['country']?></td>
<td><?php echo $log['city']?></td>
<td><?php echo $log['url']?></td>
<td><?php echo $log['message']?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php }else{?>
<div class="alert alert-info">
<h4><i class="icon-info-sign"></i> <?php echo __('Information');?></h4>
<?php echo __('No information available');?>
</div>
<?php } ?>