Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Odzyskiwanie hasła. Skrypt nie działa.
szczalpi
post
Post #1





Grupa: Zarejestrowani
Postów: 336
Pomógł: 0
Dołączył: 25.10.2006

Ostrzeżenie: (10%)
X----



Witam
Poniżej mam skrypt, który powinien pobierać hasło z bazy danych i wysyłać na e-mail. NIestety nie działa. Nie wiem gdzie jest błąd.
Proszę was o pomoc co jest nie tak z tym skryptem.


  1. <form method="post" action="przy.php">
  2.  
  3. <input name="mail" type="text" id="mail" size="25">
  4.  
  5. <input type="submit" name="Submit" value="Wyślij">




  1.  
  2. $mail=$_POST['mail'];
  3.  
  4.  
  5.  
  6. $query=("SELECT password FROM users WHERE mail_kontakt ='$mail'");
  7.  
  8. $result=mysql_query($query);
  9.  
  10.  
  11.  
  12. $count=mysql_num_rows($result);
  13.  
  14.  
  15.  
  16.  
  17. if($count==1){
  18.  
  19.  
  20.  
  21. $rows=mysql_fetch_array($result);
  22.  
  23. $your_password=$rows['password'];
  24.  
  25. $to=$mail;
  26.  
  27.  
  28.  
  29.  
  30.  
  31. $subject="temat e-maila";
  32.  
  33.  
  34.  
  35.  
  36.  
  37. $header="from: administrator<mój adres@moje.pl>";
  38.  
  39.  
  40.  
  41.  
  42.  
  43. $messages.= "Twoje hasło do Bazy \r\n";
  44.  
  45. $messages.= "Twoje hasło do bazy to $your_password \r\n";
  46.  
  47.  
  48.  
  49.  
  50.  
  51. $sentmail = mail($to,$subject,$messages,$header);
  52.  
  53. }else{
  54.  
  55. echo "Nie znaleziono takiego adresu e-mail w naszej bazie";
  56.  
  57. }
  58.  
  59.  
  60.  
  61.  
  62.  
  63. if($sentmail){
  64.  
  65. echo "Twoje hasło zostało wysłane na twój adres e-mail.";
  66.  
  67. }else{
  68.  
  69. echo "Nie mogliśmy wysłać hasła na Twój adres. Spróbuj jeszcze raz";
  70.  
  71. }
  72.  


--------------------
Nieregulaminowa stopka usunieta
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 18)
Kshyhoo
post
Post #2





Grupa: Opiekunowie
Postów: 3 855
Pomógł: 317
Dołączył: 4.01.2005
Skąd: że




Genialne, wysłać mailem hasło wink.gif
Włącz pełne raportowanie błędów... i wtedy wróć.


--------------------
Go to the top of the page
+Quote Post
szczalpi
post
Post #3





Grupa: Zarejestrowani
Postów: 336
Pomógł: 0
Dołączył: 25.10.2006

Ostrzeżenie: (10%)
X----


właśnie w tym problem. Kiedy wstawiam error_reporting(E_ALL); nie pokazuje żadnego błędu.


--------------------
Nieregulaminowa stopka usunieta
Go to the top of the page
+Quote Post
Kshyhoo
post
Post #4





Grupa: Opiekunowie
Postów: 3 855
Pomógł: 317
Dołączył: 4.01.2005
Skąd: że




  1. ini_set( 'display_errors', 'on' );
  2. error_reporting( E_ALL );


--------------------
Go to the top of the page
+Quote Post
szczalpi
post
Post #5





Grupa: Zarejestrowani
Postów: 336
Pomógł: 0
Dołączył: 25.10.2006

Ostrzeżenie: (10%)
X----


I się pojawia:
  1. Warning: require(db.php): failed to open stream: No such file or directory in /przy.php on line 4
  2.  
  3. Fatal error: require(): Failed opening required 'db.php' (include_path='.:/usr/share/php:/usr/share/pear') in /przy.php on line 4


--------------------
Nieregulaminowa stopka usunieta
Go to the top of the page
+Quote Post
Kshyhoo
post
Post #6





Grupa: Opiekunowie
Postów: 3 855
Pomógł: 317
Dołączył: 4.01.2005
Skąd: że




No to już wiesz?


--------------------
Go to the top of the page
+Quote Post
szczalpi
post
Post #7





Grupa: Zarejestrowani
Postów: 336
Pomógł: 0
Dołączył: 25.10.2006

Ostrzeżenie: (10%)
X----


Łączenie z bazą mam wpisanie w pliku przy.php. Tutaj akurat pokazuje błąd w db.php, gdzie takiego pliku wogóle nie używam....


--------------------
Nieregulaminowa stopka usunieta
Go to the top of the page
+Quote Post
Kshyhoo
post
Post #8





Grupa: Opiekunowie
Postów: 3 855
Pomógł: 317
Dołączył: 4.01.2005
Skąd: że




Fatal error: require(): Failed opening required 'db.php' (include_path='.:/usr/share/php:/usr/share/pear') in /przy.php on line 4


--------------------
Go to the top of the page
+Quote Post
szczalpi
post
Post #9





Grupa: Zarejestrowani
Postów: 336
Pomógł: 0
Dołączył: 25.10.2006

Ostrzeżenie: (10%)
X----


A jak to przetłumaczyć smile.gif Możesz pomóc Kshyhoo questionmark.gif

Z tego co wyczytałem musiałbym zainstalować "pear install DB". Mam pytanie. Czy jest możliwość zmiany w jakiś sposób skryptu, aby działał questionmark.gif


--------------------
Nieregulaminowa stopka usunieta
Go to the top of the page
+Quote Post
Kshyhoo
post
Post #10





Grupa: Opiekunowie
Postów: 3 855
Pomógł: 317
Dołączył: 4.01.2005
Skąd: że




Nie wiemy, co masz w pliku przy.php on line 4...
Nie znamy zawartości pliku db.php.


--------------------
Go to the top of the page
+Quote Post
szczalpi
post
Post #11





Grupa: Zarejestrowani
Postów: 336
Pomógł: 0
Dołączył: 25.10.2006

Ostrzeżenie: (10%)
X----


Stworzyłem plik db.php i coś poszło. POjawił się błąd o takiej nazwie :
  1. "Notice: Undefined variable: messages in /przy.php on line 48
  2. Twoje hasło zostało wysłane na twój adres e-mail."


--------------------
Nieregulaminowa stopka usunieta
Go to the top of the page
+Quote Post
Kshyhoo
post
Post #12





Grupa: Opiekunowie
Postów: 3 855
Pomógł: 317
Dołączył: 4.01.2005
Skąd: że




Notice to nie błąd, to informacja - w Twoim przypadku oznacza, że zmienna messages nie istnieje.


--------------------
Go to the top of the page
+Quote Post
szczalpi
post
Post #13





Grupa: Zarejestrowani
Postów: 336
Pomógł: 0
Dołączył: 25.10.2006

Ostrzeżenie: (10%)
X----


I też email nie dochodzi na skrzynkę ...


--------------------
Nieregulaminowa stopka usunieta
Go to the top of the page
+Quote Post
Kshyhoo
post
Post #14





Grupa: Opiekunowie
Postów: 3 855
Pomógł: 317
Dołączył: 4.01.2005
Skąd: że




Z localhost to trudne...


--------------------
Go to the top of the page
+Quote Post
szczalpi
post
Post #15





Grupa: Zarejestrowani
Postów: 336
Pomógł: 0
Dołączył: 25.10.2006

Ostrzeżenie: (10%)
X----


Ale z tego co widzę wszystkie zmienne mam zdefiniowane ...


--------------------
Nieregulaminowa stopka usunieta
Go to the top of the page
+Quote Post
Kshyhoo
post
Post #16





Grupa: Opiekunowie
Postów: 3 855
Pomógł: 317
Dołączył: 4.01.2005
Skąd: że




Przed wysłaniem formularza też?


--------------------
Go to the top of the page
+Quote Post
ikssde
post
Post #17





Grupa: Zarejestrowani
Postów: 217
Pomógł: 40
Dołączył: 20.08.2008

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


Zanim zaczniesz używać $messages .= ... musisz najpierw zdefiniować zmienna, np. $messages = "". Natomiast z localhosts nie będziesz mógł wysyłać maili o ile nie skonfigurujesz sobie serwera poczty albo nie użyjesz zewnętrznego.
Go to the top of the page
+Quote Post
szczalpi
post
Post #18





Grupa: Zarejestrowani
Postów: 336
Pomógł: 0
Dołączył: 25.10.2006

Ostrzeżenie: (10%)
X----


Wyrzuciłem $messages to e-mail dochodzi, ale bez pobranego hasła.


--------------------
Nieregulaminowa stopka usunieta
Go to the top of the page
+Quote Post
robertpiaty
post
Post #19





Grupa: Zarejestrowani
Postów: 113
Pomógł: 18
Dołączył: 7.10.2007
Skąd: Pruszków

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


W pliku PHP po $rows=mysql_fetch_array($result); wstaw var_dump($rows); Myślę że tu jest problem smile.gif


--------------------
Go to the top of the page
+Quote Post

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: 19.08.2025 - 21:56