-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.php
executable file
·240 lines (212 loc) · 11.1 KB
/
index.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
<?php
session_start();
$server = "localhost";
$username = "root";
$password = "";
$dbname = "survey";
$conn = mysqli_connect($server, $username, $password, $dbname);
if (!$conn)
{
die("failed" . mysqli_error());
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<link href="https://fonts.googleapis.com/css?family=Dosis|Kreon|Raleway" rel="stylesheet">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="favicon.ico">
<title>TutOverflow</title>
<link href="src/css/bootstrap.min.css" rel="stylesheet">
<link href="src/css/scrolling-nav.css" rel="stylesheet">
<link href="src/css/landing.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
</head>
<body id="page-top" data-spy="scroll" data-target=".navbar-fixed-top">
<!-- Navigation -->
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand page-scroll" href="#page-top">TutOverflow</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav navbar-right">
<!-- Hidden li included to remove active class from about link when scrolled up past about section -->
<li class="hidden" style="color: aqua;">
<a class="page-scroll" href="#page-top"></a>
<li>
<a class="page-scroll" href="#tutorials">Popular tutorials</a>
</li>
</li>
<li>
<a class="page-scroll" href="display.php">Blog</a>
</li>
<li>
<a class="page-scroll" href="Trend/survey/main.php">Trend Analysis</a>
</li>
<button class="btn btn-info navbar-btn" data-toggle="modal" data-target="#exampleModal">+ Add Tutorial</button>
<?php if(!isset($_SESSION['username']))
echo "<a href='db.php'><button class='btn btn-info navbar-btn'>Login/Signup</button></a>";
else
echo "<a href='db.php?logout='1><button class='btn btn-info navbar-btn'>Logout</button></a>";
?>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<!-- MODAL BEGINS HERE -->
<div class="modal fade bd-example-modal-lg" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title" id="exampleModalLabel">Add Tutorial</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form name="add-form" method="GET" action="insert.php">
<div class="form-group row">
<label class="col-sm-2 col-form-label">Technology</label>
<?php
$q1="SELECT * from Languages;";
$check=mysqli_query($conn,$q1);
if (!$check) {
printf("Error: %s\n", mysqli_error($conn));
exit();
}
?>
<div class="col-sm-10">
<select name="ctech">
<?php
while ($row = mysqli_fetch_array($check))
{?>
<?php echo $row['technology']; ?>
<option value="<?php echo $row['technology']; ?>"><?php echo ucfirst($row['technology']); ?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">Course Name</label>
<div class="col-sm-10">
<input id="main-search" type="text" name="cname" placeholder="Course Name">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">Link</label>
<div class="col-sm-10">
<input id="main-search" type="text" name="clink" placeholder="Course Link">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">Cost</label>
<div class="col-sm-10">
<input type="radio" name="ccost" value="free">Free
<input type="radio" name="ccost" value="paid">Paid
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">Type</label>
<div class="col-sm-10">
<input type="radio" name="ctype" value="video">Video Tutorial
<input type="radio" name="ctype" value="book">E-Book/Book
<input type="radio" name="ctype" value="online-course">Online Course
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">Difficulty Level</label>
<div class="col-sm-10">
<input type="radio" name="clevel" value="beginner">Beginner
<input type="radio" name="clevel" value="medium">Medium
<input type="radio" name="clevel" value="expert">Expert
</div>
</div>
<div>
<input type="submit" class="btn btn-primary" value="Submit Tutorial" name="form-submit">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- MODAL ENDS HERE. -->
<!-- Intro Section -->
<section id="intro" class="intro-section">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1 id="header">TutOverflow</h1>
<h3 id="header">Find & Share the Best Rated Online Programming Courses & Tutorials</h3><br>
<form action="courses.php" method="GET" name="tech_form">
<input id="main-search" type="search" name="search_tech" placeholder="Search for the language you want to learn">
<input id="main-search" type="submit" class="btn btn-primary" value="Find Tutorials">
</form>
<br>
</div>
</div>
</div>
</section>
<!-- Tutorials Section -->
<section id="tutorials" class="tutorials-section">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1 id="header2">Our Popular Tutorials</h1> <br><br>
<ul class="flex-container">
<li class="flex-item" onclick="window.location.href='courses.php?search_tech=cpp'"><img class="topic-icon" src="img/logo-cpp.svg">C++</li>
<li class="flex-item" onclick="window.location.href='courses.php?search_tech=android'""><img class="topic-icon" src="img/logo-android.svg">Android</li>
<li class="flex-item" onclick="window.location.href='courses.php?search_tech=javascript'"><img class="topic-icon" src="img/logo-javascript.svg">Javascript</li>
<li class="flex-item" onclick="window.location.href='courses.php?search_tech=python'"><img class="topic-icon" src="img/logo-python.svg">Python</li>
<li class="flex-item" onclick="window.location.href='courses.php?search_tech=sql'"><img class="topic-icon" src="img/logo-sql.svg">SQL</li>
<li class="flex-item" onclick="window.location.href='courses.php?search_tech=php'"><img class="topic-icon" src="img/logo-php.svg">PHP</li>
<li class="flex-item" onclick="window.location.href='courses.php?search_tech=ruby'"><img class="topic-icon" src="img/logo-ruby.svg">Ruby</li>
<li class="flex-item" onclick="window.location.href='courses.php?search_tech=java'"><img class="topic-icon" src="img/logo-java.svg">JAVA</li>
<li class="flex-item" onclick="window.location.href='courses.php?search_tech=matlab'"><img class="topic-icon" src="img/logo-matlab.svg">MATLAB</li>
<li class="flex-item" onclick="window.location.href='courses.php?search_tech=data-structures-algorithms'"><img class="topic-icon" src="img/logo-data-structures-algorithms.svg">Data Strucures/Algorithms</li>
<li class="flex-item" onclick="window.location.href='courses.php?search_tech=reactjs'"><img class="topic-icon" src="img/logo-reactjs.svg">React</li>
<li class="flex-item" onclick="window.location.href='courses.php?search_tech=angular'"><img class="topic-icon" src="img/logo-angular.svg">Angular</li>
</ul>
</div>
</div>
</div>
</section>
<!-- jQuery -->
<script src="src/js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="src/js/bootstrap.min.js"></script>
<!-- Scrolling Nav JavaScript -->
<script src="src/js/jquery.easing.min.js"></script>
<script src="src/js/scrolling-nav.js"></script>
</body>
<footer>
<div class="container1">
<div class="footer-box">
<p style="text-align: center;">Copyright © 2018 TutOverflow</p>
<i class="fa fa-facebook"></i>
<i class="fa fa-twitter"></i>
<i class="fa fa-instagram"></i>
<i class="fa fa-github"></i>
<i class="fa fa-behance"></i>
</div>
</div>
</footer>
</html>