Dynamic php-file displaying in iframe in static page

Ok, my php skills are basic, I can customize existing scripts quite well, but I can’t write one.

My problem is the following:
I’m using a php-based forum script in a friends website. I load the ‘forum.php’ script in an iframe of a static page.

When a user gets a response to a post that he wrote on the forum, he receives a mail with a link that should get him to the response he got ie. http://someurl.com/forum.php?todo=viewtopic&tid=6#t2

The problem is now that if he clicks the link, the file of course doesn’t open in the iframe of the static page (http://someurl.com/forum.html) which is normally opening the forum.php-file in an iframe.

I guess I will have to make the static page also into a php-file and then use parts of the mailed url (forum.php?todo=viewtopic&tid=6#t2) and insert it into the iframe as the file to load … would appreciate your help a lot, anyone can advice me how to do that?

Thanks in advance,
K.

To do this, you would have to modify the part of the forum that sends e-mails with the forums’ link in so that they send them to your URL (with the iframe link included).

I would base64_encode the URL for the iframe and then base64_decode it on your page.

E-mail script sends:

[php]$link = ‘http://example.org/page-with-iframe.php?url=’ . base64_encode(‘http://some-forum.com/some/forum/page’);[/php]

Then your script receives it:

[php]if(isset($_GET[‘url’])) {
$url = base64_decode($_GET[‘url’]);

if(strpos($url, 'http://some-forum.com') == 0) {
     // Valid URL (starts with our forum site)
} else {
    // Someone has tried to send the user to another page
    $url = 'http://some-forum.com';
}

} else {
$url = ‘http://some-forum.com’;
}[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service