Login with Facebook and Twitter
Wall Script
Follow Me:
Thursday, February 17, 2011

Login with Facebook and Twitter

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.

Facebook Twitter Login


Download Script     New Live Demo

Developer
Ravi Tamada
Ravi Tamada
Designer Developer & Freelance
Chennai, INDIA
androidhive.info

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)
);

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

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');
?>

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');
?>

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);
?>

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>

If any queries please comment here.

Thanks,
Srinivas Tamada
Was this article helpful?
Thanks! Your feedback helps us to improve 9lessons.info


529 comments:

  1. Wow... nice and easy

    ReplyDelete
  2. Cool,........keep inspiring, Bro....!! Thanks

    ReplyDelete
  3. Superb ravi... its really cool.. keep it up..

    ReplyDelete
  4. this is great simple, can you add google ?

    ReplyDelete
  5. Nice 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

    Thx a lot

    ReplyDelete
  6. We have been working with Google Oauth. Second version Google + Yahoo + Facebook + Twitter

    ReplyDelete
  7. i'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
  8. "We have been working with Google Oauth. Second version Google + Yahoo + Facebook + Twitter"

    That will be great as well, thanks!

    ReplyDelete
  9. 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.

    ReplyDelete
  10. epic nice.. awosome :D

    ReplyDelete
  11. nice work!

    but facebook login seems to be tricky..
    can´t get it working, there´s always the "There was an error." message...

    hope someone can help!

    ReplyDelete
  12. nice work.............

    still need better

    ReplyDelete
  13. Really awesome , thanks you

    ReplyDelete
  14. hi ! 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 !!!

    ReplyDelete
  15. Gud Greetings

    When 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

    ReplyDelete
  16. Facebook Login Error:
    ------------
    Invalid Argument

    Given URL is not allowed by the Application configuration.
    ------------
    ?!?!?!?!?!?

    ReplyDelete
  17. This comment has been removed by the author.

    ReplyDelete
  18. tink's brained :)

    ReplyDelete
  19. Hey 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!

    ReplyDelete
  20. Dats 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.

    ReplyDelete
  21. Anonymous said...
    Hey 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 !!!

    ReplyDelete
  22. Sweet dude. I've been looking everywhere for something simple and clean like this.

    ReplyDelete
  23. i 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?

    ReplyDelete
  24. Excellent post, I would like to download the updated version of the demo, where after login follow the record of the email.

    Thanks!

    ReplyDelete
  25. Can you provide code for login through Linkedin

    ReplyDelete
  26. The script worls perfectly.

    To store oauth_uid of the user, oauth_uid int(11) no longer works...that should be changed to higher varchar ...

    ReplyDelete
  27. please help me...... covert this codes to ASPx...


    Regards
    Sanoj

    ReplyDelete
  28. 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

    ReplyDelete
  29. Great! I am waiting for new version(Google + Yahoo + Facebook + Twitter).

    thanks for the code.

    ReplyDelete
  30. Facebook page: facebook.php linha 108 add:
    ---------------------------------|
    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',
    );

    ReplyDelete
  31. line:108 facebook.php ADD:
    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',
    );

    ReplyDelete
  32. Logout not working: Session cookie still alive

    ReplyDelete
  33. I just installed it, and man! Works like a baby's ass -smoth-

    ReplyDelete
  34. sarfaraz

    you 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

    ReplyDelete
  35. Help me:

    What 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

    ReplyDelete
  36. This 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..

    ReplyDelete
  37. Amazing i got the script without suscription !!!! This is the most security mode i ever seen on the web. Congrats my friend

    ReplyDelete
  38. Thanks i just got the script after trying for so long but it took more than 18hrs.. Anyway, thanks and keep blogging.....

    ReplyDelete
  39. hi,nice tutorial...
    I 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??

    ReplyDelete
  40. 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 >.

    Saludos

    ReplyDelete
  41. facebook login error -> There was an error.

    What should I do?

    ReplyDelete
  42. so how can i have database for it ?

    ReplyDelete
  43. why logout is not working???? session is still alive :(

    that driving me crazy... help help... help

    Thanks,
    Mit

    ReplyDelete
  44. This system will not clear facebook and twitter sessions.

    ReplyDelete
  45. where is 'Facebook Secret' i dont see it. I see the other three but not 'Facebook Secret' code?

    ReplyDelete
  46. theres no store-email.php file like your demo has. after you get permission from fb or twitter, no email page included.

    ReplyDelete
  47. Good one..Thanks a lot

    ReplyDelete
  48. it'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

    ReplyDelete
  49. HI Srinivas,
    thank you for this tutorials,
    i'm working with symfony framework, have you an idea how implement this in symfony project ?

    ReplyDelete
  50. Getting Message

    There was an error.


    help me

    ReplyDelete
  51. Getting Message
    There was an error
    Please help me

    ReplyDelete
  52. Uncaught exception 'Exception' with message 'Facebook needs the CURL PHP extension.' bro i got this problem any idea?

    ReplyDelete
  53. how we get user id after login in twitter

    ReplyDelete
  54. i am getting this error i try to install it on wamp server
    Fatal error: Call to undefined function curl_init() in C:\wamp\www\Login_Twitbook\twitter\twitteroauth.php on line 199
    please help me out

    ReplyDelete
  55. i am also getting this error i try to install it on wamp server
    Fatal error: Call to undefined function curl_init() in E:\wamp\www\Login_Twitbook\twitter\twitteroauth.php on line 199
    please help me out

    ReplyDelete
  56. THANKSSSSSSSSSSSSSSS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! great topic!

    ReplyDelete
  57. Pleas could you help me?

    Facebook 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!

    ReplyDelete
  58. Hi Srinivas Tamada,

    What is the Callback URL? i put in twitter? thanks..

    ReplyDelete
  59. Getting Message

    There was an error.


    help me

    ReplyDelete
  60. Hello i need help please im begging for help.

    i 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

    ReplyDelete
  61. i have too same error how can we fix it

    ReplyDelete
  62. To solve headers error - erase all blank lines and spaces after the close php tag which looks like this " ?> "

    ReplyDelete
  63. Add ob_start(); at the top of the page giving you the error headers already sent by (output started at this and that....

    Example:

    <?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();

    ReplyDelete
  64. 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.

    Thanks in advance.

    ReplyDelete
  65. thanks for this great tuto which works well

    i'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?

    ReplyDelete
  66. Could you pls tell me how to get the user email address from Facebook and Twitter?


    Breteuil 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...

    ReplyDelete
  67. Hi, thanks for this tutorial.

    i started to subscribe 3 days ago.

    but still i cant get download link

    ReplyDelete
  68. good one :) thanks a lot working fine

    ReplyDelete
  69. twitter 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;
    Immediately following it, add:
    $opts[CURLOPT_SSL_VERIFYPEER] = false;

    :) its working fine now

    ReplyDelete
  70. great code, very useful.

    any idea on what the connect_url in FB should be?

    ReplyDelete
  71. What URL do I set up on FB?

    To 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.

    ReplyDelete
  72. i am getting error.. following message is coming "There was an error" .. what is problem?
    please guide me. thanks

    ReplyDelete
  73. hi i am getting a problem in login with yahoo..
    i 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

    ReplyDelete
  74. 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 :]

    ReplyDelete
  75. http://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.
    Designed with a very slim method so it will speed up the access and of course save the cost.

    ReplyDelete
  76. i have this message...


    There was an error.


    how do i resolve this? any ideas

    ReplyDelete
  77. Getting Message

    There was an error.


    help me

    ReplyDelete
  78. Nice Post for Facebook and Twitter login's thanks lot...

    ReplyDelete
  79. There was an error.

    ReplyDelete
  80. Is 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?
    gomtv 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

    ReplyDelete
  81. Oh, just thought of one mroe thing!
    Could 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!

    ReplyDelete
  82. how to get user email and gender along with username to insert in mysql

    ReplyDelete
  83. wow ... 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 ...

    ReplyDelete
  84. I have signed and and it want let me download

    ReplyDelete
  85. I 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.

    ReplyDelete
  86. i 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.

    and 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..

    ReplyDelete
  87. 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
  88. @toem

    This system not storing facebook email manual update. Storing twitter and facebook tokens

    ReplyDelete
  89. We going to update this post soon with storing fb email.

    ReplyDelete
  90. Ty sir... i'll bookmark this post, for your next update.. :)

    ReplyDelete
  91. Update to SDK 3.1.1 and you can use

    $facebook->getLoginUrl(array('scope'=>'email'));

    to get the user's email

    ReplyDelete
  92. awesome.. is there a way to store twitter username instead of full name? or maybe both? thanks

    ReplyDelete
  93. I can't wait for the update :)

    ReplyDelete
  94. hello i have problem the facebook url back after login not working why??
    Thanks good job!!

    ReplyDelete
  95. Great, this will great option in forums or question and answers website.

    ReplyDelete
  96. hello

    if i want to try in localhost.
    what should be changed?

    and i cant download the script

    ReplyDelete
  97. 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

    ReplyDelete
  98. The following message is:

    ... Something wrong happened ... when clik log to twitter

    Please tell me where's the error....

    ReplyDelete
  99. When click twit button, messsage is

    the error code is: 401
    Something wrong happened.

    ReplyDelete
  100. $Hasan

    Please give valid twitter CONSUMER_KEYs

    ReplyDelete
  101. The page isn't redirecting properly.

    This 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.

    ReplyDelete
  102. Hello Srinivas Sir

    i 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

    ReplyDelete
  103. First off all thanks,
    Hi 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?

    ReplyDelete
  104. Hi Srinivas,

    I 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

    ReplyDelete
  105. Hi I got the following error in facebook login page. What i do. Help me. Thanks.

    Invalid Argument

    Given URL is not allowed by the Application configuration.

    ReplyDelete
  106. Hi srinivas

    I 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

    ReplyDelete
  107. Hi, can you help me with this? can I tweet from that documents?

    ReplyDelete
  108. Hi is this possible to port this over to wordpress?

    ReplyDelete
  109. Download script working perfect. I had re-tested

    http://demos.9lessons.info/fttest/index.php

    ReplyDelete
  110. Hi srinivas

    Again 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

    ReplyDelete
  111. Hallo!
    In 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

    ReplyDelete
  112. Hi Srinivas ,
    Can 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

    ReplyDelete
  113. @Matze Thank you. Download script and table updated.

    ReplyDelete
  114. Hi srinivas,
    Iam 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

    ReplyDelete
  115. Hy Srinivas

    i 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.

    ReplyDelete
  116. This comment has been removed by the author.

    ReplyDelete
  117. Srinivas, 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.

    Anyway, 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.

    ReplyDelete
  118. 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?

    ReplyDelete
  119. If 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!

    ReplyDelete
  120. thanks this is help for my knowledge

    ReplyDelete
  121. it very nice and excellence, i want script for login with facebook and twitter, i subscribed it..please send me script thanks dear

    ReplyDelete
  122. When a facebook profile name has ' or " i get an sql error!

    ReplyDelete
  123. where is the java script code ????

    ReplyDelete
  124. For over a month now I trying to open twitter but I can

    ReplyDelete
  125. wait google+yahoo+facebook+twitter

    ReplyDelete
  126. hi sriniwas its great application i need script for linkedin and facebook + twitter+yahoo+gmail please help thanks

    ReplyDelete
  127. sir help
    error 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

    ReplyDelete
  128. 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.

    ReplyDelete
  129. is there any way to separate first name and last name via facebook API?

    ReplyDelete
  130. the oauth uid is unique to the current logged user?

    ReplyDelete
  131. please help me error "Column count doesn't match value count at row 1"

    ReplyDelete
  132. i 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.

    ReplyDelete
  133. replace the file config/functions.php

    oauth_provider, oauth_uid, username,email,twitter_oauth_token,twitter_oauth_token_secret) VALUES ('$oauth_provider', '$uid', '$username','$email','$twitter_otoken','$twitter_otoken_secret')

    ReplyDelete
  134. As KOMPUTER and NATE mentioned above:
    I 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

    ReplyDelete
  135. Hello, Thnx alot for this,
    I 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, :)

    ReplyDelete
  136. Thanx awesome script and works fine for me!!

    ReplyDelete
  137. What 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?

    ReplyDelete
  138. I 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.

    ReplyDelete
  139. Thanks for your tutorial.But I can't download script.

    ReplyDelete
  140. Thanks. I can't download the script, though.

    ReplyDelete
  141. Same problem as her.aya. Asks me for the Facebook permissions but then when redirecting back get the following error

    please 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.

    ReplyDelete
  142. Thanks for the Script! its awesome .. my FB-SIgn in works well!
    but my twitter errors all the time "Something wrong happened."

    twconfig.php is fine! both keys are fine ..
    Help me please ..

    ReplyDelete
  143. Now I know why you have no negative comments. You screen them! What a joke.

    ReplyDelete
  144. am 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.

    ReplyDelete
  145. Hi Very nice tutorial.

    But i got an error to connect with facebook

    error message are as follow:

    "An error occurred with test. Please try again later."

    ReplyDelete
  146. 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:

    ...'$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.

    ReplyDelete
  147. my hosting provider doesnt allow me to curl_exec


    Warning: 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?

    ReplyDelete
  148. @dvidsilva

    Please sent a request to hosting people to enable CURL_EXEC()

    ReplyDelete
  149. Hi
    I 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.

    ReplyDelete
  150. Fatal 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

    ReplyDelete
  151. Does the Twitter app require a callback URL or should I leave that blank?

    ReplyDelete
  152. thanks, 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

    ReplyDelete
  153. Its good or not? but This system not storing facebook email manual update. Storing twitter and facebook tokens.. its ok for me. @puffpie_snack

    ReplyDelete
  154. I like facebook and twitter api connect. But after reading this.. need to think how it work, in more good manner. Thanks

    ReplyDelete
  155. Excelent!!! 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.

    CURLOPT_SSL_VERIFYPEER => false, //this fix the Certificate CURL problem
    CURLOPT_SSL_VERIFYHOST => 2, //this fix the Certificate CURL problem

    I hope this helps. Greetings.

    ReplyDelete
  156. Hi..

    Can 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.

    ReplyDelete
  157. This comment has been removed by the author.

    ReplyDelete
  158. hello sir i need this script i am already signup my email with this site but i can't download file. please help me.

    ReplyDelete
  159. Hi,

    what 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

    ReplyDelete
  160. Hi,

    why its comes?"An error occurred with APP-NAME. Please try again later." How to resolve?

    ReplyDelete
  161. 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.

    ReplyDelete
  162. This script is great. Works like a charm. Thanks!

    ReplyDelete
  163. Just great script. Thanks for sharing it. Hope to find something else usable.

    ReplyDelete
  164. Hi

    I 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.. :(

    ReplyDelete
  165. How can i use?:
    $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.

    ReplyDelete
  166. how I get facebook and twitter library?

    ReplyDelete
  167. Can you please tell me how to intergrate the fb wallpost function correctly if the user is logged in with facebook?

    $statusUpdate = $facebook->api('/me/feed', 'post', array('message'=> 'Testing posting to my wall', 'cb' => ''));

    ReplyDelete
  168. i am getting this error
    An error occurred with APP Name. Please try again later.

    ReplyDelete
  169. can any one help me ?

    i am getting this error

    An error occurred with APP Name. Please try again later.

    ReplyDelete

Make in India