Reply
Adding Password Reminder page already have code- please help
Old 08-28-2004, 01:19 PM Adding Password Reminder page already have code- please help
Junior Talker

Posts: 3
Trades: 0
I am using a testing script called PHPTEST the website is http://www.resynthesize.com/code/phptest_info.php

the author has the option in the script to send the password to the user but never made a "front end" version. So basically there is no way of using it. I was wondering if anyone could help me design a page for users to retrieve lost passwords. Any help given i could make a small donation via paypal.

Here is the authors code that i needs to put in use on my site. It can be a separate page all together

Code:
 // mails lost password to user
    function mail_password($username, $email)
    {
        global $use_mysql_encryption;
        global $db;
        $result = $db->query("SELECT email FROM users WHERE username = '$username' AND email = '$email'");

        if (!$db->num_rows($result)) {
            $this->error("The username or email address is incorrect.");
            return false;
        } else {
            $password = $this->make_password();
            list($email) = $db->fetch_array($result);
            $subject = "Your lost password.";
            $message = "Your password that you requested had to be reset.  Your new password is:\n" .
                       "$password";
            $header = "From: Password reset <noreply@site.com>\r\n";

            if (!mail($email, $subject, $message, $header)) {
                $this->error("Failed to send email.");
                return false;
            } else {
                $query = "UPDATE users SET password = PASSWORD('$password')";
                $db->query($query);
            }

        }

    }
this code is in a file called cuser.inc.php located in a folder called "include"

any help i would be very grateful

thanks

fozi
fozi is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 08-28-2004, 11:06 PM
ACJavascript's Avatar
Humble Mod

Posts: 548
Location: CT, USA
Trades: 0
Hey Fozi,


lost_password.php:

<?php
include("cuser.inc.php");

if($_POST['pageid']=="1"){

$result=mail_password('$_POST[username]','$_POST[email]');

if(!$result){
echo("We could not locate your account. Please hit back and try again.");
exit;
}else{
echo("Your password has been emailed to you!");
exit;
}
}

?>
<form action="lost_password.php" method="POST">
<input type="hidden" name="pageid" value="1">
Your Username: <input type="text" name="username">
<BR>
Your Email: <input type="text" name="email">
<BR>
<input type="submit" value=" Retrieve ">
</form>


END SCRIPT

thats a really REALLY basic idea of what you can do. If you want it done more professionaly just email me at ACJavascript@aol.com I would be happy to help out more!
__________________
CYTech-services.com - 100 Satisfied Customers - Custom Programming and Web Development
ACJavascript is offline
Reply With Quote
View Public Profile Visit ACJavascript's homepage!
 
Reply     « Reply to Adding Password Reminder page already have code- please help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.08456 seconds with 13 queries