Web Hosting Talk







View Full Version : Forgot password?


vito
03-01-2002, 09:53 PM
I want to have a section in my site where if the visitor has forgotten his username or password for the Help Desk, he can enter his email address and the username/password is automatically sent to him.

Does anyone know of a script that will do this?

DWood
03-01-2002, 10:21 PM
Here is what you do if you have php:

(form to enter e-mail or username with var user being the field'; use post not get)

<?php

mysql_connect("host", "user", "pass")
or die ("Unable to connect to database.");
$sql = "SELECT emailaddy
FROM users
WHERE user='$USER'

$email = mysql_query($sql);

$sql = "SELECT password
FROM users
WHERE user='$USER'

$password = mysql_query($sql);

mail ( "$email", "Password Notification",
"Your username is $USER and your password is $password");
$url="(redirect page here)";
header("Location: $url");
die;
?>

I am not sure if this is gonna work, you may need to tweak it as I just came up with it and didn't check it.

vito
03-01-2002, 10:37 PM
Wow, Dwood, you just came up with that ?? I've really gotta learn PHP. It would be so cool to just be able to put a script together just like that.

I'm not sure if I can integrate that into my site. I use perldesk, and I'm not really sure how to get your script to work with perldesk. I'll have to look at it and see what I can figure out.

Thanks for the effort! :)