Clearing pipe stream and a few other issues.
| From: | zedleon | Date: | Thu, 16 Feb 2006 22:01:18 +0000 |
| Subject: | Clearing pipe stream and a few other issues. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-230597@lists.php.net to get a copy of this message | ||
ok, I'm not sure how to explain this but here goes..
I have a php script being used as a cgi to get around certain permission
issues.
Its not what I wanted but is basically working. Running through the cgi-bin
has been
much more difficult however, for example,
1. I need to clear or reset the stream because on occasion, I am get
variables from a previous submission to the form.
Not sure how to do this.
2. I have having trouble using the header function. Its says that the header
is already been sent.
I can only assume at this point its because of the
#!/usr/local/bin/php -q at the top of the script required for cgi's.
I may be wrong. I may not even need the header.
3. The formatting is coming out in plain text..The html code is not
executing. Here again I believe its a header content issue.
here is the code:
<?
echo "
<H1 align=center>Thank You, $sender_name</h1>
<p align=center>Your secret message has been sent.</p>";
?>
here is the result:
<H1 align=center>Thank You, David</h1>
<p align=center>Your secret message has been sent.</p>
I am rookie at php, so any insights, workarounds or help is appreciated.
Thanks in advance,
Zed
<?
$fp=popen("cat","r");
$str=fgets($fp);
pclose($fp);
print $str;
$arr = array();
foreach (explode('&', $str) as $v) {
$split = explode('=', $v);
// urldecode content for readability
$arr[$split[0]] = urldecode($split[1]); // create assoc. array
${$split[0]} = urldecode($split[1]); // form the variables
}
//echo $sender_name . '<br/>' . $arr['sender_name'];
print_r($arr);
$msg = "Sender's Full Name: $sender_name\n";
$msg .= "Sender's E-Mail: $sender_email\n";
$msg .= "Secret Message? $sender_msg\n\n";
?>