Your IP : 3.135.241.191
<?php
session_start();
include("lib/connect.inc.php");
if($uidx != 1){
header("Location:../login.php");
}
$rep=$uidx;
class dailyAdd
{
//User Array Keys
/* Class constructor */
function __construct()
{
global $report, $count;
if(array_key_exists('EditDailyAdvert', $_POST)) { $this->EditDailyAdvert(); }
elseif (array_key_exists('AddNewAdvert', $_POST)) { $this->AddNewAdvert(); }
elseif (array_key_exists('NewAddCategory', $_POST)) { $this->NewAddCategory(); }
}
function EditDailyAdvert()
{
global $db,$report,$count,$rep;
$note = $_POST['note'];
$day = $_POST['day'];
$cat = $_POST['category'];
// $url = $_POST['url'];
$sn = $_GET['edit'];
//$nophoto = $_POST['nophoto']??0;
if(empty($_FILES['image']['name'])){
$sql = $db->query("UPDATE dailyad SET day='$day',category='$cat',note='$note',rep='$rep' WHERE sn = '$sn' ");
}else{
$name = $_FILES['image']['name'];
$name2 = 'p'.$day.$this->win_hashs(12).$this->fileExt2($name);
define('upload', 'img/ads/');
if($this->fileExt($name)==TRUE){
$success = move_uploaded_file($_FILES['image']['tmp_name'], upload.$name2);
$sql = $db->query("UPDATE dailyad SET day='$day',category='$cat',note='$note',url='$url',rep='$rep',photo='$name2' WHERE sn = '$sn' ");
}
}
$report = 'Daily Advert Successfully Submitted!';
return;
}
function AddNewAdvert()
{
global $db,$report,$count,$rep;
//rep = $this->Uid();
$note = $_POST['note'];
$day = $_GET['day'];
$cat = $_POST['category'];
// $url = $_POST['url'];
$name = $_FILES['image']['name'];
$name2 = 'p'.$day.$this->win_hashs(12).$this->fileExt2($name);
define('upload', 'img/ads/');
if($this->fileExt($name)==TRUE){
$success = move_uploaded_file($_FILES['image']['tmp_name'], upload.$name2);
$sqlw = $db->query("INSERT INTO dailyad (day,category,note,rep,photo) VALUES ('$day','$cat','$note','$rep','$name2') ");
$report = 'Daily Advert Successfully Submitted!';
}else{$report='Operation failed, could not upload Photograph'; $count=1; }
return;
}
function NewAddCategory(){
global $db, $count, $report ;
$title = $_POST['title'];
$note = $_POST['note'];
$sql = $db->query("INSERT INTO adcategory (category,note) VALUES ('$title','$note') ")or die ('cannot connect to server');
$report = 'Succesfully Submitted';
return;
}
function fileExt($name){
$ext = strtolower(substr($name, strpos($name,'.'), strlen($name)-1));
if($ext=='.jpg' OR $ext=='.jpeg' OR $ext=='.png'){ $res = TRUE; }else{$res= FALSE; }
return $res;
}
function fileExt2($name){
$ext = strtolower(substr($name, strpos($name,'.'), strlen($name)-1));
// if($ext=='.jpg' OR $ext=='.jpeg' OR $ext=='.png'){ $res = TRUE; }else{$res= FALSE; }
return $ext;
}
function win_hashs($length)
{
return substr(str_shuffle(str_repeat('123456789abcdefghijklmnopqrstuvwxyz', $length)), 0, $length);
}
}
$ads = new dailyAdd;
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="treant/examples/tree/basic-example2.css">
<!-- Neptune CSS -->
<link rel="stylesheet" href="css/core.css">
<title> Manage Daily Ads</title>
<link rel="shortcut icon" href="img/fav.png" />
<link rel="stylesheet" href="treant/Treant.css">
<link rel="stylesheet" href="treant/examples/tree/basic-example2.css">
<!-- Neptune CSS -->
<link rel="stylesheet" href="css/core.css">
<!-- Neptune CSS -->
<!-- Tell the browser to be responsive to screen width -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Neptune CSS -->
<link rel="stylesheet" href="css/core.css">
<!-- Vendor CSS -->
<link rel="stylesheet" href="../vendor/bootstrap4/css/bootstrap.min.css">
<link rel="stylesheet" href="../vendor/themify-icons/themify-icons.css">
<link rel="stylesheet" href="../vendor/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="../vendor/animate.css/animate.min.css">
<link rel="stylesheet" href="../vendor/jscrollpane/jquery.jscrollpane.css">
<link rel="stylesheet" href="../vendor/waves/waves.min.css">
<link rel="stylesheet" href="../vendor/switchery/dist/switchery.min.css">
<link rel="stylesheet" href="../vendor/morris/morris.css">
<link rel="stylesheet" href="../vendor/dropify/dist/css/dropify.min.css">
<!-- Font Awesome -->
<?php include('head.php'); ?>
</head>
<body class="hold-transition sidebar-mini layout-fixed">
<?php include('nav.php'); ?>
<div class="content-wrapper">
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h3> Manage Daily Ads</h3>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
<li class="breadcrumb-item active">Daily Ads</li>
</ol>
</div>
</div>
</div><!-- /.container-fluid -->
</section>
<div class="content">
<div class="container-fluid">
<!-- ============================================================== -->
<!-- Sales chart -->
<!-- ============================================================== -->
<div class="row">
<div class="col-lg-4">
<?php if(isset($_GET['edit'])){ $edit = $_GET['edit']; ?>
<div class="card ">
<div class="card-header text-white bg-dark">
<h5>Edit Promotional Adverts</h5></div>
<div class="card-body">
<form method="post" enctype="multipart/form-data">
<?php $day = sqLx('dailyad','sn',$edit,'day'); ?>
<select name="day" class="form-control" required>
<option value="">Select Day</option>
<?php $i=1;
while($i<=32){ $e=$i++ ?>
<option value="<?php echo $e ?>" <?php if($day==$e){echo 'selected'; } ?>>Day <?php echo $e ?></option>
<?php } ?>
</select><br>
<select name="category" class="form-control" required>
<option value="">Select Category</option>
<?php $sql = $db->query("SELECT * FROM adcategory");
while($row = mysqli_fetch_assoc($sql)){ ?>
<option value="<?php echo $row['sn'] ?>" <?php if(sqLx('dailyad','sn',$edit,'category')==$row['sn']){echo 'selected'; } ?>><?php echo $row['category'] ?></option>
<?php } ?>
</select>
<br>
<textarea name="note" rows="5" class="form-control" placeholder="Advert Details" required><?php echo sqLx('dailyad','sn',$edit,'note') ?></textarea><br>
<input type="text" name="url" value="<?php echo sqLx('dailyad','sn',$edit,'url') ?>" class="form-control" placeholder="Advert URL" ><br>
<input type="file" name="image" class="form-control" placeholder="Advert Poster" ><br>
<img src="uphoto/ad/<?php echo sqLx('dailyad','sn',$edit,'photo') ?>" width="100%"> <br><br>
<button class="btn btn-success" style="width: 100%" name="EditDailyAdvert">Edit Advert</button>
</form>
</div>
</div>
<?php } else{ ?>
<div class="card">
<div class="card-header text-white bg-dark"> <h5>Add A New Promotional Adverts</h5></div>
<div class="card-body">
<form method="get">
<?php $day = $_GET['day']??''; ?>
<select name="day" class="form-control" onchange="submit()" required>
<option value="">Select Day</option>
<?php $i=1;
while($i<=32){ $e=$i++ ?>
<option value="<?php echo $e ?>" <?php if($day==$e){echo 'selected'; } ?>>Day <?php echo $e ?></option>
<?php } ?>
</select><br>
</form>
<?php if(isset($_GET['day'])){ ?>
<form method="post" enctype="multipart/form-data">
<select name="category" class="form-control" required>
<option value="">Select Category</option>
<?php $sql = $db->query("SELECT * FROM adcategory");
while($row = mysqli_fetch_assoc($sql)){ ?>
<option value="<?php echo $row['sn'] ?>"><?php echo $row['category'] ?></option>
<?php } ?>
</select>
<br>
<textarea name="note" rows="5" class="form-control" placeholder="Advert Details" required></textarea><br>
<!-- <input type="text" name="url" class="form-control" placeholder="Advert URL" >-->
<input type="file" name="image" class="form-control" placeholder="Advert Poster" required><br>
<button class="btn btn-success" style="width: 100%" name="AddNewAdvert">Submit Advert</button>
</form>
<?php } ?>
</div>
</div>
<?php } ?>
<div class="card ">
<div class="card-header text-white bg-dark">
<h5>New Add Category</h5></div>
<div class="card-body">
<form method="post">
<input type="text" name="title" class="form-control" placeholder="Offer Title" required><br>
<textarea name="note" class="form-control" placeholder="Description of offers" required></textarea><br>
<button class="btn btn-success" style="width: 100%" name="NewAddCategory">Add New Category</button>
</form>
</div>
</div>
</div>
<div class="col-lg-8 col-md-12 order-lg-2 order-md-3">
<div class="card ">
<div class="card-header text-white bg-dark">
<h5>Daily Advert List: Day <?php echo $day ?></h5></div>
<div class="card-body">
<?php $show = $_GET['show'] ?? '';
$i=1;
$sql = !empty($show) ? $db->query("SELECT * FROM dailyad WHERE category='$show' ORDER BY sn DESC ") : $db->query("SELECT * FROM dailyad WHERE day='$day' ORDER BY sn DESC ");
while($row = mysqli_fetch_assoc($sql)) { $e = $i++; $cat = $row['category']; $sn=$row['sn'];
?>
<div class="row">
<div class="col-lg-12"> Category: <a href="?show=<?php echo $row['category']; ?>"><?php echo sqLx('adcategory','sn',$cat,'category') ?></a> <hr></div>
<div class="col-lg-6">
<a href="?edit=<?php echo $sn ?>"><?php echo $row['note'] ?> <br>
<!-- --><?php //echo $row['url'] ?><!--ref=--><?php //echo userName($uid,'sn') ?>
</a>
</div>
<div class="col-lg-6">
<img src="img/ads/<?php echo $row['photo']; ?>" width="70%" height="40%"><br><br> </td>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
<!-- ============================================================== -->
<!-- Email campaign chart -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- Ravenue - page-view-bounce rate -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- Ravenue - page-view-bounce rate -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- Recent comment and chats -->
<!-- ============================================================== -->
</div>
<!-- ============================================================== -->
<!-- End Container fluid -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- footer -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- End footer -->
<!-- ============================================================== -->
<!-- /.row (main row) -->
</div><!-- /.container-fluid -->
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<?php include('foot.php'); ?>
<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Control sidebar content goes here -->
</aside>
<!-- /.control-sidebar -->
</div>
<!-- ./wrapper -->
<!-- jQuery -->
<script src="../plugins/jquery/jquery.min.js"></script>
<!-- jQuery UI 1.11.4 -->
<script src="../plugins/jquery-ui/jquery-ui.min.js"></script>
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
<script>
$.widget.bridge('uibutton', $.ui.button)
</script>
<!-- Bootstrap 4 -->
<script src="../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- ChartJS -->
<script src="../plugins/chart.js/Chart.min.js"></script>
<!-- Sparkline -->
<script src="../plugins/sparklines/sparkline.js"></script>
<!-- JQVMap -->
<script src="../plugins/jqvmap/jquery.vmap.min.js"></script>
<script src="../plugins/jqvmap/maps/jquery.vmap.usa.js"></script>
<!-- jQuery Knob Chart -->
<script src="../plugins/jquery-knob/jquery.knob.min.js"></script>
<!-- daterangepicker -->
<script src="../plugins/moment/moment.min.js"></script>
<script src="../plugins/daterangepicker/daterangepicker.js"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="../plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
<!-- Summernote -->
<script src="../plugins/summernote/summernote-bs4.min.js"></script>
<!-- overlayScrollbars -->
<script src="../plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script>
<!-- AdminLTE App -->
<script src="../dist/js/adminlte.js"></script>
<!-- AdminLTE dashboard demo (This is only for demo purposes) -->
<script src="../dist/js/pages/dashboard.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../dist/js/demo.js"></script>
<!-- DataTables -->
<script src="../plugins/datatables/jquery.dataTables.min.js"></script>
<script src="../plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="../plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="../plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<!-- page script -->
<script>
$(function () {
$("#example1").DataTable({
"responsive": true,
"autoWidth": false,
});
$('#example2').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": false,
"responsive": true,
});
});
</script>
<!-- page script -->
<script type="text/javascript">
<?php
// if($covis->globeStage($uidy)==1 ){
if($stages==1 ){
echo $covis->covisTreeGlobe($uid);
}else{
echo $covis->covisTree4Globe($uid);
}
?>
</script>
<script src="treant/vendor/raphael.js"></script>
<script src="treant/Treant.js"></script>
<script>
new Treant( chart_config );
</script>
</body>
</html>