|
|
PHP redirect
PHP Code
<?php
Comments Annonymous / 5 Sep 05simple, thanks the T man / 9 Nov 05cool... Drew / 30 Jan 06You can also recustomize this for: [code] function redirect($page, $error = "", $success = "") { $error_str = ""; $success_str = ""; $extra = ""; if(!empty($error)) $error_str = "?e=" . urlencode($error); if(!empty($success)) $success_str = "?s=" . urlencode($success); if(@$_REQUEST['force'] == 1) $extra = "&force=1"; $relocate = "Location: " . $page . $error_str . $success_str; $relocate = str_replace("&?e","&e", $relocate); $relocate = str_replace("&?s","&s", $relocate); header($relocate . $extra); return; } [/code] Thus, in the target page that you are redirecting to you could parse the error, success, or generic messages based on your reason for redirecting. |