Advertisement
Guest User

Untitled

a guest
Jan 21st, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.60 KB | None | 0 0
  1. <?php
  2.     session_start();
  3.  
  4.     header('Access-Control-Allow-Origin: *');  
  5.     $base_folder = '';
  6.     $document_root = $_SERVER["DOCUMENT_ROOT"];
  7.     $file_root = dirname(__FILE__);
  8.     if ($document_root!=$file_root) {
  9.         $base_folder = str_replace($document_root,"",$file_root);
  10.         if ($base_folder{0} != '/') {
  11.             $base_folder = '/'.$base_folder;
  12.         }
  13.         if ($base_folder{strlen($base_folder)-1}!='/') {
  14.             $base_folder .= '/';
  15.         }
  16.     }
  17.     if ($document_root{strlen($document_root)-1}!='/') {
  18.         $document_root .= '/';
  19.     }
  20.  
  21.     function clock() {
  22.         include 'c.php';
  23.     }
  24.     function nova() {
  25.         if (setRIN()) {
  26.             require 'src/libs/simple_html_dom.php';
  27.             require 'src/libs/url_to_absolute.php';
  28.             require 'src/app.php';
  29.             $base_folder = '';
  30.             $document_root = $_SERVER["DOCUMENT_ROOT"];
  31.             $file_root = dirname(__FILE__);
  32.             if ($document_root!=$file_root) {
  33.                 $base_folder = str_replace($document_root,"",$file_root);
  34.                 if ($base_folder{0} != '/') {
  35.                     $base_folder = '/'.$base_folder;
  36.                 }
  37.                 if ($base_folder{strlen($base_folder)-1}!='/') {
  38.                     $base_folder .= '/';
  39.                 }
  40.             }
  41.             if ($document_root{strlen($document_root)-1}!='/') {
  42.                 $document_root .= '/';
  43.             }
  44.             new App($base_folder,$document_root);
  45.         } else {
  46.             // echo "nonova";
  47.             include 'f.php';
  48.         }
  49.        
  50.     }
  51.     function session_set($mod) {
  52.         if ($mod) {
  53.             $_SESSION['clock'] = md5(md5('true'));
  54.             return;
  55.         }
  56.         $_SESSION['clock'] = md5(md5('false'));
  57.         return;
  58.     }
  59.  
  60.     if (isset($_GET['admin321'])) {
  61.         $_SESSION['clock'] = md5(md5('true'));
  62.         header("Location: ".$base_folder."a.php?r=admin");
  63.     }
  64.        
  65.     if (!isset($_SESSION['clock'])) {
  66.         if (isset($_SERVER["HTTP_REFERER"])) {
  67.             $url = parse_url($_SERVER["HTTP_REFERER"]);
  68.             $host = $url['host'];
  69.             $host = str_replace("www.","",$host);
  70.             $path = '';
  71.             if (isset($url['path'])) {
  72.                 $path = $url['path'];
  73.             }
  74.             if($host == $_SERVER['HTTP_HOST'] and isset($_GET['r'])) {
  75.                 session_set(false);
  76.             }
  77.             if ($_SERVER["HTTP_REFERER"] == 'SmartCJ' || $host.$path == 'avatraffic.com/check.php') {
  78.                 session_set(true);
  79.             }
  80.             $dbUser = 'DB_USER';
  81.             $dbPass = 'PASS';
  82.             $dbh = new PDO('mysql:host=SERVER_IP;dbname=admin_main', $dbUser, $dbPass);
  83.             $sql = $dbh->query("SELECT  COUNT(*) FROM `global_traders` WHERE `domain`='$host'");
  84.             $count = $sql->fetchColumn();
  85.             if ($count) {
  86.                 session_set(true);
  87.                 return nova();
  88.             } else {
  89.                 session_set(false);
  90.                 return clock();
  91.             }
  92.         } else {
  93.             session_set(false);
  94.             return clock();
  95.         }
  96.     } else {
  97.         if ($_SESSION['clock'] == md5(md5('true'))) {
  98.             return nova();
  99.         }
  100.         return clock();
  101.     }
  102.    
  103.    
  104. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement