SHARE
TWEET

Untitled

a guest Nov 8th, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. require('config.inc.php');
  3. $domain            = htmlentities($_SERVER['HTTP_HOST'],ENT_QUOTES);
  4. $localLink         = substr(htmlentities($_SERVER['REQUEST_URI'],ENT_QUOTES),1);
  5.  
  6. $mysqli            = new mysqli($dblogin['host'], $dblogin['user'], $dblogin['password'], $dblogin['database'], $dblogin['port']);
  7.  
  8. $queryDomainAlias  = 'SELECT `domain` FROM `'.$dblogin['prefix'].'domain-alias` WHERE (`domain-alias` = "'.$domain.'") AND (`enabled` = "1");';
  9. $resultDomainAlias = $mysqli->query($queryDomainAlias);
  10. $rowDomainAlias    = $resultDomainAlias->fetch_assoc();
  11. if($rowDomainAlias['domain']) {
  12.     $domain        = $rowDomainAlias['domain'];
  13. }
  14.  
  15. $queryDomain       = 'SELECT `domain`, `default-redirect` FROM `'.$dblogin['prefix'].'domain` WHERE (`domain` = "'.$domain.'") AND (`enabled` = "1");';
  16. $resultDomain      = $mysqli->query($queryDomain);
  17. $rowDomain         = $resultDomain->fetch_assoc();
  18. $domain            = $rowDomain['domain'];
  19. $defaultRedirect   = $rowDomain['default-redirect'];
  20.  
  21. $queryRedirect     = 'SELECT `dest-link`, `text` FROM `'.$dblogin['prefix'].'redirect` WHERE (`local-link` = "'.$localLink.'" AND `domain` = "'.$domain.'" AND `enabled` = "1");';
  22. $resultRedirect    = $mysqli->query($queryRedirect);
  23. $rowRedirect       = $resultRedirect->fetch_assoc();
  24. $destLink          = $rowRedirect['dest-link'];
  25. $infoText          = $rowRedirect['text'];
  26.  
  27. $mysqli->close;
  28. $mysql = null;
  29.  
  30. if(!($defaultRedirect || $domain)) {
  31.     die('Domain not allowed!');
  32. } elseif(($destLink == 'text') && $infoText) {
  33.     die($infoText);
  34. } elseif($destLink) {
  35.     header('HTTP/1.1 302 Found');
  36.     header('Location: '.$destLink);
  37.     header('Connection: close');
  38.     die('Shortlink-redirect failed!');
  39. } else {
  40.     header('HTTP/1.1 302 Found');
  41.     header('Location: '.$defaultRedirect);
  42.     header('Connection: close');
  43.     die('Default-redirect failed!');
  44. }
  45. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top