..


Sponsored Links

A system of registration confirmation and password reminder

Article written by Claudio Garau
Page 1 of 4

1. Database and configuration files

Many sites, for example, through the link directory, chat or discussion forums, in order to use certain services that users need to enroll using your email and possibly also choosing a user ID and password for 'authentication.

The passsword is easily forgotten, so it's good to also provide visitors the opportunity to recover their password and receive it in the mailbox reported in enrollment.

In this short article will show some of the steps common for this type of service:

  1. Registration
  2. The confirmation of the
  3. The module "password reminder"
In practice the user will have a registration form at the website, to register must provide a user ID (in our case the e-mail address) and password, the data used will be sent to the email address indicated and must be entered in a form of confirmation with the task to activate your account.
In case you have forgotten your password, you will have a form in which to enter your address to receive mail elettornica.

The database that utilizzaremo, we might call "members" will have a very simple structure and contains a single table that will be associated with 4 fields:

  1. Id: unique identifier, and autoincermentale whole number for each record;
  2. email: text field for email / userID;
  3. Password: text field for passwords;
  4. active ENUM field that includes only two possible values: 0 (user is not active), 1 (active user).
Below we report the simple statement SQL for the creation of the table "subscriptions":
 



 CREATE TABLE `subscriptions` (



  



 `Id` int (5) NOT NULL auto_increment,



  



 `Email` varchar (50) NOT NULL default'',



  



 `Password` varchar (10) NOT NULL default'',



  



 `Active` enum ('0 ', '1') NOT NULL default '0 ',



  



 PRIMARY KEY (`id`)







 );

 
At this point, our application can be structured in this way:
  1. config.php: will contain the class of connection to the DBMS and database selection with its parameters;
  2. form_iscrizione.php: the file that contains the form for registration, the code for the insermento data in the table and what to send email requesting confirmation;
  3. conferma.php: will contain the confirmation of enrollment form and the code needed to activate the account;
  4. iscritti.php: only page in which users can access once you have activated your account through the form;
  5. ricorda_password.php: will contain the application form for forgotten passwords.
The first code will show that for the configuration file:
 



 <Php







 / / Class connection to the DBMS and database selection







 MySQL class







 {

 

  



 MySQL function ()

 

  



 {

 

    



 / / Connection parameters



    



 $ This-> host_name = "localhost";



    



 $ This-> user_name = "username";



    



 $ This-> password = "password";



    



 $ This-> data_name = "members";



    



 $ This-> link = @ mysql_connect ($ this-> host_name, $ this-> user_name, $ this-> password) or die (mysql_error ());



    



 @ Mysql_select_db ($ this-> data_name) or die (mysql_error ());

 

  



 }

 





 }

 





 / / Instance of the class







 $ Date = new MySQL ();









 / / Mail administrator







 $ Admin_email = "info@miosito.it";







 ?>

 
It contains a class that deals with the connection to the MySQL database and selection, on the same page that contains the code necessary to the instance of the class as well as the email address that will be the sender of all email messages sent by the system.

In the same category ...
E-Learning
Linux (Course) Linux (Course)
Complete guide to open-source system. Starting from 49 €.
MySQL (Course) MySQL (Course)
Management of open-source database. Starting from 39 €.
PHP (Course) PHP (Course)
Full course for creating dynamic Web sites. Starting from 49 €.
Sponsored Links