first commit
This commit is contained in:
109
application/views/web/test/facebook_login.php
Executable file
109
application/views/web/test/facebook_login.php
Executable file
@@ -0,0 +1,109 @@
|
||||
<script>
|
||||
// // This is called with the results from from FB.getLoginStatus().
|
||||
function statusChangeCallback(response) {
|
||||
if (response.status === 'connected') {
|
||||
FB.api('/me', function(response) {
|
||||
if(response.id!='') {
|
||||
var form_data = {
|
||||
"id" : response.id,
|
||||
"name" : response.name
|
||||
};
|
||||
$.ajax({
|
||||
url: '/web/share/facebook_login_proc',
|
||||
async: false,
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
data: form_data,
|
||||
success: function (rtnJson) {
|
||||
if (rtnJson.code == "0000") {
|
||||
window.location.reload();
|
||||
} else {
|
||||
alert("페이스북 로그인에 실패했습니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
},
|
||||
error: function (rtnJson) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
//
|
||||
//function checkLoginState() {
|
||||
// FB.getLoginStatus(function(response) {
|
||||
// statusChangeCallback(response);
|
||||
// }, true);
|
||||
//}
|
||||
|
||||
|
||||
function facebook_login() {
|
||||
window.FB.login(function(response) {
|
||||
console.log(response);
|
||||
if (response.status === 'connected') {
|
||||
statusChangeCallback(response);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
window.fbAsyncInit = function() {
|
||||
FB.init({
|
||||
appId : '961578337335000',
|
||||
cookie : true, // enable cookies to allow the server to access
|
||||
xfbml : true, // parse social plugins on this page
|
||||
version : 'v2.8' // use graph api version 2.8
|
||||
});
|
||||
|
||||
};
|
||||
// Load the SDK asynchronously
|
||||
(function(d, s, id) {
|
||||
var js, fjs = d.getElementsByTagName(s)[0];
|
||||
if (d.getElementById(id)) return;
|
||||
js = d.createElement(s); js.id = id;
|
||||
js.src = "https://connect.facebook.net/en_US/sdk.js";
|
||||
fjs.parentNode.insertBefore(js, fjs);
|
||||
}(document, 'script', 'facebook-jssdk'));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a href="javascript:;" onclick="facebook_login();">test</a>
|
||||
|
||||
|
||||
<fb:login-button scope="public_profile,email" onlogin="facebook_login();">
|
||||
</fb:login-button>
|
||||
|
||||
<div id="status">
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
$this->load->helper('cookie');
|
||||
$comment_sns_id = get_cookie('crossmap_comment_sns_id');
|
||||
$comment_sns_name = get_cookie('crossmap_comment_sns_name');
|
||||
$comment_sns_type = get_cookie('crossmap_comment_sns_type');
|
||||
echo $comment_sns_id;
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
7
application/views/web/test/index.php
Executable file
7
application/views/web/test/index.php
Executable file
@@ -0,0 +1,7 @@
|
||||
|
||||
<script type="text/javascript" language="Javascript">
|
||||
window.onbeforeunload = function() {
|
||||
console.log('event');
|
||||
return false; //here also can be string, that will be shown to the user
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user