PageRenderTime 58ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/html/AppCode/expressionengine/libraries/Redirect.php

https://github.com/w3bg/www.hsifin.com
PHP | 61 lines | 25 code | 11 blank | 25 comment | 9 complexity | 62cf5d8211cb6f2a65054112adfcd1ed MD5 | raw file
Possible License(s): AGPL-3.0
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2. /**
  3. * ExpressionEngine - by EllisLab
  4. *
  5. * @package ExpressionEngine
  6. * @author ExpressionEngine Dev Team
  7. * @copyright Copyright (c) 2003 - 2010, EllisLab, Inc.
  8. * @license http://expressionengine.com/user_guide/license.html
  9. * @link http://expressionengine.com
  10. * @since Version 2.0
  11. * @filesource
  12. */
  13. // ------------------------------------------------------------------------
  14. /**
  15. * URL Redirect
  16. *
  17. * @package ExpressionEngine
  18. * @subpackage Core
  19. * @category Core
  20. * @author ExpressionEngine Dev Team
  21. * @link http://expressionengine.com
  22. */
  23. if ( ! isset($_GET['URL']))
  24. {
  25. exit();
  26. }
  27. $_GET['URL'] = str_replace(array("\r", "\r\n", "\n", '%3A','%3a','%2F','%2f'), array('', '', '', ':', ':', '/', '/'), $_GET['URL']);
  28. if (strncmp($_GET['URL'], 'http', 4) != 0 && strpos($_GET['URL'], '://') === FALSE && substr($_GET['URL'], 0, 1) != '/')
  29. {
  30. $_GET['URL'] = "http://".$_GET['URL'];
  31. }
  32. $_GET['URL'] = str_replace( array('"', "'", ')', '(', ';', '}', '{', 'script%', 'script&', '&#40', '&#41'), '', strip_tags($_GET['URL']));
  33. $host = ( ! isset($_SERVER['HTTP_HOST'])) ? '' : (substr($_SERVER['HTTP_HOST'],0,4) == 'www.' ? substr($_SERVER['HTTP_HOST'], 4) : $_SERVER['HTTP_HOST']);
  34. if ( ! isset($_SERVER['HTTP_REFERER']) OR ! stristr($_SERVER['HTTP_REFERER'], $host))
  35. {
  36. // Possibly not from our site, so we give the user the option
  37. // Of clicking the link or not
  38. $str = "<html>\n<head>\n<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>\n<title>Redirect</title>\n</head>\n<body>".
  39. "<p>To proceed to the URL you have requested, click the link below:</p>".
  40. "<p><a href='".$_GET['URL']."'>".$_GET['URL']."</a></p>\n</body>\n</html>";
  41. }
  42. else
  43. {
  44. $str = "<html>\n<head>\n<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>\n<title>Redirect</title>\n".
  45. '<meta http-equiv="refresh" content="0; URL='.$_GET['URL'].'">'.
  46. "\n</head>\n<body>\n</body>\n</html>";
  47. }
  48. exit($str);
  49. /* End of file Redirect.php */
  50. /* Location: ./system/expressionengine/libraries/Redirect.php */