Save the following to a file called fixlinks.php:
PHP Code:
<?php
function FixLinks($buffer) {
return isset($_GET['rid']) ?
str_replace('rid=1000', 'rid=' . $_GET['rid'], $buffer) : $buffer;
}
ob_start("FixLinks");
?>
Now once at the top of each of your gallery.php files put:
PHP Code:
<?php include 'fixlinks.php'; ?>
This will change all the links on the page of the form
http://www.sponsor.com/tour.php?rid=1000
rid=1000 is your default code if someone forgets to add an rid= parameter to the url or it gets lost.
Works on PHP 4.1 or later.
Alternatively, in your .htaccess file put
PHP Code:
<Files ~ "\.php$">
php_value auto_prepend_file "fixlinks.php"
</Files>
And all PHP files in that directory will automagically have their links redone and you don't have to change them in any way.
PHP Code:
<Files ~ "\.html$">
php_value auto_prepend_file "fixlinks.php"
ForceType application/x-httpd-php
</Files>
With this all the html files in the directory will become PHP files and have their links rewritten.
I haven't tested any of this. You'll be lucky if it works.
Damn, the PHP highlighting colors are fugly on this board. and vBulleton mangles code. There is a \ in front of the .php and in front of .html in the .htacces file samples. you really will be lucky to get this to work.