How to Create Login Script More Secure in PHP
Today we are going to talk about How to Create Secure Login Script in PHP. Login Script is easy to make but how you will make it more secure in PHP. In this tutorial we need a login script which is written in PHP and a database connection with it. We will encode the username and password to make it more secure.
There are many methods though which you can make it secure but mostly used method is saving your data as MD5 or SHA1.
How to create MD5 and SHA1 in PHP
While saving the values in database use md5() function to around your text. It will encrypt it and save the encrypted value. Which is near to impossible to crack. Ex- If you want to save the value in database than we will save it like this.
Insert into login (Username,Password,Name) values (‘demo’,’demo’,’demo’);
When you run this query you will see that it will save it as demo, demo, demo for all the three values. Now if we use the MD5 than it will change the value in 32 character long value. Lets use md5 in password field
Insert into login (Username,Password,Name) values (‘demo’,md5(‘demo’),’demo’);
Check the values in your database you will find your password value is changed in something 32 long characters.
When you check for your login just use the md5 while selecting the finding the value else it will show the error.
Check Here : – Online MD5 Hash Generator
SHA1 Encryption in PHP
While saving the values in database use SHA1() function to around your text. It will encrypt it and save the encrypted value. Which is near to impossible to crack. Ex- If you want to save the value in database than we will save it like this.
Insert into login (Username,Password,Name) values (‘demo’,’demo’,’demo’);
When you run this query you will see that it will save it as demo, demo, demo for all the three values. Now if we use the SHA1 than it will change the value in 40 character long value. Lets use SHA1 in password field
Insert into login (Username,Password,Name) values (‘demo’,md5(‘demo’),’demo’);
Check the values in your database you will find your password value is changed in something 40 long characters.
When you check for your login just use the SHA1 while selecting the finding the value else it will show the error.
Check Here :- Online SHA1 Hash Generator
Hi vivek,
Can you please help me to integrate tally and with php i am using YII framework.
Sorry bro i havent ever used this YII framework…..