| 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/admin2/ |
Upload File : |
<?php
include '../configchannel.php';
include 'configtotal.php';
if(isset($_POST['danhsachkenh']))
{
$str = $_POST['danhsachkenh'];
$str = explode("?", $str)[0];
$re = '/^(?:(http|https):\/\/[a-zA-Z-]*\.{0,1}[a-zA-Z-]{3,}\.[a-z]{2,})\/channel\/([a-zA-Z0-9_\/\-]{3,})$/m';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
$tongsoInssert = 0;
foreach($matches as $key => $item)
{
if(isset($item[2]))
{
$idChannelEx = explode("/", $item[2]);
$idChannelEx = explode("?", $idChannelEx[0]);
$idChannel = rtrim($idChannelEx[0], '/');
$result = mysqli_fetch_assoc(SelectThuan('QuanLyChannel', false, 'IdChannel LIKE "'.$idChannel.'"'));
if(isset($result['id']))
{
Update('QuanLyChannel', array('IdNguoiLam' => $_SESSION['login']['id']), '`IdChannel` LIKE "'.$idChannel.'"');
}
else
{
Insert('QuanLyChannel', array('IdChannel' => $idChannel, 'IdNguoiLam' => $_SESSION['login']['id']));
$result = mysqli_fetch_assoc(SelectThuan('QuanLyChannel', false, 'IdChannel LIKE "'.$idChannel.'"'));
Insert('SoLieuChannel', array('IdChannel' => $result['id'], 'NgayUpdate' => "2021-03-01 00:00:00.000000", 'SoLuotXem' => 0, 'GioXem' => 0, 'ThoiGianXemTrungBinh' => '11:00', 'DoanhThu' => 0));
}
$tongsoInssert++;
}
}
if($tongsoInssert == 0)
{
$_SESSION['thongbao'] = 'Không thêm được kênh nào';
}
else
{
$_SESSION['thongbao'] = "Đã Thêm Thành Công " . $tongsoInssert . ' Kênh';
}
Header( "Location: https://rubymedia.studio/admin/channel.php" );
exit;
}
else if(isset($_POST['IdChannelEdit']))
{
$dataInsert = array(
'NameChannel' => mysql_real_escape_string($_POST['NameChannel']),
'NetworkSuport' => mysql_real_escape_string($_POST['NetworkSuport'])
);
Update('QuanLyChannel', $dataInsert, '`id` = ' . $_POST['IdChannelEdit'] . '');
Header( "Location: " . $_SERVER['REQUEST_URI'] );
exit;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="A fully featured admin theme which can be used to build CRM, CMS, etc.">
<meta name="author" content="Coderthemes">
<link rel="shortcut icon" href="assets/images/favicon_1.ico">
<title>Ruby Media</title>
<!--Morris Chart CSS -->
<link href="assets/plugins/custombox/css/custombox.css" rel="stylesheet">
<link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="assets/css/core.css" rel="stylesheet" type="text/css" />
<link href="assets/css/components.css" rel="stylesheet" type="text/css" />
<link href="assets/css/icons.css" rel="stylesheet" type="text/css" />
<link href="assets/css/pages.css" rel="stylesheet" type="text/css" />
<link href="assets/css/responsive.css" rel="stylesheet" type="text/css" />
<!-- HTML5 Shiv and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<script src="assets/js/modernizr.min.js"></script>
</head>
<body class="fixed-left">
<!-- Begin page -->
<div id="wrapper">
<!-- ========== Left Sidebar Start ========== -->
<?php include 'header/taskbar.php'; ?>
<!-- Left Sidebar End -->
<!-- ============================================================== -->
<!-- Start right Content here -->
<!-- ============================================================== -->
<div class="content-page">
<!-- Start content -->
<div class="content">
<div class="container">
<!-- Page-Title -->
<div class="row">
<div class="col-sm-12">
<h4 class="page-title">QUẢN LÝ KÊNH</h4>
<ol class="breadcrumb">
<li><a href="#">Ruby Media</a></li>
<li class="active">Kênh</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="card-box">
<div class="row">
<div class="col-sm">
<a href="#custom-modal" class="btn btn-default btn-md waves-effect waves-light m-b-30" data-animation="fadein" data-plugin="custommodal"
data-overlaySpeed="200" data-overlayColor="#36404a"><i class="md md-add"></i> Thêm Kênh</a>
</div>
<div class="col-sm-8">
<a href="channel.php" class="badge badge-<?php echo (!isset($_GET['doanhthu']))? "danger" : "primary" ?>">ALL</a>
<a href="?doanhthu=28" class="badge badge-<?php echo (isset($_GET['doanhthu']) && $_GET['doanhthu']==28)? "danger" : "primary" ?>">Doanh Thu 28 Ngày</a>
<?php
$resultDate = mysqli_fetch_assoc(Select('SoLieuChannel', false, "`DoanhThu` > 0" ,'`SoLieuChannel`.`NgayUpdate` DESC'));
$soLuongThangXemLai = 6;
?>
<a href="?doanhthu=0" class="badge badge-<?php echo (isset($_GET['doanhthu']) && $_GET['doanhthu']==0)? "danger" : "primary" ?>">Doanh Thu Tháng <?php echo date('m', strtotime("-0 month", strtotime($resultDate['NgayUpdate']))); ?></a>
<?php
for($i = 1; $i <= $soLuongThangXemLai; $i++)
{
$thangtruoc = date('m', strtotime('last day of -'.$i." month", strtotime($resultDate['NgayUpdate'])));
?>
<a href="?doanhthu=<?php echo $i; ?>" class="badge badge-<?php echo $_GET['doanhthu']==$i? "danger" : "primary" ?>">Doanh Thu Tháng <?php echo $thangtruoc; ?></a>
<?php
}
?>
</div>
</div>
<div class="table-responsive">
<table class="table table-hover mails m-0 table table-actions-bar">
<thead>
<tr>
<th>#</th>
<th>Kênh</th>
<th>Id Kênh</th>
<th>Người Quản Lý Kênh</th>
<!-- <th>Time Public</th> -->
<th>Network Join</th>
<th>Doanh Thu</th>
<th>Công Ty Thanh Toán</th>
<th>Trạng Thái</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php
$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;
}
if(isset($_GET['doanhthu']))
{
if($_GET['doanhthu'] == 28) // doanh 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);
$ngaySQLSelect = $ngaySQL;
}
else if($_GET['doanhthu'] == 0) // doanh thu tháng này
{
$thoiGianGioiHan = date('d/m/Y', strtotime('-0 day', strtotime($ngaySQL)));
$date = explode('/', $thoiGianGioiHan);
$time = mktime(0,0,0,$date[1],01,$date[2]);
$mysqldate = date( 'Y-m-d H:i:s', $time);
$ngaySQLSelect = $ngaySQL;
}
else
{
for($i = 1; $i <= $soLuongThangXemLai; $i++)
{
if($i == $_GET['doanhthu'])
{
$thoiGianGioiHan = date('d/m/Y', strtotime('last day of -'.$i.' month', strtotime($ngaySQL))); // chọn ngày so sánh đau
$date = explode('/', $thoiGianGioiHan);
$time = mktime(0,0,0,$date[1],01,$date[2]);
$mysqldate = date( 'Y-m-d H:i:s', $time);
$thoiGianGioiHan = date('d/m/Y', strtotime('last day of this month', strtotime($mysqldate))); // chọn ngày so sánh đau
$date = explode('/', $thoiGianGioiHan);
$time = mktime(0,0,0,$date[1], $date[0],$date[2]);
$ngaySQLSelect = date( 'Y-m-d H:i:s', $time);
}
}
}
$result = SelectAll('QuanLyChannel',"SELECT QuanLyChannel.id AS IDChannelSQL, NameChannel, QuanLyChannel.IdChannel as IdKenh, NgayUpdate, NetworkSuport, SUM(SoLuotXem) AS TongLuotXem, ROUND(SUM(DoanhThu),0) AS TongDoanhThu, IdNguoiLam FROM QuanLyChannel JOIN SoLieuChannel ON QuanLyChannel.id = SoLieuChannel.IdChannel WHERE DoanhThu > 0 AND `NgayUpdate` <= '".$ngaySQLSelect."' AND `NgayUpdate` >= '".$mysqldate."' GROUP BY SoLieuChannel.IdChannel ORDER BY TongDoanhThu DESC");
}
else
{
$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);
$ngaySQLSelect = $ngaySQL;
$result = SelectAll('QuanLyChannel',"SELECT QuanLyChannel.id AS IDChannelSQL, NameChannel, QuanLyChannel.IdChannel as IdKenh, NgayUpdate, NetworkSuport, SUM(SoLuotXem) AS TongLuotXem, ROUND(SUM(DoanhThu),0) AS TongDoanhThu, IdNguoiLam FROM QuanLyChannel JOIN SoLieuChannel ON QuanLyChannel.id = SoLieuChannel.IdChannel WHERE DoanhThu >= 0 GROUP BY SoLieuChannel.IdChannel ORDER BY TongDoanhThu DESC");
}
$tongDoanhThu = 0;
$dem = 1;
$tongLuong = 0;
$tongTienCongTyChiTra = 0;
echo $ngaySQLSelect . " - " . $mysqldate;
while($res = mysqli_fetch_array($result)) :
?>
<tr>
<td>
<?php echo $dem++; ?>
</td>
<td>
<a href="https://www.youtube.com/channel/<?php echo $res['IdKenh']; ?>" target="_blank"><?php echo $res['NameChannel']==null? $res['IdKenh'] : $res['NameChannel']; ?></a>
</td>
<td>
<?php echo $res['IdKenh']; ?>
</td>
<td>
<?php
$resultQL = mysqli_fetch_assoc(Select('NguoiLam', false, "`id` = ".$res['IdNguoiLam']."" ,''));
if(isset($resultQL['id']))
{
echo $resultQL['TenNhanVien'];
}
else
{
echo "NONE";
}
?>
</td>
<!--<td>
<?php
$thoiGianGioiHan = date('d/m/Y', strtotime($res['NgayPublicCuoi']));
$thoiGianPublic = strtotime($res['NgayPublicCuoi']);
$thoiGianHienTai = strtotime(date('Y/m/d H:i:s'));
$thoiGianChuaLamViec = $thoiGianHienTai - $thoiGianPublic;
if($thoiGianChuaLamViec >= 604800)
{
echo $thoiGianGioiHan . ' <span style="font-size: 9px;"><i class="fa fa-caret-down text-danger m-r-5"></i><span style="color: #f05050;">'.secondsToTime($thoiGianChuaLamViec).'</span> </span>';
}
else
{
echo $thoiGianGioiHan . ' <span style="font-size: 9px;"><i style="color: #5dec7c;" class="fa fa-caret-up text-primary m-r-5"></i><span style="color: #5dec7c;">'.secondsToTime($thoiGianChuaLamViec).'</span></span>';
}
?>
</td>
-->
<td>
<?php
$resultQLNetwork = mysqli_fetch_assoc(Select('NetworkSuport', false, "`Id` = ".$res['NetworkSuport']."" ,''));
if(isset($resultQLNetwork['Id']))
{
echo $resultQLNetwork['NameNetwork'] . ' - Tỉ Lệ Share ' . $resultQLNetwork['TiLeShareDoanhThu'] . ' %';
}
else
{
echo "NONE";
}
?>
</td>
<td>
$ <?php echo $res['TongDoanhThu']; ?>
<?php $tongDoanhThu += $res['TongDoanhThu']; ?>
</td>
<td>
<?php
if($_SESSION['login']['Admin'] == 1)
{
$tiLeNhanDoanhThu = $res['TongDoanhThu'] * ($resultQLNetwork['TiLeShareDoanhThu']/100);
$tongTienCongTyChiTra += $tiLeNhanDoanhThu;
echo formatMoney((int)$tiLeNhanDoanhThu * tiGiaUsdSangVND());
}
else
{
if($resultQL['id'] == $_SESSION['login']['id'])
{
$tiLeNhanDoanhThu = $res['TongDoanhThu'] * ($resultQLNetwork['TiLeShareDoanhThu']/100);
$tiLeNhanDoanhThuThuc = $tiLeNhanDoanhThu * ($_SESSION['login']['TiLeNhanChiaSe']/100);
$tongTienCongTyChiTra += $tiLeNhanDoanhThuThuc;
echo formatMoney((int)$tiLeNhanDoanhThuThuc * tiGiaUsdSangVND());
}
else
{
$tiLeNhanDoanhThu = $res['TongDoanhThu'] * ($resultQLNetwork['TiLeShareDoanhThu']/100);
$tiLeNhanDoanhThuThuc = $tiLeNhanDoanhThu * ($_SESSION['login']['TiLeNhanChiaSeQuanLy']/100);
$tongTienCongTyChiTra += $tiLeNhanDoanhThuThuc;
echo formatMoney($tiLeNhanDoanhThuThuc * tiGiaUsdSangVND());
}
}
?> VNĐ
</td>
<td>
<?php
$month = date("m",strtotime($mysqldate));
$resultQLBaoCaoDem = mysqli_fetch_assoc(Select('NetworkPayment', true, "`IdNetWork` = ".$res['NetworkSuport']." AND `ThangPayMent` = ".$month."" ,'`ThoiGianThanhToan` DESC'));
$resultQLBaoCao = mysqli_fetch_assoc(Select('NetworkPayment', false, "`IdNetWork` = ".$res['NetworkSuport']." AND `TrangThaiDaThanhToan` = 0 AND `ThangPayMent` = ".$month."" ,'`ThoiGianThanhToan` DESC'));
if(isset($resultQLBaoCao))
{
if($_GET['doanhthu'] == 28 || !isset($_GET['doanhthu']))
{
?> Chưa thanh toán <?php
}
else
{
?>
<span class="badge badge-info">ĐÃ VỀ CÔNG TY</span>
<?php
}
}
else
{
$resultQLBaoCao = mysqli_fetch_assoc(Select('NetworkPayment', false, "`IdNetWork` = ".$res['NetworkSuport']." AND `TrangThaiDaThanhToan` = 1 AND `ThangPayMent` = ".$month."" ,'`ThoiGianThanhToan` DESC'));
if(isset($resultQLBaoCao))
{
if($_GET['doanhthu'] == 28 || !isset($_GET['doanhthu']))
{
?> Chưa thanh toán <?php
}
else
{
$thoiGianGioiHanCurrent = date('Y', time());
$thoiGianGioiHanConvert = date('Y', strtotime('0 day', strtotime($resultQLBaoCao['NgayPayNhanVien'])));
$thoiGianGioiHan = date('d/m/Y', strtotime('0 day', strtotime($resultQLBaoCao['NgayPayNhanVien'])));
if($resultQLBaoCao['NgayPayNhanVien'] == null)
{
$thoiGianGioiHan = date('d/m/Y', strtotime('0 day', strtotime($resultQLBaoCao['ThoiGianThanhToan'])));
}
if($thoiGianGioiHanCurrent == $thoiGianGioiHanConvert)
{
?><span class="badge badge-success">Đã thanh toán tháng <span style="color: red;"><?php echo $resultQLBaoCao['ThangPayMent']; ?></span> vào ngày <?php echo $thoiGianGioiHan; ?></span> <?php
}
else
{
?> Chưa thanh toán <?php
}
}
}
else
{
if($resultQLBaoCaoDem == 0)
{
if($_GET['doanhthu'] == 28 || !isset($_GET['doanhthu']))
{
?> Chưa thanh toán <?php
}
else
{
?> Không có thông tin <?php
}
}
else
{
if($_GET['doanhthu'] == 28)
{
?> Chưa thanh toán <?php
}
else
{
?> Chưa thanh toán <?php
}
}
}
}
?>
</td>
<td>
<a href="#custom-modal-<?php echo $res['IDChannelSQL']; ?>" class="table-action-btn" data-animation="fadein" data-plugin="custommodal" data-overlaySpeed="200" data-overlayColor="#36404a"><i class="md md-edit"></i></a>
<div id="custom-modal-<?php echo $res['IDChannelSQL']; ?>" class="modal-demo">
<button type="button" class="close" onclick="Custombox.close();">
<span>×</span><span class="sr-only">Close</span>
</button>
<h4 class="custom-modal-title">Edit Channel</h4>
<div class="custom-modal-text text-left">
<form role="form" method="POST" enctype="multipart/form-data">
<div class="form-group">
<label for="name">Tên Channel</label>
<input type="text" class="form-control" name="NameChannel" placeholder="Nhập tên network" value="<?php echo $res['NameChannel']; ?>">
</div>
<?php if($_SESSION['login']['Admin'] == 1) : ?>
<div class="form-group">
<label for="name">Support Network</label>
<select class="selectpicker" name="NetworkSuport" data-style="btn-white">
<option value="0">Không có</option>
<?php
$resulta = Select('NetworkSuport', false, "", "");
while($resa = mysqli_fetch_array($resulta))
{
if($res['NetworkSuport'] == $resa['Id'])
{
echo '<option value="'.$resa['Id'].'" selected>'.$resa['NameNetwork'].' - '.$resa['SuportNetwork'].' - '.$resa['TiLeShareDoanhThu'].'</option>';
}
else
{
echo '<option value="'.$resa['Id'].'">'.$resa['NameNetwork'].' - '.$resa['SuportNetwork'].' - '.$resa['TiLeShareDoanhThu'].'</option>';
}
}
?>
</select>
</div>
<?php else : ?>
<input type="hidden" value="<?php echo $res['IDChannelSQL']; ?>" name="IdChannelEdit"/>
<?php endif; ?>
<input type="hidden" value="<?php echo $res['IDChannelSQL']; ?>" name="IdChannelEdit"/>
<button type="submit" class="btn btn-default waves-effect waves-light">Save</button>
<button type="button" class="btn btn-danger waves-effect waves-light m-l-10" onclick="Custombox.close();">Cancel</button>
</form>
</div>
</div>
</td>
</tr>
<?php endwhile; ?>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
<span style="color: white;">TỔNG:</span>
</td>
<td>
<span style="color: white;">$ <?php echo $tongDoanhThu; ?></span>
</td>
<td>
<span style="color: white;"><?php echo formatMoney($tongTienCongTyChiTra * tiGiaUsdSangVND()); ?> VNĐ</span>
</td>
<td>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div> <!-- end col -->
</div>
</div> <!-- container -->
</div> <!-- content -->
<?php include 'header/footer.php'; ?>
</div>
<!-- Modal -->
<div id="custom-modal" class="modal-demo">
<button type="button" class="close" onclick="Custombox.close();">
<span>×</span><span class="sr-only">Close</span>
</button>
<h4 class="custom-modal-title">Thêm Kênh</h4>
<div class="custom-modal-text text-left">
<form role="form" method="POST">
<div class="form-group">
<label for="name">Danh Sách Kênh (Định dạng: https://youtube.com/channel/ID)</label>
<textarea class="form-control" rows="5" placeholder="Nhập Danh Sách Kênh" style="height: 400px;" name="danhsachkenh"></textarea>
</div>
<button type="submit" class="btn btn-default waves-effect waves-light">Thêm</button>
<button type="button" class="btn btn-danger waves-effect waves-light m-l-10" onclick="Custombox.close();">Cancel</button>
</form>
</div>
</div>
<!-- /Right-bar -->
</div>
<!-- END wrapper -->
<script>
var resizefunc = [];
</script>
<!-- jQuery -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/detect.js"></script>
<script src="assets/js/fastclick.js"></script>
<script src="assets/js/jquery.slimscroll.js"></script>
<script src="assets/js/jquery.blockUI.js"></script>
<script src="assets/js/waves.js"></script>
<script src="assets/js/wow.min.js"></script>
<script src="assets/js/jquery.nicescroll.js"></script>
<script src="assets/js/jquery.scrollTo.min.js"></script>
<script src="assets/js/jquery.core.js"></script>
<script src="assets/js/jquery.app.js"></script>
<!-- Modal-Effect -->
<script src="assets/plugins/custombox/js/custombox.min.js"></script>
<script src="assets/plugins/custombox/js/legacy.min.js"></script>
<script src="assets/plugins/notifyjs/js/notify.js"></script>
<script src="assets/plugins/notifications/notify-metro.js"></script>
</body>
</html>