Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Referer Help

  1. #1
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Referer Help

    I need to find the actual refering URL with a small snippet that will post it then have another script that will get the query from that and redirect there. ALthough i would prefer it if it was all hidden. Is there a way to do this? This is what i have so far

    Code:
    <?php 
    // find out the domain:
    $domain = $_SERVER['HTTP_HOST']; 
    
    // find out the path to the current file:
    
    $path = $_SERVER['SCRIPT_NAME']; 
    
    // find out the QueryString: 
    
    $queryString = $_SERVER['QUERY_STRING'];
    // put it all together: 
    
    $url = "http://" . $queryString; 
    // An alternative way is to use REQUEST_URI instead of both
    
    // SCRIPT_NAME and QUERY_STRING, if you don't need them seperate: 
    
    $url2 = "http://" . $domain . $_SERVER['REQUEST_URI'];
    
    mail($email, $subject, $message);
    
    $handle = fopen("log.txt", "a"); 
    
    foreach($_GET as $variable => $value) { fwrite($handle, $variable);
    
     fwrite($handle, "=");
    
     fwrite($handle, $value);
    
     fwrite($handle, "\r\n"); 
    
    } fwrite($handle, "\r\n"); 
    
    fclose($handle);
    header("Location: http://$queryString");
    exit;
    
    ?>
    But that will get the full posted query in the URL. Which contains all the info.

  • #2
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,169
    Thanks
    19
    Thanked 65 Times in 64 Posts
    does what you've posted actually work? It doesnt seem like it should and I'm not entirely certain what you're trying to do.

    It seems to send a blank email (or the part of the script that writes the email isnt included) then write a file that has each key & value pair on a new line then redirects to http://$queryString - which should go no-where
    The code you're using gets the current page (not the referer) and then doesnt do anytihng with that information.

  • #3
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    lol i know. I don't care about the email. What i want it to do is print the referer which when i try to use the Get referer it won't get it "<?
    $ref = getenv("HTTP_REFERER");
    echo $ref;
    ?> "
    and then i want to get that header and find the query string from that referer which would be "www.example.com/?querystring here" and then get that query string and go to that query. Get it? lol :S


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •