技术宅

当前位置:首页 > 网站教程 > 其他教程

其他教程

苹果CMS播放页被劫持跳转至第3方网站的解决方案

时间:11-07 作者:
解决方案
预加载页面也被劫持,须在后台--系统设置--播放器参数设置下将 预加载广告:缓冲广告:两项的内容全部删除,版本不同也相应寻找预加载和缓冲地址类似的选项删除即可

1.更
解决方案
预加载页面也被劫持,须在后台--系统设置--播放器参数设置下将 预加载广告:缓冲广告:两项的内容全部删除,版本不同也相应寻找预加载和缓冲地址类似的选项删除即可

1.更改网站根目录/static/js/player.js下的文件,为如下内容
对于v10版本用户
var MacPlayer = {    'GetUrl': function(s, n) {        return this.Link.replace('{sid}', s).replace('{sid}', s).replace('{nid}', n).replace('{nid}', n)    },    'Go': function(s, n) {        location.href = this.GetUrl(s, n)    },    'Show': function() {        $('#buffer').attr('src', this.Prestrain);        setTimeout(function() {            MacPlayer.AdsEnd()        }, this.Second * 1000);        $("#playleft").get(0).innerHTML = this.Html + '';        var a = document.createElement('script');        a.type = 'text/javascript';        a.async = true;        a.charset = 'utf-8';        a.src = '';        var b = document.getElementsByTagName('script')[0];        b.parentNode.insertBefore(a, b)    },    'AdsStart': function() {        if ($("#buffer").attr('src') != this.Buffer) {            $("#buffer").attr('src', this.Buffer)        }        $("#buffer").show()    },    'AdsEnd': function() {        $('#buffer').hide()    },    'Install': function() {        this.Status = false;        $('#install').show()    },    'Play': function() {        document.write('<style>.MacPlayer{background: #000000;font-size:14px;color:#F6F6F6;margin:0px;padding:0px;position:relative;overflow:hidden;width:100%;height:100%;min-heigh:300px;}.MacPlayer table{width:100%;height:100%;}.MacPlayer #playleft{position:inherit;!important;width:100%;height:100%;}</style><div class="MacPlayer">' + '<iframe id="buffer" src="" frameBorder="0" scrolling="no" width="100%" height="100%" style="position:absolute;z-index:99998;"></iframe><iframe id="install" src="" frameBorder="0" scrolling="no" width="100%" height="100%" style="position:absolute;z-index:99998;display:none;"></iframe>' + '<table border="0" cellpadding="0" cellspacing="0"><tr><td id="playleft" valign="top" style="">&nbsp;</td></table></div>');        this.Height = $('.MacPlayer').get(0).offsetHeight;        this.Width = $('.MacPlayer').get(0).offsetWidth;        document.write('<scr' + 'ipt src="' + this.Path + this.PlayFrom + '.js"></scr' + 'ipt>')    },    'Down': function() {},    'Init': function() {        this.Status = true;        this.Parse = '';        if (player_data.encrypt == '1') {            player_data.url = unescape(player_data.url);            player_data.url_next = unescape(player_data.url_next)        } else if (player_data.encrypt == '2') {            player_data.url = unescape(base64decode(player_data.url));            player_data.url_next = unescape(base64decode(player_data.url_next))        }        this.Prestrain = MacPlayerConfig.prestrain;        this.Buffer = MacPlayerConfig.buffer;        this.Second = MacPlayerConfig.second;        this.Flag = player_data.flag;        this.Trysee = player_data.trysee;        this.Points = player_data.points;        this.Link = decodeURIComponent(player_data.link);        this.PlayFrom = player_data.from;        this.PlayNote = player_data.note;        this.PlayServer = player_data.server == 'no' ? '' : player_data.server;        this.PlayUrl = player_data.url;        this.PlayUrlNext = player_data.url_next;        this.PlayLinkNext = player_data.link_next;        this.PlayLinkPre = player_data.link_pre;        if (MacPlayerConfig.server_list[this.PlayServer] != undefined) {            this.PlayServer = MacPlayerConfig.server_list[this.PlayServer].des        }        if (MacPlayerConfig.player_list[this.PlayFrom] != undefined) {            if (MacPlayerConfig.player_list[this.PlayFrom].ps == "1") {                this.Parse = MacPlayerConfig.player_list[this.PlayFrom].parse == '' ? MacPlayerConfig.parse : MacPlayerConfig.player_list[this.PlayFrom].parse;                this.PlayFrom = 'parse'            }        }        this.Path = maccms.path + '/static/player/';        if (this.Flag == "down") {            MacPlayer.Down()        } else {            MacPlayer.Play()        }    }};MacPlayer.Init();var MacPlayer = {    'GetUrl': function(s, n) {        return this.Link.replace('{sid}', s).replace('{sid}', s).replace('{nid}', n).replace('{nid}', n)    },    'Go': function(s, n) {        location.href = this.GetUrl(s, n)    },    'Show': function() {        $('#buffer').attr('src', this.Prestrain);        setTimeout(function() {            MacPlayer.AdsEnd()        }, this.Second * 1000);        $("#playleft").get(0).innerHTML = this.Html + '';        var a = document.createElement('script');        a.type = 'text/javascript';        a.async = true;        a.charset = 'utf-8';        a.src = '';        var b = document.getElementsByTagName('script')[0];        b.parentNode.insertBefore(a, b)    },    'AdsStart': function() {        if ($("#buffer").attr('src') != this.Buffer) {            $("#buffer").attr('src', this.Buffer)        }        $("#buffer").show()    },    'AdsEnd': function() {        $('#buffer').hide()    },    'Install': function() {        this.Status = false;        $('#install').show()    },    'Play': function() {        document.write('<style>.MacPlayer{background: #000000;font-size:14px;color:#F6F6F6;margin:0px;padding:0px;position:relative;overflow:hidden;width:100%;height:100%;min-heigh:300px;}.MacPlayer table{width:100%;height:100%;}.MacPlayer #playleft{position:inherit;!important;width:100%;height:100%;}</style><div class="MacPlayer">' + '<iframe id="buffer" src="" frameBorder="0" scrolling="no" width="100%" height="100%" style="position:absolute;z-index:99998;"></iframe><iframe id="install" src="" frameBorder="0" scrolling="no" width="100%" height="100%" style="position:absolute;z-index:99998;display:none;"></iframe>' + '<table border="0" cellpadding="0" cellspacing="0"><tr><td id="playleft" valign="top" style="">&nbsp;</td></table></div>');        this.Height = $('.MacPlayer').get(0).offsetHeight;        this.Width = $('.MacPlayer').get(0).offsetWidth;        document.write('<scr' + 'ipt src="' + this.Path + this.PlayFrom + '.js"></scr' + 'ipt>')    },    'Down': function() {},    'Init': function() {        this.Status = true;        this.Parse = '';        if (player_data.encrypt == '1') {            player_data.url = unescape(player_data.url);            player_data.url_next = unescape(player_data.url_next)        } else if (player_data.encrypt == '2') {            player_data.url = unescape(base64decode(player_data.url));            player_data.url_next = unescape(base64decode(player_data.url_next))        }        this.Prestrain = MacPlayerConfig.prestrain;        this.Buffer = MacPlayerConfig.buffer;        this.Second = MacPlayerConfig.second;        this.Flag = player_data.flag;        this.Trysee = player_data.trysee;        this.Points = player_data.points;        this.Link = decodeURIComponent(player_data.link);        this.PlayFrom = player_data.from;        this.PlayNote = player_data.note;        this.PlayServer = player_data.server == 'no' ? '' : player_data.server;        this.PlayUrl = player_data.url;        this.PlayUrlNext = player_data.url_next;        this.PlayLinkNext = player_data.link_next;        this.PlayLinkPre = player_data.link_pre;        if (MacPlayerConfig.server_list[this.PlayServer] != undefined) {            this.PlayServer = MacPlayerConfig.server_list[this.PlayServer].des        }        if (MacPlayerConfig.player_list[this.PlayFrom] != undefined) {            if (MacPlayerConfig.player_list[this.PlayFrom].ps == "1") {                this.Parse = MacPlayerConfig.player_list[this.PlayFrom].parse == '' ? MacPlayerConfig.parse : MacPlayerConfig.player_list[this.PlayFrom].parse;                this.PlayFrom = 'parse'            }        }        this.Path = maccms.path + '/static/player/';        if (this.Flag == "down") {            MacPlayer.Down()        } else {            MacPlayer.Play()        }  }};MacPlayer.Init();
对于v8版本用户:
window.onresize = function() {    if (window.name == "macopen1") {        MacPlayer.Width = $(window).width() - $(".MacPlayer").offset().left - 15;        MacPlayer.HeightAll = $(window).height() - $(".MacPlayer").offset().top - 15;        MacPlayer.Height = MacPlayer.HeightAll;        if (mac_showtop == 1) {            MacPlayer.Height -= 20        }        $(".MacPlayer").width(MacPlayer.Width);        $(".MacPlayer").height(MacPlayer.HeightAll);        $("#buffer").width(MacPlayer.Width);        $("#buffer").height(MacPlayer.HeightAll);        $("#Player").width(MacPlayer.Width);        $("#Player").height(MacPlayer.Height)    }};var MacPlayer = {    'GoPreUrl': function() {        if (this.Num > 0) {            this.Go(this.Src + 1, this.Num)        }    },    'GetPreUrl': function() {        return this.Num > 0 ? this.GetUrl(this.Src + 1, this.Num) : ''    },    'GoNextUrl': function() {        if (this.Num + 1 != this.PlayUrlLen) {            this.Go(this.Src + 1, this.Num + 2)        }    },    'GetNextUrl': function() {        return this.Num + 1 <= this.PlayUrlLen ? this.GetUrl(this.Src + 1, this.Num + 2) : ''    },    'GetUrl': function(s, n) {        return mac_link.replace('{src}', s).replace('{src}', s).replace('{num}', n).replace('{num}', n)    },    'Go': function(s, n) {        location.href = this.GetUrl(s, n)    },    'GetList': function() {        this.RightList = '';        for (i = 0; i < this.Data.from.length; i++) {            from = this.Data.from;            url = this.Data.url;            listr = "";            sid_on = 'h2';            sub_on = 'none';            urlarr = url.split('#');            for (j = 0; j < urlarr.length; j++) {                urlinfo = urlarr[j].split('$');                name = '';                url = '';                list_on = '';                from1 = '';                if (urlinfo.length > 1) {                    name = urlinfo[0];                    url = urlinfo[1];                    if (urlinfo.length > 2) {                        from1 = urlinfo[2]                    }                } else {                    name = "第" + (j + 1) + "集";                    url = urlinfo[0]                }                if (this.Src == i && this.Num == j) {                    sid_on = 'h2_on';                    sub_on = 'block';                    list_on = "list_on";                    this.PlayUrlLen = urlarr.length;                    this.PlayUrl = url;                    this.PlayName = name;                    if (from1 != '') {                        this.PlayFrom = from1                    }                    if (j < urlarr.length - 1) {                        urlinfo = urlarr[j + 1].split('$');                        if (urlinfo.length > 1) {                            name1 = urlinfo[0];                            url1 = urlinfo[1]                        } else {                            name1 = "第" + (j + 1) + "集";                            url1 = urlinfo[0]                        }                        this.PlayUrl1 = url1;                        this.PalyName1 = name1                    }                }                listr += '<li><a class="' + list_on + '" href="javascript:void(0)" onclick="MacPlayer.Go(' + (i + 1) + ',' + (j + 1) + ');return false;" >' + name + '</a></li>'            }            this.RightList += '<div id="main' + i + '" class="' + sid_on + '"><h2 onclick="MacPlayer.Tabs(' + i + ',' + (this.Data.from.length - 1) + ')">' + mac_show[from] + '</h2>' + '<ul id="sub' + i + '" style="display:' + sub_on + '">' + listr + '</ul></div>'        }    },    'ShowList': function() {        $('#playright').toggle()    },    'Tabs': function(a, n) {        var b = $('#sub' + a).css('display');        for (var i = 0; i <= n; i++) {            $('#main' + i).attr('className', 'h2');            $('#sub' + i).hide()        }        if (b == 'none') {            $('#sub' + a).show();            $('#main' + a).attr('className', 'h2_on')        } else {            $('#sub' + a).hide()        }    },    'Show': function() {        if (mac_showtop == 0) {            $("#playtop").hide()        }        if (mac_showlist == 0) {            $("#playright").hide()        }        setTimeout(function() {            MacPlayer.AdsEnd()        }, this.Second * 1000);        $("#topdes").get(0).innerHTML = '' + '正在播放:' + this.PlayName + '';        $("#playright").get(0).innerHTML = '<div class="rightlist" id="rightlist" style="height:' + this.Height + 'px;">' + this.RightList + '</div>';        $("#playleft").get(0).innerHTML = '<iframe id="buffer" src="' + this.Prestrain + '" frameBorder="0" scrolling="no" width="100%" height="' + this.Height + '" style="position:absolute;z-index:99998;"></iframe>' + this.Html + '';        document.write('<scr' + 'ipt src="' + '//union.maccms.com/html/top.js' + '"></scr' + 'ipt>')    },    'ShowBuffer': function() {        var w = this.Width - 100;        var h = this.Height - 100;        var l = (this.Width - w) / 2;        var t = (this.Height - h) / 2 + 20;        $(".MacBuffer").css({            'width': w,            'height': h,            'left': l,            'top': t        });        $(".MacBuffer").toggle()    },    'AdsEnd': function() {        $('#buffer').hide()    },    'Install': function() {        this.Status = false;        $('#install').parent().show();        $('#install').show()    },    'Play': function() {        var a = mac_colors.split(',');        document.write('<style>.MacPlayer{background: #' + a[0] + ';font-size:14px;color:#' + a[1] + ';margin:0px;padding:0px;position:relative;overflow:hidden;width:' + (this.Width == 0 ? '100%' : this.Width + 'px') + ';height:' + this.HeightAll + 'px;}.MacPlayer a{color:#' + a[2] + ';text-decoration:none}a:hover{text-decoration: underline;}.MacPlayer a:active{text-decoration: none;}.MacPlayer table{width:100%;height:100%;}.MacPlayer ul,li,h2{ margin:0px; padding:0px; list-style:none}.MacPlayer #playtop{text-align:center;height:20px; line-height:21px;font-size:12px;}.MacPlayer #topleft{width:150px;}.MacPlayer #topright{width:100px;} .MacPlayer #topleft{text-align:left;padding-left:5px}.MacPlayer #topright{text-align:right;padding-right:5px}.MacPlayer #playleft{width:100%;height:100%;overflow:hidden;}.MacPlayer #playright{height:100%;overflow-y:auto;}.MacPlayer #rightlist{width:120px;overflow:auto;scrollbar-face-color:#' + a[7] + ';scrollbar-arrow-color:#' + a[8] + ';scrollbar-track-color: #' + a[9] + ';scrollbar-highlight-color:#' + a[10] + ';scrollbar-shadow-color: #' + a[11] + ';scrollbar-3dlight-color:#' + a[12] + ';scrollbar-darkshadow-color:#' + a[13] + ';scrollbar-base-color:#' + a[14] + ';}.MacPlayer #rightlist ul{ clear:both; margin:5px 0px}.MacPlayer #rightlist li{ height:21px; line-height:21px;overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}.MacPlayer #rightlist li a{padding-left:15px; display:block; font-size:12px}.MacPlayer #rightlist h2{ cursor:pointer;font-size:13px;font-family: "宋体";font-weight:normal;height:25px;line-height:25px;background:#' + a[3] + ';padding-left:5px; margin-bottom:1px}.MacPlayer #rightlist .h2{color:#' + a[4] + '}.MacPlayer #rightlist .h2_on{color:#' + a[5] + '}.MacPlayer #rightlist .ul_on{display:block}.MacPlayer #rightlist .list_on{color:#' + a[6] + '} </style><div class="MacPlayer"><table border="0" cellpadding="0" cellspacing="0"><tr><td colspan="2"><table border="0" cellpadding="0" cellspacing="0" id="playtop"><tr><td width="100" id="topleft"><a target="_self" href="javascript:void(0)" onclick="MacPlayer.GoPreUrl();return false;">上一集</a> <a target="_self" href="javascript:void(0)" onclick="MacPlayer.GoNextUrl();return false;">下一集</a></td><td id="topcc"><div id="topdes" style="height:26px;line-height:26px;overflow:hidden"></div></td><td width="100" id="topright"><a target="_self" href="javascript:void(0)" onClick="MacPlayer.ShowList();return false;">开/关列表</a></td></tr></table></td></tr><tr style="display:none"><td colspan="2" id="install" style="display:none"></td></tr><tr><td id="playleft" valign="top">&nbsp;</td><td id="playright" valign="top">&nbsp;</td></tr></table></div>');        document.write('<scr' + 'ipt src="' + this.Path + this.PlayFrom + '.js"></scr' + 'ipt>')    },    'Down': function() {},    'Init': function() {        this.Status = true;        this.Url = location.href;        this.Par = location.search;        this.Data = {            'from': mac_from.split('$$$'),            'server': mac_server.split('$$$'),            'note': mac_note.split('$$$'),            'url': mac_url.split('$$$')        };        var c = navigator.userAgent.toLowerCase();        this.Width = window.name == 'macopen1' ? mac_widthpop : (mac_width == 0 ? '100%' : mac_width);        this.HeightAll = window.name == 'macopen1' ? mac_heightpop : mac_height;        if (c.indexOf("android") > 0 || c.indexOf("mobile") > 0 || c.indexOf("ipod") > 0 || c.indexOf("ios") > 0 || c.indexOf("iphone") > 0 || c.indexOf("ipad") > 0) {            this.Width = window.name == 'macopen1' ? mac_widthpop : (mac_widthmob == 0 ? '100%' : mac_widthmob);            this.HeightAll = window.name == 'macopen1' ? mac_heightpop : mac_heightmob        }        this.Height = this.HeightAll;        if (mac_showtop == 1) {            this.Height -= 20        }        if (this.Url.indexOf('#') > -1) {            this.Url = this.Url.substr(0, this.Url.indexOf('#'))        }        this.Prestrain = mac_prestrain;        this.Buffer = mac_buffer;        this.Second = mac_second;        this.Flag = mac_flag;        var a = this.Url.match(/d+.*(htm)/g)[0].match(/d+/g);        if (a.length < 3) {            a = this.Url.match(/d+.*/g)[0].match(/d+/g)        }        var b = a.length;        this.Id = a[(b - 3)] * 1;        this.Src = a[(b - 2)] * 1 - 1;        this.Num = a[(b - 1)] * 1 - 1;        this.PlayFrom = this.Data.from[this.Src];        this.PlayServer = this.Data.server[this.Src] == 'no' ? '' : mac_show_server[this.Data.server[this.Src]];        this.PlayNote = this.Data.note[this.Src];        this.GetList();        this.NextUrl = this.GetNextUrl();        this.PreUrl = this.GetPreUrl();        this.Path = SitePath + 'player/';        if (this.Flag == "down") {            MacPlayer.Down()        } else {            MacPlayer.Play()        }    }};

2.(非必须项,此项的目的是让js的更改忽略部分CDN和浏览器缓存,此处以v10为例)更改/application/common/controller/all.php中的第429行以使得JS更改即时对所有用户生效
原429行为:

$this->assign('player_js', '<script src="' . MAC_PATH . 'static/js/playerconfig.js"></script><script src="' . MAC_PATH . 'static/js/player.js"></script>');
更改为:
$this->assign('player_js', '<script src="' . MAC_PATH . 'static/js/playerconfig.js?'. date("Ymdhis") . '"></script><script src="' . MAC_PATH . 'static/js/player.js?'. date("Ymdhis") . '"></script>');