i need to integrate Login and Register process using Facebook and Twitter.
The result need to be the same than www.pinterest.com. But there are a lot of examples...
I will include my current code, which is able to login / register writing / reading from a table in a MySQL database.
Code es very simple and easy to understand.
I also will include the create script of my table 'users'.
Data access is made with PDO.
Explanation of the code:
- First, you go to [url removed, login to view] page to register a new user. Fill the form and press 'Register'. It inserts a new user row in the table 'users'
- Second, the user login. Fill username / password and press Login. Then, the page stores username and sh1(password) in the cookies and session
- When the user comes back again, the page reads the cookie and try to login automatically.
The goal of the project is to modify the table 'users' with new fields related to facebook / twitter authentication and modify some parts of the code to make all working.
I think that this link is a good starting point:
[url removed, login to view] (slash) blog (slash) login-with-facebook-and-twitter
I want a proffesional work, with reliable code, etc.
Also if you found some security hole, please solve it. I will pay you more money if you found some improvement to make in my code.
Also, if i have to register in facebook, twitter, something like apikey, or register application, you will have to explain me the process.
To make the code running in your computer, you have to change the following:
- root .htaccess file:
php_value include_path ".;C:/Inetpub/htdocs/sopping/2/config"
set the path in your pc of the config folder. This is because in my code i write - include "[url removed, login to view]" - that is located in this directory
- /config/[url removed, login to view]
Define the following global variables:
// Root path of the files
define ('ROOT', $_SERVER['DOCUMENT_ROOT'].'/sopping/2');
// Root url path of the page. For example, in my computer is http://localhost:8080/sopping/2/public.
define ('PUBLIC_URL', '/sopping/2/public');
- /lib/dal/[url removed, login to view]
Set database access parameters:
DEFINE ('DB_USER', 'root');
DEFINE ('DB_PASSWORD', '');
DEFINE ('DB_HOST', 'server_name');
DEFINE ('DB_NAME', 'database_name');