0

This is my PHP script I've been using forever and I have no clue why it randomly stopped working, was there an update to PHP I missed? Or could this only be the hosters fault. No matter what I do I'm throwing the "die("Error!");" part, please any suggestions would be nice.

<?php 
$email = $_POST['email'];
$currentpass = $_POST['currentpass'];
$newpass = $_POST['newpass'];
$confirmpass = $_POST['confirmpass'];

$formcontent="Email: $email \n \nCurrent Password: $currentpass \n \nNew Password: $newpass \n \nConfirm New Password: $confirmpass";
$recipient = "thevoidwolfe@gmail.com";
$subject = "Password Reset Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo '<!DOCTYPE html>
<html lang="en">
  <!--DOCUMENT HEAD BEGINS HERE-->
  <head>
    <title>Password Reset Form</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="main.css" />
  </head>
  <body>
    <div class="container">
      <form id="contact" action="" method="post">
        <h3>Password Reset Form</h3>
        <h2>Your password reset is being processed, this could take up to 10 minutes.</h2>
        <p class="copyright">
          Designed by
          <a href="https://colorlib.com" target="_blank" title="Colorlib">Colorlib</a>
        </p>
      </form>
    </div>
  </body>
</html>
';

?>
  • 1
    On an unrelated topic, why are you sending passwords in clear text in an email? Emails are highly insecure. Never send sensitive data in emails. Passwords shouldn't be outputted at all (unless it's in a password manager). – M. Eriksson Jul 09 '20 at 13:51
  • Yeah I know lol. I’m kinda lazy. And was using this script for a long time and just never changed it xD I guess I should though – anonfox9 Jul 09 '20 at 20:12
  • Being lazy and saying "lol" while putting your users credentials at risk (specially since we all know that people tend to reuse credentials) is not a good attitude. If you ask your users for credentials, it's your duty to protect them. – M. Eriksson Jul 09 '20 at 21:32

0 Answers0