Created
February 1, 2010 01:51
-
-
Save patrickberkeley/291388 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # make sure referer is set | |
| if ((isset($_SERVER['HTTP_REFERER'])) and ($_SERVER['HTTP_REFERER']!= '')) { | |
| $url = urldecode($_SERVER['HTTP_REFERER']); | |
| $url_ary = parse_url($url); | |
| # make sure referer matches our domain (hardcoded as WEB_ROOT global variable) | |
| if (($url_ary[scheme].'://'.$url_ary[host]).'/' == WEB_ROOT) { | |
| # grab path, remove slash | |
| $url_path = substr($url_ary[path], 1); | |
| # redirect with message and id | |
| header("Location: ".WEB_ROOT.$url_path."?msg=".$message."&userID=".$_POST['userID']); | |
| } else { | |
| # redirect and kill if we're being spoofed | |
| header("Location: ".WEB_ROOT."index.php?msg=2"); | |
| die(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment