-
Notifications
You must be signed in to change notification settings - Fork 3
/
index1.php
241 lines (213 loc) · 5.95 KB
/
index1.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
<!DOCTYPE html>
<html>
<head>
<title> Education Haven</title>
<link rel="stylesheet" href="style3.css">
<link rel="stylesheet" href="style2.css">
<style>
* {box-sizing: border-box;}
html {
overflow:hidden;
}
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
.topnav {
background-color: #e9e9e9;
height:50px;
}
.topnav a {
float:right;
display: block;
color: black;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
.topnav a:hover {
background-color: #ddd;
color: black;
}
.topnav a.active {
background-color: #2196F3;
color: white;
}
.topnav input[type=text] {
float: right;
padding: 6px;
margin-top: 8px;
margin-right: 16px;
border: none;
font-size: 17px;
}
@media screen and (max-width: 600px) {
.topnav a, .topnav input[type=text] {
float: none;
display: block;
text-align: left;
width: 100%;
margin: 0;
padding: 14px;
}
.topnav input[type=text] {
border: 1px solid #ccc;
}
}
</style>
<style>
* {box-sizing: border-box;}
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
.topnav {
overflow: hidden;
background-color: #e9e9e9;
}
.topnav a {
float:right;
display: block;
color: black;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
.topnav a:hover {
background-color: #ddd;
color: black;
}
.topnav a.active {
background-color: #2196F3;
color: white;
}
.topnav input[type=text] {
float: right;
padding: 6px;
margin-top: 8px;
margin-right: 16px;
border: none;
font-size: 17px;
}
@media screen and (max-width: 600px) {
.topnav a, .topnav input[type=text] {
float: none;
display: block;
text-align: left;
width: 100%;
margin: 0;
padding: 14px;
}
.topnav input[type=text] {
border: 1px solid #ccc;
}
}
</style>
</head>
<body>
<div class="w3-sidebar w3-bar-block w3-card w3-animate-left" style="display:none" id="mySidebar">
<button class="w3-bar-item w3-button w3-large"
onclick="w3_close()" style="text-align:center;"><h5>Collapse ×</h5></button>
<img src="user.jpg" height="200" width="200" style="border-radius:50%;"><br><br><br><br>
<?php
session_start();
define('DB_HOST', 'localhost');
define('DB_NAME', 'practice');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
$con = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die("Failed to connect to MySQL: " . mysql_error());
$db = mysql_select_db(DB_NAME, $con) or die("Failed to connect to MySQL: " . mysql_error());
$query = mysql_query("SELECT * FROM websiteusers WHERE userID = '".$_SESSION['theuser']."'" );
$row = mysql_fetch_array($query);
if(!$row){
echo '<script type="text/javascript">
window.location = "index.php";
</script>';
}
$query = mysql_query("SELECT * FROM filet WHERE userID = '".$_SESSION['theuser']."'" );
$i=0;
while($vote = mysql_fetch_array($query)){
$i++;
}
echo "<div style='text-align:center;'>$row[1] <br><i>(@$row[2])</i></div><br><br><div style='text-align:center'>$i Posts</div>";
?>
<a href="index1.php" style="text-align:center;margin-top:60px;" class="w3-bar-item w3-button"><h3>Upload Material</h3></a>
<a href="myposts.php" style="text-align:center;" class="w3-bar-item w3-button"><h3>My Posts</h3></a>
<a href="index.php" style="text-align:center;" class="w3-bar-item w3-button" class="log"><h3>Log out</h3></a>
</div>
<div id="main">
<div class="topnav">
<button id="openNav" class="w3-button w3-teal w3-xlarge" onclick="w3_open()">☰</button>
<a href="#about">About</a>
<a href="new.php">Home</a>
<a class="active" style="cursor: pointer;" onclick="k()">Search</a>
<select name="subtopic" class = "form-control" id="k3">
<option value="01">Mechanics</option>
<option value="02">Quantum</option>
<option value="03">Modern</option>
<option value="04">Electrodynamics</option>
</select>
<select name="subject" class = "form-control">
<option value="01">Physics</option>
<option value="02">Maths</option>
<option value="03">Chemistry</option>
</select>
<script>
function k(){a=document.getElementById("k3");var strUser = a.options[a.selectedIndex].value;
if(strUser==01)
{window.location.href="mechanics.php";}
else if(strUser==02)
{window.location.href="index1.php";}
else if(strUser==03)
{window.location.href="index1.php";}
else if(strUser==04)
{window.location.href="mechanics.php";}
}
</script>
</div>
</div>
<div id="k1"><br><br>
<form action="file_upload1.php" method="post" enctype="multipart/form-data" class="form">
<br><br>
<div id="f9">
<table>
<tr>
<select name="subject" class = "form-control1 input-lg c">
<option value="Physics">PHYSICS</option>
</select> </tr>
<tr>
<select name="subtopic" class = "form-control1 input-lg c">
<option value="Mechanics">Mechanics</option>
<option value="Quantum">Quantum</option>
<option value="Modern">Modern</option>
<option value="Electrodynamics">Electrodynamics</option>
</select>
</tr>
<div id="f7"> <input type="text" name="desc" value="" class="form-control1 input-lg" placeholder="Notes Description" /></div>
</tr>
<tr>
<input type="file" name="fileToUpload" id="fileToUpload"><br>
<button type="submit" name="submit" class="form-control1 c">Upload file(max 100MB)</button>
</tr>
</table>
</div>
</form>
</div>
<script>
function w3_open() {
document.getElementById("main").style.marginLeft = "25%";
document.getElementById("mySidebar").style.width = "25%";
document.getElementById("mySidebar").style.display = "block";
document.getElementById("openNav").style.display = 'none';
}
function w3_close() {
document.getElementById("main").style.marginLeft = "0%";
document.getElementById("mySidebar").style.display = "none";
document.getElementById("openNav").style.display = "inline-block";
}
</script>
</body>
</body>
</html>