Pomoc - Szukaj - U¿ytkownicy - Kalendarz
Pe³na wersja: [php] Kod nie dziala
Forum PHP.pl > Forum > Przedszkole
Lethys
Strasznie dziwna sprawa ale ostatnio na serwerze byla awaria i stracilem dane , na szczescie mialem wszystko u siebie na dysku . Kiedy wgralem kod okazuje sie ze nie dziala a to ten sam sad.gif Np. podczas rejestracji nic sie nie dzieje , tutaj wgram przykladowo skrypt rejestracji ...


  1. <form method=post action=register.php?action=register>
  2. <table>
  3. <tr><td>Username:</td><td><input type=text name=user></td></tr>
  4. <tr><td>Email:</td><td><input type=text name=email></td></tr>
  5. <tr><td>Verify Email:</td><td><input type=text name=vemail></td></tr>
  6. <?php
  7. print "<tr><td>Referral ID:</td><td><input type=text name=ref readonly value=$ref> <i>If you don't know what this is, leave it blank.</i></td></tr>";
  8. ?>
  9. <tr><td colspan=2 align=center><input type=submit value=Register></td></tr>
  10. </form>
  11.  
  12. <?php
  13. if ($action == register) {
  14. if (!$user || !$email || !$vemail ) {
  15. print "You must fill out all fields.";
  16. include("foot.php");
  17. }
  18. $dupe1 = mysql_num_rows(mysql_query("select * from players where user='$user'"));
  19. if ($dupe1 > 0) {
  20. print "Someone already has that username.";
  21. include("foot.php");
  22. }
  23. $dupe2 = mysql_num_rows(mysql_query("select * from players where email='$email'"));
  24. if ($dupe2 > 0) {
  25. print "Someone already has that email.";
  26. include("foot.php");
  27. }
  28. if ($email != $email) {
  29. print "The emails do not match.";
  30. include("foot.php");
  31. }
  32. $ref = strip_tags($ref);
  33. $user = strip_tags($user);
  34. $pass = strip_tags($pass);
  35. if ($ref) {
  36. mysql_query("update players set refs=refs+1 where id=$ref");
  37. }
  38. $pass = rand(10000 , 90000);
  39. $message = "welcome to $gamename your pass is $pass login now and change it. have fun p
    laying at $gamename. Webmaster"
    ;
  40. mysql_query("insert into players (user, email, pass) values('$user','$email','$pass')") or die("Could not register.");
  41. mail("$email", "$gamename", $message,
  42.  "From: webmaster@{$_SERVER['SERVER_NAME']}rn"
  43. ."Reply-To: webmaster@{$_SERVER['SERVER_NAME']}rn"
  44. ."X-Mailer: php/" . phpversion()) or die("could not send mail");
  45.  
  46. print "You are now registered to play, $user. Please check your e-mail for your pass and login now.";
  47. print "<br><a herf=index.php>login</a>";
  48. }
  49. ?>


Moze wiecie co moze byc nie tak ?
dtb
moze chodzi o register globals? zamien $user na $_POST['user'] i sprawdz czy dziala
Ociu
  1. <?php
  2. $action = $_GET['action'];
  3. $user = $_POST['user'];
  4. $pass = $_POST['pass'];
  5. $email = $_POST['email'];
  6. ?>

Daj przed tym pierwszym if'em smile.gif
Lethys
Nie bo kilka dni ten kod dzialal wysmienicie , przed resetem serwera . A teraz pozportu nic sie nie dzieje. Podalem rejestracje jako przyklad ale nc nie dziala np. rowniez logowanie O.o

To jest logowanie :

  1. <?php
  2. if (!$email || !$pass) {
  3. print "Musisz wypelnic wszystkie pola.";
  4. }
  5. $logres = mysql_num_rows(mysql_query("select * from players where email='$email' and pass='$pass'"));
  6. if ($logres <= 0) {
  7. print "Logowanie nie udalo sie . Jezeli nie masz jeszcze konta zarejestruj sie . A
     jesli masz sprawdz poprawnosc wpisanych danych."
    ;
  8. } else {
  9. $names = mysql_num_rows(mysql_query("select * from players where user='$name' "));
  10.  
  11. session_register("email");
  12. print "&nbsp;<br><center>Witam , logowanie udalo sie kliknij <a href=wiadomosci.php>tutaj</a> aby przejsc dalej...";
  13.  
  14.  
  15.  
  16. }
  17.  
  18. ?>


kiedy wpisuje poprawne dane pisze zebym wypelnil poprawnie wszytskie pola , wczesniej dzialal ten skrypt ...
dtb
a skad wiesz, ze restartujac serwer nie zrobil modyfikacji ustawien i nie wylaczyl register globals? sprawdz to
To jest wersja lo-fi g³ównej zawarto¶ci. Aby zobaczyæ pe³n± wersjê z wiêksz± zawarto¶ci±, obrazkami i formatowaniem proszê kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.