Skip to content

Commit

Permalink
Merge commit '5239d2800041cb77d9344843c3bf9cb9f387bef6'
Browse files Browse the repository at this point in the history
  • Loading branch information
andifahruddinakas committed Aug 2, 2021
2 parents 1071cee + 5239d28 commit 2290118
Showing 1 changed file with 76 additions and 7 deletions.
83 changes: 76 additions & 7 deletions themes/natra/widgets/statistik_pengunjung.php
@@ -1,4 +1,73 @@
<?php if(!defined('BASEPATH')) exit('No direct script access allowed'); ?>
<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>

<?php if (IS_PREMIUM): ?>

$hari_ini = $statistik_pengunjung['hari_ini'];
$kemarin = $statistik_pengunjung['kemarin'];
$total = $statistik_pengunjung['total'];
$os = $statistik_pengunjung['os'];
$ip_address = $statistik_pengunjung['ip_address'];
$browser = statistik_pengunjung['browser'];

<?php else: ?>

<?php

$CI =& get_instance();
$CI->load->library('user_agent');

if ($CI->agent->is_browser()) {
$browser = $CI->agent->browser() . ' ' . $CI->agent->version();
} elseif ($CI->agent->is_robot()) {
$browser = $CI->agent->robot();
} elseif ($CI->agent->is_mobile()) {
$browser = $CI->agent->mobile();
} else {
$browser = 'Tidak ditemukan';
}

$ip = $CI->input->ip_address();
$os = $CI->agent->platform();

if (!isset($_SESSION['MemberOnline'])) {
$cek = $this->db->query("SELECT Tanggal,ipAddress FROM sys_traffic WHERE Tanggal='".date("Y-m-d")."'");
if ($cek->num_rows()==0) {
$up = $this->db->query("INSERT INTO sys_traffic (Tanggal,ipAddress,Jumlah) VALUES ('".date("Y-m-d")."','".$ip."','1')");
$_SESSION['MemberOnline']=date('Y-m-d H:i:s');
} else {
$res = $cek->result_array();
$ipaddr = $res['ipAddress'].$ip;
$up = $this->db->query("UPDATE sys_traffic SET Jumlah=Jumlah + 1,ipAddress='".$ipx."' WHERE Tanggal='".date("Y-m-d")."'");
$_SESSION['MemberOnline']=date('Y-m-d H:i:s');
}
}

$rs = $this->db->query('SELECT Jumlah AS Visitor FROM sys_traffic WHERE Tanggal="'.date("Y-m-d").'" LIMIT 1');
if ($rs->num_rows()>0) {
$visitor = $rs->row(0);
$today = $visitor->Visitor;
} else {
$today = 0;
}

$strSQL = "SELECT Jumlah AS Visitor FROM sys_traffic WHERE Tanggal=(SELECT DATE_ADD(CURDATE(),INTERVAL -1 DAY) FROM sys_traffic LIMIT 1) LIMIT 1";
$rs = $this->db->query($strSQL);
if ($rs->num_rows()>0) {
$visitor = $rs->row(0);
$yesterday = $visitor->Visitor;
} else {
$yesterday = 0;
}

$rs = $this->db->query('SELECT SUM(Jumlah) as Total FROM sys_traffic');
$visitor = $rs->row(0);
$total = $visitor->Total;

$hari_ini = $today;
$kemarin = $yesterday;
$ip_address = $ip;

endif; ?>

<div class="archive_style_1">
<div class="single_bottom_rightbar">
Expand All @@ -8,22 +77,22 @@
<li class="info-case">
<table style="width: 100%;" cellpadding="0" cellspacing="0" class="table table-striped table-inverse counter" >
<tr>
<td class="description">Hari ini</td><td class="dot">:</td><td class="case"><?= ribuan($statistik_pengunjung['hari_ini']) ?></td>
<td class="description">Hari ini</td><td class="dot">:</td><td class="case"><?= ribuan($hari_ini) ?></td>
</tr>
<tr>
<td class="description">Kemarin</td><td class="dot">:</td><td class="case"><?= ribuan($statistik_pengunjung['kemarin']) ?></td>
<td class="description">Kemarin</td><td class="dot">:</td><td class="case"><?= ribuan($kemarin) ?></td>
</tr>
<tr>
<td class="description">Total Pengunjung</td><td class="dot">:</td><td class="case"><?= ribuan($statistik_pengunjung['total']) ?></td>
<td class="description">Total Pengunjung</td><td class="dot">:</td><td class="case"><?= ribuan($total) ?></td>
</tr>
<tr>
<td class="description">Sistem Operasi</td><td class="dot">:</td><td class="case"><?= $statistik_pengunjung['os']; ?></td>
<td class="description">Sistem Operasi</td><td class="dot">:</td><td class="case"><?= $os ?></td>
</tr>
<tr>
<td class="description">IP Address</td><td class="dot">:</td><td class="case"><?= $statistik_pengunjung['ip_address']; ?></td>
<td class="description">IP Address</td><td class="dot">:</td><td class="case"><?= $ip_address ?></td>
</tr>
<tr>
<td class="description">Browser</td><td class="dot">:</td><td class="case"><?= $statistik_pengunjung['browser']; ?></td>
<td class="description">Browser</td><td class="dot">:</td><td class="case"><?= $browser; ?></td>
</tr>
</table>
</li>
Expand Down

0 comments on commit 2290118

Please sign in to comment.