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
| <?php
include('config.php');
function dehtml($html)
{
return htmlentities($html, ENT_QUOTES, 'utf-8');
}
include 'inc/header.php';
?>
<body>
<div id="container">
<div id="header">
<?php
//On verifie si ladministrateur a essaye de se connecter
if(isset($_POST['motdepasse']))
{
//On verifie si le mot de passe est bon
if(strtolower($_POST['motdepasse'])==strtolower($mot_de_passe))
{
echo '<div class="connection">Vous avez bien été connecté.</div>';
$_SESSION['connecte'] = true;
}
else
{
echo '<div class="connection">Le mot de passe que vous avez entré n\'est pas le bon.</div>';
}
}
//On affiche un lien dinscription et la top site
?>
<?php include 'inc/search.php'; ?>
</div>
<div id="container-top">
<div id="navigation">
<a id="navi-home" href="#" onclick="page('pages/accueil.php'); return false;"></a>
<a id="navi-ajouter" href="nouveau.php"></a>
<a id="navi-news" href="#" onclick="page('pages/news.php'); return false;"></a>
<a id="navi-contact" href="contact.php"></a>
<a id="navi-partenaires" href="partenaires.php"></a>
</div>
</div>
<div id="container-bg">
<div id="notice-bg"><b>Accueil</b>
</div>
<div id="contents">
<script type="text/javascript">
page('pages/accueil.php')
</script>
</div>
<br /><div id="notice-bg">
<div class="classement2"><b>Classement</b></div>
<div class="serveur2"><b>Serveur</b></div>
<div class="vote2"><b>Vote</b></div>
</div>
</div>
<div id="container-bg">
<div id="contents">
<table class="topsite" cellpadding="0" cellspacing="0">
<tr>
<th class="classement_th"></th>
<th class="site_th"></th>
<th class="votes_th"></th>
</tr>
<?php
//On recupere le nombre de sites
$req1 = mysql_fetch_array(mysql_query('select count(id) as nb from topsite where statut="ok"'));
//On recupere la page actuelle
if(isset($_GET['page']))
{
$page = intval($_GET['page']);
}
else
{
$page = 1;
}
//On calcule le nombre de pages et on affiche la site des pages
$nbpages = ceil($req1['nb']/$nb_site_page);
if($page<1 or $page>$nbpages)
{
$page = 1;
}
$pages_list = 'Pages:<br />';
if($page>1)
{
$pages_list .= '<a href="?page='.($page-1).'"><img src="images/flechegauche.png" alt="" align="center"></a> ';
}
for($i=1;$i<=$nbpages;$i++)
{
if($i==$page)
{
$pages_list .= '<strong>'.$i.'</strong> ';
}
else
{
$pages_list .= '<a href="?page='.$i.'">'.$i.'</a> ';
}
}
if($page<$nbpages)
{
$pages_list .= '<a href="?page='.($page+1).'"><img src="images/flechedroite.png" alt="" align="center" </a>';
}
?>
<?php
//on calcule la position premier a afficher
$premier_message = ($page-1)*$nb_site_page;
$i = $premier_message;
//On affiche les sites
$req2 = mysql_query('select id, url, nom, description, banniere, votes from topsite where statut="ok" order by votes desc limit '.$premier_message.','.$nb_site_page);
while($dnn2 = mysql_fetch_array($req2))
{
$i++;
?>
<tr>
<td class="classement"><?php echo $i; ?>
<?php
//On verifie si cest un administrateur
if($_SESSION['connecte']==true)
{
?>
<br /><a href="accepter_refuser.php?id=<?php echo $dnn2['id']; ?>&ch=s" style="font-size:16px;">Supprimer ce site</a>
<?php
}
?>
</td>
<td class="site"><a href="<?php echo dehtml($dnn2['url']); ?>" style="color:#5F8CA3;text-decoration:none;font-weight:bold;"><font size="4px"><center><?php echo dehtml($dnn2['nom']); ?></center></font></a><br />
<center><?php echo dehtml($dnn2['description']); ?></center>
<div style="text-align:center;"><a href="<?php echo dehtml($dnn2['url']); ?>"><br /><img src="<?php echo dehtml($dnn2['banniere']); ?>" alt="<?php echo dehtml($dnn2['nom']); ?>" style="max-width:450px;max-height:130px;" /></a></div></td>
<td class="votes"><?php echo $dnn2['votes']; ?><br /><br /><a class="voter" href="vote.php?id=<?php echo $dnn2['id']; ?>"><img src="images/voter.gif" alt=""onmouseover="javascript:this.src='images/voter-hover.gif';" onmouseout="javascript:this.src='images/voter.gif';"></a></td>
</tr>
<tr>
<td colspan="3"><div id="notice-bg2">
</div></td>
</tr>
<?php
}
//On reaffiche la site des pages en bas
?>
<tr>
<td colspan="3" class="pages"><?php echo $pages_list; ?></td>
</tr>
</table>
<?php
//On verifie si cest un administrateur
if($_SESSION['connecte']==true)
{
//On affche un lien pour reinitialiser les votes
?>
<div style="text-align:right;margin-right:20px;"><a href="reinitialisation.php">Réinitialiser les votes</a></div>
<?php
}
//On reaffiche un lien dinscription
?>
<br /><br /><div class="new"><a href="nouveau.php" id="ajouter"><img src="images/ajouterserveur.png" alt=""onmouseover="javascript:this.src='images/ajouterserveur-hover.png';" onmouseout="javascript:this.src='images/ajouterserveur.png';"></a></div>
<?php
//On verifie si cest un administrateur
if($_SESSION['connecte']==true)
{
?>
<h1>Administration</h1>
<table class="topsite" cellpadding="0" cellspacing="0">
<tr>
<th class="site_th">Site</th>
<th class="votes_th">Votes</th>
<th class="accepter_refuser_th">Accepter/Refuser</th>
</tr>
<?php
//On affiche les sites qui nont pas encore ete valides
$i = false;
$req2 = mysql_query('select id, url, nom, description, banniere, votes from topsite where statut!="ok"');
while($dnn2 = mysql_fetch_array($req2))
{
$i = true;
?>
<tr>
<td class="site"><a href="<?php echo dehtml($dnn2['url']); ?>" style="color:#0000ff;text-decoration:underline;font-weight:bold;"><?php echo dehtml($dnn2['nom']); ?></a><br />
<?php echo dehtml($dnn2['description']); ?><br />
<div style="text-align:center;"><a href="<?php echo dehtml($dnn2['url']); ?>"><img src="<?php echo dehtml($dnn2['banniere']); ?>" alt="<?php echo dehtml($dnn2['nom']); ?>" style="max-width:500px;max-height:200px;" /></a></div></td>
<td class="votes"><?php echo $dnn2['votes']; ?><br /><a href="vote.php?id=<?php echo $dnn2['id']; ?>">Voter</a></td>
<td class="accepter_refuser"><a href="accepter_refuser.php?id=<?php echo $dnn2['id']; ?>&ch=a">Accepter</a><br /><a href="accepter_refuser.php?id=<?php echo $dnn2['id']; ?>&ch=r">Refuser</a></td>
</tr>
<?php
}
if(!$i)
{
?>
<tr>
<td colspan="3">Il n'y a aucun site en attente de validation.</td>
</tr>
<?php
}
?>
</table>
<?php
}
else
{
//Si ladmnistrateur nest pas connecte, on affiche un formulaire
?>
<a href="#null" onclick="document.getElementById('administration').style.display='block';">Administration</a>
<form action="<?php echo $url_toplist; ?>" method="post" id="administration" style="display:none;">
<label for="motdepasse">Mot de passe</label><input type="password" name="motdepasse" id="motdepasse" /><input type="submit" value="Connection" />
</form>
<?php
}
?>
</div>
</div>
<?php include 'inc/footer.php'; ?> |
Partager