PHP MySQL lost password code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
evildrome
Forum Newbie
Posts: 3
Joined: Thu Oct 16, 2008 1:08 pm

PHP MySQL lost password code

Post by evildrome »

Hi All,

I've got a small shareware program with a few users and I need to set up a 'Retrieve your registration details' form. I've been told that PHP is the way forward. The idea is a form that the users enter their username or email into and the PHP script mails them their registration details which it gets from a MySQL database.

Not rocket science but I'm not a PHP programmer. I'll manage the SQL by myself.

Can anyone point me to a code snippet that resembles this requirement?

Thanks,

Wilson Logan.
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: PHP MySQL lost password code

Post by aceconcepts »

1. Create a form with the fields you require.
2. Get the input values:

Code: Select all

 
$frmErr=0;
if(isset($_POST['submit']))
{
   //check if value was entered
   if(!empty($_POST['email']))
   {
      $email=$_POST['email'];
      
      //get user's details via query
   }
   else
   {
      $frmErr=1;
   }
 
   //if there are no errors then send details
   if($frmErr==0)
   {
      //send email
   }
}
 
Does this make sense? If so i'll show you how to send the email.
evildrome
Forum Newbie
Posts: 3
Joined: Thu Oct 16, 2008 1:08 pm

Re: PHP MySQL lost password code

Post by evildrome »

OK, thanks. Thats great.

I've got my form up & going with the PHP.

I suppose now I need to know how to connect to the database and send the email. I will be able to write the SQL query.

I have MySQL and Linux.

Cheers,

Wilson.
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: PHP MySQL lost password code

Post by aceconcepts »

Write your query then post it.

We'll then put it all together.
evildrome
Forum Newbie
Posts: 3
Joined: Thu Oct 16, 2008 1:08 pm

Re: PHP MySQL lost password code

Post by evildrome »

Okay doaky.

I'll post again when I've got it ready.

Wilson.
Post Reply