Browse By

Archives

Calendar

How To Create Login With Facebook In PHP

Login with Fb using PHP

Hello, there as we know how popular Facebook is. There are billions and millions of user of fb. Even the users aren’t interested to filing the long registration forms theme self. So, it’s very user friendly to create login with fb in your website or blog. So, with the help of this tutorials you can easily make fb registration and login in you website. This tutorial explains you very deeply to how to implement user registration and login with Facebook using PHP and store the user information’s to the MySQL database. We have used Facebook PHP SDK with Facebook Graph API for build Facebook login system using PHP.

In our step by step tutorial, at first we will describe the folder structure of this project. After that you will learn how can you create the Facebook apps and use this app for Facebook login at your website. And finally we will discuss about the integration process of our scripts. This tutorial helps you to make whole process quicker and easier.

Below demo link will lend you to the live demo of Facebook login with and download link able you to directly download the complete project.

(4)Then after choose a platform and choose Web.After that Tell fb about you website,fill the url of your website.In case you want to test Facebook login at the localhost server[XAMPP/WAMP], then your App Domains should be localhost. Also localhost domain will only work.So your localhost site URL is http://localhost/fb_login/ Then click Continue for every steps.

(5)After that completed ,Go to setting your apps settings page would be displayed like the below screenshot[refer image].

(6)Now,make your app publicly for that.Go to App Review And Switch To Publicly.Contact email is required for enable the apps live option. If you have not add apps contact email earlier, go to the settings page and add email. Once you submit the contact email, you would be able to enable the apps live option.

Very Congratulation! your fb apps creation has completed.

MySQL Database table creation:

For store the user information in MySQL Databse, you need to create a database and a table. At first create a database like “shortcutblog”. After that copy the below SQL query and run the SQL query on the database.

Installation/Implementation Of PHP Files:

In this project you just have to modify only two php files.
⇒Database configuration :- Go To Folder includes/functions.php Edit functions.php file You need only to change the $dbServer, $dbUsername, $dbPassword and $dbName variables value with your MySQL server details.There are Users class with some functions. Into the __construct() function we have configured the database and connect with the database.

⇒Facebook API configuration : Open File Name config.php ,and modify the $appId, $appSecret, $return_url and $homeurl variables values.Note: You can find the App ID and App Secret from your Facebook Apps settings page the app you created for Facebook Login.

Covering Post 🙂

Yuppie,Now your successfully allow to login with Facebook.I hope you learn how to create fb login using php. This tutorial cover all basic step for make this project.If you have any quires free to ask in comment box or if you found this is helpful for other then don’t forgot to share over social world.