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.

Замечание: This function buffers the output.

Пример 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());
?>

Результат выполнения данного примера:

<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().



output_add_rewrite_var
ng4rrjanbiah at rediffmail dot com
18-Jun-2005 11:41
This function obeys url_rewriter.tags ( ref.session#ini.url-rewriter.tags ) configuration and hence can be used to rewrite selected tags.

HTH,
R. Rajesh Jeba Anbiah
qbolec
14-Apr-2005 05: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
08-Feb-2005 10: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: Tue, 15 Nov 2005