Bonsoir,

Je suis actuellement en train de concevoir un topsite,j'ai donc utilisé un script,juste un soucis je n'arrive pas à faire en sorte que la bdd puisse stocker l'ip pour empêcher un autre vote car il suffit de vider ses cookies pour voter à nouveau ( les votes sont fait 1 fois tous les 24H) donc voilà j'aimerai savoir si quelqu'un pourrait m'aider à résoudre ce problème car je suis bloqué.

Voici l'index.php :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 &eacute;t&eacute; connect&eacute;.</div>';
		$_SESSION['connecte'] = true;
	}
	else
	{
		echo '<div class="connection">Le mot de passe que vous avez entr&eacute; 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&eacute;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'; ?>
Vote.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
<?php
include('config.php');
//On verifie si lidentifiant a ete defini
if(isset($_GET['id']))
{
	$id = intval($_GET['id']);
	//On verifie si le site existe
	$req1 = mysql_query('select nom from topsite where id="'.$id.'"');
	if(mysql_num_rows($req1)>0)
	{
		$req1 = mysql_fetch_array($req1);
if(isset($_POST['confirmation']) and $_POST['confirmation']=='true')
{
	setcookie('topsitevote_'.$id, 'true', time()+86400);
}
include 'inc/header.php';
?>
 
 
<body>
<div id="container">
	<div id="header">
 
<?php include 'inc/search.php'; ?>
	</div>
 
	<?php include 'inc/menu.php'; ?>
 
		<div id="container-bg">
				<div id="notice-bg">
		</div><center>
<?php
//On verifie si la personne na pas encore vote
if(isset($_COOKIE['topsitevote_'.$id]))
{
	echo '<font size="3">Vous avez déjà voté aujourd\'hui !</font>';
}
else
{
//Si le vote a ete confirme
if(isset($_POST['confirmation']) and $_POST['confirmation']=='true')
{
	//On ajoute le vote
	if(mysql_query('update topsite set votes=votes+1 where id="'.$id.'"'))
	{
		echo '<strong>Votre vote a bien &eacute;t&eacute; comptabilis&eacute; !</strong>';
	}
}
else
{
	//On affiche le formulaire
<?php $mbre_ip = USER_IP;
	$query2 = mysql_query("SELECT * FROM vote WHERE vote_ip = $mbre_ip AND vote_date >= DATE_SUB(CURDATE(), INTERVAL 1 DAY)") or die (mysql_error());
	$nb_resultats2 = mysql_num_rows($query2);
 
		if (!$nb_resultats2) {
		ENREGISTREMENT DES DONNEES } ?>
?>
        	<form action="vote.php?id=<?php echo $id; ?>" method="post" class="voteon-hover">
                <input type="hidden" name="confirmation" value="true" />
		        <font size="3pt">Êtes-vous sûr de vouloir voter pour<b> <?php echo htmlentities($req1['nom']); ?></b> ?</font><br /><br />
				<input border=0 src="images/voteon.png" onmouseover="javascript:this.src='images/voteon.png';" onmouseout="javascript:this.src='images/voteon-hover.png';" type=image Value=submit align="middle" alt="" /><br /><br /><br />
				<a href="index.php"><img src="images/voteoff.png" alt="" onmouseover="javascript:this.src='images/voteoff.png';" onmouseout="javascript:this.src='images/voteoff-hover.png';" /></a>
            </form>
<?php
}
}
?>
<br /><br />
 
<b><a class="retour" href="index.php"><font size="2">Retour au classement des serveurs</font></b></a>
</div></center>
<?php include 'inc/footer.php'; ?>
<?php
	}
}
?>
Et la db
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
phpMyAdmin SQL Dump
-- version 3.1.1
-- http://www.phpmyadmin.net
--
-- Serveur: localhost
-- Généré le : Dim 28 Août 2011 à 01:14
-- Version du serveur: 5.1.30
-- Version de PHP: 5.2.8
 
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
 
 
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
 
--
-- Base de données: `test`
--
 
-- --------------------------------------------------------
 
--
-- Structure de la table `topsite`
--
 
CREATE TABLE IF NOT EXISTS `topsite` (
  `id` int(11) NOT NULL,
  `nom` varchar(55) NOT NULL,
  `url` varchar(255) NOT NULL,
  `description` varchar(255) NOT NULL,
  `banniere` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `votes` int(11) NOT NULL,
  `statut` varchar(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
--
-- Contenu de la table `topsite`
--
 
INSERT INTO `topsite` (`id`, `nom`, `url`, `description`, `banniere`, `email`, `votes`, `statut`) VALUES