Re: [PHP] Clearing pipe stream and a few other issues.

2006-02-16 Thread Support
Permissions on a virtual server is the reason for running this script as a
cgi. It's not what prefer to do. However, this is only way php will work
under my user name. Perl would probably be a better alternative but I don't
know perl. If I had control of the apache server this would not be a
problem.

I have the script working, I just need to clear up these issues.

Zed

- Original Message - 
From: "Chris" <[EMAIL PROTECTED]>
To: "zedleon" <[EMAIL PROTECTED]>
Cc: 
Sent: Thursday, February 16, 2006 8:27 PM
Subject: Re: [PHP] Clearing pipe stream and a few other issues.


>
> >  >
> > $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 . '' . $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";
> > ?>
> >
>
> What exactly are you trying to achieve and what problems were you having
> using it as a normal script?
>
>
> I'm guessing it's some form of a mailing script.
>
> What's wrong with using a regular php script with a mail command:
>
>  $sender_name = htmlentities($_POST['sender_name']);
> $sender_email = htmlentities($_POST['sender_email']);
> $sender_msg = htmlentities($_POST['sender_msg']);
>
> $msg = "Name: $sender_name\n";
> $msg .= "Email: $sender_email\n";
> $msg .= "Message: $sender_msg\n";
>
> mail('');
> ?>
>
>
> and then your form posts to this script (change the form action to point
> to this new file)...
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Clearing pipe stream and a few other issues.

2006-02-16 Thread Chris



' . $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";
?>



What exactly are you trying to achieve and what problems were you having 
using it as a normal script?



I'm guessing it's some form of a mailing script.

What's wrong with using a regular php script with a mail command:




and then your form posts to this script (change the form action to point 
to this new file)...


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Clearing pipe stream and a few other issues.

2006-02-16 Thread zedleon
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:

Thank You, $sender_name
Your secret message has been sent.";
?>

 here is the result:
Thank You, David
Your secret message has been sent.

I am rookie at php, so any insights, workarounds or help is appreciated.

Thanks in advance,

Zed


' . $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";
?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php