Jump to content
  • 0

Facebook Share


Promise

Question


  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  386
  • Reputation:   38
  • Joined:  04/28/13
  • Last Seen:  

Hi guise,

i have a question about a web system.

 

Is there any chance to make a facebook share button that when u share the server facebook page, it adds a sql value?

 

Like...

 

  • I share the server page on my profile.
  • Then if(#facebookshare == 2) end; else adds #facebookshare to the server DB
  • OnPCLoginEvent: if(#facebookshare == 1) getitem .@reward, 1; set #facebookshare, 2;

So the players will get a reward on facebook share, only one time per account.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Developer
  • Topic Count:  36
  • Topics Per Day:  0.01
  • Content Count:  587
  • Reputation:   431
  • Joined:  01/26/16
  • Last Seen:  

You can do that with Facebook Javascript SDK.

It provides a callback which you can use to call another web endpoint that increments the account variable.

FB.ui(
  {
    method: 'share',
    href: 'your-ro.com',
  },
  // callback
  function(response) {
    if (response && !response.error_message) {
      //endpoint call
      alert('Shared the link!');
    } else {
      alert('Error!');
    }
  }
);

Read more : https://developers.facebook.com/docs/javascript/reference/FB.ui

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  386
  • Reputation:   38
  • Joined:  04/28/13
  • Last Seen:  

So.. should i add a query sql on 

    if (response && !response.error_message) {
      // HERE?
      alert('Shared the link!'); 
    } else {
      alert('Error!');
    }
Edited by Promise
Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  36
  • Topics Per Day:  0.01
  • Content Count:  587
  • Reputation:   431
  • Joined:  01/26/16
  • Last Seen:  

No, this is a JavaScript code for you web page, and you should not interact with your database on front-end of your web app.

You should raise a XMLHttpRequest call or jQuery.ajax() call if you are using jQuery to call a back-end code to update the database instead.

 

If you don't understand what I'm talking about above, you should rather learn about coding a web app or hire someone to do it for you.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  386
  • Reputation:   38
  • Joined:  04/28/13
  • Last Seen:  

ic... okay, thank you so much! :)

I'll learn about that.

Link to comment
Share on other sites

×
×
  • Create New...