Jump to content

Forget Password Script !


Recommended Posts

hello i was using a forget password script which is based on default php mail() function but for some reason the host has disabled this function and im not able to use this script , ( mail not sending )

i messaged the host to renable it and they refused and asked me to use SMTP mail , i succeeded with that on forum ( mybb) but with this script i have no idea how to convert it to SMTP mail so im asking if anyone have any idea how to do it 

 

thats the script im using:

<div class="main main_title">
			>> Reset Pass By Email
		</div><div class="main main_content">
<center>
<?PHP


  if(isset($_POST['sfform']) && $_POST['sfform']=="reset") {
  
    if(!empty($_POST['account']) && !empty($_POST['sicherheitsf']) && !empty($_POST['sicherheitsa'])) {
  
      $acc = mysql_real_escape_string($_POST['account']);
      $frage = mysql_real_escape_string($_POST['sicherheitsf']);
      $antwort = mysql_real_escape_string(md5($_POST['sicherheitsa']));
      
      $sqlCmd = "SELECT id FROM account.account WHERE login='".$acc."' AND question1='".$frage."' AND answer1='".$antwort."' LIMIT 1";
      $sqlQry = mysql_query($sqlCmd,$sqlServ);
      
      if(mysql_num_rows($sqlQry)>0) {
        
        $newPass = substr(md5(rand(999,99999)),0,8);
        $setPass = "UPDATE account.account SET password=PASSWORD('".$newPass."') WHERE login='".$acc."' LIMIT 1";
        $qryPass = mysql_query($setPass);
        
        if($qryPass) {
          echo'<p class="meldung" style="color:Green">Your Password has been successfully reseted.<br/><br/>The New password for the account <b>'.$acc.'</b> is: </p><p style="color : red"><b>'.$newPass.'</b>.</p><p class="meldung" style="color:Green"><br/><br/>Have Fun playing.</p>';
        }
        else {
          echo'<p class="meldung">A new password could not be set.If you see this message, please contact an admin.</p>';
        }
        
      }
      
    }
    else {
      echo'<p class="meldung">No data has been entered.</p>';
    }
    
  }
  
  if(isset($_POST['emailreset']) && $_POST['emailreset']=="reset") {
    
    if(!empty($_POST['account']) && checkMail($_POST['email'])) {
      
      $acc = mysql_real_escape_string($_POST['account']);
      $email = mysql_real_escape_string($_POST['email']);
      $newPass = substr(md5(rand(999,99999)),0,8);
      
      $getUser = "SELECT id FROM account.account WHERE login='".$acc."' AND email='".$email."' LIMIT 1";
      $qryUser = mysql_query($getUser);
      
      if(mysql_num_rows($qryUser)>0) {
      
        $setPass = "UPDATE account.account SET password=PASSWORD('".$newPass."') WHERE login='".$acc."' LIMIT 1";
        $qryPass = mysql_query($setPass);
        
        if($qryPass) {
          echo'<p class="meldung" style="color:Green">Your password has been successfully reset. You will receive an e-mail with your new password.</p>';
          
          $absender = $serverSettings['titel']." Password-service";
          $email = $serverSettings['pass_mail'];
          $empfaenger = $_POST['email'];
          $mail_body = "Hello,
          Your password has been successfully reset.
          
          Account: ".$acc."
          New Password: ".$newPass."
          
          Have fun playing,
          
          Sincerely, ".$serverSettings['titel']."-Team
          
          
          This e-mail was generated automatically. Please do not reply to this address.";
          $titel = "Password of ".$serverSettings['titel'];
          
          $header .= "X-Priority: 3n";
          $header .= "X-Mailer: mtVision Homepage Mailern";
          $header .= "MIME-Version: 1.0n";
          $header .= "From: ".$absender." <".$serverSettings['pass_mail'].">n";
          $header .= "Reply-To: ".$serverSettings['pass_mail']."n";
          //$header .= "Content-Transfer-Encoding: 8bitn"; 
          $header .= "Content-Type: text/plain; charset=iso-8859-1n";
          
          if(!mail($empfaenger, $titel, $mail_body, $header)) {
            echo'<p class="meldung">Fail with this mail server, please contact an admin.</p>';
          }
          
        }
        else {
          echo'<p class="meldung">A new password could not be set.If you see this message, please contact an admin.</p>';
        }
        
      }
      else {
        echo'<p class="meldung">The combination specified does not exist.</p>';
      }
      
    }
    else {
      echo'<p class="meldung">You have not entered all data correctly.</p>';
    }
    
  }

?>

<div>
  <h3>Reset by security question</h3>
  <p>To reset your account, Enter the right answer according to the question you chose when registering.</p>
  <form action="index.php?s=lostpw" method="POST">
    <table>
      <tr>
        <th class="topLine">Account:</th>
        <td class="tdunkel"><input type="text" name="account" size="16" maxlength="16"/></td>
      </tr>
      <tr>
        <th class="topLine">Secret Question:</th>
        <td class="thell">
          <select name="sicherheitsf">
            <?PHP
              foreach($sFrage AS $fragew => $frage) {
                echo'<option value="'.$fragew.'">'.$frage.'</option>';
              }
            ?>
          </select>
        </td>
      </tr>
      <tr>
        <th class="topLine">Answer:</th>
        <td class="tdunkel"><input type="text" name="sicherheitsa" size="16" maxlength="16"/></td>
      </tr>
      <tr>
        <th class="topLine" colspan="2" style="text-align:center;"><input type="submit" name="sfform" value="reset"/></th>
      </tr>
    </table>
  </form>
</div>
<br/><br/>
<div>
  <h3>Reset By Email</h3>
  <p>You need to specify the registered email linked to the account to be able to reset your password.</p>
  <form action="index.php?s=lostpw" method="POST">
    <table>
      <tr>
        <th class="topLine">Account:</th>
        <td class="tdunkel"><input type="text" name="account" size="16" maxlength="16"/></td>
      </tr>
      <tr>
        <th class="topLine">E-Mail:</th>
        <td class="tdunkel"><input type="text" name="email" size="25" maxlength="25"/></td>
      </tr>
      <tr>
        <th colspan="2" class="topLine" style="text-align:center;"><input type="submit" name="emailreset" value="reset"/></th>
      </tr>
    </table>
  </form>
</div>
</center>
</div>
		<div class="main main_bottom">
		</div>

thank you in advance ,

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 0

      Metin2 effect script files (MSE and MSA file) how can convert

    2. 10

      Multi Language System

    3. 0

      We are looking for a C++ and Python programmer

    4. 0

      [Quest Scheduler Request] Is there a way to make a quest run independet of player events? Lets say start quest automatically at server startup?

    5. 111

      Ulthar SF V2 (TMP4 Base)

    6. 0

      Quest function when 102.kill definition whereabouts help

    7. 5

      [M2 FILTER] Customized Client Filter

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.