<?php
//data
$repeatpassword = strip_tags($_POST['repeatpassword']);
if ($submit)
{
//check for existance
if ($fullname&&$username&&$password&&$repeatpassword)
{
// encrypt password
$password = md5($password); $repeatpassword = md5($repeatpassword);
if ($password==$repeatpassword)
{
//check char lenght of username and fullname
if (strlen($username)>25||strlen
($fullname)>25
) {
echo "username albo fullname jest za dlugie"; }
else
{
//check password lenght
if(strlen($password)>25||strlen
($password)<6
) {
echo "Haslo musi byc pomiedzy 6 a 25 znakami!"; }
else
{
//register info
}
}
}
else
echo "Twoje haslo sie nie zgadza";
}
else
echo "<b>Prosze uzupelnic wszystkie pola!";
}
?>
<html>
<p>
<form action='register.php'>
<table>
<tr>
<td>
Your full name:
</td>
<td>
<input type='text' name='fullname'>
</td>
</tr>
<td>
<tr>
<td>
Choose a username:
</td>
<td>
<input type='text' name='fullname'>
</td>
</tr>
<td>
Choose a password:
</td>
<td>
<input type='password' name='password'>
</td>
</tr>
<br>
<td>
Repeat your password:
</td>
<td>
<input type='password' name='repeatpassword'>
</td>
</tr>
</table>
<p>
<input type='submit' name='submit' value="Register">
<a href="index.php">Back</a>
</form>
</html>
Błąd jest w tym, że jak wpisze wszystkie dane(lub byle co) poprawnie to dalej pokazuje, że "Prosze uzupelnić wszystkie pola" , i tak w kółko .Dodam , że kod jest nie skończony , ale np jak nic nie wpisze albo za dlugie username itp. to powinno błąd pokazywać.
Ten post edytował gigzorr 6.02.2010, 22:36:46