Forum Moderators: coopster
<?php
//Here is the function i used to find the Query. THanks anyways for //the help Habtom :D
// 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'];
?>
<?php
$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: pagetoredirect.php"); after finishing the text writing.
you can also use
header("refresh:5; url='pagetoredirect.php'"); after finishing writing, it will redirect after 5 seconds, you can change the number of seconds there. this can be used if you want to display a message too that the writing is successful now redirecting..
remember there shouldn't be any output before header() otherwise it will give you 'header already sent' error. if you do have some output before header() then you can use ob_start() on the top of your page to skip that error by artificial buffering.
// 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: [$queryString");...]
exit;
?>