-
Notifications
You must be signed in to change notification settings - Fork 6
/
display.php
executable file
·209 lines (197 loc) · 8.45 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
<?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-Blogs</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="index.php">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>
<li>
<a class="page-scroll" href="write.php">Write 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. -->
<div class="blog-div">
<?php
$c=mysqli_connect('localhost','root','','survey');
if($c){
$q="select * from `blog` order by blog_id desc";
$r=mysqli_query($c,$q);
while($data=mysqli_fetch_array($r)){
echo "<div class='container'>";
echo "<div class='title'>";
echo $data['title']."<br>";
echo "<div class ='container-fluid'>";
echo "<div class='author'>"."-".$data['author']."</div>";
echo "<div class='date'>".$data['date_pub']."</div>";
echo "</div>";
echo "</div>";
echo "<div class='pic'>";
echo "<img src ='uploads/".$data['image']."'>";
echo "</div>";
echo "</div>";
# for printing the content
echo "<div class='section_content'>";
echo htmlspecialchars_decode(stripcslashes($data['content']));
echo "</div>";
echo "<br><br>";
}
}
?>
</div>
<!-- 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>