0

this part of code send a email to user if they forgot there password.

first question i have is how can i add string and variables. this give me error
Parse error: syntax error, unexpected ':' in C:\xampp\htdocs\login_test\forgotpassword.php on line 46

$body = "Hi " . $firtname_db . ",\n Your password is" . $password_db:

2nd question can any one make user if iam using mail() function right?

else
                {
                    //success - send email
                    //get user name from table
                    $queryget = mysql_query("SELECT firstname FROM user WHERE username = '$user'") or die("query didnt work");
                    $row = mysql_fetch_assoc($queryget);    
                    $firstname_db = $row['firstname'];

                    //old_passworrddb = get from table
                    $queryget = mysql_query("SELECT password FROM user WHERE username = '$user'") or die("query didnt work");
                    $row = mysql_fetch_assoc($queryget);    
                    $password_db = $row['passwor'];

                    $to = $email;
                    $subject = "Forgot password";
                    $body = "Hi " . $firtname_db . ",\n Your password is" . $password_db:

                    echo $firstname . "/" .$username."/".$email."/";
                    if(mail($to, $subject, $body))
                    {
                    echo "message successfully sent";
                    }
                    else
                    { echo "failed";}
                }
1
Contributor
1
Reply
2
Views
5 Years
Discussion Span
Last Post by hwoarang69
0

so i fixed all the erros but iam getting this error on mail() function.
i also added $headers = "test@hotmail.com";

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\login_test\forgotpassword.php on line 49
failed

i dont now what is smtp or smtp_port or ini_set. iam i dont know how to check it.

Edited by hwoarang69

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.