note 51596 deleted from function.header by betz
| From: | betz@php.net | Date: | Tue, 05 Apr 2005 16:07:14 +0000 |
| Subject: | note 51596 deleted from function.header by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-87506@lists.php.net to get a copy of this message | ||
Note Submitter: Juan Karlo de Guzman (01karlo at gmail dot com)
Reason: bad code
----
Let's face it. Sometimes, when we do many functions and many codes, and we called, header() the
message "headers already sent or function is already declared" appears. Here's a
wonderful way to do that.
<?php
function fastredirect($url){
die("<script language=\\"javascript\\" type=\\"text/javascript\\">
setTimeout(\\"window.location='$url';\\",1);
</script>");
}
function redirectmsg($url,$msg){
$msg=str_replace("'","\\'",$msg);
die("<body bgcolor=\\"white\\">
<script language=\\"javascript\\" type=\\"text/javascript\\">
document.write('<span style=\\"color: black;font-family: Verdana; font-size: 12px;
font-weight: bold;\\">$msg</span>');
setTimeout(\\"window.location='$url';\\",1);
</script></body>");
}
?>