Facebook and Twitter have become large in the social network world and both networks offering oAuth support. We developed a system to login with Twitter and Facebook. Nowadays web users not interested to filling the big registration forms. This script helps you to avoid registration forms, It’s is very useful and simple to integrate.
Download Script New Live Demo
Developer
Database
Sample database users table columns id, email, oauth_uid, oauth_provider and username.
CREATE TABLE users
(
id INT PRIMARY KEY AUTO_INCREMENT,
email VARCHAR(70),
oauth_uid VARCHAR(200),
oauth_provider VARCHAR(200),
username VARCHAR(100),
twitter_oauth_token VARCHAR(200),
twitter_oauth_token_secret VARCHAR(200)
);
(
id INT PRIMARY KEY AUTO_INCREMENT,
email VARCHAR(70),
oauth_uid VARCHAR(200),
oauth_provider VARCHAR(200),
username VARCHAR(100),
twitter_oauth_token VARCHAR(200),
twitter_oauth_token_secret VARCHAR(200)
);
The tutorial contains three folders called facebook,twitter and config with PHP files.
facebook //Facebook OAUTH library
twitter //Twitter OAUTH library
config
-- functions.php
-- dbconfig.php //Database connection
-- fbconfig.php //Facebook API connection
-- twconfig.php //Twitter API connection
index.php
home.php
login-twitter.php
login-facebook.php
getTwitterData.php
twitter //Twitter OAUTH library
config
-- functions.php
-- dbconfig.php //Database connection
-- fbconfig.php //Facebook API connection
-- twconfig.php //Twitter API connection
index.php
home.php
login-twitter.php
login-facebook.php
getTwitterData.php
Facebook Setup
You have to create a application. Facebook will provide you app id and app secret id, just modify following code fgconfig.php
<?php
define('APP_ID', 'Facebook APP ID');
define('APP_SECRET', 'Facebook Secret ID');
?>
define('APP_ID', 'Facebook APP ID');
define('APP_SECRET', 'Facebook Secret ID');
?>
Twitter Setup
Create a twitter application click here. Some like Facebook Twitter provide you consumer key amd consumer secret key using these modify following code.twconfig.php
<?php
define('YOUR_CONSUMER_KEY', 'Twitter Key');
define('YOUR_CONSUMER_SECRET', 'Twitter Secret Key');
?>
define('YOUR_CONSUMER_KEY', 'Twitter Key');
define('YOUR_CONSUMER_SECRET', 'Twitter Secret Key');
?>
dbconfig.php
Database configuration file.
<?php
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'username');
define('DB_PASSWORD', 'password');
define('DB_DATABASE', 'database');
$db = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);
?>
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'username');
define('DB_PASSWORD', 'password');
define('DB_DATABASE', 'database');
$db = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);
?>
login-twitter.php
In root directory find out the below line at login-twitter.php code and replace yourwebsite.
$request_token = $twitteroauth->getRequestToken('http://yourwebsite.com/getTwitterData.php');
index.php
If you want to modify your web project existing login or index pages, just use following code.
<?php
session_start();
if (isset($_SESSION['id'])) {
// Redirection to login page twitter or facebook
header("location: home.php");
}
if (array_key_exists("login", $_GET))
{
$oauth_provider = $_GET['oauth_provider'];
if ($oauth_provider == 'twitter')
{
header("Location: login-twitter.php");
}
else if ($oauth_provider == 'facebook')
{
header("Location: login-facebook.php");
}
}
?>
//HTML Code
<a href="?login&oauth_provider=twitter">Twitter_Login</a>
<a href="?login&oauth_provider=facebook">Facebook_Login</a>
session_start();
if (isset($_SESSION['id'])) {
// Redirection to login page twitter or facebook
header("location: home.php");
}
if (array_key_exists("login", $_GET))
{
$oauth_provider = $_GET['oauth_provider'];
if ($oauth_provider == 'twitter')
{
header("Location: login-twitter.php");
}
else if ($oauth_provider == 'facebook')
{
header("Location: login-facebook.php");
}
}
?>
//HTML Code
<a href="?login&oauth_provider=twitter">Twitter_Login</a>
<a href="?login&oauth_provider=facebook">Facebook_Login</a>
If any queries please comment here.
Thanks,
Srinivas Tamada
awesome!
ReplyDeleteNice man ..
ReplyDeleteWow... nice and easy
ReplyDeleteamazing!!!
ReplyDeleteGOOD :D
ReplyDeleteperfect....\m/
ReplyDeleteCool,........keep inspiring, Bro....!! Thanks
ReplyDeleteSuperb ravi... its really cool.. keep it up..
ReplyDeletethis is great simple, can you add google ?
ReplyDeleteNice tut! i was lookin for one alike a long time now. but i'm confronting some problems installing it if anyone can help me: when i go on the page index.php and click on facebook login i got an erro type:Parse error: syntax error, unexpected '{' in /homez.167/wacomori/www/Login_Twitbook/login-facebook.php on line 17
ReplyDeleteThx a lot
We have been working with Google Oauth. Second version Google + Yahoo + Facebook + Twitter
ReplyDeletei'm having problems ... when logging in i'm redirected back but only query result from oauth provider is shown as an array ... can you take a look ?
ReplyDelete"We have been working with Google Oauth. Second version Google + Yahoo + Facebook + Twitter"
ReplyDeleteThat will be great as well, thanks!
I impressive very much you are right thing in this post any face book or twitter attachment in the Google. Thanks sharing this important information.
ReplyDeleteepic nice.. awosome :D
ReplyDeletenice work!
ReplyDeletebut facebook login seems to be tricky..
can´t get it working, there´s always the "There was an error." message...
hope someone can help!
Subscriber emails updates
ReplyDeletenice work.............
ReplyDeletestill need better
Really awesome , thanks you
ReplyDeletewow...great .thanks bro
ReplyDeletehi ! it seems that my php version 4 doznt support the use of try and catch and gimme somme error on page login-facebook.php. can someone give some information on it !!!
ReplyDeleteGud Greetings
ReplyDeleteWhen ever I am trying to use oath account whether it is of yahoo, gmail or facebook
below error came out.
Can any one help me.
Fatal error: Uncaught exception 'Exception' with message 'Facebook needs the CURL PHP extension.' in C:\wamp\www\facebooklog\facebook\facebook.php on line 4
( ! ) Exception: Facebook needs the CURL PHP extension. in C:\wamp\www\facebooklog\facebook\facebook.php on line 4
Facebook Login Error:
ReplyDelete------------
Invalid Argument
Given URL is not allowed by the Application configuration.
------------
?!?!?!?!?!?
This comment has been removed by the author.
ReplyDeletetink's brained :)
ReplyDeleteHey I'm going crazy here, Im getting this error every time after I click "Allow" -> Warning: Cannot modify header information - headers already sent by (output started at /.../getTwitterData.php:18) in /.../getTwitterData.php on line 35. Help!
ReplyDeleteDats great i've put the alternative connexion with twitter on my website here is the adress:http://wacomori.com . Thanks a lot Srinivas for this tutos.
ReplyDeleteAnonymous said...
ReplyDeleteHey I'm going crazy here, Im getting this error every time after I click "Allow" -> Warning: Cannot modify header information - headers already sent by (output started at /.../getTwitterData.php:18) in /.../getTwitterData.php on line 35. Help!
-> delete all empty lines in files BEFORE SENDING ANYTHING TO WEB SERVER !!!
thanks for sharing the code
ReplyDeleteSweet dude. I've been looking everywhere for something simple and clean like this.
ReplyDeletei was using the FB button code to make my call to facebook - not this style - how can i call the session/login with the same parameters as my generated button?
ReplyDeleteExcellent post, I would like to download the updated version of the demo, where after login follow the record of the email.
ReplyDeleteThanks!
Can you provide code for login through Linkedin
ReplyDeleteThe script worls perfectly.
ReplyDeleteTo store oauth_uid of the user, oauth_uid int(11) no longer works...that should be changed to higher varchar ...
please help me...... covert this codes to ASPx...
ReplyDeleteRegards
Sanoj
Great Job! Srinivas Tamada I´m really interesting in version 2. Google + Yahoo + Facebook + Twitter... login. When do you think it will available? Thanks in advance
ReplyDeleteGreat! I am waiting for new version(Google + Yahoo + Facebook + Twitter).
ReplyDeletethanks for the code.
Facebook page: facebook.php linha 108 add:
ReplyDelete---------------------------------|
CURLOPT_SSL_VERIFYPEER => false, |
CURLOPT_SSL_VERIFYHOST => 2, |
---------------------------------|
public static $CURL_OPTS = array(
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
CURLOPT_USERAGENT => 'facebook-php-2.0',
);
line:108 facebook.php ADD:
ReplyDeleteCURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => 2,
------------------------------------------
public static $CURL_OPTS = array(
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
CURLOPT_USERAGENT => 'facebook-php-2.0',
);
Emails updated
ReplyDeleteLogout not working: Session cookie still alive
ReplyDeleteHere just storing Oauth tokens.
ReplyDeleteI just installed it, and man! Works like a baby's ass -smoth-
ReplyDeletethanks
ReplyDeletesarfaraz
ReplyDeleteyou need to enable curl
if u run windows do it
by uncommenting the extension=php_curl.dllin the xampp\apache\bin\php.ini file
if debian
apt-get install curl php5-curl libcurl3-dev
*php5 - installed php version
Help me:
ReplyDeleteWhat is CURL?
Fatal error: Uncaught exception 'Exception' with message 'Facebook needs the CURL PHP extension.' in C:\xampp\htdocs\new\facebook\facebook.php:4 Stack trace: #0 C:\xampp\htdocs\new\login-facebook.php(3): require() #1 {main} thrown in C:\xampp\htdocs\new\facebook\facebook.php on line 4
amazing
ReplyDeleteThis tutorial is really amazing and i have been thinking on how to play around all the social Network account and merge them together facebook, twitter and linkedin. But you issue am having is am having difficulties in downloading the tutorial. Kindly help cos i have registered..
ReplyDeleteAmazing i got the script without suscription !!!! This is the most security mode i ever seen on the web. Congrats my friend
ReplyDeleteThanks i just got the script after trying for so long but it took more than 18hrs.. Anyway, thanks and keep blogging.....
ReplyDeletehi,nice tutorial...
ReplyDeleteI have a problem
...when logging in i'm redirected back but only query result from oauth provider is shown as an array
What should i do??
buenos dias! Gracias por este valioso tutorial!, les cuento que en el archivo login-facebook.php la redireccion a la pagina de inicio no se deberia hacer con header("Location: index.php"); sino mediante javascript, esto para evitar un email de de facebook solicitando que en la pagina final de retorno(en este caso el index.php) no exista contenido de terceros como < script>< img >< iframe >.
ReplyDeleteSaludos
facebook login error -> There was an error.
ReplyDeleteWhat should I do?
so how can i have database for it ?
ReplyDeletewhy logout is not working???? session is still alive :(
ReplyDeletethat driving me crazy... help help... help
Thanks,
Mit
This system will not clear facebook and twitter sessions.
ReplyDeletewhere is 'Facebook Secret' i dont see it. I see the other three but not 'Facebook Secret' code?
ReplyDeletetheres no store-email.php file like your demo has. after you get permission from fb or twitter, no email page included.
ReplyDeleteGood one..Thanks a lot
ReplyDeleteit's not working on my pc, I've put AppId and Secret id and created table and created connection, all things are fine but not working, don't know why... please help me
ReplyDeleteHI Srinivas,
ReplyDeletethank you for this tutorials,
i'm working with symfony framework, have you an idea how implement this in symfony project ?
Getting Message
ReplyDeleteThere was an error.
help me
Getting Message
ReplyDeleteThere was an error
Please help me
Uncaught exception 'Exception' with message 'Facebook needs the CURL PHP extension.' bro i got this problem any idea?
ReplyDeletehow we get user id after login in twitter
ReplyDeletei am getting this error i try to install it on wamp server
ReplyDeleteFatal error: Call to undefined function curl_init() in C:\wamp\www\Login_Twitbook\twitter\twitteroauth.php on line 199
please help me out
WAAAAAAAAAAAAW.....
ReplyDeletei am also getting this error i try to install it on wamp server
ReplyDeleteFatal error: Call to undefined function curl_init() in E:\wamp\www\Login_Twitbook\twitter\twitteroauth.php on line 199
please help me out
THANKSSSSSSSSSSSSSSS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! great topic!
ReplyDeletePleas could you help me?
ReplyDeleteFacebook Issue:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /login-facebook.php:29) in login-facebook.php on line 36
Warning: Cannot modify header information - headers already sent by (output started at login-facebook.php:29) in login-facebook.php on line 42
Twitter issue:
Warning: Cannot modify header information - headers already sent by (output started at fb-twitter/getTwitterData.php:18) in fb-twitter/getTwitterData.php on line 35
Thanks!
Hi Srinivas Tamada,
ReplyDeleteWhat is the Callback URL? i put in twitter? thanks..
Getting Message
ReplyDeleteThere was an error.
help me
thanks
ReplyDeleteHello i need help please im begging for help.
ReplyDeletei get the display of user info from twitter
but at the bottom of the result page i get
Warning: Cannot modify header information - headers already sent by (output started at /home/******/public_html/******/getTwitterData.php:16) in /home/******/public_html/******/getTwitterData.php on line 33
i have too same error how can we fix it
ReplyDeleteTo solve headers error - erase all blank lines and spaces after the close php tag which looks like this " ?> "
ReplyDeleteAdd ob_start(); at the top of the page giving you the error headers already sent by (output started at this and that....
ReplyDeleteExample:
<?php
ob_start();
Any page that session_start(); is used, make sure that session_start(); is the first variable at the top of your code b4 any other code begins.
Example:
<?php
session_start();
Please help, How do i get the user email address from both facebook and twitter after authentication has been performed and the user details saved to my database. It's just the user fullname that is saved to my database and no email address. I need to get the user email address as well. please help.
ReplyDeleteThanks in advance.
thanks for this great tuto which works well
ReplyDeletei'm now facing an issue while integrating this to my existing login system: no problem for new users but how do you deal with existing(old users)?
i think i'll need to sync their old account with their facebook and twitter login based on their email address
the only way to do that is to ask this to the user, do u have any other solution in mind?
Could you pls tell me how to get the user email address from Facebook and Twitter?
ReplyDeleteBreteuil all you need to do is to modify the file config/functions.php insert the user details brought from Facebook or Twitter so that those information can be inserted into your current users table and see how you can create a session variable in the page (login-facebook.php) for users who logged in with their facebook accounts and (getTwitterData.php) for users who logged in with their Twitter accounts and change the header("location: home.php"); in those two files to take the user to the page that your users see upon a successful login.
Hope that solves your problem.
My own problem is how to get the users email from Facebook and Twitter...
Hi, thanks for this tutorial.
ReplyDeletei started to subscribe 3 days ago.
but still i cant get download link
good one :) thanks a lot working fine
ReplyDeletetwitter login working fine and in the facebook login an error occurs when testing in local. The problem solved by adding one additional line in facebook.php in the makeRequest() method there $opts = self::$CURL_OPTS;
ReplyDeleteImmediately following it, add:
$opts[CURLOPT_SSL_VERIFYPEER] = false;
:) its working fine now
great code, very useful.
ReplyDeleteany idea on what the connect_url in FB should be?
Mail updated 27 July 2011
ReplyDeleteWhat URL do I set up on FB?
ReplyDeleteTo fix this error, please set your Connect URL in the application settings editor. Once it has been set, users will be redirect to that URL instead of this page after logging in.
i am getting error.. following message is coming "There was an error" .. what is problem?
ReplyDeleteplease guide me. thanks
hi i am getting a problem in login with yahoo..
ReplyDeletei am using code--
$session = YahooSession::requireSession(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, OAUTH_APP_ID);
if (is_object($session)) {
$user = $session->getSessionedUser();
$profile = $user->getProfile();
$name = $profile->nickname; // Getting user name
$guid = $profile->guid; // Getting Yahoo ID
}
but when i click on yahoo login button page remain same. i also define OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, OAUTH_APP_ID.
but if i do:--
if (!is_object($session)) {echo "djf"; }
its working ..plz help me
please how to make a update of status on twitter ?.. i try used http://www.9lessons.info/2010/02/connect-twitter-api-with-oauth-using.html but don't work, help me please Srinivas :]
ReplyDeletehttp://socialtweet.us/ Mobile Twitter Client with fast access, very minimalist design and rich of features that you don't get on the normal mobile Twitter site.
ReplyDeleteDesigned with a very slim method so it will speed up the access and of course save the cost.
i have this message...
ReplyDeleteThere was an error.
how do i resolve this? any ideas
Getting Message
ReplyDeleteThere was an error.
help me
Nice Post for Facebook and Twitter login's thanks lot...
ReplyDeleteThere was an error.
ReplyDeleteIs it possible to make it so that if the user isn't already logged in via twitter or facebook, then instead of loading the same page with the login request, it instead loads in a pop-up or drop-in or a jQuery reveal?
ReplyDeletegomtv dot net has a version that does a pop-up and a demo(not of the fb/twitter login though) of the reveal or drop-in can be found at zurb dot com/playground
Great work btw, I love this site and signed up for twitter just to test this and follow you! :D
Oh, just thought of one mroe thing!
ReplyDeleteCould you also add a remember me check box option so that if the same user comes back to the site and previously checked that field it will attempt to auto log them into facebook or twitter if they're already logged into one of those two places?
Thanks!
how to get user email and gender along with username to insert in mysql
ReplyDeletewow ... amazing tutorial :D I really love it ... and I hope if the redirection will in a popup window and returning the results in div in the main window ...
ReplyDeleteI have signed and and it want let me download
ReplyDeleteI dont what is wrong, from all the comment in this post, most of reader doing fine with this tutorial, but i got a problem when login to FB, it say my application is is under construction.
ReplyDeletei fixed that problem i post before, but now i had anothr problem, when i click the fb login button and allow app access, it redirect me to this url: login-facebook.php?session={"session_key":"2.AQCAvTZGKTY-sAz9.3600.13150bla bla bla bla.
ReplyDeleteand i got message on browser: There was an error.
i really dont what to do, because after this happen when i click fb login button, the allow form never apear. just "There was an error" that show in browser, plizz help me with this..
hi sir... Problems solved, my site already connected, just one thing, how to get user email from fb (not manualy input) and put it in mysql DB? in the email column just apear "NULL"
ReplyDelete@toem
ReplyDeleteThis system not storing facebook email manual update. Storing twitter and facebook tokens
We going to update this post soon with storing fb email.
ReplyDeleteTy sir... i'll bookmark this post, for your next update.. :)
ReplyDeleteUpdate to SDK 3.1.1 and you can use
ReplyDelete$facebook->getLoginUrl(array('scope'=>'email'));
to get the user's email
awesome.. is there a way to store twitter username instead of full name? or maybe both? thanks
ReplyDeleteI can't wait for the update :)
ReplyDeletehello i have problem the facebook url back after login not working why??
ReplyDeleteThanks good job!!
Great, this will great option in forums or question and answers website.
ReplyDeletehello
ReplyDeleteif i want to try in localhost.
what should be changed?
and i cant download the script
Fatal error: Uncaught exception 'Exception' with message 'Facebook needs the CURL PHP extension.' in C:\wamp\www\Facebook_Twitter_Login\facebook\base_facebook.php:19 Stack trace: #0 C:\wamp\www\Facebook_Twitter_Login\facebook\facebook.php(18): require_once() #1 C:\wamp\www\Facebook_Twitter_Login\login-facebook.php(3): require('C:\wamp\www\Fac...') #2 {main} thrown in C:\wamp\www\Facebook_Twitter_Login\facebook\base_facebook.php on line 19
ReplyDeleteThe following message is:
ReplyDelete... Something wrong happened ... when clik log to twitter
Please tell me where's the error....
When click twit button, messsage is
ReplyDeletethe error code is: 401
Something wrong happened.
$Hasan
ReplyDeletePlease give valid twitter CONSUMER_KEYs
The page isn't redirecting properly.
ReplyDeleteThis is the problem I am facing when I am trying to log with facebook details . It worked once for me. But after that it doesn't work. Also it would be really helpful if you could please make the log-out.
Hello Srinivas Sir
ReplyDeletei have error.
You don't have permission to access /getdata.php on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
for more Go on www.prag.asksanju.com
First off all thanks,
ReplyDeleteHi Srinivas i got following error facebook login
Warning: Missing argument 5 for User::checkUser() in fblogin/login-facebook.php on line 35 and config/functions.php on line 7
How resolve resolve it?
Check the SQL statments
ReplyDeleteHi Srinivas,
ReplyDeleteI didnt change anything i just followed ur steps but this error coming
Warning: Missing argument 5 for User::checkUser() in fblogin/login-facebook.php on line 35 and config/functions.php on line 7
Where should i check? Can you please let me know
I will recheck the download script.
ReplyDeleteHi I got the following error in facebook login page. What i do. Help me. Thanks.
ReplyDeleteInvalid Argument
Given URL is not allowed by the Application configuration.
nice job! thanks!
ReplyDeleteHi srinivas
ReplyDeleteI didnt change anything i just followed ur steps but this error coming
Warning: Missing argument 5 for User::checkUser() in fblogin/login-facebook.php on line 35 and config/functions.php on line 7
Where should i check? Can you please let me know
Hi, can you help me with this? can I tweet from that documents?
ReplyDeleteHi is this possible to port this over to wordpress?
ReplyDeleteDownload script working perfect. I had re-tested
ReplyDeletehttp://demos.9lessons.info/fttest/index.php
Hi srinivas
ReplyDeleteAgain donwloading and check it same error after giving facebook login
Warning: Missing argument 5 for User::checkUser() in fblogin/login-facebook.php on line 35 and config/functions.php on line 7
Can you please let me know
Hallo!
ReplyDeleteIn Database oauth_uid int(11) Field is to short.
I changed it in varchar(255) and it works.
The warning is because of
$userdata = $user->checkUser($uid, 'facebook', $username,$email); -> 4 Arguments
and function checkUser($uid, $oauth_provider, $username,$email,$twitter_otoken,$twitter_otoken_secret) -> 6 Arguments
Greetings
Hi Srinivas ,
ReplyDeleteCan you help me following error
Chkuser?
Warning: Missing argument 5 for User::checkUser() in fblogin/login-facebook.php on line 35 and config/functions.php on line 7
Where should i check? Can you please let me know
@Matze Thank you. Download script and table updated.
ReplyDeleteHi srinivas,
ReplyDeleteIam getting error both Facebook and Twitter login same error is
Column count doesn't match value count at row 1
can you help me how to resolve this issue
Updated insert statement
ReplyDeleteHy Srinivas
ReplyDeletei was test your app login fb n twit but i dont understand why alaways display
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
This comment has been removed by the author.
ReplyDeleteSrinivas, I got your code uploaded on one of my developer sites and the Twitter required some work, I had to put ob_start(); on the getTwitterData.php page and move session_start(); above it at the very top of the page. It works fine now, very smooth. I also changed the username to screen_name so it uses people's @ name instead of their name which may have spaces or symbols.
ReplyDeleteAnyway, I can't get your Facebook code to work. As komputer said above, it just sits in an endless redirect loop. I didn't modify any code, I just added my keys. It's been a day so I'm sure Facebook's stuff is propagated through their servers. I don't know where to start looking, I just know that nothing is added to the database.
Any help would be appreciated, thanks.
Awesome tutorial. Thanks for sharing. One question. i keep getting #_=_ at the end of all urls after login. Any idea on how to not have this happen?
ReplyDeleteIf you use this you may want to include some mysql_real_escape_string(). I have an apostrophe in my name and the script had an error. if you add the real escape function to fields being inserted into database it makes it safer and also prevents errors when someone like me tries to sign up. Damn irish and their apostrophes hehe!
ReplyDeletethanks this is help for my knowledge
ReplyDeleteit very nice and excellence, i want script for login with facebook and twitter, i subscribed it..please send me script thanks dear
ReplyDeleteWhen a facebook profile name has ' or " i get an sql error!
ReplyDeletewhere is the java script code ????
ReplyDeleteFor over a month now I trying to open twitter but I can
ReplyDeletewait google+yahoo+facebook+twitter
ReplyDeletehi sriniwas its great application i need script for linkedin and facebook + twitter+yahoo+gmail please help thanks
ReplyDeletesir help
ReplyDeleteerror in twitter
Fatal error: Call to undefined function curl_init() in /www/99k.org/l/o/v/lovesongs/htdocs/fb/twitter/twitteroauth.php on line 199
in facebook:
Fatal error: Uncaught exception 'Exception' with message 'Facebook needs the CURL PHP extension.' in /www/99k.org/l/o/v/lovesongs/htdocs/fb/facebook/base_facebook.php:19 Stack trace: #0 /www/99k.org/l/o/v/lovesongs/htdocs/fb/facebook/facebook.php(18): require_once() #1 /www/99k.org/l/o/v/lovesongs/htdocs/fb/login-facebook.php(3): require('/www/99k.org/l/...') #2 {main} thrown in /www/99k.org/l/o/v/lovesongs/htdocs/fb/facebook/base_facebook.php on line 19
i am using facebook login logout api. if i login from my site it will login successfully but if i do logout it will logout from my site but cant broke the session from facebook. it will directly login into facbook not even ask for username and password.
ReplyDeleteis there any way to separate first name and last name via facebook API?
ReplyDeletethe oauth uid is unique to the current logged user?
ReplyDeleteuseful
ReplyDeleteplease help me error "Column count doesn't match value count at row 1"
ReplyDeletei was test your app login fb n twit but i dont understand why alaways display
ReplyDeleteThe page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
replace the file config/functions.php
ReplyDeleteoauth_provider, oauth_uid, username,email,twitter_oauth_token,twitter_oauth_token_secret) VALUES ('$oauth_provider', '$uid', '$username','$email','$twitter_otoken','$twitter_otoken_secret')
As KOMPUTER and NATE mentioned above:
ReplyDeleteI am facing the same issue with facebook login. The page redirects to facebook back to localhost and to facebook again... And it gets looped... the browser gives up :(. Please help.
Thanks,
Venkat
Hello, Thnx alot for this,
ReplyDeleteI am trying to customize this work and make it worke with Symfony 1.4 framework, already started working on it, if anyone can offer help contact me please, :)
Thanx awesome script and works fine for me!!
ReplyDeleteWhat about logging in via ajax? I'm on a project that doesn't have page reloads. And by other side, i know a fb connect script that opens a new window to authenticate and then sends login info as a callback. This can be achieved with this script?
ReplyDeleteI tried accessing the code vía ajax, and also using iframes. The first thing wont help at all, because no secondary window can be reached that way. I can return the $url instead of redirecting, but what then? And the second try, the iframes, won't work. They remain blank for twitter and Facebook just post a link instead of a login formulary.
ReplyDeleteThanks for your tutorial.But I can't download script.
ReplyDeleteThanks. I can't download the script, though.
ReplyDeleteSame problem as her.aya. Asks me for the Facebook permissions but then when redirecting back get the following error
ReplyDeleteplease help me error "Column count doesn't match value count at row 1"
Would be great if you could post a response to this. Otherwise smooth as a Cashmere codpiece.
Thanks for the Script! its awesome .. my FB-SIgn in works well!
ReplyDeletebut my twitter errors all the time "Something wrong happened."
twconfig.php is fine! both keys are fine ..
Help me please ..
That is all i want, thanks
ReplyDeleteNow I know why you have no negative comments. You screen them! What a joke.
ReplyDeleteam getting "Firefox has detected that the server is redirecting the request for this address in a way that will never complete." i just added my app key and secret.
ReplyDeleteHi Very nice tutorial.
ReplyDeleteBut i got an error to connect with facebook
error message are as follow:
"An error occurred with test. Please try again later."
Hi Gooner, I had the same problem. It is because of a wrong INSERT statement in functions.php file. Go to that file inside the config folder and at the end of line 15 where you see:
ReplyDelete...'$email')") or die(mysql_error());
add the two missing columns like this:
...'$email','$twitter_otoken','$twitter_otoken_secret')") or die(mysql_error());
That worked for me.
BTW, great script Srinivas! Thank you very much.
my hosting provider doesnt allow me to curl_exec
ReplyDeleteWarning: curl_exec() has been disabled for security reasons in /home/memegust/public_html/m/login/facebook/base_facebook.php on line 803
is there an alternative?
@dvidsilva
ReplyDeletePlease sent a request to hosting people to enable CURL_EXEC()
please send
ReplyDeleteHi
ReplyDeleteI think I am missing an idea here.
Say you have a simple database of members that contains, name, email login and password, and city. WHen they log in you can say "Hello " for example. That's all normal standard stuff.
If someone logs in using Twitter or Facebook, how do you know their name? Their email? Their City?
This is really basic but important stuff. So far I have found no one who can answer this fundamental question.
i like it,WOW
ReplyDeleteFatal error: Uncaught exception 'Exception' with message 'Facebook needs the CURL PHP extension.' in C:\xampp\htdocs\Facebook_Twitter_Login\facebook\base_facebook.php:19 Stack trace: #0 C:\xampp\htdocs\Facebook_Twitter_Login\facebook\facebook.php(18): require_once() #1 C:\xampp\htdocs\Facebook_Twitter_Login\login-facebook.php(3): require('C:\xampp\htdocs...') #2 {main} thrown in C:\xampp\htdocs\Facebook_Twitter_Login\facebook\base_facebook.php on line 19
ReplyDeletenice...
ReplyDeleteDoes the Twitter app require a callback URL or should I leave that blank?
ReplyDeletethanks, super example and I'm slowly picking my way through it.... I installed it on a test machine with internet connection but where Apache was running on localhost and a localhost entry in my host table for my website.... anyway after a cpl of hours (and a fee beers).. the code seemed to get stuck in an endless redirect loop (like some of the above people have said).. thuinking about it it does look like facebook makes a call back to the php script.. which it can't do if your running your site on a test locahost set up like me... I moved the code on to the live server and it worked straight away!... thought this might be off use to someone
ReplyDeleteIts good or not? but This system not storing facebook email manual update. Storing twitter and facebook tokens.. its ok for me. @puffpie_snack
ReplyDeleteI like facebook and twitter api connect. But after reading this.. need to think how it work, in more good manner. Thanks
ReplyDeleteExcelent!!! man, i find an issue in the CURL certificate problem, i fixed it writing these two lines in the Facebook.php File after the line 112.
ReplyDeleteCURLOPT_SSL_VERIFYPEER => false, //this fix the Certificate CURL problem
CURLOPT_SSL_VERIFYHOST => 2, //this fix the Certificate CURL problem
I hope this helps. Greetings.
coool, worked pretty well too.
ReplyDeleteGood......!
ReplyDeleteHi..
ReplyDeleteCan someone help me out with this.Need this urgently.I ve followed the exact tutorial.I keep getting this error-"There was an error".
Need someone to help me out with the configuration on Facebook Apps.
Waiting for a response
Thanks.
This comment has been removed by the author.
ReplyDeleteImagzing
ReplyDeletehello sir i need this script i am already signup my email with this site but i can't download file. please help me.
ReplyDeleteHi,
ReplyDeletewhat this error means -
Fatal error: Uncaught exception 'Exception' with message 'Facebook needs the CURL PHP extension.' in D:\xampp\htdocs\Facebook_Twitter_Login\facebook\base_facebook.php:19 Stack trace: #0 D:\xampp\htdocs\Facebook_Twitter_Login\facebook\facebook.php(18): require_once() #1 D:\xampp\htdocs\Facebook_Twitter_Login\login-facebook.php(3): require('D:\xampp\htdocs...') #2 {main} thrown in D:\xampp\htdocs\Facebook_Twitter_Login\facebook\base_facebook.php on line 19
Hi,
ReplyDeletewhy its comes?"An error occurred with APP-NAME. Please try again later." How to resolve?
Hello. I downloaded this script but when I want to join with facebook there is error "Column count doesn't match value count at row 1" I think that problem is in functions.php with insert into... i dont knot but when I put the information to the databaze manually the script is working perfect. Thank you for your responze.
ReplyDeleteThis script is great. Works like a charm. Thanks!
ReplyDeleteJust great script. Thanks for sharing it. Hope to find something else usable.
ReplyDeleteLike It!!!
ReplyDeleteHi
ReplyDeleteI am unable to connect when i click on Facebook login button just got following error:
There was an error.
Actually i want to integrate setting with my forum by using existing login option..here is my forum:
http://www.jbpguide.com/forums
Please tell me is that possible to integrate that script with my forum by doing something different? Although in my forums Admin panel there is option to connect with facebook and twitter but these are also not working.. :(
How can i use?:
ReplyDelete$statusUpdate = $facebook->api('/me/feed', 'post', array('message'=> 'Testing posting to my wall', 'cb' => ''));
Want to post on a fb wall if they are sending a message.
how I get facebook and twitter library?
ReplyDeleteits better
ReplyDeleteCan you please tell me how to intergrate the fb wallpost function correctly if the user is logged in with facebook?
ReplyDelete$statusUpdate = $facebook->api('/me/feed', 'post', array('message'=> 'Testing posting to my wall', 'cb' => ''));
i am getting this error
ReplyDeleteAn error occurred with APP Name. Please try again later.
can any one help me ?
ReplyDeletei am getting this error
An error occurred with APP Name. Please try again later.
i tried it but getting following
ReplyDeleteerror An error occurred with APP-NAME. Please try again later.
Nice
ReplyDelete