MODx referer authentication snippet
<?php
/*
http://snipplr.com/view/17481/modx-referer-authentication-snippet/
MODx referer authentication snippet
For low level authentication only.
*/
$referer = $_SERVER['HTTP_REFERER'];
$referer_parse = parse_url($referer);
if($referer_parse['host'] == "site.com" || $referer_parse['host'] == "www.site.com") {
// download...
$chunk = $modx->getChunk("displayChunk");
echo $chunk;
} else {
//header("Location: http://www.mysite.com");
//$modx->sendRedirect();
echo $modx->getChunk("noAccess");
//exit();
}
?>