forked from Kelevan/ForumHundredMiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathincludes.php
215 lines (204 loc) · 9.86 KB
/
includes.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
<?php
// Démarrage de la session
session_start();
// Verification du script DB.PHP
include_once("./db.php");
// --------------------- FONCTION ENTETE -------------------
function entete($titre)
{
echo'
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hundred Miles :: '.$titre.'</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->
<style type="text/css">
body {
padding-top: 60px;
padding-bottom: 40px;
}
.sidebar-nav {
padding: 9px 0;
}
</style>
<link href="./css/bootstrap.css" rel="stylesheet" media="screen">
<link href="./css/bootstrap-responsive.css" rel="stylesheet">
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="./index.php">Hundred Miles</a>
';
menu();
echo'</div></div>';
}
// --------------------- FONCTION DU MENU POUR GERER LES DROITS -------------------
function verif_connexion()
{
if (!isset($_SESSION['idUtil']))
{
echo'Vous devez etre inscrit et connecté pour visionner cette page.';
$url="./index.php";
die('<meta http-equiv="refresh" content="1;URL='.$url.'">');
}
}
function menu()
{
if(isset($_SESSION['pseudo']))
{
if (isset($_SESSION['idTypeUtil']))
{
echo '
<div class="nav-collapse">
<ul class="nav">
<div class="tabbable">
<ul class="nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Catégories<b class="caret"></b></a>
<ul class="dropdown-menu">
';
$req_connexion=query("select idCat,nomCat from categorie");
while ($row = mysql_fetch_array($req_connexion, MYSQL_NUM))
{
echo "<li><a href=./categorie.php?id=".$row[0].">".$row[1]."</a></li>";
}
echo'
</ul>
</li>
</ul>
</div>
</ul>
</div>
';
if ($_SESSION['idTypeUtil']==1)
{
}
elseif($_SESSION['idTypeUtil']==2)
{
echo '
<ul class="nav pull-right">
<div class="btn-group">
<ul class="nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Panel Admin<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="./listeCategorie.php"><i class="icon-th-large"></i> Gestion des catégories</a></li>
<li><a href="./listeForum.php"><i class="icon-th-list"></i> Gestion des forums</a></li>
</ul>
</li>
</ul>
</div>
</ul>
';
}
elseif($_SESSION['idTypeUtil']==3)
{
echo '
<ul class="nav pull-right">
<div class="btn-group">
<ul class="nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Panel Admin<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="./listeMembre.php"><i class="icon-user"></i> Gestion des utilisateurs</a></li>
<li><a href="./listeCategorie.php"><i class="icon-th-large"></i> Gestion des catégories</a></li>
<li><a href="./listeForum.php"><i class="icon-th-list"></i> Gestion des forums</a></li>
</ul>
</li>
</ul>
</div>
</ul>
';
}
}
echo '
<div class="nav-collapse">
<ul class="nav pull-right">
<div class="btn-group">
<ul class="nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#"><i class="icon-user icon-white"></i> ';
echo $_SESSION['pseudo'];
echo '<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="./profil.php"><i class="icon-user"></i> Profil</a></li>
<li><a href="./messagerie.php"><i class="icon-envelope"></i> Messages </a></li>
<li class="divider"></li>
<li><a href="./connect.php?action=logout"><i class="icon-off"></i> Se déconnecter</a></li>
</ul>
</li>
</ul>
</div>
</ul>
</div>
</div>
';
}
else
{
echo'
<ul class="nav pull-right">
<ul class="nav nav-pills">
<a data-toggle="modal" href="#myModal" class="btn btn-danger" class="btn-group"><i>Se connecter</i></a>
</ul>
</ul>
</div>
</div>
</div>
</div>
<div id="myModal" class="modal hide fade">
<div class="modal-header">
<button class="close" data-dismiss="modal">×</button>
<h3>Connexion</h3>
</div>
<div class="modal-body">
<div class="tab-pane active" id="connexion">
<form class="well form-horizontal" method="post" action="./connect.php?action=login">
<div class="control-group">
<label class="control-label" for="input01"><b>E-mail</b></label>
<div class="controls">
<input type="text" class="input-large" id="mail" name="mail">
</div>
</div>
<div class="control-group">
<label class="control-label" for="input01"><b>Mot de passe</b></label>
<div class="controls">
<input type="password" class="input-large" id="pass" name="pass">
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Se connecter</button>
<button data-dismiss="modal" class="btn btn-warning">Annuler</button>
</div>
</form>
</div>
</div>';
}
}
function pied()
{
echo'
<div class="navbar navbar-bottom">
<footer class="footer-bottom">
<p class="pull-right"><a href="#">Back to top</a></p>
<p class="pull-left"><h3>By Kelevan & Kirby</h3></p>
</footer>
</div>
<script src="./js/jquery.js"></script>
<script src="./js/bootstrap.min.js"></script>
</div>
</body>
</html> ';
}
?>