Forum Moderators: coopster
Many thanks to eelixduppy for walking me through a difficult challenge and having the patience to help me!
My final issue is this:
I have a field in my database called "externallink"
externallink can be either a link to a page within my site or to an external site. I populate this field with the complete url, and after I have grabbed the database row, I want the page to redirect to the link specified in $externallink
I have run into problems with the following:
This does not load the page:
{
echo file_get_contents($externallink);
}
This redirects me to the homepage:
<SCRIPT LANGUAGE="JavaScript">
setTimeout("document.location = '<?=$link?>'", 5000);
</SCRIPT>
If I simply display $externallink, it prints fine...this is what I use:
/* Display results in a table */
echo "<table cellspacing='15'>";
echo "<tr><td colspan='3'><hr></td></tr>";
{
echo "<tr>\n
<td>$story</td>\n
<td>$externallink</td>\n
</tr>\n";
echo "<tr><td colspan='3'><hr></td></tr>\n";
}
echo "</table>\n";
Any thoughts are appreciated!
No; Only if something is echoed to the browser.
[added]
>>Many thanks to eelixduppy
You're welcome! I wish I could have helped more!
[/added]
[edited by: eelixduppy at 6:06 pm (utc) on Oct. 12, 2006]
I define a registered user by using the following:
.str_replace("tracking",$_SESSION['tracking'],$link).
I thought I could simply take that string above and replace
header("Location: $externalurl");
with
header("Location: $.str_replace("tracking",$_SESSION['tracking'],$link");
but that does not actually work! I then tried defining a new variable:
$URL = .str_replace("tracking",$_SESSION['tracking'],$link);
header("Location: $URL");
but that didn't work either...
Thoughts?
Make sure that the URL begins with an "http://", otherwise it might not redirect properly.
Also, there were a few errors in the code lines you pasted. They should read as follows:
-------------
header("Location: ". str_replace("tracking",$_SESSION['tracking'],$link));
$URL = str_replace("tracking",$_SESSION['tracking'],$link);
header("Location: $URL");
Hope it helps.