search for in the  
<ob_startoutput_reset_rewrite_vars>
Last updated: Thu, 19 May 2005

output_add_rewrite_var

(PHP 4 >= 4.3.0, PHP 5)

output_add_rewrite_var --  Add URL rewriter values

Description

bool output_add_rewrite_var ( string name, string value )

This function rewrite the URLs and forms with the given variable.

Note: This function buffers the output.

Example 1. output_add_rewrite_var() example

<?php
output_add_rewrite_var
('var', 'value');

// a link
echo '<a href="file.php">link</a>';

// a form
echo '<form action="script.php" method="post">
<input type="text" name="var2" />
</form>'
;

print_r(ob_list_handlers());
?>

The above example will output:

<a href="file.php?var=value">link</a>

<form action="script.php" method="post">
<input type="hidden" name="var" value="value" />
<input type="text" name="var2" />
</form>

Array
(
    [0] => URL-Rewriter
)

See also output_reset_rewrite_vars(), ob_flush() and ob_list_handlers().



User Contributed Notes
output_add_rewrite_var
qbolec
14-Apr-2005 07:46
I'm using this function in control panel, to append md5(session_id()) to each form and link in this panel. I also check when receiving data in control panel, if it contains this md5. I think it's quite good way to prevent the attack, where the user posts an image to the forum, but instead of image url, it specifies the url to control panel with some instructions. You should also check if the data come from the source you intended (GET or POST?).
konrad DOT meyer AT gNOSPAMmail DOT com
09-Feb-2005 12:21
This function can be very helpful for a survey or registration style set of pages where you need to keep variables from one page to the next. (For example, when you mess up a registration, it's always nice to have all but the incorrect fields as you entered them. Re-entering tons of fields is tedious on your users.)

<ob_startoutput_reset_rewrite_vars>
 Last updated: Thu, 19 May 2005
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: The Server Pages
Last updated: Thu May 19 17:35:34 2005 CDT