-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
100 lines (95 loc) · 3.52 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
<?php
require_once("require/database.php");
error_reporting(E_ALL & ~E_WARNING);
?>
<html>
<head>
<title>Gallery.php</title>
<link rel="stylesheet" href="foundation.css"/>
<script src="modernizr.js"></script>
</head>
<body>
<link href="http://cdnjs.cloudflare.com/ajax/libs/foundicons/3.0.0/foundation-icons.css" rel="stylesheet">
<nav class="menu">
<h1 class="name"><i class="fi-widget"></i> Gallery.php</a></h1>
<ul class="inline-list">
<li class="active"><a href="index.php">Gallery</a></li>
<li><a href="ladda.php">Upload</a></li>
</ul>
<ul class="inline-list hide-for-small-only account-action">
<li><?php require("require/logged.php") ?></li>
<?php require_once("require/outorin.php") ?>
</ul>
<a class="account hide-for-medium-up" href="signin.php" data-reveal-id="myModal"><i class="fi-unlock"></i></a>
</nav>
<?php
if (isset($_SESSION["db_error"])) {
echo '<nav class="menu"><h1>You have an error with the database! If this is the first time starting this webapp run <a href="install/install.php">install.php</a></h1></nav>';
unset($_SESSION["db-error"]);
}
if (isset($_SESSION["installed"])) {
echo "<strong>IMPORTANT!!!!</strong> INSTALLATION DONE! PLEASE REMOVE THE INSTALL FOLDER!!!";
unset($_SESSION["installed"]);
} else if (scandir("install")) {
echo "<strong>IMPORTANT</strong> INSTALLATION FOLDER STILL EXISTS PLEASE REMOVE IT OR RUN THE INSTALLATION! <a href='install/install.php'>installation here</a>";
}
?>
<?php
$date2 = date('Y-m-d', strtotime('-7 days'));
$i = 0;
$resultat = mysqli_query($conn,"SELECT images, description, likes FROM imgs LIMIT 8");
while($row = mysqli_fetch_array($resultat, MYSQLI_NUM)) {
echo '<div class="medium-6 columns end">
<div class="card">
<div class="images">
<a href='; echo "uploads/", $row["0"]; echo'><img height="500" width="500" src='; echo "uploads/", $row["0"]; echo '></a>
</div>
<div class="content" id='.$row["0"].'>
<span class="title"></span>
<p>'; echo $row["1"];
echo '</p>
</div>
<div class="action">';
if (empty($_SESSION["user_id"]) >= 1) {
echo '<span class="liek">'.$row["2"].' Likes </span>';
echo '</div>';
} else {
if ($_SESSION["like_err"] == 1 and $row["0"] == $_GET["like"]) {
echo "You have already liked this post";
unset($_SESSION["like_err"]);
echo '<span class="liek">'.$row["2"].' Likes </span>';
echo '<a id="like" href="like.php?like='; echo $row["0"]; echo '">Like</a>
<a id="dislike" href="like.php?dislike='; echo $row["0"]; echo '">Dislike</a>';
echo '</div>';
} else {
echo '<span class="liek">'.$row["2"].' Likes </span>';
echo '<a id="like" href="like.php?like='; echo $row["0"]; echo '">Like</a>
<a id="dislike" href="like.php?dislike='; echo $row["0"]; echo '">Dislike</a>';
echo '</div>';
}
}
echo '</div>
</div>
</div>';
$i++;
}
?>
<!-- modal content -->
<script>
document.write('<script src=js/vendor/' +
('__proto__' in {} ? 'zepto' : 'jquery') +
'.js><\/script>')
</script>
<script src="jquery.js"></script>
<script>
$(document).foundation();
</script>
<script src="jquery.js"></script>
<script src="sfoundation.js"></script>
<script>
$(document).foundation();
var doc = document.documentElement;
doc.setAttribute('data-useragent', navigator.userAgent);
</script>
</body>
</html>