-
Notifications
You must be signed in to change notification settings - Fork 2
/
schedule.php
149 lines (136 loc) · 3.65 KB
/
schedule.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
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
146
147
148
149
<?php
session_start();
include 'dbh.php';
//$userId = isset($_GET['id']) ? mysqli_real_escape_string($conn,$_GET['id']) : mysqli_real_escape_string($conn,$_SESSION['id']);
date_default_timezone_set('Asia/Kolkata');//setting the timezone
if(isset($_SESSION['id'])){
$userId=$_SESSION['id'];
?>
<html>
<head>
<title>Today's Schedule</title>
<link rel="stylesheet" type="text/css" href="da.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script type="text/javascript" src="general.js"></script>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300" rel="stylesheet">
</head>
<body>
<div class="backgrndimg">
<div class="f">
<div class="t2">
<h1>Today's Schedule</h1>
<p><?php echo date('d-m-Y'); ?></p>
<?php
$datetime= date('Y-m-d');
$sql="SELECT * FROM ms_schedule_table WHERE datetime='$datetime'";
$result=mysqli_query($conn,$sql);
$isThereAnEntry=false;
$bf=true;
$lu=true;
$sn=true;
$dn=true;
$med=true;
while($row=mysqli_fetch_assoc($result))
{
if($row['eventType']==0)
{
$bf=false;//means its already present
}
if($row['eventType']==1)
{
$lu=false;
}
if($row['eventType']==2)
{
$sn=false;
}
if($row['eventType']==3)
{
$dn=false;
}
if($row['eventType']==4)
{
$med=false;
}
//$isThereAnEntry=true;
}
if($bf==true)
{
?>
<form class="breakfastForm">
<input type="hidden" name="datetime" value="<?php echo date('Y-m-d'); ?>">
<button class="b" style="cursor:pointer" type="submit">Breakfast</button>
</form>
<p id="bf" style="display:none">Breakfast Taken!</p>
<?php
$isThereAnEntry=true;
}
if($lu==true)
{
?>
<form class="lunchForm">
<input type="hidden" name="datetime" value="<?php echo date('Y-m-d'); ?>">
<button class="b1" style="cursor:pointer" type="submit">Lunch</button>
</form>
<p id="lu" style="display:none">Lunch Taken!</p>
<?php
$isThereAnEntry=true;
}
if($sn==true)
{
?>
<form class="snacksForm">
<input type="hidden" name="datetime" value="<?php echo date('Y-m-d'); ?>">
<button class="b2" style="cursor:pointer" type="submit">Snacks</button>
</form>
<p id="sn" style="display:none">Snacks Taken!</p>
<?php
$isThereAnEntry=true;
}
if($dn==true)
{
?>
<form class="dinnerForm">
<input type="hidden" name="datetime" value="<?php echo date('Y-m-d'); ?>">
<button class="b3" style="cursor:pointer" type="submit">Dinner</button>
</form>
<p id="dn" style="display:none">Dinner Taken!</p>
<?php
$isThereAnEntry=true;
}
if($med==true)
{
?>
<form class="medicationForm">
<input type="hidden" name="datetime" value="<?php echo date('Y-m-d'); ?>">
<button class="b4" style="cursor:pointer" type="submit">Medication</button>
</form>
<p id="med" style="display:none">Medicines Taken!</p>
<?php
$isThereAnEntry=true;
}
if($isThereAnEntry==false)
{
?>
<p>All entries for today are done!</p>
<?php
}
?>
</div>
</div>
</div>
</body>
</html>
<?php
}
else
{
if(isset($_SESSION['id']))
{
header('Location: userprofile.php?id='.$_SESSION['id']);
}
else
{
//header('Location: index.php');
}
}