note 2944 deleted from require by ronabop

From: Date: Fri, 11 Aug 2000 08:06:27 +0000
Subject: note 2944 deleted from require by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-1057@lists.php.net to get a copy of this message
The following snipets are getting me in trouble: <pre> &lt;?php require("input_sweep.php3"); $visit_album_ref = sweep($visit_album_ref); $visit_password = sweep($visit_password); ...SNIP... setcookie("cookie_sessid", $visit_sessid, 0, "", $users_global->server); //Line 49 header("Location: http://$users_global->server/Strawman_server/show_album_page.php3?non_cookie_sessid=$visit_sessid&page=0x00"); // Line 50 </pre> For reference, here is the complete content of input_sweep.php3: <pre> &lt;?php function sweep ($input_string) { return (ereg_replace('[|<>"]', "", $input_string)); } ?> </pre> The error result follows: QUOTE Warning: Oops, php3_SetCookie called after header has been sent in /home/httpd/html/Strawman_global/visit_auth.php3 on line 49 Warning: Cannot add more header information - the header was already sent (header information may be added only before any output is generated from the script - check for text or whitespace outside PHP tags, or calls to functions that output text) in /home/httpd/html/Strawman_global/visit_auth.php3 on line 50 UNQUOTE If I comment out the require() and the two calls to sweep(), my troubles are over. WHY? Does require() force header output? As you can infer from the fact that the warnings go away, the snipped portion of the script sends nothing to the browser. This is the only require() statement in the script. Any other toughts you care to share with this rookie are welcome - Am I checking for the right characters in sweep to keep hackers at bay? Do you see an obvious reason why the cookie isn't making it to the page the browser is redirected to? Is there a correct way to "include" definitions of utility functions like sweep without wrecking cookies and headers? Thanx! Wil

« previous php.notes (#1057) next »