-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
262 lines (251 loc) · 8.81 KB
/
index.php
File metadata and controls
262 lines (251 loc) · 8.81 KB
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
<?php
session_start();
include "dbconn.php";
$stmt = $conn->prepare('SELECT title, text, imagepath FROM news');
$stmt->execute();
if($stmt->error !== "")
$error = "SQL error: " . $stmt->error;
$stmt->bind_result($title, $text, $imagepath);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="img/favicon.ico">
<title>NASA - Bootstrap</title>
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/custom.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script type="text/javascript">
$(function()
{
var jumbo = $('#jumbo');
var title = $('#jumbo-title');
var text = $("#jumbo-text");
var hiddenImage = $("#hidden-image");
var hiddenTitle = $("#hidden-title");
var hiddenText = $("#hidden-text");
var backgrounds = ['url(img/earth2.jpg)', 'url(img/rocketJumbo.jpg)', 'url(img/supernova.jpg)'];
var titles = ["Titel 1", "Titel 2", "Titel 3"];
var texts = ["Photoshopped picture of earth like planet.", "Picture of a rocket.", "Supernova!"]
var current = 0;
<?php
while($stmt->fetch())
{
echo 'backgrounds.push("url('. $imagepath .')");';
echo 'titles.push("'. $title .'");';
echo 'texts.push("'. $text .'");';
}
?>
function nextBackground()
{
jumbo.css('background-image', backgrounds[current = ++current % backgrounds.length]);
title.html(titles[current]);
//text.html(texts[current]);
setTimeout(nextBackground, 3000);
hiddenImage.attr('value', backgrounds[current].substring(4, backgrounds[current].length - 1));
hiddenTitle.attr('value', titles[current]);
hiddenText.attr('value', texts[current]);
if(texts[current].length > 100)
{
text.html(texts[current].substr(0, 100));
}
else
{
text.html(texts[current]);
}
}
setTimeout(nextBackground, 3000);
jumbo.css('background-image', backgrounds[0]);
title.html(titles[0]);
text.html(texts[0]);
hiddenImage.attr('value', backgrounds[0].substring(4, backgrounds[0].length - 1));
hiddenTitle.attr('value', titles[0]);
hiddenText.attr('value', texts[0])
});
function search(str)
{
if (str.length == 0)
{
document.getElementById("search-results-container").style.display = "none";
document.getElementById("search-results").innerHTML = "";
return;
}
else
{
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("search-results").innerHTML = this.responseText;
}
if(this.responseText != "")
document.getElementById("search-results-container").style.display = "inline";
};
xmlhttp.open("GET", "search.php?q=" + str, true);
xmlhttp.send();
}
}
</script>
</head>
<body>
<nav class="navbar navbar-inverse navbar-static-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar" aria-expanded="true" aria-controls="navbar">
<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-left" href="index.php">
<img src="img/logo.png">
</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<div class="row">
<div class="search">
<form action="search.php" method="get">
<input type="search" name="q" placeholder="Search" autocomplete="off" onkeyup="search(this.value)">
</form>
<div class="search-results-container" id="search-results-container">
<ul class="search-results" id="search-results">
</ul>
</div>
</div>
<ul class="links nav navbar-nav navbar-right">
<li><a href="#">Missions</a></li>
<li><a href="#">Galleries</a></li>
<li><a href="#">NASA TV</a></li>
<li><a href="#">Follow NASA</a></li>
<li><a href="#">Downloads</a></li>
<li><a href="#">About</a></li>
<li><a href="#">NASA Audiences</a></li>
<?php
if(isset($_SESSION["username"]))
{
echo "<li><a href=\"admin.php\">Admin Page</a></li>";
echo "<li><a href=\"logout.php\">Logout</a></li>";
}
else
echo "<li><a href=\"login.php\">Login</a></li>";
?>
</ul>
</div>
<div class="row">
<ul class="menu nav navbar-nav navbar-right">
<li><a href="#">International Space Station</a></li>
<li><a href="#">Journey to Mars</a></li>
<li><a href="#">Earth</a></li>
<li><a href="#">Technology</a></li>
<li><a href="#">Aeronautics</a></li>
<li><a href="#">Solar System and Beyond</a></li>
<li><a href="#">Education</a></li>
<li><a href="#">Education</a></li>
<li><a href="#">Benefits to You</a></li>
</ul>
</div>
</div>
</div>
</nav>
<div class="container">
<?php
if(isset($error))
{
echo "<div class=\"alert alert-danger\">";
echo "<a href=\"#\" class=\"close\" data-dismiss=\"alert\" aria-label=\"close\">×</a>";
echo "<strong>Error</strong> ".$error;
echo "</div>";
}
?>
<div class="row" >
<div class="col-lg-12">
<?php echo '<a onclick="linkClick();">'; ?>
<div id="jumbo" class="item jumbo col-md-12">
<div class="image-container">
<h2 class="image-title" id="jumbo-title">Hola</h2>
<br>
<p class="image-text" id="jumbo-text">muble jumble humble dumble tumblemuble jumble humble dumble tumblemuble
</p>
</div>
</div>
<?php echo '</a>'; ?>
<script type="text/javascript">
function linkClick()
{
document.getElementById("hidden-link").submit();
}
</script>
</div>
<div class="col-sx-12 col-sm-6 col-md-3">
<div class="item text-item col-md-12">
<div class="text-container">
<div class="text-container-header">
<h3>Fancy title</h3>
</div>
<div class="text-container-content">
<p>muble jumble humble dumble tumblemuble jumble humble dumble tumblemuble jumble humble dumble tumble</p>
</div>
<div class="text-container-footer">
<a href="#">Other stuff</a>
</div>
</div>
</div>
</div>
<div class="col-sx-12 col-sm-6 col-md-3">
<div class="item news-item col-md-12">
<div class="image-container">
<h2 class="image-title">Hola</h2>
<p class="image-text">
muble jumble humble dumble tumblemuble jumble
<span class="cont">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s
</span>
</p>
</div>
</div>
</div>
<div class="col-sx-12 col-sm-6 col-md-6">
<div class="item double col-md-12">
<div class="double-square">
</div>
<div class="double-image">
<img src="https://pbs.twimg.com/profile_images/562466745340817408/_nIu8KHX.jpeg">
</div>
<div class="double-text">
<h2>Hey, What's up?</h2>
<p>Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum</p>
</div>
</div>
</div>
<div class="col-sx-12 col-sm-6 col-md-3">
<div class="item col-md-12">
<video controls id="video1" width="300px" height="300px">
<source src="video/vid1.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
</div>
<div class="col-sx-12 col-sm-6 col-md-6">
<div class="item col-md-12">
<img src="img/kitten.jpg">
</div>
</div>
<div class="col-sx-12 col-sm-6 col-md-3">
<div class="item col-md-12">
<a class="twitter-timeline" data-dnt="true" href="https://twitter.com/NASA" data-widget-id="332858661187751936">Tweets by @NASA</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
</script>
</div>
</div>
</div>
</div>
<form id="hidden-link" method="post" action="article.php">
<input type="hidden" value="" name="image" id="hidden-image">
<input type="hidden" value="" name="title" id="hidden-title">
<input type="hidden" value="" name="text" id="hidden-text">
</form>
<script src="js/bootstrap.js"></script>
</body>
</html>