Registration and authorization form in jquery. Step-by-step registration using jQuery

Good day, friends! Let's look at user registration in PHP. First, let's define the conditions for our user registration:

  • The password is encrypted using the MD5 algorithm
  • We will salt the password
  • Checking if your login is busy
  • User activation by letter.
  • Recording and storing data in the MySQL DBMS

To write this script, we need to understand what user registration is. User registration means obtaining real user data, processing and storing data.

To explain in simple words, registration is just recording and storing certain data by which we can authorize the user in our case - this is Login and Password.

Authorization is the granting of rights to a certain person or group of persons to perform certain actions, as well as the process of verifying these rights when attempting to perform these actions. Simply put, with the help of authorization, we can limit access to certain content on our website.

Let's look at the structure of script directories for implementing our registration with authorization. We need to break the scripts into logical components. We placed the registration and authorization modules in a separate directory. We will also place the connection to the MySQL database, a file with user functions, a CSS style file and our HTML template in separate directories. This structure allows you to quickly navigate through scripts. Imagine that you have a large website with a bunch of modules, etc. and if there is no order, it will be very difficult to find something in such a mess.

Since we will store all the data in the MySQL DBMS, let's create a small table in which we will store registration data.

First you need to create a table in the database. Let's call the table bez_reg where bez is the table prefix, and reg is the name of the table.

Table structure: bez_reg -- -- Table structure `bez_reg` -- CREATE TABLE IF NOT EXISTS `bez_reg` (`id` int(11) NOT NULL AUTO_INCREMENT, `login` varchar(200) NOT NULL, `pass` varchar( 32) NOT NULL, `salt` varchar(32) NOT NULL, `active_hex` varchar(32) NOT NULL, `status` int(1) NOT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; Now let's create the main scripts for further work.

File INDEX.PHP

CONFIG.PHP file