Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; WP_MatchesMapRegex has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-includes/class-wp.php on line 632

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Translation_Entry has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-includes/pomo/entry.php on line 14

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; POMO_Reader has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-includes/pomo/streams.php on line 12

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; POMO_FileReader has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-includes/pomo/streams.php on line 120

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; POMO_StringReader has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-includes/pomo/streams.php on line 175

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; POMO_CachedFileReader has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-includes/pomo/streams.php on line 221

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; POMO_CachedIntFileReader has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-includes/pomo/streams.php on line 236

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; WP_Widget_Factory has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-includes/widgets.php on line 544

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzAdSense has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/easy-adsense-lite.php on line 38

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzAdsWidget has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/easy-adsense-lite.php on line 941

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzAdsSearch has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/easy-adsense-lite.php on line 1003

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzAdsLU has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/easy-adsense-lite.php on line 1078

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzBaseOption has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 22

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzCheckBox has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 174

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzRadioBox has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 199

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzSelect has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 250

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzMessage has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 294

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzHelpTag has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 313

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzHelpPopUp has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 328

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzTextArea has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 346

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzText has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 366

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzSubmit has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 385

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzColorPicker has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 409

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzOneTab has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 432

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzMiniTab has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 476
Login Facebook use PHP

Login Facebook use PHP

Trước tiên để tạo ứng dụng,bạn phải có FACEBOOK  APP.

Vào trang : https://developers.facebook.com/apps/  ,chọn Add a New App .

Chọn website sau đó điền tên app:
ví dụ ở đây tên app là :test
1

Sau đó chọn vào phần Setting,Tại đây bạn điền vào App Domain,Contact Email của bạn.
Tiếp theo,chọn Add Platform ,chọn website và điền vào site URL:
2

 

Save lại.Vậy là bạn có App ID và App Secret của Facebook app.
Tiếp Theo bạn vào phần Setting,vào Advance tìm đến phần Client Oauth Settings và chọn YES cho phần Embedded Browser OAuth Login để kích hoạt URL của bạn:
3

Bước cuối cùng:bạn vào phần Status & Review click YES để kích hoạt App:

4

 

Vào fbconfig.php và sửa lại theo đúng app id và app secret như theo APP của bạn,thay đổi domain name:

Tiếp đó vào file dbconfig.php để chỉnh sửa lại giá trị theo đúng database trên host sever của bạn.

Tiếp theo là import file import.sql vào database.
Sau đó up lên host và test thôi :).Phần up lên host thì các bạn tự google nhé.
Ngoài ra,đây toàn code php dễ hiểu.Các bạn tự đọc tự hiểu nhé,mình không giải thích chi tiết.
Giao diện lúc đầu mới vào:
5Click vào login with facebook:

6

Có thể dowload source code: https://www.dropbox.com/sh/afw8gdz46lgwadg/AACTSfpYoVnkk6yFuKOTlH_ka?dl=0 .

Chạy thử demo tại:  http://condom.zz.mu/demofb/

 

You may also like...

5 Responses

  1. Lưu Mạnh Hùng says:

    Bài viết khá cơ bản, hay :D

  2. is05 says:

    bài viết hay quá

  3. Đỗ VŨ Quốc Việt says:

    Bạn ơi xem lại giúp mình sao phần demo ko chạy được. Có phải do bây giờ PHP SDK nó update phiên bản mới không?
    Sau khi ấn nút đăng nhập nó bị redirect liên tục giữa trang demo và trang fb.

    • long says:

      Mình vừa test thử đúng là demo chạy sai rồi. Có thể app facebook bị config lại dùng để test ứng dụng khác nên bị lỗi. Bạn có thể tự tạo riêng 1 app để test sẽ không bị tình trạng này

      • Đỗ VŨ Quốc Việt says:

        Thực ra trước khi xem bài viết của bạn thì mình cũng tìm được một bài viết tương tự và tải code của họ về rồi, cũng bị lỗi như này. Mình nghĩ có lẽ không phải do code sai mà do bây giờ SDK PHP của fb nó đã cập nhật lên bản cao hơn.
        Mình mới làm quen với PHP và tập viết app facebook nên chưa tự tạo ứng dụng được mà đang tự học thôi. Mình tìm mấy ngày rồi, cả Việt Nam cả nước ngoài nhưng không có demo nào chạy được hết. Nếu được bạn có thể chỉ giúp mình cách tạo ứng dụng đăng nhập, xin cảm ơn.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">