Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php/mysql]problem z przegladarkami
pavell
post
Post #1





Grupa: Zarejestrowani
Postów: 44
Pomógł: 0
Dołączył: 21.01.2006

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


witam!
mam nastepujacy plik o nazwie index.html
  1. register
  2. <form action="register.php" method="post">
  3. <input type="text" name="nick"> ..:: nick ::..<br>
  4. <input type="password" name="password"> ..:: password ::..<br>
  5. <input type="password" name="repeat_password"> ..:: repeat password ::..<br>
  6. <input type="submit" value="send">
  7. <input type="reset" value="clear">
  8. </form>
  9.  
  10. login
  11. <form action="login.php" method="post">
  12. <input type="text" name="nick"> ..:: nick ::..<br>
  13. <input type="password" name="password"> ..:: password ::..<br>
  14. <input type="submit" value="send">
  15. <input type="reset" value="clear">
  16. </form>
  17.  
  18. <a href="connect.php">check connection</a><br>
  19. <a href="log_test.php">login test</a>


kolejny plik nosi nazwe register.php
  1. <?
  2.  
  3. $nick = $_POST['nick'];
  4. $password = $_POST['password'];
  5.  
  6. if (($_POST['nick'] != "") && ($_POST['password'] != "") && ($_POST['repeat_password'] != "") && ($_POST['password'] == $_POST['repeat_password']))
  7. {
  8.  $connect = mysql_connect ("localhost") or die ("Unable to connect the database.");
  9.  $select_db = mysql_select_db ("users");
  10.  $get_data = mysql_query ("SELECT nick FROM user WHERE nick='$nick' AND password = '$password'");
  11.  $num_rows = mysql_num_rows ($get_data);
  12.  
  13.  if ($num_rows == 0)
  14.  {
  15. $insert_data = mysql_query ("INSERT INTO user VALUES ('', '$nick', '$password', '0')");
  16. echo ("Registration successful! Now you can log in..");
  17.  }
  18.  else
  19.  {
  20. echo ("Selected nick exists in the database! Try to use another one..");
  21.  }
  22.  
  23.  mysql_close ($connect);
  24. }
  25. else
  26. {
  27.  echo ("Missed or invalid data!");
  28. }
  29.  
  30. ?>


pod IE wszystko smiga a pod Mozilla wywala blad:

Notice: Undefined index: nick in C:\www\register.php on line 3

Notice: Undefined index: password in C:\www\register.php on line 4

Notice: Undefined index: nick in C:\www\register.php on line 6
Missed or invalid data!
back
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 - 09:36