Bonjour, d'après certains, ma page d'inscription aurait une faille SQL, qui permettrait de détruire toute ma Base de Donnée.

J'aurais aimé savoir si c'était le cas, si oui, quelqu'un sait la corriger ?

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
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
263
264
265
266
267
268
269
270
<div id="title"><span>Inscription à <?php echo $title_site; ?></span>Inscription à <?php echo $title_site; ?></div><img src="theme/img/hr.png" class="hr"/>
 
 
<?php
if(isset($_SESSION['login']) AND isset($_SESSION['level'])){
	echo '<p class="error-message"><img class="icon_text"src="theme/img/error.png">Vous avez deja un Compte !!</p>';
print("<script type=\"text/javascript\">setTimeout('location=(\"".$lien_home."\")' ,0);</script>");
}
else{ 
if(empty($_SESSION['id']))
{
   $error['username'] = FALSE;
   $error['pseudo'] = FALSE;
   $error['password'] = FALSE;
   $error['email'] = FALSE;
   $error['captcha'] = FALSE;
   $error['ques'] = FALSE;
   $error['rep'] = FALSE;
   $error['rule'] = FALSE;
 
   if(isset($_POST['send']) && secu($_POST['send']) == 'Inscription !')
   {
	  $username = secu($_POST['username']);
	  $password = secu($_POST['password']);
	  $password_conf = secu($_POST['password_conf']);
	  $pseudo = secu($_POST['pseudo']);
	  $email = secu($_POST['email']);
	  $question = secu($_POST['ques']);
	  $reponse = secu($_POST['rep']);
	  $captcha = secu($_POST['captcha']);
 
	  $register['username'] = FALSE;
	  $register['password'] = FALSE;
	  $register['pseudo'] = FALSE;
	  $register['email'] = FALSE;
	  $register['ques'] = FALSE;
	  $register['rep'] = FALSE;
	  $register['captcha'] = FALSE;
	  $register['rule'] = FALSE;
 
	  if(isset($_POST['username']) && $username != '')
	  {
			$sq = 'SELECT * FROM accounts';
			$re = mysql_query($sq) or die('SQL Error !<br>'.$sq.'<br>'.mysql_error());
			$dat = mysql_fetch_array($re);
		if($dat['cuenta'] == $username)
		{
			$error['username'] = TRUE;
			$errUser = "<img title='Le nom de compte est déjà utilisé !' src='theme/img/close.png'>";
		}
		else
		{
			$register['username'] = TRUE;
		}
	  }
	  else
	  {
		 $error['username'] = TRUE;
		 $errUser = "<img title='Aucun nom de compte indiqué !' src='theme/img/close.png'>";
	  }
 
	  if(isset($_POST['password']) && $password != '')
	  {
		 if($password == $password_conf)
		 {
			$register['password'] = TRUE;
		 }
		 else
		 {
			$error['password'] = TRUE;
			$errPass = "<img title='Les deux mots de passe ne sont pas identiques !' src='theme/img/close.png'>";
		 }
	  }
	  else
	  {
		 $error['password'] = TRUE;
		 $errPass = "<img title='Aucun mots de passe  !' src='theme/img/close.png'>";
	  }
 
	   if(isset($_POST['pseudo']) && $pseudo != '' )
	  {
			$sq = 'SELECT * FROM accounts';
			$re = mysql_query($sq) or die('SQL Error !<br>'.$sq.'<br>'.mysql_error());
			$dat = mysql_fetch_array($re);
		if($dat['pseudo'] == $pseudo)
		{
			$error['pseudo'] = TRUE;
			$errPseudo = "<img title='Le pseudo est déjà utilisé !' src='theme/img/close.png'>";
		}
		else
		{
			$register['pseudo'] = TRUE;
		}
	  }
	  else
	  {
		 $error['pseudo'] = TRUE;
		 $errPseudo = "<img title='Aucun pseudo indiqué !' src='theme/img/close.png'>";
	  }
 
	  if(isset($_POST['email']) && $email != '')
	  {
		 if(preg_match("/^[a-z0-9\-_.]+@[a-z0-9\-_.]+\.[a-z]{2,3}$/i",$email))
		 {
			$register['email'] = TRUE;
		 }
		 else
		 {
			$error['email'] = TRUE;
			$errMail = "<img title='Adresse est invalide !' src='theme/img/close.png'>";
		 }
	  }
	  else
	  {
		 $error['email'] = TRUE;
		 $errMail = "<img title='Aucune adresse indiquée !' src='theme/img/close.png'>";
	  }
 
	  if(isset($_POST['captcha']) && $captcha != '')
	  {
		 if(strtoupper($captcha) == $_SESSION['captcha'])
		 {
			$register['captcha'] = TRUE;
		 }
		 else
		 {
			$error['captcha'] = TRUE;
			$errCode = "<img title='Le code est invalide !' src='theme/img/close.png'>";
		 }
	  }
	  else
	  {
		 $error['captcha'] = TRUE;
		 $errCode = "<img title='Aucun code indiqué ! src='theme/img/close.png'>";
	  }
 
	  if(isset($_POST['rule']))
	  {
		 $register['rule'] = TRUE;
	  }
	  else
	  {
		 $error['rule'] = TRUE;
		 $errRule = "<img title='Les C.G.U doivent être lus & compris !' src='theme/img/close.png'>";
 
	  }
 
	  if($register['username'] == TRUE && $register['password'] == TRUE && $register['email'] == TRUE && $register['pseudo'] == TRUE && $register['captcha'] == TRUE)
	  {
		mysql_query("INSERT INTO accounts (guid,account,pass,level,vip,email,lastIP,lastConnectionDate,question,reponse,pseudo,banned,bankKamas,friends,enemy,logged,points,vote,heurevote) VALUES ('0','".$username."','".$password."','0','0','".$email."','0','127.0.0.1','".$question."','".$reponse."','".$pseudo."','0','0','0','0','0','0','0','0')")or die(mysql_error());
					echo '<p class="clean-message"><small><img class="icon_text" src="theme/img/clean.png"> Félicitation <b>'.$pseudo.'</b>, vous êtes maintenant inscrit sur <b>'.$title.'</b> avec le compte <b>'.$account.'</b> !<br><i>Redirection automatique vers la page d\'accueil dans quelques secondes !</i></small></p><img src="theme/img/bottomContenu.png">';
				$donnees = mysql_fetch_array(mysql_query("SELECT * FROM accounts WHERE cuenta = '".$username."'"));
						$_SESSION['login'] = $donnees['cuenta'];
						$_SESSION['guid'] = $donnees['guid'];	
						print("<script type=\"text/javascript\">setTimeout('location=(\"".$lien_getin."\")' ,4000);</script>");
		 exit;
	  }
   }
   echo'<h1>● Veuillez remplir le formulaire suivant</h1>
<img src="theme/img/hr.png" class="hr"/>
<p class="error-message">
<img src="theme/img/error.png" class="devtool"/>
 Si vous vous inscrivez, cela veux donc dire que vous avez lus et pris en compte 
 <a href="pages.php?p=reglement">
 <u>le réglement</u>
 </a> déposé par <?php echo $title_site; ?> !</p>
 <img src="theme/img/hr.png" class="hr"/>';
 
   echo "<form action=\"".$lien_inscription."\" method=\"POST\" id=\"form\">\n";
   echo "<table width='94%' style='margin:8px 0px 8px 20px;'>\n";
 
   echo '<tr>';
   echo '<td>';
   echo "<img title='' class='icon_text' src='theme/img/joueur.png'> Nom de compte : \n";
   echo '</td>';
   echo '<td width="290">';
   if($error['username']){ echo $errUser; }
   echo " <input name=\"username\" id=\"username\" type=\"text\" maxlength=\"32\" value=\"".@$username."\">\n";
   echo '</td>';
   echo '</tr>';
 
   echo '<tr>';
   echo '<td>';
   echo "<img title='' class='icon_text' src='theme/img/construction.png'> Mot de passe :\n";
   echo '</td>';
   echo '<td>';
   if($error['password']){ echo $errPass; }
   echo " <input name=\"password\" id=\"password\" type=\"password\" maxlength=\"40\" value=\"".@$password."\">\n";
   echo '</td>';
   echo '</tr>';
 
   echo '<tr>';
   echo '<td>';
   echo "<img title='' class='icon_text' src='theme/img/construction.png'> Confirmez votre mot de passe :\n";
   echo '</td>';
   echo '<td>';
   if($error['password']){ echo $errPass; }
   echo " <input name=\"password_conf\" id=\"password_conf\" type=\"password\" maxlength=\"40\" value=\"".@$password_conf."\">\n";
   echo '</td>';
   echo '</tr>';
 
   echo '<tr>';
   echo '<td>';
   echo "<img title='' class='icon_text' src='theme/img/user.png'> Pseudo :\n";
   echo '</td>';
   echo '<td>';
   if($error['pseudo']){ echo $errPseudo; }
   echo " <input name=\"pseudo\" id=\"pseudo\" type=\"text\" value=\"".@$pseudo."\">\n";
   echo '</td>';
   echo '</tr>';
 
   echo '<tr>';
   echo '<td>';
   echo "<img title='' class='icon_text' src='theme/img/user.png'> Question secrète :\n";
   echo '</td>';
   echo '<td>';
   echo " <input name=\"ques\" id=\"ques\" type=\"text\" value=\"".@$question."\">\n";
   echo '</td>';
   echo '</tr>';
      echo '<tr>';
   echo '<td>';
   echo "<img title='' class='icon_text' src='theme/img/construction.png'> Réponse secrète :\n";
   echo '</td>';
   echo '<td>';
   echo " <input name=\"rep\" id=\"rep\" type=\"text\" value=\"".@$reponse."\">\n";
   echo '</td>';
   echo '</tr>';
 
   echo '<tr>';
   echo '<td>';
   echo "<img title='' src='theme/img/email_open.png'> Adresse E-mail :\n";
   echo '</td>';
   echo '<td>';
   if($error['email']){ echo $errMail; }
   echo " <input name=\"email\" id=\"email\" type=\"text\" value=\"".@$email."\">\n";
   echo '</td>';
   echo '</tr>';
 
   echo '<tr>';
   echo '<td>';
   echo "<img title='' class='icon_text' src='theme/img/ip.png'> Code de sécurité :\n";
   echo '</td>';
   echo '<td>';
   if($error['captcha']){ echo $errCode; }
   echo " <input name=\"captcha\" id=\"captcha\" type=\"text\" value=\"\" /> : <img class='img_text' src=\"module/captcha.php\" alt=\"Captcha\" />\n";
   echo '</td>';
   echo '</tr>';
 
   echo '<tr>';
   echo '<td>';
   echo "<img title='' class='icon_text' src='theme/img/error.png'> Conditions générales d'utilisation :\n";
   echo '</td>';
   echo '<td>';
   if($error['rule']){ echo $errRule; }
   echo "<input type=\"checkbox\" value=\"check[]\" name=\"rule\"><a href='pages.php?p=reglement'><img title='Attention, lire attentivement & accepter les C.G.U !' class='icon_text' src='theme/img/help.png'></a>\n";
   echo '</td>';
   echo '</tr>';
 
   echo "</table>\n";
   echo'<br>';
   echo '<center><input type="submit" name="send" class="submit" value="Inscription !"></center>'."\n";	
   echo "</form>\n";
 
}
else
{
   print("<script type=\"text/javascript\">setTimeout('location=(\"".$lien_home."\")' ,0);</script>");
}
}
?>
Merci