View Full Version : Referer Help

07-17-2007, 02:07 PM
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

// 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");

header("Location: http://$queryString");


But that will get the full posted query in the URL. Which contains all the info.

07-17-2007, 02:23 PM
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.

07-18-2007, 05:21 AM
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

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum