Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][MYSQL]Rejestracja- problem
-Remiii-
post
Post #1





Goście







Witam mam nastepujacy problem w mojej rejestracji na stronce:
1) nie sprawdza mi czy dany uzytkownik juz czasami nie istnieje w bazie
2) nei sprawdza podanych haseł czy są takie same

i nie wiem jak rozwiazac ten problem, jak narazie mam nastepujący KOD:
  1. <?php
  2. pol_mysql();
  3.  
  4. if (   isset($_POST['login']) && isset($_POST['haslo']) && isset($_POST['haslo2']) && isset($_POST['gg']) ){  
  5. $login = $_POST['login'];
  6. $gg = $_POST['gg'];
  7. $haslo = $_POST['haslo'];
  8. $haslo2 = $_POST['haslo2'];
  9.  
  10.  
  11. $usersadd = "insert into users values ('', '0', '$login', $gg, '$haslo', '$haslo2')";
  12. mysql_query($usersadd);
  13.  
  14.  
  15.  
  16. echo '<font color="white"><b>Rejestracja przebiegła pomyślnie!<br>Teraz możesz się zalogować!</b><br><a href="index.php"><font color="white">Wróć do strony głownej!</font></a></font>';
  17. } else {  
  18. <form action="rejestracja.php" method="POST" ><center>    
  19. <center>
  20. <b> Nowy uzytkownik:</b><br>
  21.  Login   :   <input type="text" name="login" class="textbox" value="" maxlength="20"><br>
  22.  GG  :       <input type="text" name="gg" class="textbox"><br>
  23.  Hasło  :    <input type="password" name="haslo" class="textbox"><br>
  24.  Powtórz hasło  :   <input type="password" name="haslo2" class="textbox"><br>
  25. <input type="submit" value="Zarejestruj">    
  26. </form>';
  27. echo '<br><a href="index.php"><font color="white"><b>Wróć do strony głownej!</b></font></a>';
  28. }
  29. ?>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
-Remiii-
post
Post #2





Goście







nie wiem daleczego ale w else mam jakis teraz błąd:

Parse error: syntax error, unexpected T_ELSE in /home/remiii/rejestracja.php on line 63
(czerwony kolor 63 linijka)
KOD
  1. <?php
  2. require_once "funkcje.php";
  3. pol_mysql();
  4.  
  5. if (   isset($_POST['login']) && isset($_POST['haslo']) && isset($_POST['haslo2']) && isset($_POST['gg']) )
  6. {  
  7. $login = $_POST['login'];
  8. $gg = $_POST['gg'];
  9. $haslo = $_POST['haslo'];
  10. $haslo2 = $_POST['haslo2'];
  11.  
  12.  
  13.  
  14. $licz = mysql_num_rows(mysql_query("SELECT `login` FROM users WHERE login='$login'"));
  15.  
  16. if($licz > 0 OR $haslo != haslo2){
  17.  
  18. if($licz > 0){
  19. echo 'Taki uzytkownik juz istnieje';
  20. }
  21.  
  22. if($haslo != haslo2){
  23. echo 'Hasła nie zgadzają się';
  24. }
  25.  
  26. [color="#FF0000"][b]} else {[/b][/color]
  27.  
  28. $usersadd = "insert into users values ('', '0', '$login', $gg, '$haslo', '$haslo2')";
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40. echo '<font color="white"><b>Rejestracja przebiegła pomyślnie!<br>Teraz możesz się zalogować!</b><br><a href="index.php"><font color="white">Wróć do strony głownej!</font></a></font>';
  41. } else {  
  42. echo '<font color="white">    
  43. <form action="rejestracja.php" method="POST" ><center>    
  44. <center>
  45. <b> Nowy Gracz:</b><br>
  46.  Login   :   <input type="text" name="login" class="textbox" value="" maxlength="20"><br>
  47.  GG  :       <input type="text" name="gg" class="textbox"><br>
  48.  Hasło  :    <input type="password" name="haslo" class="textbox"><br>
  49.  Powtórz hasło  :   <input type="password" name="haslo2" class="textbox"><br>
  50.  
  51.  
  52.  
  53. <input type="submit" value="Zarejestruj">    
  54. </form></font>';
  55. echo '<br><a href="index.php"><font color="white"><b>Wróć do strony głownej!</b></font></a>';
  56. }
  57. ?>
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 27.12.2025 - 17:16