-
Notifications
You must be signed in to change notification settings - Fork 0
/
display.php
283 lines (219 loc) · 7.75 KB
/
display.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>Courses</title>
<link rel='stylesheet prefetch' href='http://fonts.googleapis.com/css?family=Open+Sans:600'>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/userD.css">
</head>
<?php
session_start();
$dbhost="localhost";
$dbname="sarchive";
$dbuser="root";
$dbpass="";
$conn=mysqli_connect($dbhost,$dbuser,$dbpass,$dbname);
if(mysqli_connect_errno()){
die("database connection failed:".mysqli_connect_error()."(".mysqli_connect_errno().")");
}
?>
<?php
$dept=$_POST['dept'];
$Course=$_POST['Course'];
//$_SESSION['Course'] =$_POST['Course'];
//$cou = $_POST['Course'];
?>
<?php
if(isset($_SESSION['users'])){
$name = $_SESSION['users'];
$sql = "SELECT fname, lname, university FROM registration where email='".$name."'";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) == 0) {
echo "sorry";}
else{
while($row = mysqli_fetch_assoc($result)) {
$fname = $row["fname"];
$lname = $row["lname"];
$university = $row["university"];
}
}
}
else{
$name = "nobody";
}
?>
<body style="padding: ">
<div class="login-wrap1">
<div class="login-html" style="position: fixed;
z-index: -1;
background-size: cover;
height: 100%;
width: 100%;">
<h3 style="color: white;">Howdy, <?php echo $fname.'!'; ?></h3>
<input id="tab-1" type="radio" name="tab" class="sign-in" checked><label for="tab-1" class="tab"><?php echo $university.' '; ?>University</label>
<input id="tab-2" type="radio" name="tab" class="sign-up"><label for="tab-2" class="tab"></label>
<div class="login-form">
<div class="sign-in-htm">
<div id="wrapper">
<form action="display.php" method="POST">
<div id="upleft">
<div class="group">
<label for="dept" class="label"><h3>Department</h3></label>
<select id="dept" name="dept" class="input" style="position: center; color: black; " onchange="getId(this.value);" required >
<!-- <option value="CS">CS</option>
<option value="IT">IT</option>
<option value="ECE"><font color="black">ECE</font></option> -->
<option value="">Select Department</option>
<?php
$query = "SELECT * FROM dept";
$res = mysqli_query($conn, $query);
foreach ($res as $dept ) {
# code...
?>
<option value="<?php echo $dept['dID']; ?>"><?php echo $dept["dname"]; ?></option>
<p><?php echo $dept["dname"]; ?></p>
<?php
}
?>
</select>
</div>
</div>
<div class="Course" id="upright">
<div class="group">
<label for="Course" class="label"><h3>Course</h3></label>
<select id="Course" name="Course" class="input" style="position: center; color: black; " required>
<option value="">Select Course</option>
<option value=""></option>
</select>
</div>
</div>
<div id="below">
<div class="group">
<input type="submit" class="button" value="Go" style="margin-top: 50px; ">
</div>
</div>
</form>
<pre>
</pre>
<div id="disp">
<div id="info"><br>
<?php
// checking subscription
$type = "guest";
$subs = "null";
$query111="SELECT * FROM subscription WHERE email = '$name' ";
$res=mysqli_query($conn,$query111);
if (mysqli_num_rows($res) == 0) {
echo "data not available";
}
else{
while($row = mysqli_fetch_assoc($res)) {
$type = $row["type"];
}
}
?>
<h3 style="margin: 0px;"><font color="black"><?php echo $type; ?> account</font></h3>
<?php
if($type=="guest"){
echo "<a href='subs.php'>"?><pre> Upgrade to premium</pre><?php "</a>";
}else{
echo "<a href='sStatus.php'>"?><pre> View subscription status</pre><?php "</a>";
}
?>
<?php
$query="SELECT * FROM courseDetails WHERE cID = $Course";
$result11=mysqli_query($conn,$query);
foreach ($result11 as $cour ) {
?>
<div>
<p style="padding-bottom: 0px;" value="<?php echo $cour['cname']; ?>"><br><hr><?php echo $cour["text"]; ?></p>
<hr>
</div>
<?php
}
$_SESSION['cID'] = $Course;
$_SESSION['email'] = $name;
?>
</div>
<?php
//premium account
if($type=="premium"){
?>
<form action="" >
<a href="content/vid.php">
<div id="thumb1">
<font color="black">Video: Intro</font>
</div>
</a>
<a href="content/demo.php">
<div id="thumb2">
<font color="black">course demo</font>
</div>
</a>
<a href="content/qpaper.php">
<div id="thumb3">
<font color="black">Previous year papers</font>
</div>
</a>
<a href="content/modules.php">
<div id="thumb4">
<font color="black">Study Material</font>
</div>
</a>
</form>
<?php
}
else{
?>
<form action="" >
<a href="content/vid.php">
<div id="thumb1">
<font color="black">Video: Intro</font>
</div>
</a>
<a href="content/demo.php">
<div id="thumb2">
<font color="black">course demo</font>
</div>
</a>
<a href="subs.php">
<div id="thumb3" style="background: url(locked.png) rgba(40,57,101,.9);">
<font color="black">Previous year papers</font>
</div>
</a>
<a href="subs.php">
<div id="thumb4" style="background: url(locked.png) rgba(40,57,101,.9);">
<font color="black">Study Material</font>
</div>
</a>
</form>
<?php
}
?>
</div>
<div class="foot-lnk" style="margin-top: 370px; margin-right: 1px;">
<br>
<a id="Logout" href="index.html" style="color: black; ">Logout</a>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-1.12.0.min.js" ></script>
<script>
function getId(val) {
//alert(val) ;
$.ajax({
type: "POST",
url: "getData.php",
data: "dID="+val,
success: function(data){
$("#Course").html(data);
}
});
}
</script>
</body>
</html>