Да не се регистрират

haus

Registered
Искам да попитам как да направя на регистрацията ми да не се регистрират хора със симето demo
 
като го сложа страницата изчезва
ето го кода ще го сложиш ли

Код:
<?php
if(isset($_POST['submit']) && $_SESSION['name'] == NULL)
{
if($_POST['name'] == NULL || $_POST['pass1'] == NULL || $_POST['pass2'] == NULL || $_POST['mail'] == NULL)
{
echo '
<table class="error1-reg" width="40%" align="center">
<td class="error-reg" rowspan="4" width="5%" align="center">
<img src="images/task_error.gif" width="33" border="0" height="33">
</td>
<td width="50%" align="center"><span style="font-weight: bold;">Този емайл е зает.</span></td>
</table>';
}

elseif($_POST['pass1'] != $_POST['pass2'])
{
echo '
<table class="error1-reg" width="40%" align="center">
<td class="error-reg" rowspan="4" width="5%" align="center">
<img src="images/task_error.gif" width="33" border="0" height="33">
</td>
<td width="50%" align="center"><span style="font-weight: bold;">Паролите не си съвпадат.</span></td>
</table>';
}

else
{
$name = htmlspecialchars($_POST['name']);
$pass = md5($_POST['pass1']);
$mail = htmlspecialchars($_POST['mail']);
$sex = htmlspecialchars($_POST['sex']);
$cars = htmlspecialchars($_POST['cars']);
$insert = "INSERT INTO `users` (`name` , `pass` , `mail` , `sex`, `cars`, `ban`) VALUES ('$name', '$pass', '$mail', '$sex', '$cars', '0')";

$select_users = mysql_query('SELECT * FROM users WHERE mail="'.$mail.'"');

if(mysql_num_rows($select_users)==0)
{
if(mysql_query($insert))
{
echo '
<table class="active1-reg" width="36%" align="center">
<td class="active-reg" rowspan="4" width="5%" align="center">
<img src="images/task_done.gif" width="33" border="0" height="33">
</td>
<td width="50%" align="center"><span style="font-weight: bold;">Успешно се регистрирахте.</span></td>
</table>';
}
else
{
echo '
<table class="error1-reg" width="40%" align="center">
<td class="error-reg" rowspan="4" width="5%" align="center">
<img src="images/task_error.gif" width="33" border="0" height="33">
</td>
<td width="50%" align="center"><span style="font-weight: bold;">Регистрацията не е успешна.</span></td>
</table>';
}
}
else
{
echo '
<table class="error1-reg" width="46%" align="center">
<td class="error-reg" rowspan="4" width="5%" align="center">
<img src="images/task_error.gif" width="33" border="0" height="33">
</td>
<td width="50%" align="center"><span style="font-weight: bold;">Има потребител с този имейл адрес.</span></td>
</table>';
}
}
}
?>
 
Код:
	 <?php 
if(isset($_POST['submit']) && $_SESSION['name'] == NULL) 
{ 
if($_POST['name'] == NULL || $_POST['pass1'] == NULL || $_POST['pass2'] == NULL || $_POST['mail'] == NULL) 
{ 
echo ' 
<table class="error1-reg" width="40%" align="center"> 
<td class="error-reg" rowspan="4" width="5%" align="center"> 
<img src="images/task_error.gif" width="33" border="0" height="33"> 
</td> 
<td width="50%" align="center"><span style="font-weight: bold;">Този емайл е зает.</span></td> 
</table>'; 
} 

elseif($_POST['pass1'] != $_POST['pass2']) 
{ 
echo ' 
<table class="error1-reg" width="40%" align="center"> 
<td class="error-reg" rowspan="4" width="5%" align="center"> 
<img src="images/task_error.gif" width="33" border="0" height="33"> 
</td> 
<td width="50%" align="center"><span style="font-weight: bold;">Паролите не си съвпадат.</span></td> 
</table>'; 
} 

else 
{ 
$name = htmlspecialchars($_POST['name']); 
$pass = md5($_POST['pass1']); 
$mail = htmlspecialchars($_POST['mail']); 
$sex = htmlspecialchars($_POST['sex']); 
$cars = htmlspecialchars($_POST['cars']); 
if($name=="demo")
{
    echo "Забранено е използването на това име";
}
else
{

$insert = "INSERT INTO `users` (`name` , `pass` , `mail` , `sex`, `cars`, `ban`) VALUES ('$name', '$pass', '$mail', '$sex', '$cars', '0')"; 

$select_users = mysql_query('SELECT * FROM users WHERE mail="'.$mail.'"'); 

if(mysql_num_rows($select_users)==0) 
{ 
if(mysql_query($insert)) 
{ 
echo ' 
<table class="active1-reg" width="36%" align="center"> 
<td class="active-reg" rowspan="4" width="5%" align="center"> 
<img src="images/task_done.gif" width="33" border="0" height="33"> 
</td> 
<td width="50%" align="center"><span style="font-weight: bold;">Успешно се регистрирахте.</span></td> 
</table>'; 
} 
else 
{ 
echo ' 
<table class="error1-reg" width="40%" align="center"> 
<td class="error-reg" rowspan="4" width="5%" align="center"> 
<img src="images/task_error.gif" width="33" border="0" height="33"> 
</td> 
<td width="50%" align="center"><span style="font-weight: bold;">Регистрацията не е успешна.</span></td> 
</table>'; 
} 
} 
else 
{ 
echo ' 
<table class="error1-reg" width="46%" align="center"> 
<td class="error-reg" rowspan="4" width="5%" align="center"> 
<img src="images/task_error.gif" width="33" border="0" height="33"> 
</td> 
<td width="50%" align="center"><span style="font-weight: bold;">Има потребител с този имейл адрес.</span></td> 
</table>'; 
}
}
} 
} 
?>
 
Мерси много и на двамата
чудясе на ко и да дам сега точка но ще я дам на първия помогнал
 

Back
Горе