Why can't I retrieve the decrypted password from the database?

Discussion in 'PHP' started by Airwalk Enterprise, Inc, Mar 28, 2011.

  1. #1
    So I've doing this forgot login info field, and no sure how to retrieve the users password and send it it them. I can only ever get it to send a decrypted version and obviously the user needs to get their actual password. Thanks in advanced :)

    <?php

    include($_SERVER["DOCUMENT_ROOT"]."/community/database.php");

    // input data into database

    $name = mysql_real_escape_string($_POST['name']);
    $email = mysql_real_escape_string($_POST['email']);

    $check = mysql_query("SELECT email FROM community WHERE email='$email'");
    $name_exist = mysql_num_rows($check);

    if($name_exist > 0) {

    $query = "SELECT * from community WHERE email='$email'";
    $result = mysql_query($query);
    $row = mysql_fetch_assoc($result);

    $name = $row['name'];
    $password = $row['password'];

    $encryption = "d28bd9bgdcnsozk2"; // salt encryption
    $encryption .= $password;
    $password = $encryption;
    $password = md5($password); // md5 hashing

    $subject = "Login Info For Airwalk Design";
    $message = "Hey bro, here is your login info for airwalk-design.com. Don't forgot it again!

    Name: $name
    Password: $emailpassword

    Regards,


    Danny @ Airwalk

    Airwalk: http://www.airwalk-design.com/
    Facebook: http://www.facebook.com/airwalkdesign/
    Twitter: http://www.twitter.com/airwalk_design
    Myspace: http://www.myspace.com/airwalk-design/
    DeviantArt: http://airwalkdesign.deviantart.com/";

    mail($email, $subject, $message, "From: Airwalk Design <no-reply@airwalk-design.com>\nX-Mailer:pHP/" . phpversion());

    header('Location: http://www.airwalk-design.com/community/login/');

    }

    else {

    include($_SERVER["DOCUMENT_ROOT"]."/community/dontmove-head.php");
    echo "<div class=\"blink\">Sorry man, I didn't recognise that email address - I don't think it's in our database. Please double-check it and try again.</div>";
    include($_SERVER["DOCUMENT_ROOT"]."/community/missing-username.php");
    include($_SERVER["DOCUMENT_ROOT"]."/community/dontmove-foot.php");

    }

    ?>
     
    Airwalk Enterprise, Inc, Mar 28, 2011 IP
  2. Mackos

    Mackos Well-Known Member

    Messages:
    364
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    #2
    Sorry, my friend but you can't decrypt md5 passwords, if the pass is not simple expression it's unbreakable.
     
    Mackos, Mar 28, 2011 IP
  3. Airwalk Enterprise, Inc

    Airwalk Enterprise, Inc Peon

    Messages:
    126
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    So how do other websites produce a forgot password feature?
     
    Airwalk Enterprise, Inc, Mar 28, 2011 IP
  4. WoRLDLiFE

    WoRLDLiFE Peon

    Messages:
    116
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Most the popular website doesn't provide you your old password ... They will rather provide you a link on your registered email to reset a new password and if you found some websites which provides your old password then they might not encrypting your password.
     
    WoRLDLiFE, Mar 29, 2011 IP
  5. Airwalk Enterprise, Inc

    Airwalk Enterprise, Inc Peon

    Messages:
    126
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Ooooh valid point sir!

    I think I'll do this then :D
     
    Airwalk Enterprise, Inc, Mar 29, 2011 IP
  6. theofficialSJ

    theofficialSJ Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Is this issue resolved. Let me know
     
    theofficialSJ, Mar 29, 2011 IP