Advertisement
Guest User

Untitled

a guest
Oct 11th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. <?php
  2. date_default_timezone_set('America/Danmarkshavn');
  3. class StartupCJ {
  4. public $db_host = '162.244.33.58';
  5. public $db_user = 'admin_ftt';
  6. public $db_pass = 'safasafas';
  7. public $db_name;
  8. public $data;
  9.  
  10. public $use_cloak = true;
  11.  
  12. function checkClock() {
  13.  
  14. $this->db_name = 'admin_'.str_replace("www.", "", $_SERVER['HTTP_HOST']);
  15.  
  16. if (!empty($this->data)) {
  17. if (in_array($_SERVER["REMOTE_ADDR"], $this->data)) {
  18. $this->use_cloak = false;
  19. }
  20. }
  21.  
  22. if ($this->use_cloak) {
  23.  
  24. if (isset($_SERVER["HTTP_REFERER"])) {
  25.  
  26. $url = parse_url($_SERVER["HTTP_REFERER"]);
  27.  
  28. if (isset($url['host'])) {
  29.  
  30. $main_host = str_replace("www.", "", $_SERVER['SERVER_NAME']);
  31. $referer = str_replace("www.", "", $url['host']);
  32. $dbh = new PDO('mysql:host='.$this->db_host.';dbname='.$this->db_name, $this->db_user, $this->db_pass);
  33. $sql = $dbh->query("SELECT COUNT(*) FROM `traders` WHERE `domain`='$referer'");
  34. $count = $sql->fetchColumn();
  35.  
  36. if ($count>0 and $main_host!=$referer) {
  37. $count = null;
  38. $sql = null;
  39. $dbh = null;
  40. return true;
  41. } else {
  42. $count = null;
  43. $sql = null;
  44. $dbh = null;
  45. return false;
  46. }
  47.  
  48. } else {
  49. return false;
  50. }
  51.  
  52. } else {
  53. return false;
  54. }
  55.  
  56. } else {
  57. return true;
  58. }
  59. }
  60.  
  61. }
  62. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement