-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdashboard.php
75 lines (57 loc) · 1.59 KB
/
dashboard.php
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
<?php
require("includes/common.php");
// Redirects the user to Login page if he/she is NOT logged in.
if (!isset($_SESSION['user_id'])) {
header('location: login.php');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php include "includes/headTag.php"; ?>
</head>
<body>
<?php include "includes/header.php"; ?>
<div id="afterHeader">
<?php if (isPlanCreated($con)) {
// if plan is already created
header("location:showPlans.php");
?>
<?php } else { ?>
<!-- If plan is not made yet -->
<h3>You don't have any active plans</h3>
<?php noActivePlan(); ?>
<?php } ?>
</div>
<?php include "includes/footer.php"; ?>
</body>
</html>
<?php
function noActivePlan()
{
?>
<div id="cont1">
<div class="panel panel-default" style="padding: 50px;">
<div class="panel-body">
<center>
<a href="new_plan.php" class="noUnderline" >
<h4 id="titlePlan"><span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span>Create a New Plan</h4>
</a </center>
</div>
</div>
</div>
<?php }
?>
<?php
function isPlanCreated($connection)
{
$con = $connection;
$query = "select id from plan where user_id = '{$_SESSION['user_id']}' ";
$result = mysqli_query($con, $query) or die(mysqli_error($con));
$num = mysqli_num_rows($result);
if ($num > 0) {
return true;
}
return false;
}
?>