Advertisement
DDCCPP

referrer

Jan 26th, 2021
758
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.14 KB | None | 0 0
  1. <?php
  2. if(isset($_SERVER['HTTP_REFERER']) == 'l.facebook.com') {
  3.     if(isset($_GET['id'])) {
  4.         if(strlen($_GET['id']) == 5) {
  5.             require('../include/config.php');
  6.             $url = mysqli_real_escape_string($conn, $_GET['id']);
  7.             $urlQuery = "SELECT * FROM url_data WHERE urlCode = '{$url}'";
  8.             $result = mysqli_query($conn, $urlQuery);
  9.            
  10.            
  11.     if(isset($_SERVER['HTTP_REFERER']) == 'l.facebook.com') {
  12.       if (mysqli_num_rows($result) > 0) {
  13.                 $redirectUrl =  mysqli_fetch_assoc($result);
  14.                 $countQuery = "UPDATE url_data SET v_facebook=v_facebook + 1 WHERE urlCode = '{$redirectUrl['urlCode']}' ";
  15.                 if(!mysqli_query($conn, $countQuery)) {
  16.                     header('Location: index.php');
  17.                     die();
  18.                 }
  19.             }
  20.            
  21.    }  
  22.             header('Location: ' . $redirectUrl['initialUrl']);
  23.             die();
  24.         }
  25.     } else  {
  26.         header('Location: ../index.php');
  27.         die();
  28.     }
  29.    
  30. }
  31.  
  32. if(isset($_SERVER['HTTP_REFERER']) == 'l.instagram.com') {
  33.     if(isset($_GET['id'])) {
  34.         if(strlen($_GET['id']) == 5) {
  35.             require('../include/config.php');
  36.             $url = mysqli_real_escape_string($conn, $_GET['id']);
  37.             $urlQuery = "SELECT * FROM url_data WHERE urlCode = '{$url}'";
  38.             $result = mysqli_query($conn, $urlQuery);
  39.            
  40.            
  41.     if(isset($_SERVER['HTTP_REFERER']) == 'l.instagram.com') {
  42.       if (mysqli_num_rows($result) > 0) {
  43.                 $redirectUrl =  mysqli_fetch_assoc($result);
  44.                 $countQuery = "UPDATE url_data SET v_instagram=v_instagram + 1 WHERE urlCode = '{$redirectUrl['urlCode']}' ";
  45.                 if(!mysqli_query($conn, $countQuery)) {
  46.                     header('Location: index.php');
  47.                     die();
  48.                 }
  49.             }
  50.            
  51.    }  
  52.             header('Location: ' . $redirectUrl['initialUrl']);
  53.             die();
  54.         }
  55.     } else  {
  56.         header('Location: ../index.php');
  57.         die();
  58.     }
  59.    
  60. }
  61.  
  62.  
  63. if(isset($_SERVER['HTTP_REFERER']) == '') {
  64.     if(isset($_GET['id'])) {
  65.         if(strlen($_GET['id']) == 5) {
  66.             require('../include/config.php');
  67.             $url = mysqli_real_escape_string($conn, $_GET['id']);
  68.             $urlQuery = "SELECT * FROM url_data WHERE urlCode = '{$url}'";
  69.             $result = mysqli_query($conn, $urlQuery);
  70.            
  71.            
  72.     if(isset($_SERVER['HTTP_REFERER']) == '') {
  73.       if (mysqli_num_rows($result) > 0) {
  74.                 $redirectUrl =  mysqli_fetch_assoc($result);
  75.                 $countQuery = "UPDATE url_data SET visitas=visitas + 1 WHERE urlCode = '{$redirectUrl['urlCode']}' ";
  76.                 if(!mysqli_query($conn, $countQuery)) {
  77.                     header('Location: index.php');
  78.                     die();
  79.                 }
  80.             }
  81.            
  82.    }  
  83.             header('Location: ' . $redirectUrl['initialUrl']);
  84.             die();
  85.         }
  86.     } else  {
  87.         header('Location: ../index.php');
  88.         die();
  89.     }
  90.    
  91. }
  92.  
  93.  
  94. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement