drduinfu915094 2012-02-26 16:15
浏览 98
已采纳

Facebook登录+ nonfacewbook

I am a little lost on how best to integrate both Facebook login and a login for non face book users ?

Can anyone offer a suggestion. Not looking for code, just best methodology please.

Trying avoid users having to get confused between both, essentially the ideal would be them to be able to login if they already have a facebook account, but how to get them onto the site with an account with they don't use facebook.

  • 写回答

2条回答 默认 最新

  • dongren1353 2012-02-26 16:36
    关注

    Assuming you have both login & facebook connect buttons, I have a methodology which is used on my web startup.

    1. In PHP SDK example, there is a field namely $loginUrl. You should have a facebook connect link with $loginUrl.
    2. Have a field in your database like "fb_conn" which is a tiny int or boolean type. fb_conn = 1 means the user is connected to the system with facebook account.
    3. When the user firstly clicks the facebook connect button, you should check whether there are existing registrations based on user_name or email field. If there exist, then perform a facebook login in your database with sql query
    4. If there are no previous registrations in that account, have a static key, concat with some of the user's unique field and md5 them. For instance ,

      $fb_pass =  md5( $_SESSION['fb_email'] ."124cc33" ) ; 
      
    5. Insert into mysql database with facebook user name and password with $fb_pass. After that, in facebook login function, you can check the password is true or not by concating fb_email with static key "124cc33". By this way, facebook logged will be same as normal login function in your database. The only change is the input fields in password.

    6. Merge facebook account with normal account (by just updating fb_conn as 1) if the user tries to connect from facebook who already got an account previously.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示