Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php][mysql] Rejestracja mam błąd
jacus24
post
Post #1





Grupa: Zarejestrowani
Postów: 133
Pomógł: 0
Dołączył: 15.12.2007

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


Próbuję zrobić sobie rejestracja ale mam błąd w lini 82 .
  1. <?php
  2. include "conn.inc.php";
  3. ?>
  4.  
  5. <?php
  6. if (isset ($_POST['submit'])) {
  7. if ($_POST['login'] != "" &&
  8. $_POST['haslo'] != "" &&
  9. $_POST['haslo2'] == $_POST['haslo'] &&
  10. $_POST['regulamin'] != "" &&
  11. $_POST['email'] !== "" ) {
  12.  
  13. $query = "SELECT login 
  14. FROM uzytkownicy
  15. WHERE login = '".$_POST['login']."' "; 
  16. $result = mysql_query($query)
  17. or die (mysql_error()); 
  18.  
  19. if (mysql_num_rows($result) != 0 ) 
  20. ?>
  21.  
  22. Nazwa użytkownika <?php echo $_POST['login']; ?> jest już zajęta, proszę wybrać inną!
  23.  
  24. <form action="rejestracja.php" method="post">
  25. Login <input type="text" name="login" size="20" maxlength="40">
  26. Hasło <input type="password" name="haslo" size="20" maxlength="40">
  27. Powtórz hasło <input type="password" name="haslo_2" size="20" maxlength="40" >
  28. Email <input type="text" name="email" size="20" maxlength="40" >
  29. <input type="checkbox" name="regulamin" value="tak" > Akceptuję&nbsp;<a href="regulamin.php">regulamin</a>
  30. <?php $today = date("Y-m-d"); ?>
  31. <input type="submit" name="submit" value="Zarejestruj" >
  32. <input type="reset" value="Wyczyść"></form>
  33.  
  34. <?php
  35. } else {
  36.  
  37. if ($_POST['haslo_2'] != $_POST['haslo']) {
  38. ?>
  39.  
  40. Podane hasła są różne!
  41.  
  42. <?php
  43.  
  44. } else {
  45.  
  46. $query = "INSERT INTO `uzytkownicy` (login, haslo, haslo_2, email, today)
  47. VALUES (
  48. '".$_POST['login']."',
  49. '".$_POST['haslo']."',
  50. '".$_POST['haslo_2']."',
  51. '".$_POST['email']."',
  52. '".date("Y-m-d")."'
  53. );";
  54.  
  55. if (mysql_query($query) == 1) {
  56.  
  57. $_SESSION['user_logged'] = $_POST['login'];
  58. $_SESSION['user_password'] = $_POST['haslo'];
  59. ?>
  60.  
  61. Dziękujemy za zarejestrowanie sie <?php echo $_POST['login']; ?> Kliknij <a href="index.php">tutaj</a> aby przejść do strony głównej.
  62.  
  63. <?php
  64. } else {
  65. ?>
  66.  
  67. Wypełnij wszystkie pola.
  68.  
  69. <form action="rejestracja.php" method="post">
  70. Login <input type="text" name="login" size="20" maxlength="40">
  71. Hasło <input type="password" name="haslo" size="20" maxlength="40">
  72. Powtórz hasło <input type="password" name="haslo_2" size="20" maxlength="40" >
  73. Email <input type="text" name="email" size="20" maxlength="40" >
  74. <input type="checkbox" name="regulamin" value="tak" > Akceptuję&nbsp;<a href="regulamin.php">regulamin</a>
  75. <?php $today = date("Y-m-d"); ?>
  76. <input type="submit" name="submit" value="Zarejestruj" >
  77. <input type="reset" value="Wyczyść"></form>
  78.  
  79. <?php
  80. } else {
  81. ?>
  82.  
  83. Witamy na stronie rejestracji
  84.  
  85. <form action="rejestracja.php" method="post">
  86. Login <input type="text" name="login" size="20" maxlength="40">
  87. Hasło <input type="password" name="haslo" size="20" maxlength="40">
  88. Powtórz hasło <input type="password" name="haslo_2" size="20" maxlength="40" >
  89. Email <input type="text" name="email" size="20" maxlength="40" >
  90. <input type="checkbox" name="regulamin" value="tak" > Akceptuję&nbsp;<a href="regulamin.php">regulamin</a>
  91. <?php $today = date("Y-m-d"); ?>
  92. <input type="submit" name="submit" value="Zarejestruj" >
  93. <input type="reset" value="Wyczyść"></form>
  94.  
  95. <?php
  96. }
  97. ?>
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 Aktualny czas: 21.08.2025 - 13:36