| Server IP : 103.82.32.14 / Your IP : 216.73.217.121 Web Server : Apache/2.2.32 (Unix) mod_ssl/2.2.32 OpenSSL/1.0.1e-fips mod_fcgid/2.3.9 System : Linux cloud.lonmanhoabinh.com 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : lonmakmf ( 524) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /home/rubymnik/public_html/admin/ |
Upload File : |
<?php
include '../configchannel.php';
include 'configtotal.php';
if(!isset($_SESSION['login']['TiLeNhanChiaSe']))
{
$_SESSION['login'] = '';
Header( "Location: https://rubymedia.studio/admin/" );
exit;
}
$resultDate = mysqli_fetch_assoc(Select('SoLieuChannel', false, "" ,'`SoLieuChannel`.`NgayUpdate` DESC'));
$resultDateCheck = Select('SoLieuChannel', true, "`DoanhThu` > 0 AND `NgayUpdate` = '".$resultDate['NgayUpdate']."'" ,'`SoLieuChannel`.`NgayUpdate` DESC');
if($resultDateCheck > 0)
{
$ngaySQL = $resultDate['NgayUpdate'];
}
else
{
$thoiGianGioiHan = date('d/m/Y', strtotime('-1 day', strtotime($resultDate['NgayUpdate'])));
$date = explode('/', $thoiGianGioiHan);
$time = mktime(0,0,0,$date[1],$date[0],$date[2]);
$mysqldate = date( 'Y-m-d H:i:s', $time);
$ngaySQL = $mysqldate;
}
$ngayCapNhat = date("d/m/Y", strtotime($ngaySQL));
// get tổng ngày
$result = Select('SoLieuChannel', false, "`NgayUpdate` = '".$ngaySQL."'");
$tongDoanhThuNgay = 0;
$tongViewNgay = 0;
$tongGioXemNgay = 0;
while($res = mysqli_fetch_array($result))
{
$tongDoanhThuNgay = $tongDoanhThuNgay+$res['DoanhThu'];
$tongViewNgay = $tongViewNgay+$res['SoLuotXem'];
$tongGioXemNgay = $tongGioXemNgay+$res['GioXem'];
}
$thoiGianXemTrungBinhNgay = gmdate("i:s", ($tongGioXemNgay*60*60/$tongViewNgay));
// get tổng 28 ngày
$thoiGianGioiHan = date('d/m/Y', strtotime('-28 day', strtotime($ngaySQL)));
$date = explode('/', $thoiGianGioiHan);
$time = mktime(0,0,0,$date[1],$date[0],$date[2]);
$mysqldate = date( 'Y-m-d H:i:s', $time);
$result = Select('SoLieuChannel', false, "`NgayUpdate` <= '".$ngaySQL."' AND `NgayUpdate` >= '".$mysqldate."'");
$tongDoanhThuThang = 0;
$tongViewThang = 0;
$tongGioXemThang = 0;
while($res = mysqli_fetch_array($result))
{
$tongDoanhThuThang = $tongDoanhThuThang+$res['DoanhThu'];
$tongViewThang = $tongViewThang+$res['SoLuotXem'];
$tongGioXemThang = $tongGioXemThang+$res['GioXem'];
}
$thoiGianXemTrungBinhThang = gmdate("i:s", ($tongGioXemThang*60*60/$tongViewThang));
// Tính phần trăm
$ngaySQLCu = date('d/m/Y', strtotime('-28 day', strtotime($ngaySQL)));
$dateCuDau = explode('/', $ngaySQLCu);
$timeCuDau = mktime(0,0,0,$dateCuDau[1],$dateCuDau[0],$dateCuDau[2]);
$mysqldateCuDau = date( 'Y-m-d H:i:s', $timeCuDau);
$thoiGianGioiHanCu = date('d/m/Y', strtotime('-56 day', strtotime($ngaySQL)));
$dateCu = explode('/', $thoiGianGioiHanCu);
$timeCu = mktime(0,0,0,$dateCu[1],$dateCu[0],$dateCu[2]);
$mysqldateCu = date( 'Y-m-d H:i:s', $timeCu);
$resultCu = Select('SoLieuChannel', false, "`NgayUpdate` <= '".$mysqldateCuDau."' AND `NgayUpdate` >= '".$mysqldateCu."'");
$tongDoanhThuThangCu = 0;
$tongViewThangCu = 0;
$tongGioXemThangCu = 0;
while($resCu = mysqli_fetch_array($resultCu))
{
$tongDoanhThuThangCu = $tongDoanhThuThangCu+$resCu['DoanhThu'];
$tongViewThangCu = $tongViewThangCu+$resCu['SoLuotXem'];
$tongGioXemThangCu = $tongGioXemThangCu+$resCu['GioXem'];
}
if($tongDoanhThuThangCu > $tongDoanhThuThang)
{
$phanTramDT = number_format((($tongDoanhThuThangCu/$tongDoanhThuThang) * 100), 2);
$phanTramDoanhThu = '<i class="fa fa-caret-down text-danger m-r-5"></i> ' . $phanTramDT . '%';
}
else
{
if($tongDoanhThuThangCu != 0)
{
$phanTramDT = number_format((($tongDoanhThuThang/$tongDoanhThuThangCu) * 100), 2);
$phanTramDoanhThu = '<i style="color: #5dec7c;" class="fa fa-caret-up text-primary m-r-5"></i> ' . $phanTramDT . '%';
}
else
{
$phanTramDoanhThu = '<i style="color: #5dec7c;" class="fa fa-caret-up text-primary m-r-5"></i> 100%';
}
}
if($tongViewThangCu > $tongViewThang)
{
$phanTramDT = number_format((($tongViewThangCu/$tongViewThang) * 100), 2);
$phanTramView = '<i class="fa fa-caret-down text-danger m-r-5"></i> ' . $phanTramDT . '%';
}
else
{
if($tongViewThangCu != 0)
{
$phanTramDT = number_format((($tongViewThang/$tongViewThangCu) * 100), 2);
$phanTramView = '<i style="color: #5dec7c;" class="fa fa-caret-up text-primary m-r-5"></i> ' . $phanTramDT . '%';
}
else
{
$phanTramView = '<i style="color: #5dec7c;" class="fa fa-caret-up text-primary m-r-5"></i> 100%';
}
}
if($tongGioXemThangCu > $tongGioXemThang)
{
$phanTramDT = number_format((($tongGioXemThangCu/$tongGioXemThang) * 100), 2);
$phanTramGioXem = '<i class="fa fa-caret-down text-danger m-r-5"></i> ' . $phanTramDT . '%';
}
else
{
if($tongGioXemThangCu != 0)
{
$phanTramDT = number_format((($tongGioXemThang/$tongGioXemThangCu) * 100), 2);
$phanTramGioXem = '<i style="color: #5dec7c;" class="fa fa-caret-up text-primary m-r-5"></i> ' . $phanTramDT . '%';
}
else
{
$phanTramGioXem = '<i style="color: #5dec7c;" class="fa fa-caret-up text-primary m-r-5"></i> 100%';
}
}
// get tổng ngày cũ tính tăng trưởng
$tongNgayTangTruongCu = date('d/m/Y', strtotime('-1 day', strtotime($ngaySQL)));
$dateTangTruongCu = explode('/', $tongNgayTangTruongCu);
$timeTangTruongCu = mktime(0,0,0,$dateTangTruongCu[1],$dateTangTruongCu[0],$dateTangTruongCu[2]);
$mysqldateTangTruongCu = date( 'Y-m-d H:i:s', $timeTangTruongCu);
$resultTangTruongCu = Select('SoLieuChannel', false, "`NgayUpdate` = '".$mysqldateTangTruongCu."'");
$tongDoanhThuNgayTangTruongCu = 0;
$tongViewNgayTangTruongCu = 0;
$tongGioXemNgayTangTruongCu = 0;
while($resTangTruongCu = mysqli_fetch_array($resultTangTruongCu))
{
$tongDoanhThuNgayTangTruongCu = $tongDoanhThuNgayTangTruongCu+$resTangTruongCu['DoanhThu'];
$tongViewNgayTangTruongCu = $tongViewNgayTangTruongCu+$resTangTruongCu['SoLuotXem'];
$tongGioXemNgayTangTruongCu = $tongGioXemNgayTangTruongCu+$resTangTruongCu['GioXem'];
}
if($tongDoanhThuNgay >= $tongDoanhThuNgayTangTruongCu)
{
$doanhThu = round($tongDoanhThuNgay - $tongDoanhThuNgayTangTruongCu);
$doanhThuTongTangTruong = '<i style="color: #5dec7c;" class="fa fa-caret-up text-primary m-r-5"></i> <span style="color: #5dec7c;">$' . $doanhThu . '</span>';
}
else
{
$doanhThu = round($tongDoanhThuNgayTangTruongCu - $tongDoanhThuNgay);
$doanhThuTongTangTruong = '<i class="fa fa-caret-down text-danger m-r-5"></i> <span style="color: #f05050;"> $' . $doanhThu . '</span>';
}
if($tongViewNgay >= $tongViewNgayTangTruongCu)
{
$showtext = $tongViewNgay - $tongViewNgayTangTruongCu;
$tongViewNgayTangTruong = '<i style="color: #5dec7c;" class="fa fa-caret-up text-primary m-r-5"></i> <span style="color: #5dec7c;">' . number_format($showtext) . '</span>';
}
else
{
$showtext = $tongViewNgayTangTruongCu - $tongViewNgay;
$tongViewNgayTangTruong = '<i class="fa fa-caret-down text-danger m-r-5"></i> <span style="color: #f05050;"> ' . number_format($showtext) . '</span>';
}
if($tongGioXemNgay >= $tongGioXemNgayTangTruongCu)
{
$showtext = $tongGioXemNgay - $tongGioXemNgayTangTruongCu;
$tongGioXemNgayTangTruong = '<i style="color: #5dec7c;" class="fa fa-caret-up text-primary m-r-5"></i> <span style="color: #5dec7c;">' . number_format($showtext) . '</span>';
}
else
{
$showtext = $tongGioXemNgayTangTruongCu - $tongGioXemNgay;
$tongGioXemNgayTangTruong = '<i class="fa fa-caret-down text-danger m-r-5"></i> <span style="color: #f05050;"> ' . number_format($showtext) . '</span>';
}
?>
<?php $titlepage = "Trang Tổng Quan" ?>
<?php include 'header/taskbar.php'; ?>
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box">
<h4 class="page-title">Trang Tổng Quan</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-md-6 col-xl-3">
<div class="card" id="tooltip-container">
<div class="card-body">
<i class="fa fa-info-circle text-muted float-end" data-bs-container="#tooltip-container" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Tổng doanh thu các kênh trong ngày <?php echo $ngayCapNhat; ?>"></i>
<h4 class="mt-0 font-16">Doanh Thu Ngày</h4>
<h2 class="text-primary my-3 text-center">$ <span data-plugin="counterup"><?php echo number_format($tongDoanhThuNgay); ?> </span> <span style="font-size: 12px;"><?php echo $doanhThuTongTangTruong; ?></span></h2>
<p class="text-muted mb-0">28 Ngày Qua: $ <?php echo number_format($tongDoanhThuThang); ?> <span class="float-end"><?php //echo $phanTramDoanhThu; ?></span></p>
</div>
</div>
</div>
<div class="col-md-6 col-xl-3">
<div class="card" id="tooltip-container1">
<div class="card-body">
<i class="fa fa-info-circle text-muted float-end" data-bs-container="#tooltip-container1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Tổng lượt xem trong ngày <?php echo $ngayCapNhat; ?>"></i>
<h4 class="mt-0 font-16">Lượt Xem</h4>
<h2 class="text-primary my-3 text-center"><span data-plugin="counterup"><?php echo number_format($tongViewNgay); ?></span> <span style="font-size: 12px;"><?php echo $tongViewNgayTangTruong; ?></span></h2>
<p class="text-muted mb-0">28 Ngày Qua: <?php echo number_format($tongViewThang); ?> <span class="float-end"><?php //echo $phanTramView; ?></span></p>
</div>
</div>
</div>
<div class="col-md-6 col-xl-3">
<div class="card" id="tooltip-container2">
<div class="card-body">
<i class="fa fa-info-circle text-muted float-end" data-bs-container="#tooltip-container2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Tổng giờ xem trong ngày <?php echo $ngayCapNhat; ?>"></i>
<h4 class="mt-0 font-16">Giờ Xem</h4>
<h2 class="text-primary my-3 text-center"><span data-plugin="counterup"><?php echo number_format($tongGioXemNgay); ?></span> <span style="font-size: 12px;"><?php echo $tongGioXemNgayTangTruong; ?></span></h2>
<p class="text-muted mb-0">28 Ngày Qua: <?php echo number_format($tongGioXemThang); ?> <span class="float-end"><?php //echo $phanTramGioXem; ?></span></p>
</div>
</div>
</div>
<div class="col-md-6 col-xl-3">
<div class="card" id="tooltip-container3">
<div class="card-body">
<i class="fa fa-info-circle text-muted float-end" data-bs-container="#tooltip-container3" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Tổng thời gian xem <?php echo $ngayCapNhat; ?>"></i>
<h4 class="mt-0 font-16">Thời Gian Xem</h4>
<h2 class="text-primary my-3 text-center"><?php echo $thoiGianXemTrungBinhNgay; ?></h2>
<p class="text-muted mb-0">28 Ngày Qua: <?php echo $thoiGianXemTrungBinhThang; ?> <span class="float-end"></span></p>
</div>
</div>
</div>
</div>
<!-- end row -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body pb-2">
<div class="float-end d-none d-md-inline-block">
<div class="btn-group mb-2">
<button type="button" class="btn btn-xs btn-secondary">28 Ngày Qua</button>
</div>
</div>
<h4 class="header-title mb-3">Analytics </h4>
<div dir="ltr">
<div id="sales-analytics" class="mt-4" data-colors="#43bfe5,#6c757d"></div>
</div>
</div>
</div> <!-- end card -->
</div> <!-- end col-->
</div>
<!-- end row -->
<div class="row">
<div class="col-xl-6">
<div class="card">
<div class="card-body">
<h4 class="mb-4 mt-0 font-16" style="margin-bottom: 0!important;">Thông Tin Cập Nhật</h4>
<div class="clerfix"></div>
<?php if($_SESSION['login']['Admin'] == 1) : ?>
<div class="border rounded mt-4">
<textarea rows="3" class="form-control border-0 resize-none" id="textareathongtin" placeholder="Nhập thông tin..."></textarea>
<div class="p-2 bg-light d-flex justify-content-between align-items-center">
<div>
<a href="#" class="btn btn-sm px-1 btn-light"><i class='mdi mdi-upload'></i></a>
<a href="#" class="btn btn-sm px-1 btn-light"><i class='mdi mdi-at'></i></a>
</div>
<a type="submit" class="btn btn-sm btn-success" id="sendthongtin"><i class="mdi mdi-send me-1"></i>Gửi</a>
</div>
</div> <!-- end .border-->
<?php endif; ?>
<div class="row" id="boxthongtin" data-plugin="dragula">
<div class="spinner-grow" role="status" id="loadingtable">
<span class="visually-hidden">Loading...</span>
</div>
</div>
</div> <!-- end card-body-->
</div>
<!-- end card-->
</div> <!-- end col -->
<div class="col-xl-6">
<div class="card">
<div class="card-body">
<h4 class="header-title mb-3">Top Kênh Doanh Thu</h4>
<div class="table-responsive">
<table class="table table-borderless table-nowrap table-hover table-centered m-0">
<thead class="table-light">
<tr>
<th>Channel</th>
<th>Người Làm</th>
<th>View</th>
<th>USD 28 Ngày</th>
<th>USD Hôm Nay</th>
</tr>
</thead>
<tbody id="topkenhdoanhthu">
<div class="spinner-grow" role="status" id="loadingtablekenhdoanhthu">
<span class="visually-hidden">Loading...</span>
</div>
</tbody>
</table>
</div> <!-- end .table-responsive-->
</div>
</div> <!-- end card-->
</div> <!-- end col -->
</div>
<!-- end row -->
</div> <!-- container -->
<?php include 'header/footer.php'; ?>
<?php
$tongdoanhthungaydashtext = "";
$tongviewngaydashtext = "";
$ngaythangtext = "";
// get tổng ngày
for($i = 27; $i >= 0; $i--)
{
$thoiGianGioiHan = date('Y/m/d', strtotime('-'.$i.' day', strtotime($ngaySQL)));
$resulta = Select('SoLieuChannel', false, "`NgayUpdate` = '".$thoiGianGioiHan."'");
$tongdoanhthungaydash = 0;
$tongviewngaydash = 0;
while($resa = mysqli_fetch_array($resulta))
{
$tongdoanhthungaydash = $tongdoanhthungaydash+$resa['DoanhThu'];
$tongviewngaydash = $tongviewngaydash+$resa['SoLuotXem'];
}
$thoiGianGioiHanShow = date('d/m', strtotime('-'.$i.' day', strtotime($ngaySQL)));
$tongdoanhthungaydashtext = $tongdoanhthungaydashtext . $tongdoanhthungaydash;
$tongviewngaydashtext = $tongviewngaydashtext . $tongviewngaydash;
$ngaythangtext = $ngaythangtext . '"'.$thoiGianGioiHanShow.'"';
if($i > 0)
{
$tongdoanhthungaydashtext .= ',';
$tongviewngaydashtext .= ',';
$ngaythangtext .= ',';
}
}
?>
<script>
var colors = ["#f1556c"],
dataColors = $("#total-revenue").data("colors");
dataColors && (colors = dataColors.split(","));
var options = {
series: [68],
chart: {
height: 242,
type: "radialBar"
},
plotOptions: {
radialBar: {
hollow: {
size: "65%"
}
}
},
colors: colors,
labels: ["Revenue"]
},
chart = new ApexCharts(document.querySelector("#total-revenue"), options);
chart.render();
colors = ["#1abc9c", "#4a81d4"];
(dataColors = $("#sales-analytics").data("colors")) && (colors = dataColors.split(","));
options = {
series: [{
name: "Lượt Xem",
type: "column",
data: [<?php echo $tongviewngaydashtext; ?>]
}, {
name: "Doanh Thu",
type: "line",
data: [<?php echo $tongdoanhthungaydashtext; ?>]
}],
chart: {
height: 378,
type: "line",
offsetY: 10
},
stroke: {
width: [2, 3]
},
plotOptions: {
bar: {
columnWidth: "50%"
}
},
colors: colors,
dataLabels: {
enabled: !0,
enabledOnSeries: [1]
},
labels: [<?php echo $ngaythangtext; ?>],
xaxis: {
type: "text"
},
legend: {
offsetY: 7
},
grid: {
padding: {
bottom: 20
}
},
fill: {
type: "gradient",
gradient: {
shade: "light",
type: "horizontal",
shadeIntensity: .25,
gradientToColors: void 0,
inverseColors: !0,
opacityFrom: .75,
opacityTo: .75,
stops: [0, 0, 0]
}
},
yaxis: [{
title: {
text: "Số Lượt Xem"
}
}, {
opposite: !0,
title: {
text: "Doanh Thu"
}
}]
};
(chart = new ApexCharts(document.querySelector("#sales-analytics"), options)).render(), $("#dash-daterange").flatpickr({
altInput: !0,
mode: "range",
altFormat: "F j, y",
defaultDate: "today"
});
</script>
<script>
$(document).ready(function(){
$.ajax({url: "thongtinupdate_ajax.php", success: function(result){
$("#boxthongtin").append(result);
$("#loadingtable").attr("style","display: none;");
}});
$.ajax({url: "topkenhdoanhthu_ajax.php", success: function(result){
$("#topkenhdoanhthu").append(result);
$("#loadingtablekenhdoanhthu").attr("style","display: none;");
}});
$("#sendthongtin").click(function(e){
var dataid = $("#textareathongtin").val();
$("#textareathongtin").val('');
var formData = {
'thongtininsert': dataid
};
$.ajax({
url: "thongtinupdate_ajax.php",
type: "post",
data: formData,
success: function(d) {
$("#boxthongtin").html(d);
}
});
});
});
</script>