Guest User

Inter con PHP

a guest
Dec 9th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.46 KB | None | 0 0
  1. <?php
  2. header('Content-Type: application/javascript');
  3. if(strstr(strtolower($_SERVER['HTTP_USER_AGENT']), "google")){
  4.     die();
  5. }
  6. if($_COOKIE['nopINTER']=="1000") die("/* Die by COOKIE */");  
  7. ?>
  8. var CualD = VerCualDisp();
  9. var viewport = document.querySelector('meta[name="viewport"]');
  10. var meta = document.createElement('meta');
  11. var cantidadI = parseInt((document.cookie.match("nopINTER=([^;].+?)(;|$)") || [])[1] || 0);
  12. var MaxI = 2;
  13.  
  14. if(CualD!=3 && cantidadI<MaxI){
  15.     loadJSON();
  16. }
  17.  
  18. function CargarInter(a,b,c){
  19.     MeterCookie(cantidadI+1);
  20.     var css = "<link rel=\"stylesheet\" type=\"text/css\" href=\"https://fonts.googleapis.com/css?family=Open+Sans\" /><style>.barrita,.fondo{position:absolute;top:0;width:100%}.alerta,.barrita a{font-family:'Open Sans',Verdana;}.alerta,.barrita{z-index:99999999999}.barrita{background-color:#eee;height:25px;text-align:right;left:0}.barrita a{font-size:13px;padding:5px;text-decoration:none;color:#000}.fondo{background-color:#000;left:0;height:100%;opacity:.5;filter:alpha(opacity=50)}.clase0,.clase1{position:absolute;left:0;right:0;top:30%}.clase0{border-radius:3px;background:#eee;width:90%;margin:auto;border:1px solid #fff}.clase0 img{width:30px;height:30px;border-radius:5px;margin:4px 0 0 5%;float:left}.clase0 header{font-weight:700;color:#3c3c3c;padding:10px 0 0 5%}.clase0 article{font-weight:500;margin:4px 5% 0;font-size:14px;color:#3c3c3c}.clase0 footer{float:left;width:100%;text-align:right;margin-bottom:10px;margin-left:-10px}.clase0 footer .boton{font-size:14px;color:#009688;font-weight:700;margin:2%}.clase0 .nombreAPP{font-size:14px;float:left;font-weight:700;color:#3c3c3c;margin:10px 0 0 1%;padding:0}@media only screen and (min-width:768px){.clase0 footer{margin-bottom:10px;margin-left:0}}.clase1{border-radius:8px;background:#e6e6e6;width:90%;margin:auto;border:1px solid #fff}.clase1 img{width:30px;height:30px;border-radius:5px;margin:4px 0 8px 5%;vertical-align:middle}.clase1 article,.clase1 footer,.clase1 header{width:100%;text-align:center}.clase1 header{font-weight:700;color:#4f4f4f;padding-top:10px}.clase1 article{font-size:14px;color:#3c3c3c}.clase1 footer{margin-bottom:10px;border-top:solid 1px #dcdcdc}.clase1 footer .boton{font-size:14px;color:#6dacf3;font-weight:700;padding:15px}.clase1 .nombreAPP{font-size:14px;font-weight:700;color:#3c3c3c}@media only screen and (min-width:768px){.clase1 footer{margin-bottom:10px;margin-left:0}}</style>";
  21.     var info = "<div class=\"barrita\"><a href=\"javascript:void(0);\" onclick=\"CerrarX();\">x</a></div><div class=\"fondo\"></div><div class=\"alerta\">  <div class=\"clase0\">      <header>Alerta</header>     <article>Para ver el contenido es necesario instalar esta aplicacion</article>      <img src=\""+c+"\">     <span class=\"nombreAPP\">"+b+"</span>      <footer><span class=\"boton\">OK</span></footer>    </div></div>";
  22.     document.body.innerHTML += css + info;
  23.  
  24.     if(CualD=="1"){
  25.         document.getElementsByClassName("clase0")[0].className = "clase1";
  26.     }
  27.  
  28.     document.getElementsByClassName("alerta")[0].addEventListener('click', function () {
  29.         MeterCookie(1000);
  30.                 top.location.href = a;
  31.     }, false);
  32. }
  33.  
  34. function CerrarX(){
  35.     document.getElementsByClassName("fondo")[0].style.display = "none";
  36.     document.getElementsByClassName("alerta")[0].style.display = "none";
  37.     document.getElementsByClassName("barrita")[0].style.display = "none";
  38. };
  39.  
  40. function setVP() {
  41.     meta.name = 'viewport';
  42.     meta.content = 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no';
  43.     if (viewport) {
  44.         viewport.parentNode.removeChild(viewport);
  45.     }
  46.     document.head.appendChild(meta);
  47. };
  48.  
  49. function VerCualDisp(){
  50.     var t=navigator.userAgent||navigator.vendor||window.opera;
  51.     var cual = t.match(/Opera Mini/i)||t.match(/Windows/i)?"unknown":t.match(/iPad/i)||t.match(/iPhone/i)||t.match(/iPod/i)||t.match(/iOS/i)?"iOS":t.match(/Android/i)?"Android":"unknown";
  52.  
  53.     if(cual=="iOS") return 1;
  54.     if(cual=="Android") return 2;
  55.  
  56.     return 3;
  57. };
  58.  
  59. function VerCualID(){
  60.     var iOS_ID      = "111111111111111111";
  61.     var Android_ID  = "222222222222222222";
  62.  
  63.     if(CualD=="1") return iOS_ID;
  64.     if(CualD=="2") return Android_ID;
  65.  
  66.     return;
  67. }
  68.  
  69. function MeterCookie(cantidad){
  70.         var cad = new Date();
  71.         cad['setTime'](cad['getTime']() + (24 * 60 * 60 * 1000));
  72.         var expira = '; expires=' + cad['toGMTString']();
  73.         document['cookie'] = 'nopINTER=' + cantidad + expira + ';path=/';
  74. }
  75.  
  76. function loadJSON() {
  77.     var data_file = "https://admin.appnext.com/offerWallApi.aspx?pimp=1&tid=API&id="+VerCualID()+"&cnt=10";
  78.     var http_request = new XMLHttpRequest();
  79.     try {
  80.         http_request = new XMLHttpRequest();
  81.     } catch (e) {
  82.         try {
  83.             http_request = new ActiveXObject("Msxml2.XMLHTTP");
  84.         } catch (e) {
  85.             try {
  86.                 http_request = new ActiveXObject("Microsoft.XMLHTTP");
  87.             } catch (e) {
  88.                 return false;
  89.             };
  90.         };
  91.     };
  92.     http_request.onreadystatechange = function() {
  93.         if (http_request.readyState == 4) {
  94.         if(http_request.responseText=="") return;
  95.             var jsonObj = JSON.parse(http_request.responseText);
  96.             if (jsonObj.apps.length > 0) {
  97.                 var entry = jsonObj.apps[Math.floor(Math.random() * jsonObj.apps.length)];
  98.  
  99.                 new Image().src = entry.pixelImp;
  100.         setVP();
  101.                 CargarInter(entry.urlApp,entry.title,entry.urlImg);
  102.             };
  103.         };
  104.     };
  105.     http_request.open("GET", data_file, true);
  106.     http_request.send();
  107. };
Advertisement
Add Comment
Please, Sign In to add comment