| Server IP : 103.82.32.14 / Your IP : 216.73.217.140 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/quanlykenh/ |
Upload File : |
<?php
$page = "../";
include '../../configchannel.php';
include '../configtotal.php';
?>
<?php
if(!isset($_GET['doanhthu']))
{
$_GET['doanhthu'] = 28;
}
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['error'] = 'Không thêm được kênh nào';
}
else
{
$_SESSION['thongbao'] = "Đã Thêm Thành Công " . $tongsoInssert . ' Kênh';
}
Header( "Location: ../quanlykenh/" );
exit;
}
else if(isset($_POST['IdChannelEdit']))
{
$dataInsert = array(
'NameChannel' => mysql_real_escape_string($_POST['NameChannel']),
'NetworkSuport' => mysql_real_escape_string($_POST['NetworkSuport'])
);
$_SESSION['thongbao'] = "Chỉnh Sửa Thành Công";
Update('QuanLyChannel', $dataInsert, '`id` = ' . $_POST['IdChannelEdit'] . '');
Header( "Location: " . $_SERVER['REQUEST_URI'] );
exit;
}
else if(isset($_GET['deletechannel']))
{
Delete('QuanLyChannel', '`id` = ' . mysql_real_escape_string($_GET['deletechannel']) . '');
$_SESSION['thongbao'] = "Delete Channel Thành Công";
Header( "Location: ../quanlykenh/" );
exit;
}
?>
<?php $titlepage = "Quản Lý Kênh" ?>
<?php $page = "../" ?>
<?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"><?php echo $titlepage; ?></h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<span class="badge bg-info hrefa" name="nhansuclick" data-value="all">Tất Cả</span>
<?php
if($_SESSION['login']['Admin'] == 1)
{
$result = Select('NguoiLam', false, "", "");
}
else
{
$result = Select('NguoiLam', false, "`QuanLy` = ".$_SESSION['login']['id']." OR `id` = ".$_SESSION['login']['id']."", "");
}
while($res = mysqli_fetch_array($result)) :
?>
<span class="badge bg-info" name="nhansuclick" data-value="<?php echo $res['id']; ?>"><?php echo $res['TenNhanVien']; ?></span>
<?php endwhile; ?>
</div>
<div class="card-body">
<div class="row">
<div class="col-sm-12">
<button type="button" class="btn btn-success waves-effect waves-light" data-bs-toggle="modal" data-bs-target="#con-close-modal-themkenh">Thêm Kênh</button>
<!-- sample modal content -->
<div id="con-close-modal-themkenh" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Thêm Channel</h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form role="form" method="POST" enctype="multipart/form-data">
<div class="modal-body p-4">
<div class="row">
<div class="col-md-12">
<div class="mb-3">
<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>
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success waves-effect waves-light">Save</button>
<button type="button" class="btn btn-danger waves-effect waves-light m-l-10" data-bs-dismiss="modal" aria-label="Close">Cancel</button>
</div>
</form>
</div>
</div>
</div><!-- /.modal -->
</div>
</div>
<div class="responsive-table-plugin">
<div class="table-rep-plugin">
<div class="table-responsive" data-pattern="priority-columns">
<table id="tech-companies-1" class="table table-striped">
<thead>
<tr>
<th>STT</th>
<th data-priority="1">Channel</th>
<th data-priority="3">Người Quản Lý Kênh</th>
<th data-priority="1">Network Join</th>
<th></th>
</tr>
</thead>
<tbody id="dataload">
<?php
$dem = 0;
$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 INNER JOIN SoLieuChannel ON QuanLyChannel.id = SoLieuChannel.IdChannel WHERE QuanLyChannel.id > 0 GROUP BY SoLieuChannel.IdChannel ORDER BY TongDoanhThu DESC LIMIT 20");
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
$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>
<a class="table-action-btn" data-animation="fadein" data-overlaySpeed="200" data-overlayColor="#36404a" data-bs-toggle="modal" data-bs-target="#con-close-modal-<?php echo $res['IDChannelSQL']; ?>"><span class="material-symbols-outlined">edit_square</span></a>
<a class="table-action-btn" data-animation="fadein" data-overlaySpeed="200" data-overlayColor="#36404a" data-bs-toggle="modal" data-bs-target="#con-close-modal-delete-<?php echo $res['IDChannelSQL']; ?>"><span style="color: #e16e6e;" class="material-symbols-outlined"> delete </span></a>
<!-- Danger Alert Modal -->
<div id="con-close-modal-delete-<?php echo $res['IDChannelSQL']; ?>" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content modal-filled bg-danger">
<div class="modal-body p-4">
<div class="text-center">
<i class="dripicons-wrong h1 text-white"></i>
<h4 class="mt-2 text-white">Cảnh Báo!</h4>
<p class="mt-3 text-white">Bạn có thực sự muốn xóa kênh này khỏi hệ thống không?</p>
<a href="?deletechannel=<?php echo $res['IDChannelSQL']; ?>" class="btn btn-light my-2">Continue</a>
</div>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- sample modal content -->
<div id="con-close-modal-<?php echo $res['IDChannelSQL']; ?>" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Edit Channel</h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form role="form" method="POST" enctype="multipart/form-data">
<div class="modal-body p-4">
<div class="row">
<div class="col-md-12">
<div class="mb-3">
<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>
</div>
</div>
<?php if($_SESSION['login']['Admin'] == 1) : ?>
<div class="row">
<div class="col-md-12">
<div class="mb-3">
<label for="name">Support Network</label>
<select class="form-select" 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>
</div>
</div>
<?php endif; ?>
<input type="hidden" value="<?php echo $res['IDChannelSQL']; ?>" name="IdChannelEdit"/>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success waves-effect waves-light">Save</button>
<button type="button" class="btn btn-danger waves-effect waves-light m-l-10" data-bs-dismiss="modal" aria-label="Close">Cancel</button>
</div>
</form>
</div>
</div>
</div><!-- /.modal -->
</td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</div> <!-- end .table-responsive -->
<nav aria-label="Page navigation example">
<ul class="pagination justify-content-center">
<li class="page-item">
<a class="page-link" id="pre"><span aria-hidden="true">«</span> Trước</a>
</li>
<li class="page-item">
<a class="page-link" id="next">Sau <span aria-hidden="true">»</span></a>
</li>
</ul>
</nav>
</div> <!-- end .table-rep-plugin-->
</div> <!-- end .responsive-table-plugin-->
</div>
</div> <!-- end card -->
</div> <!-- end col -->
</div>
<!-- end row -->
</div> <!-- container -->
<?php include '../header/footer.php'; ?>
<script>
var page = 1;
var nhansu = "all";
var saveatribuicu = null;
function loadpage()
{
$.ajax({url: "quanlykenh_ajax.php?page=" + page + "&nhansu=" + nhansu, success: function(result){
$("#dataload").html(result);
}});
}
$(document).ready(function(){
$("#pre").click(function(){
page--;
if(page <= 1) page = 1;
loadpage();
});
$("#next").click(function(){
page++;
loadpage();
});
$("[name='nhansuclick']").click(function(e){
nhansu = $(this).data("value");
if(saveatribuicu != null)
{
saveatribuicu.attr("class","badge bg-info");
}
saveatribuicu = $(this);
saveatribuicu.attr("class","badge bg-danger");
page = 1;
loadpage();
});
});
</script>