Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] rejestracja
gigzorr
post 6.02.2010, 22:34:51
Post #1





Grupa: Zarejestrowani
Postów: 652
Pomógł: 47
Dołączył: 6.02.2010
Skąd: Radom

Ostrzeżenie: (0%)
-----


  1. <?php
  2. //data
  3. $fullname = strip_tags($_POST['fullname']);
  4. $username = strip_tags($_POST['username']);
  5. $password = strip_tags($_POST['password']);
  6. $repeatpassword = strip_tags($_POST['repeatpassword']);
  7. $date = date("Y-m-d");
  8.  
  9. if ($submit)
  10. {
  11. //check for existance
  12. if ($fullname&&$username&&$password&&$repeatpassword)
  13. {
  14. // encrypt password
  15. $password = md5($password);
  16. $repeatpassword = md5($repeatpassword);
  17.  
  18. if ($password==$repeatpassword)
  19. {
  20. //check char lenght of username and fullname
  21. if (strlen($username)>25||strlen($fullname)>25)
  22. {
  23. echo "username albo fullname jest za dlugie";
  24. }
  25. else
  26. {
  27.  
  28. //check password lenght
  29. if(strlen($password)>25||strlen($password)<6)
  30. {
  31. echo "Haslo musi byc pomiedzy 6 a 25 znakami!";
  32. }
  33. else
  34. {
  35. //register info
  36.  
  37. echo "Success!!";
  38.  
  39.  
  40. }
  41.  
  42.  
  43. }
  44.  
  45.  
  46.  
  47.  
  48. }
  49. else
  50. echo "Twoje haslo sie nie zgadza";
  51.  
  52.  
  53. }
  54. else
  55. echo "<b>Prosze uzupelnic wszystkie pola!";
  56.  
  57.  
  58. }
  59.  
  60.  
  61. ?>
  62.  
  63. <html>
  64. <p>
  65. <form action='register.php'>
  66. <table>
  67. <tr>
  68. <td>
  69. Your full name:
  70. </td>
  71. <td>
  72. <input type='text' name='fullname'>
  73. </td>
  74. </tr>
  75. <td>
  76. <tr>
  77. <td>
  78. Choose a username:
  79. </td>
  80. <td>
  81. <input type='text' name='fullname'>
  82. </td>
  83. </tr>
  84. <td>
  85. Choose a password:
  86. </td>
  87. <td>
  88. <input type='password' name='password'>
  89. </td>
  90. </tr>
  91. <br>
  92. <td>
  93. Repeat your password:
  94. </td>
  95. <td>
  96. <input type='password' name='repeatpassword'>
  97. </td>
  98. </tr>
  99.  
  100.  
  101. </table>
  102. <p>
  103. <input type='submit' name='submit' value="Register">
  104. <a href="index.php">Back</a>
  105. </form>
  106. </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
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 29.06.2025 - 19:50