i/jif.php
by webproger on 2022-09-02
ᐥ...ᐥ
var jif = {
     i  : null
    ,ip : '<?php echo $_SERVER["REMOTE_ADDR"]; ?>'
    ,cy : ''
    ,cu : location.href
    ,ru : document.referrer
    ,ou : ''
    ,ac : null
    ,ar : null
    ,ao : null
    ,usragnt : navigator.userAgent
    ,ch : null
    ,cw : null
    ,pt : null
    ,ri : /^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/i
    ,ra : /(microsoft internet explorer|msie|netscape6|netscape|galeon|phoenix|mozilla firebird|firebird|firefox|chimera|camino|epiphany|chrome|safari|k-meleon|opera|konqueror|icab|lynx|links|ncsa mosaic|amaya|omniweb|hotjava|browsex|amigavoyager|amiga-aweb|ibrowse)[\/\sa-z(]*([0-9]+)([\.0-9a-z]+)?/i
    ,gh : function() {
      if(typeof(document.compatMode)=='undefined' ) return document.documentElement.clientHeight;
      else if(document.compatMode   =='BackCompat') return document.body.clientHeight;
      else if(document.compatMode   =='CSS1Compat') return document.documentElement.clientHeight;
    }
    ,gw : function() {
      if(typeof(document.compatMode)=='undefined' ) return document.documentElement.clientWidth;
      else if(document.compatMode   =='BackCompat') return document.body.clientWidth;
      else if(document.compatMode   =='CSS1Compat') return document.documentElement.clientWidth;
    }
    ,ls : function() {
        if(document.documentElement.requestFullscreen)
            document.getElementsByTagName('body')[0].requestFullscreen();
        else if(document.documentElement.webkitRequestFullScreen)
            document.getElementsByTagName('body')[0].webkitRequestFullScreen();
        screen.orientation.lock("landscape-primary");
        jif.i.style.visibility = 'hidden';
    }
    ,fs : function() {
        if(jif.pt && false) {
            jif.i = document.createElement("img");
            jif.i.setAttribute("src","http://qindex.info/g/jif.png");
            jif.i.setAttribute("onclick","jif.ls();");
            jif.i.style.position = 'fixed';
            jif.i.style.width  = '30px';
            jif.i.style.height = '30px';
            jif.i.style.right  = '10px';
            jif.i.style.bottom = '10px';
            jif.i.style.zIndex = '1000';
            document.getElementsByTagName("body")[0].appendChild(jif.i);
        }
    }
    ,dt : function(y,d,h,m,s) {
        var t = new Date();
        var e = new Date();
        e.setTime(t.getTime()
                  +1000*60*60*24*365*y
                  +1000*60*60*24    *d
                  +1000*60*60       *h
                  +1000*60          *m
                  +1000             *s);
        return e;
    }
    /*
    String name, content
    Date expires
    String path, domain
    Boolean secure
    optional: expires,path,domain,secure
    */
    ,ck : function(n,v,e,p,d,s) {
        var c,i,j;
        if(arguments.length==0) {
            return document.cookie;
        } else if(arguments.length==1) {
            if(document.cookie.length>0) {
                c = n+'=';
                i = document.cookie.indexOf(c);
                if(i==-1) return false;
                else {
                    i += c.length;
                    j = document.cookie.indexOf(';',i);
                    if(j==-1) j = document.cookie.length;
                    return unescape(document.cookie.substring(i,j));
                }
            } else return false;
        } else {
            if(!v) var e = jif.dt(0,0,0,0,0);
            document.cookie = n+'='  + escape(v)       + ';'
                + ((e) ? ' expires=' + e.toGMTString() + ';' : '')
                + ((p) ? ' path='    + p               + ';' : '')
                + ((d) ? ' domain='  + d               + ';' : '')
                + ((s) ? ' secure'                     + ';' : '');
        }
    }
    ,ui : function(n,v) {
        if(n=='cu')      var x = jif.ac;
        else if(n=='ru') var x = jif.ar;
        else if(n=='ou') var x = jif.ao;
        switch(v) {
            case 'protocol': if(typeof(x[2])!='undefined') return x[2]; else return '';
            case 'host'    : if(typeof(x[4])!='undefined') return x[4]; else return '';
            case 'path'    : if(typeof(x[5])!='undefined') return x[5]; else return '';
            case 'qs'      : if(typeof(x[7])!='undefined') return x[7]; else return '';
            case 'hash'    : if(typeof(x[9])!='undefined') return x[9]; else return '';
        }
        return '';
    }
    ,qs : function(n,v) {
        var s,r,x,y,k;
        s = jif.ui(n,'qs');
        r = new RegExp("[^;/?:@&=+$,#]+=[^;/?:@&=$,#]*",'g');
        x = s.match(r);
        r = new RegExp("([^;/?:@&=+$,#]+)=([^;/?:@&=$,#]*)");
        try{
            for(k=0; k<x.length; k++) {
                y = x[k].match(r);
                if(y[1]==v) return decodeURIComponent(y[2]);
            }
        } catch(e) {}
        return '';
    }
    ,nw : function(n,v) {
        var x,y,r;
        x  = jif.ui('cu','protocol');
        x += '://'+jif.ui('cu','host');
        x += jif.ui('cu','path');
        y  = jif.ui('cu','qs');
        if(y) {
            if(jif.qs('cu',n)) {
                if(v) {
                    r = new RegExp(n+"=([^;/?:@&=$,#]*)");
                    x += '?'+y.replace(r,n+"="+v);
                } else {
                    r = new RegExp("(&?"+n+"=[^;/?:@&=$,#]*)");
                    x += '?'+y.replace(r,'');
                }
            } else x += '?'+y+'&'+n+'='+v;
        } else x += '?'+n+'='+v;
        if(jif.ui('cu','hash')) x += '#'+jif.ui('cu','hash');
        return x;
    }
    ,ua : function(v) {
        switch(v) {
            case 'browser':
                var x = jif.usragnt.match(jif.ra);
                if(x && x[1] && x[2]) return x[1]+' '+x[2]; else return '';
        }
    }
    ,set : function() {
        var w = window;
        var n = 0;
        jif.ch = jif.gh();
        jif.cw = jif.gw();
        if(jif.cw<jif.ch) jif.pt = 1;
        while(n<100) {
            n++;
            try{ if( w.parent.location.href && w.parent!=w ) w = w.parent; else break;
            } catch(e){ break; }
        }
        if(w.document.referrer) {
            jif.ou = w.document.referrer;
        } else if(jif.usragnt.toLowerCase().indexOf('msie')!=-1) {
            try{ if(typeof(w.opener.location.href)!='undefined') jif.ou = w.opener.location.href; } catch(e){}
        } else if(jif.usragnt.toLowerCase().indexOf('chrome')!=-1) {
            try{ if(typeof(w.opener.location.href)!='undefined') jif.ou = w.opener.location.href; } catch(e){}
        }
        jif.ac = jif.cu.match(jif.ri);
        jif.ar = jif.ru.match(jif.ri);
        jif.ao = jif.ou.match(jif.ri);
    }
};
jif.set();
<?php
include $_SERVER['DOCUMENT_ROOT']."/i/idb.php";
$d_link = @mysql_connect($d_server,$d_user,$d_psswrd)
    or die("Could not connect to the DATABASE.");
mysql_select_db($d_name,$d_link);

$ip = $_SERVER["REMOTE_ADDR"];
$tm = time();

$r = mysql_query("SELECT * FROM ipc WHERE ip='".$ip."'",$d_link);
if($a=mysql_fetch_array($r)) {
    echo "jif.cy = '".trim($a['cy'])."';";
} else {
    //$a = file("http://ip-api.com/line/".$ip);
    //mysql_query("INSERT INTO ipc SET i='".$ip."',c='".trim($a[1])."',t=".$tm,$d_link);
    //echo "jif.cy = '".$a[1]."';";
}
?>