Hey guys
it is very easy and simple indeed.Today I
have decided to share with you some information on how to create a login page
using these two vibrant languages which are
commonly used by web developers and programmer,i.e PHP AND MYSQL.
To Start
creating your login page,you need to have any web development IDE such as
dreamweaver,atom or sublime and a local server
applications such as Xamp for windows,Lamp for linux and Mamp for mac os.
Open
your Dreamweaver and head to File tab ,then click on New file and select the
new document and click on create button
to create a file with a php extension..
Then on
that new file we will start by creating login form with simple text inputs for
email and password. Like here below. The form should have a POST method so that
it may send data to our database in which has
been created in MySQL Also we
need to have a submit button which we will use while posting our data in
database. .You can also format your login form to look more interesting with CSS.
After creating
the two inputs and a button, it is our turn to create another php function
which we will use to verify the data
which we have received from inputs if it matches with our login data in the database.
The
function will run through our database table rows with a if statement while
checking if the data it has received from the text field inputs matches the
data in our tables.If the
data from the text inputs matches the one in our database table,the user is
authenticated to login and access the
index or home page.
If the
data from text inputs doesn’t match the
data in the database tables ,then the user is prompted with a alert message
that the either the password or email is
wrong and is returned to login page to try other login credentials.Below is
a script of the login function.
Finally
we will also need to another php file called
connection which we will use to communicate with the database and local
server.Here is the code of the connection file.
Post a Comment Blogger Facebook