Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- //get referrer url
- if (!isset($_SESSION["origURL"]))
- $_SESSION["origURL"] = $_SERVER["HTTP_REFERER"];
- $url = $_SESSION["origURL"];
- //get the 123/456 from the url
- $last = parse_url($url, PHP_URL_PATH);
- $where = substr($last, -7, 3);
- //get the users ip address
- $IP_address = $_SERVER["REMOTE_ADDR"];
- //where should we send the user?
- if ($IP_address == "123.456.789" || $IP_address == "987.654.321") {
- header( 'Location: http://example.com/original-link' );
- }
- else {
- if ($where == "123") {
- header( 'Location: http://example.com/custom_string1='.$where ) ;
- }
- elseif ($where == "456") {
- header( 'Location: http://example.com/custom_string2='.$where );
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement