-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdashboard.php
More file actions
145 lines (138 loc) · 5.54 KB
/
dashboard.php
File metadata and controls
145 lines (138 loc) · 5.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?php
session_start();
if(!isset($_SESSION['id'])){
header("location:login.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Dashboard | Alone</title>
<!-- Material Icon CDN -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- Materialize CSS CDN -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">
<!-- Your custom styles -->
<link rel="stylesheet" href="css/style.css">
<!-- Used as an example only to position the footer at the end of the page.
You can delete these styles or move it to your custom css file -->
<style>
body {
display: flex;
min-height: 100vh;
flex-direction: column;
}
main {
flex: 1 0 auto;
}
</style>
</head>
<?php
require_once("db-connection.php");
$id=$_SESSION['id'];
$sql = "SELECT sum(donation_amt) as donation_total FROM donations where `donor_id`=$id";
$sql2 = "SELECT COUNT(e.event_id) AS total_event FROM `events` AS e, `donations` AS d WHERE d.donor_id = $id AND d.event_id = e.event_id AND start_date BETWEEN '2017-11-18' AND '2018-11-18' ";
$result = mysqli_query($conn,$sql);
$result2= mysqli_query($conn,$sql2);
$donation = mysqli_fetch_assoc($result);
$event = mysqli_fetch_assoc($result2);
$donation_amt=0;
$event_total=0;
$donation_amt = $donation['donation_total'];
$event_total = $event['total_event'];
if($donation['donation_total']){}
else{$donation_amt=0;}
if($event['total_event']){}
else{$event_total=0;}
?>
<body>
<header>
<nav class="black">
<div class="nav-wrapper">
<div class="container">
<a href="/index.php" class="brand-logo pink-text">Alone</a>
<a href="#" data-activates="mobile-menu" class="button-collapse"><i class="material-icons">menu</i></a>
<ul class="right hide-on-med-and-down">
<li><a href="/index.php">Home</a></li>
<li><a href="/events.php">Events</a></li>
<?php if( isset($_SESSION['username']) && !empty($_SESSION['username']) )
{
?>
<li><a href="/dashboard.php" class="active">Dashboard</a></li>
<li><a href="logout.php">Logout</a></li>
<?php }else{ ?>
<li><a href="login.php">Login</a></li>
<li><a href="register.php">Register</a></li>
<?php } ?>
<li><a href="contact.php">Contact us</a></li>
</ul>
</div>
</div>
</nav>
<div class="sidenav">
<a href="<?php if($id=='1'){echo "admin/admin_dashboard.php";}
else echo "/dashboard.php"; ?>">Dashboard</a>
<a href="/edit_user.php">Edit Profile</a>
<a href="/donation_history.php">Past Donation</a>
</div>
</header>
<main>
<h5 class="center">Welcome <?php echo $_SESSION['name']; ?></h5>
<section >
<div class="container">
<div class="row">
<div class="col s6">
<div class="card">
<div class="card-content red white-text">
<p class="card-stats-title center">
<i class="material-icons">person_outline</i>Helped Events</p>
<h4 class="card-stats-number center"><?php echo $event_total; ?></h4>
</div>
<div class="card-action red darken-1 center">
<a href="/events.php" class="waves-effect waves-light btn red darken-1">View All Events</a>
</div>
</div>
</div>
<div class="col s6">
<div class="card">
<div class="card-content blue white-text">
<p class="card-stats-title center">
<i class="material-icons">person_outline</i> Total donations</p>
<h4 class="card-stats-number center"><?php echo $donation_amt; ?> ₹</h4>
</div>
<div class="card-action blue darken-1 center">
<a href="/donation_history.php" class="waves-effect waves-light btn blue darken-1">View All</a>
</div>
</div>
</div>
</div>
<div class="row center">
<a href="/donation.php" class="waves-effect waves-light btn">Start Donating now</a>
</div>
</div>
</section>
</main>
<?php require('footer.php'); ?>
<!-- jQuery CDN -->
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<!-- Materialize JS CDN -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
<script>
$("document").ready(function(){
$(".button-collapse").sideNav();
});
$(document).ready(function(){
$('.carousel').carousel();
});
$('.carousel.carousel-slider').carousel({
fullWidth: true
});
$(document).ready(function(){
$('.tabs').tabs();
});
</script>
</body>
</html>