Your IP : 3.149.238.67
<?php
session_start();
include("lib/connect.inc.php");
if($uidx == 1 OR $uidx==117){}else{
header("Location:../login.php");
}
function countDonate($ref,$opt=1){
global $db;
$sql = $db->query("SELECT * FROM donate WHERE dsn='$ref' "); $i = 0; $sum=0;
while($row = $sql->fetch_assoc()){ $i +=1; $sum += $row['amount']; }
$res = $opt==1 ? $i : $sum;
return $res;
}
if(array_key_exists('ConfirmUser', $_POST)) {
$user = $_POST['user'];
$sql = $db->query("SELECT * FROM user WHERE user='$user' "); $i = 0; $sum=0;
if(mysqli_num_rows($sql)==1){ $row = $sql->fetch_assoc();
$_SESSION['bene']=$row['id'];
$report='Beneficiary Verified'; } else{$report='Specified username does not exist'; $count=1;}
}
?>
<!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 Donations</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">
<!-- Tell the browser to be responsive to screen width -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 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/jvectormap/jquery-jvectormap-2.0.3.css">
<!-- Font Awesome -->
<?php include('head.php'); ?>
</head>
<body class="hold-transition sidebar-mini layout-fixed">
<div class="wrapper">
<?php include('nav.php'); ?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1> Manage Donations</h1>
</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">Manage Donations</li>
</ol>
</div>
</div>
</div><!-- /.container-fluid -->
</section>
<!-- Content Header (Page header) -->
<!-- Content -->
<div class="card-body">
<div id="refresh"><?php if(isset($report)){$covis->Alert(); } ?></div>
<?php if(isset($_GET['donation'])){ $ref = $_GET['donation'];
$sql = $db->query("SELECT * FROM donation WHERE tno='$ref' "); $i = 0;
$row = $sql->fetch_assoc(); $sta=$row['status']; $i +=1; $status = ($row['status']==0)?'<font color="red">Not Active</font>':'<font color="green">Active</font>';
$link = '<img src="news/'.$row['link'].'" width="100%">' ;
?>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-4">
<div class="card">
<div class="card-header text-white bg-dark">
<h5>Edit Donation</h5>
</div>
<br/>
<div class="card-body">
<p><?php echo $row['title'] ?></p>
</em>
<form class="form-group" method="post" enctype="multipart/form-data">
<input type="text" name="title" class="form-control" required placeholder="Donation Title" value="<?php echo $row['title'] ?>"><br>
<textarea class="form-control" name="note" placeholder="Additional Note/Description"><?php echo $row['note'] ?></textarea><br>
Related Image/Graphic Design
<input type="file" name="image" class="form-control" required><br>
<button class="btn btn-primary btn-lg" style="width: 100%" name="EditDonationPhoto">Update Donation</button>
<br/><br/>
</form>
</div>
</div>
</div>
<div class="col-md-8">
<div class="box bg-white ">
<div class="box-block">
<h5 align="">Donations Details [Status: <?php echo $status ?>] <form method="post" style="float: right"> <?php if($row['status']==0){?>
<button class="btn btn-success" name="ApproveDonation">Approve</button>
<?php }elseif($row['status']==1){ ?>
<button class="btn btn-warning" name="DisapproveDonation">Disapprove</button>
<?php } ?> </form></h5>
<br/>
<?php echo $link ?><br>
<h5>Donators</h5>
<div class="card-body">
<table class="table table-hover">
<tr>
<th>SN</th>
<th>Donated By</th>
<th>Amount</th>
</tr>
<?php $sql = $db->query("SELECT * FROM donate WHERE dsn='$ref' "); $i = 1;
while($row = $sql->fetch_assoc()){ $e=$i++ ?>
<tr>
<td><?php echo $e ?></th>
<td><?php echo $covis->idToKey($row['id'],'user') ?></th>
<td>$<?php echo number_format($row['amount'],2) ?></th>
</tr>
<?php } ?>
<tr><th colspan="2">TOTAL</th><th>$<?php echo number_format(countDonate($ref,2),2) ?></th></tr>
</table>
<?php if(mysqli_num_rows($sql)==0){ ?>
<form method="post"><button class="btn btn-danger" value="<?php echo $ref ?>" name="DeleteDonation" style="float: right">Delete Donation</button></form>
<?php } ?>
<?php if(mysqli_num_rows($sql)>0 AND $sta<2){ ?>
<h5>Terminate Donation</h5><hr>
<form method="post"><input type="text" name="user" placeholder="Beneficiary Username"><button class="btn btn-primary" name="ConfirmUser">Confirm Beneficiary</button></form>
<?php if(isset($_SESSION['bene'])){ $bene = $_SESSION['bene']; ?>
<form method="post"><input type="hidden" name="amount" value="<?php echo countDonate($ref,2) ?>">
<button class="btn btn-success" value="<?php echo $bene ?>" name="TerminateDonation" style="float: right">Transfer Funds to <?php echo $covis->idToKey($bene,'user'); ?> & Terminate Donation</button></form>
<?php } } ?>
<br><br>
</div>
</div>
</div>
</div>
<?php } ?>
<div class="row">
<div class="col-md-4">
<div class="card ">
<div class="card-header text-white bg-dark">
<h5>Manage Donations</h5>
</div>
<br/>
<div class="card-body">
<p>Donations can be for an event, a course, a project or charity donation to help someone </p>
</em>
<form class="form-group" method="post" enctype="multipart/form-data">
<input type="text" name="title" class="form-control" required placeholder="Donation Title"><br>
<textarea class="form-control" name="note" placeholder="Additional Note/Description"></textarea><br>
Related Image/Graphic Design
<input type="file" name="image" class="form-control" required><br>
<button class="btn btn-primary btn-lg" style="width: 100%" name="DonationPhoto">Post Donation</button>
<br/><br/>
</form>
</div>
</div>
</div>
<div class="col-md-8">
<div class="card ">
<div class="card-header text-white bg-dark">
<h5>Record of Donations</h5>
</div>
<br/>
<div class="card-body">
<table class="table table-hover">
<tr>
<th>S/N</th>
<th>Title</th>
<th>Description</th>
<th>Sum</th>
<th>Status</th>
</tr>
<?php $sql = $db->query("SELECT * FROM donation ORDER BY sn DESC LIMIT 50"); $i = 0;
while($row = $sql->fetch_assoc()){ $i +=1; $status = ($row['status']==0)?'<font color="red">Not Active</font>':'<font color="green">Active</font>';
$status = ($row['status']==2)?'<font color="red">Terminated</font>':$status;
$link = '<img src="news/'.$row['link'].'" width="100%">' ;
?>
<tr>
<td><?php echo $i ?></th>
<td><?php echo $row['title'] ?></th>
<td><?php echo $row['note'] ?></th>
<td>$<?php echo number_format(countDonate($row['tno'],2),2) ?></th>
<td><?php echo $status ?><br><a href="?donation=<?php echo $row['tno'] ?>">Manage</a> </th>
</tr>
<?php } ?>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /.card-body -->
<!-- /.card -->
</div>
<!-- right col -->
</div>
<!-- /.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>
<script type="text/javascript" src="../vendor/chartist/chartist.min.js"></script>
<!-- Vendor JS -->
<script type="text/javascript" src="../vendor/jquery/jquery-1.12.3.min.js"></script>
<script type="text/javascript" src="../vendor/tether/js/tether.min.js"></script>
<script type="text/javascript" src="../vendor/bootstrap4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../vendor/detectmobilebrowser/detectmobilebrowser.js"></script>
<script type="text/javascript" src="../vendor/jscrollpane/jquery.mousewheel.js"></script>
<script type="text/javascript" src="../vendor/jscrollpane/mwheelIntent.js"></script>
<script type="text/javascript" src="../vendor/jscrollpane/jquery.jscrollpane.min.js"></script>
<script type="text/javascript" src="../vendor/jquery-fullscreen-plugin/jquery.fullscreen-min.js"></script>
<script type="text/javascript" src="../vendor/waves/waves.min.js"></script>
<script type="text/javascript" src="../vendor/switchery/dist/switchery.min.js"></script>
<script type="text/javascript" src="../vendor/flot/jquery.flot.min.js"></script>
<script type="text/javascript" src="../vendor/flot/jquery.flot.resize.min.js"></script>
<script type="text/javascript" src="../vendor/flot.tooltip/js/jquery.flot.tooltip.min.js"></script>
<script type="text/javascript" src="../vendor/CurvedLines/curvedLines.js"></script>
<script type="text/javascript" src="../vendor/TinyColor/tinycolor.js"></script>
<script type="text/javascript" src="../vendor/sparkline/jquery.sparkline.min.js"></script>
<script type="text/javascript" src="../vendor/raphael/raphael.min.js"></script>
<script type="text/javascript" src="../vendor/morris/morris.min.js"></script>
<script type="text/javascript" src="../vendor/jvectormap/jquery-jvectormap-2.0.3.min.js"></script>
<script type="text/javascript" src="../vendor/jvectormap/jquery-jvectormap-world-mill.js"></script>
<script type="text/javascript" src="../vendor/peity/jquery.peity.js"></script>
<script type="text/javascript" src="../vendor/chartist/chartist.min.js"></script>
<!-- Neptune JS -->
<script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript" src="js/demo.js"></script>
<script type="text/javascript" src="js/index.js"></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>