I am using this script to get the user image,name and email…
now, how can I get those details and enter them into the database?
I thought about Ajax to send a request like that:
insertDB.php?image=abc&name=dan&email=dan@dan.com
but its some kind of a security issue since bots could register to my website…
(just send GET requests…).
what can I do to solve this problem?
<html>
<head>
<title>My Facebook Login Page</title>
</head>
<body>
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId:'169630839752390', cookie:true,
status:true, xfbml:true
});
FB.api('/me', function(user) {
if(user != null) {
var image = document.getElementById('image');
image.src = 'http://graph.facebook.com/' + user.id + '/picture?type=large';
var email = document.getElementById('email');
email.innerHTML = user.email;
var name = document.getElementById('name');
name.innerHTML = user.name;
}
});
</script>
<fb:login-button perms="email,user_birthday,publish_stream">Login with Facebook</fb:login-button>
<div align="center">
<img id="image"/>
<div id="name"></div>
<div id="email"></div>
</div>
</body>
</html>