alkanumut Posted August 12, 2016 Share Posted August 12, 2016 Hi, I have forgotpass.php code. But I dont have a forgotpass.html code. I tray somethink but it's not working. I need cust html code, for the this php code. Thank you and regards. <? include("header.php"); $error = $diplay = ""; if(isset($_POST['sendmepass'])) { $mem_email = $affiliater->GetEmailByUsername($_POST['affiliatername']); if ($mem_email != "") { $newpass = generatePassword(); $affiliater->ReminderPassword($_POST['affiliatername'], $newpass); //Send mail $to = $mem_email; $subject = 'Password Reminder'; $body = str_replace("{USERNAME}", $_POST['affiliatername'], FORGOTMAILDETAIL); $body = str_replace("{NEWPASSWORD}", $newpass, $body); $headers = "Content-Type: text/html; charset=iso-8859-1\n"; mail($to, $subject, $body, $headers); $error = "Your password will be e-mailed to you at the e-mail address you registered with the system! Please check it to recovery your password"; $diplay = "style='display: none;'"; }else $error = "User inactive or not exists! Please type exactly affiliatername which you used to registry"; } $template->set_filenames(array("body" => "forgotpass.html")); $template->assign_vars(array( 'ERROR' => $error, 'DIPLAY' => $diplay, 'USERNAME'=> "Username", )); $template->pparse("body"); include("footer.php"); ?> Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted August 12, 2016 Share Posted August 12, 2016 What is your question? What have you tried, and what exactly “isn't working”? If you want us to write the HTML markup for you, this won't happen. We can help you with specific questions, but we don't do your job. Quote Link to comment Share on other sites More sharing options...
alkanumut Posted August 12, 2016 Author Share Posted August 12, 2016 I tray to write html code like this, but it's not working. <form action="forgotpass.php" method="post" > <input size="30" placeholder="email adress" name="rmail" type="email"/> <input type="submit" value="New Password" name="submit" class="button"/> </form> I don't understand where is the problem? in the php or html ? Thank you very much ! Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted August 12, 2016 Share Posted August 12, 2016 The form parameters don't match the target script at all. Your forgotpass.php expects a “sendmepass” parameter and a “affiliatername” parameter. The former is appearently supposed to be the name of the submit button, the latter is for the username. Quote Link to comment Share on other sites More sharing options...
alkanumut Posted August 12, 2016 Author Share Posted August 12, 2016 How I have to write this parameter? Can you write for me? Thank you for all answer.. Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted August 12, 2016 Share Posted August 12, 2016 You have an HTML form with a text field and a submit button, right? For some reason, you've named the text field “rmail” and the button “submit”. Those names are wrong. They have to be “sendmepass” and “affiliatername”. So all you have to do is change the two names in your form. Quote Link to comment Share on other sites More sharing options...
alkanumut Posted August 13, 2016 Author Share Posted August 13, 2016 <input size="30" placeholder="email adress" name="sendmepass" type="email"/> <input type="submit" value="New Password" name="affiliatername" class="button"/> Still doesn´t work :-( Quote Link to comment Share on other sites More sharing options...
ginerjm Posted August 13, 2016 Share Posted August 13, 2016 How about showing the whole form? Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted August 13, 2016 Share Posted August 13, 2016 The form field name= values look backwards to me. Just sayin' . . . Quote Link to comment Share on other sites More sharing options...
ginerjm Posted August 13, 2016 Share Posted August 13, 2016 (edited) I have tried to make sense of your code so far. Please review my embedded comments. if(isset($_POST['sendmepass'])) { //??******************************************* // You checked for "sendmepass" but now you are using "affiliatername" // value which you have NOT checked for yet??? $mem_email = $affiliater->GetEmailByUsername($_POST['affiliatername']); if ($mem_email != "") { $newpass = generatePassword(); $affiliater->ReminderPassword($_POST['affiliatername'], $newpass); //Send mail $to = $mem_email; $subject = 'Password Reminder'; //??******************************************* // You are editing affiliatername here but STILL have not verified that it was provided. $body = str_replace("{USERNAME}", $_POST['affiliatername'], FORGOTMAILDETAIL); $body = str_replace("{NEWPASSWORD}", $newpass, $body); //??******************************************* // I believe you HAVE to provide a From address in the headers $headers = "Content-Type: text/html; charset=iso-8859-1\n"; mail($to, $subject, $body, $headers); $error = "Your password will be e-mailed to you at the e-mail address you registered with the system! Please check it to recovery your password"; $diplay = "style='display: none;'"; } else $error = "User inactive or not exists! Please type exactly affiliatername which you used to registry"; } $template->set_filenames(array("body" => "forgotpass.html")); $template->assign_vars(array ( 'ERROR' => $error, 'DIPLAY' => $diplay, 'USERNAME'=> "Username", ) ); $template->pparse("body"); include("footer.php"); Edited August 13, 2016 by ginerjm Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted August 13, 2016 Share Posted August 13, 2016 (edited) The form field name= values look backwards to me. Just sayin' . . . Yes. The submit button must be "sendmepass", the text field must be "affiliatername" (which is somewhat logical, I think). Edited August 13, 2016 by Jacques1 Quote Link to comment Share on other sites More sharing options...
alkanumut Posted August 26, 2016 Author Share Posted August 26, 2016 <form action="forgotpass.php" method="post"> <input style="opacity:0.9" class="sidelinks5" size="30" maxlength="50" placeholder="email adress" type="email" name="affiliatername"> <input type="submit" value="New Password" name="sendmepass" class="button"> </form> This my HTML code. But, I think so some think wrong whit the php code. But I don't know what's is the problem. I tray 1000 version but it's not work . I hope some body can HELP me... Thank you and regards... Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted August 26, 2016 Share Posted August 26, 2016 Again: What does “not work” mean? Is there a problem on the page itself? Are you simply not getting any e-mail? Has the application ever sent any e-mails? Be specific! We're not sitting in front of your screen, and we cannot read your mind. Your e-mails don't have a From header, the headers should be terminated with \r\n rather than \n, and you should try a plaintext mail before jumping to HTML content. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.