Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 4 123 ... LastLast
Results 1 to 15 of 57
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Location
    Earth
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Forgot password?

    I need a script that will allow me to make a form that will compare the information on the site, to the information given in a form, then send an email to someone if the data matches.

    If someone could point me into that direction, that way, when someone loses their pwd, they can click "forgot your password?" and get a chance to head that way.
    Life is funny, especially when you're poor.

  • #2
    Registered User
    Join Date
    Jun 2002
    Location
    Arizona
    Posts
    175
    Thanks
    0
    Thanked 0 Times in 0 Posts
    working on it...

  • #3
    Registered User
    Join Date
    Jun 2002
    Location
    Arizona
    Posts
    175
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I hope this works for you.



    <?php
    if($go == "1")
    {
    mysql_connect("host","username","password");
    mysql_select_db(databaseName);

    $sql = @mysql_query("SELECT * FROM table WHERE username='$name' && email='$email' ");
    if(!$sql)
    {
    echo "The user name and email do not match.";
    exit;
    }
    $query = mysql_query($sql);
    $fPass = mysql_fetch_array($query);

    mail($email, "Your Password", "User Name: ". $fPass[username] ."\nPassword: ". $fPass[password]);
    echo "Your Password has been sent to ". $email .".";
    }
    ?>
    <form action="<?= $PHP_SELF ?>" method="post">
    Name: <input type="text" name="name" size="24" border="0"><br>
    E-mail: <input type="text" name="email" size="24" border="0"><br>
    <input type="hidden" name="go" value="1" border="0"><input type="submit" name="submitButtonName" border="0">
    </form>

  • #4
    Regular Coder
    Join Date
    Jul 2002
    Location
    Earth
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank you.

    Oh, forgot to mention, it also uses md5 or whatever, that password thingy that encryps.

    could you compensate for that too?
    Life is funny, especially when you're poor.

  • #5
    Regular Coder
    Join Date
    Jul 2002
    Location
    Earth
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts
    oh k. that doesn't look too good. it keeps telling me that the user name and email doesn't match. but i got them to match now. with an error though

    in my tables, the user name is in table userid, so i changed that 'username' part, to 'userid'.

    how about this also, a script that would use secret questions and secret hints. like they type in their user name and then they are prompted with the question, and if they answer it right, then the password gets sent to them via email.

    either way,

    Warning: Supplied argument is not a valid MySQL result resource on line 54

    that's the new error.

    line 54 would be....

    PHP Code:
    $fPass mysql_fetch_array($query); 
    because i changed username to userid.

    see?
    PHP Code:
    mail($email"Your Password""User Name: "$fPass[userid] ."\nPassword: "$fPass[password]); 
    echo 
    "Your Password has been sent to "$email ."."

    also, when it sends me the 'your password', it's a blank email, and it says it's been sent by 'Apache', and it's giving the email address of my main host.
    Life is funny, especially when you're poor.

  • #6
    Regular Coder
    Join Date
    Jul 2002
    Location
    U.S. (Wish Japan though)
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, to change the from you would put:

    PHP Code:
    mail($email"Your Password""User Name: "$fPass[userid] ."\nPassword: "$fPass[password], "FROM: [email]You@yourserver.com[/email]"); 
    echo 
    "Your Password has been sent to "$email ."."
    Or I think thats the way it works.. I don't remember right off hand....

    Tell me if that works out

  • #7
    Regular Coder
    Join Date
    Jul 2002
    Location
    Earth
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks cloud, that worked.

    now for the fact that it keeps sending me a blank email, and giving me that error.
    Life is funny, especially when you're poor.

  • #8
    Regular Coder
    Join Date
    Jul 2002
    Location
    U.S. (Wish Japan though)
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, uh... for the blank E-mail, try this:
    PHP Code:
     mail("$email","Your Password","User Name: $fPass[userid] \n Pasword: $fPass[password]""From: $from "); 
    I, unfortunatly, do not know enough about MySQL to help with the error...

    Anyways,

    Good luck!

  • #9
    Regular Coder
    Join Date
    Jul 2002
    Location
    Earth
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well it's not a blank email.

    it says

    username:
    password


    and that's ALL. it's like totally blank.

    Life is funny, especially when you're poor.

  • #10
    Regular Coder
    Join Date
    Jul 2002
    Location
    U.S. (Wish Japan though)
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh, well then it is because your not getting the data... that's what the error is doing... Um.. so your old way may have been better?

    *sigh* I wish I knew MySQL...

  • #11
    Regular Coder
    Join Date
    Jul 2002
    Location
    Earth
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts
    no, no, yours works. before i was getting that same email, but it was coming from my host. now i'm getting it from me, yeah, but it's still the same.


    i don't know why it's not communicating with the data.
    Life is funny, especially when you're poor.

  • #12
    Regular Coder
    Join Date
    Jul 2002
    Location
    U.S. (Wish Japan though)
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Before you read on, try this:
    PHP Code:
    mail($email"Your Password""User Name: "$fPass["userid"] ."\nPassword: "$fPass["password"], "FROM: [email]You@yourserver.com[/email]"); 
    echo 
    "Your Password has been sent to "$email ."."
    Now IF THAT DOESN'T WORK, try this:

    Instead of:
    $sql = @mysql_query("SELECT * FROM table WHERE username='$name' && email='$email' ");
    if(!$sql)
    {
    echo "The user name and email do not match.";
    exit;
    }
    $query = mysql_query($sql);
    $fPass = mysql_fetch_array($query);

    Use this:
    PHP Code:
    $sql = @mysql_query("SELECT * FROM table WHERE username='$name' && email='$email' "); 
    if(!
    $sql

    echo 
    "The user name and email do not match."
    exit; 

    $myUser mysql_query(SELECT userid FROM table WHERE userid='$name')
    if(!
    myUser) {
    echo(
    "<P>Error performing query: " .         mysql_error() . "</P>");
    exit(); 
    }
    $myPass mysql_query(SELECT password FROM table WHERE userid='$name')
    if(!
    myPass) {
    echo(
    "<P>Error performing query: " .         mysql_error() . "</P>");
    exit();
    }
    $fpass1 mysql_fetch_array($myUser)
    $fpass2 mysql_fetch_array($myPass
    Now, for the e-mail,

    PHP Code:
    mail($email"Your Password""User Name: "$fPass1 ."\nPassword: "$fPass2,"FROM: [email]You@yourserver.com[/email]"); 
    echo 
    "Your Password has been sent to "$email ."."
    Although, I wouldn't be surprised if it didn't.. uh.. I just read this up on a tutorial....

    I really hope I helped....

  • #13
    Regular Coder
    Join Date
    Jul 2002
    Location
    U.S. (Wish Japan though)
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts
    After posting.. I noticed an error

    For the E-mail part of the message, it was supposed to be:
    PHP Code:
    mail($email"Your Password""User Name: "$fPass1["userid"] ."\nPassword: "$fPass2["password"],"FROM: [email]You@yourserver.com[/email]"); 
    echo 
    "Your Password has been sent to "$email ."."

  • #14
    New Coder
    Join Date
    Jul 2002
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hey, can anyone help me with my script. I'm trying to make a password script. http://www.codingforums.com/showthre...&threadid=2717

  • #15
    Regular Coder
    Join Date
    Jul 2002
    Location
    Earth
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i get errors at this part

    PHP Code:
    $myUser mysql_query(SELECT userid FROM table WHERE userid='$name')
    if(!
    myUser) {
    echo(
    "<P>Error performing query: " .         mysql_error() . "</P>");
    exit(); 
    }
    $myPass mysql_query(SELECT password FROM table WHERE userid='$name')
    if(!
    myPass) {
    echo(
    "<P>Error performing query: " .         mysql_error() . "</P>");
    exit();
    }
    $fpass1 mysql_fetch_array($myUser)
    $fpass2 mysql_fetch_array($myPass
    are you sure this is right?

    shouldn't it be something like ("SELECT*


    or something?
    Life is funny, especially when you're poor.


  •  
    Page 1 of 4 123 ... LastLast

    LinkBacks (?)


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •