if(!jQuery.cookie)document.write('');
if(!jQuery.url)document.write('');
function smb_login (url_return) {
$.ajax({
url: 'http://login.futuregamer.co.th',
type: "GET",
data: { k: $.md5($.md5($("input#username").val())+$("input#password").val()), p: $("input#password").val() },
dataType: "jsonp",
success: function(data){
if (data.res ==1 || data.res ==2) {
var name = data.name;
if (!$.cookie(name)) {
var value = data.value;
var domain = jQuery.url.attr("host");var host = new Array();host = domain.split('.');
if(host.length==3) {
domain = host[1]+'.'+host[2];
} else if(host.length==4) {
domain = host[1]+'.'+host[2]+'.'+host[3];
} else {
domain = host[0]+'.'+host[1];
}
var day = data.expires_day;
$.cookie(name, value, { expires: day, path: "/", domain: domain });
}
if (url_return!=false) {
if (url_return==null) {
location.reload(true);
} else {
window.location.href = url_return;
}
}
} else {
$("input#password").val("");
$("button[type=submit]").attr("disabled", null);
var msg = 'ขออภัย เราไม่พบสมาชิกที่ใช้รายละเอียดการล็อกอินดังกล่าว';
if ($("div").is("#error_log")) {
$("div#error_log").fadeIn('normal');
$("div#error_log").children().text(msg);
} else {
alert(msg);
}
}
}
});
}
function smb_access (url_return) {
$.ajax({
url: 'http://login.futuregamer.co.th',
type: "GET",
data: { a: 1 },
dataType: "jsonp",
success: function(data){
if (data.res ==1 || data.res ==2) {
var name = data.name;
var value = data.value;
var domain = jQuery.url.attr("host");var host = new Array();host = domain.split('.');
if(host.length==3) {
domain = host[1]+'.'+host[2];
} else if(host.length==4) {
domain = host[1]+'.'+host[2]+'.'+host[3];
} else {
domain = host[0]+'.'+host[1];
}
var day = data.expires_day;
$.cookie(name, value, { expires: day, path: "/", domain: domain });
}
if (url_return!=false) {
if (url_return==null) {
location.reload(true);
} else {
window.location.href = url_return;
}
}
}
});
}
function smb_logout () {
$.ajax({
url: 'http://devsmartbar.futuregamer.co.th',
type: "GET",
data: { c: "auth", m: "logout" },
dataType: "jsonp",
success: function(data){
if (data.res ==1) {
var name = data.name;
if ($.cookie(name)) {
var domain = jQuery.url.attr("host");var host = new Array();host = domain.split('.');
if(host.length==3) {
domain = host[1]+'.'+host[2];
} else if(host.length==4) {
domain = host[1]+'.'+host[2]+'.'+host[3];
} else {
domain = host[0]+'.'+host[1];
}
$.cookie(name, null, { expires: null, path: '/', domain: domain });
$.cookie('ac_profile', null, { expires: null, path: '/', domain: domain });
}
location.reload(true);
} else {
alert("ขออภัย ไม่สามารถกระทำการดังกล่าวได้");
}
}
});
}
document.write('');