[PHP] Re: php script running as a cgi

2006-01-16 Thread zedleon
Let me ask this...
What is the proper way to configure a php script to run as a cgi?
What items need to be included (i.e. header info, content type, etc ) for
the cgi
to find the variables sent from the html form?

anybody?

zed


zedleon [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I am running a php script as a cgi so to be able to run under my user
name.
 The script seems to be working except for one major problem.
 the cgi script is not finding the variables passed by the html form...

 Any suggestions on how to make this work?

 Any help is greatly appreciated -

 zed

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



Re: [PHP] Re: php script running as a cgi

2006-01-16 Thread John Nichel

zedleon wrote:

Let me ask this...
What is the proper way to configure a php script to run as a cgi?
What items need to be included (i.e. header info, content type, etc ) for
the cgi
to find the variables sent from the html form?

anybody?


POST/GET variables will work without any added 'tweaking' regardless of 
how your webserver is running php (CGI/Module).  Post some code as to 
what is not working.


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] Re: php script running as a cgi

2006-01-16 Thread Adi
check to make sure you are allowing globals to be accessed in your
php.ini.make sure you are accessing the post/get vars correctly

On 1/16/06, John Nichel [EMAIL PROTECTED] wrote:

 zedleon wrote:
  Let me ask this...
  What is the proper way to configure a php script to run as a cgi?
  What items need to be included (i.e. header info, content type, etc )
 for
  the cgi
  to find the variables sent from the html form?
 
  anybody?

 POST/GET variables will work without any added 'tweaking' regardless of
 how your webserver is running php (CGI/Module).  Post some code as to
 what is not working.

 --
 John C. Nichel IV
 Programmer/System Admin (ÜberGeek)
 Dot Com Holdings of Buffalo
 716.856.9675
 [EMAIL PROTECTED]

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




--
Take care...
Adam


[PHP] Re: php script running as a cgi

2006-01-16 Thread zedleon


here is the php code i am using as a cgi in the cgi-bin
This form executes fine, just doesn't get the variables for the form.

simple test form at:
http://www.passeycorp.com/gnupg.php

thanks for the feedback.

zed
---

#!/usr/local/bin/php -q

?

$msg = Sender's Full Name:\t$_POST[sender_name]\n;

$msg .= Sender's E-Mail:\t$_POST[sender_email]\n;
$msg .= Secret Message?\t$_POST[sender_msg]\n\n;

putenv(GNUPGHOME=/home/account_name/.gnupg);

$username = passey;

$tmpToken = md5(uniqid(rand()));

$plainTxt = /home/account_name/temp/input/ . $tmpToken . data;
$crypted = /home/account_name/output/ . gpgdata;

$fp = fopen($plainTxt, w+);
fputs($fp, $msg);
fclose($fp);

system(/usr/bin/gpg  --encrypt -ao $crypted -r 'ted passey' $plainTxt);

$fd = fopen($crypted, r);
$mail_cont = fread($fd, filesize($crypted));
fclose($fd);

unlink($plainTxt);
unlink($crypted);

$recipient = [EMAIL PROTECTED];
$subject = Stupid Secret Message;

$mailheaders = From: www.yourwebsite.com\n;
$mailheaders .= Reply-To: $sender_email\n\n;

mail($recipient, $subject, $mail_cont, $mailheaders);

echo 
H1 align=centerThank You, $sender_name/h1
p align=centerYour secret message has been sent./p;

?


zedleon [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I am running a php script as a cgi so to be able to run under my user
name.
 The script seems to be working except for one major problem.
 the cgi script is not finding the variables passed by the html form...

 Any suggestions on how to make this work?

 Any help is greatly appreciated -

 zed

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



Re: [PHP] Re: php script running as a cgi

2006-01-16 Thread John Nichel

zedleon wrote:

here is the php code i am using as a cgi in the cgi-bin
This form executes fine, just doesn't get the variables for the form.

simple test form at:
http://www.passeycorp.com/gnupg.php

thanks for the feedback.

zed
---

#!/usr/local/bin/php -q

?


What is the output if you 'print_r ( $_POST )' here?


$msg = Sender's Full Name:\t$_POST[sender_name]\n;

$msg .= Sender's E-Mail:\t$_POST[sender_email]\n;
$msg .= Secret Message?\t$_POST[sender_msg]\n\n;

putenv(GNUPGHOME=/home/account_name/.gnupg);

$username = passey;

$tmpToken = md5(uniqid(rand()));

$plainTxt = /home/account_name/temp/input/ . $tmpToken . data;
$crypted = /home/account_name/output/ . gpgdata;

$fp = fopen($plainTxt, w+);
fputs($fp, $msg);
fclose($fp);

system(/usr/bin/gpg  --encrypt -ao $crypted -r 'ted passey' $plainTxt);

$fd = fopen($crypted, r);
$mail_cont = fread($fd, filesize($crypted));
fclose($fd);

unlink($plainTxt);
unlink($crypted);

$recipient = [EMAIL PROTECTED];
$subject = Stupid Secret Message;

$mailheaders = From: www.yourwebsite.com\n;
$mailheaders .= Reply-To: $sender_email\n\n;

mail($recipient, $subject, $mail_cont, $mailheaders);

echo 
H1 align=centerThank You, $sender_name/h1
p align=centerYour secret message has been sent./p;

?



--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] Re: php script running as a cgi

2006-01-16 Thread zedleon
I am getting a parse error, unexpected T_VARIABLE

you would think this would be easy.

zed

John Nichel [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 zedleon wrote:
  here is the php code i am using as a cgi in the cgi-bin
  This form executes fine, just doesn't get the variables for the form.
 
  simple test form at:
  http://www.passeycorp.com/gnupg.php
 
  thanks for the feedback.
 
  zed
  ---
 
  #!/usr/local/bin/php -q
 
  ?

 What is the output if you 'print_r ( $_POST )' here?

  $msg = Sender's Full Name:\t$_POST[sender_name]\n;
 
  $msg .= Sender's E-Mail:\t$_POST[sender_email]\n;
  $msg .= Secret Message?\t$_POST[sender_msg]\n\n;
 
  putenv(GNUPGHOME=/home/account_name/.gnupg);
 
  $username = passey;
 
  $tmpToken = md5(uniqid(rand()));
 
  $plainTxt = /home/account_name/temp/input/ . $tmpToken . data;
  $crypted = /home/account_name/output/ . gpgdata;
 
  $fp = fopen($plainTxt, w+);
  fputs($fp, $msg);
  fclose($fp);
 
  system(/usr/bin/gpg  --encrypt -ao $crypted -r 'ted passey'
$plainTxt);
 
  $fd = fopen($crypted, r);
  $mail_cont = fread($fd, filesize($crypted));
  fclose($fd);
 
  unlink($plainTxt);
  unlink($crypted);
 
  $recipient = [EMAIL PROTECTED];
  $subject = Stupid Secret Message;
 
  $mailheaders = From: www.yourwebsite.com\n;
  $mailheaders .= Reply-To: $sender_email\n\n;
 
  mail($recipient, $subject, $mail_cont, $mailheaders);
 
  echo 
  H1 align=centerThank You, $sender_name/h1
  p align=centerYour secret message has been sent./p;
 
  ?


 -- 
 John C. Nichel IV
 Programmer/System Admin (ÜberGeek)
 Dot Com Holdings of Buffalo
 716.856.9675
 [EMAIL PROTECTED]

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



Re: [PHP] Re: php script running as a cgi

2006-01-16 Thread John Nichel

zedleon wrote:

I am getting a parse error, unexpected T_VARIABLE

you would think this would be easy.


Did you put the semi-colon at the end of the line?


zed

John Nichel [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]


zedleon wrote:


here is the php code i am using as a cgi in the cgi-bin
This form executes fine, just doesn't get the variables for the form.

simple test form at:
http://www.passeycorp.com/gnupg.php

thanks for the feedback.

zed
---

#!/usr/local/bin/php -q

?


What is the output if you 'print_r ( $_POST )' here?



$msg = Sender's Full Name:\t$_POST[sender_name]\n;

$msg .= Sender's E-Mail:\t$_POST[sender_email]\n;
$msg .= Secret Message?\t$_POST[sender_msg]\n\n;

putenv(GNUPGHOME=/home/account_name/.gnupg);

$username = passey;

$tmpToken = md5(uniqid(rand()));

$plainTxt = /home/account_name/temp/input/ . $tmpToken . data;
$crypted = /home/account_name/output/ . gpgdata;

$fp = fopen($plainTxt, w+);
fputs($fp, $msg);
fclose($fp);

system(/usr/bin/gpg  --encrypt -ao $crypted -r 'ted passey'


$plainTxt);


$fd = fopen($crypted, r);
$mail_cont = fread($fd, filesize($crypted));
fclose($fd);

unlink($plainTxt);
unlink($crypted);

$recipient = [EMAIL PROTECTED];
$subject = Stupid Secret Message;

$mailheaders = From: www.yourwebsite.com\n;
$mailheaders .= Reply-To: $sender_email\n\n;

mail($recipient, $subject, $mail_cont, $mailheaders);

echo 
H1 align=centerThank You, $sender_name/h1
p align=centerYour secret message has been sent./p;

?



--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]






--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] Re: php script running as a cgi

2006-01-16 Thread zedleon
Thank you -- brain freeze..

I am getting emply results from print_r

Array
(
)



John Nichel [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 zedleon wrote:
  I am getting a parse error, unexpected T_VARIABLE
 
  you would think this would be easy.

 Did you put the semi-colon at the end of the line?

  zed
 
  John Nichel [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
 
 zedleon wrote:
 
 here is the php code i am using as a cgi in the cgi-bin
 This form executes fine, just doesn't get the variables for the form.
 
 simple test form at:
 http://www.passeycorp.com/gnupg.php
 
 thanks for the feedback.
 
 zed
 ---
 
 #!/usr/local/bin/php -q
 
 ?
 
 What is the output if you 'print_r ( $_POST )' here?
 
 
 $msg = Sender's Full Name:\t$_POST[sender_name]\n;
 
 $msg .= Sender's E-Mail:\t$_POST[sender_email]\n;
 $msg .= Secret Message?\t$_POST[sender_msg]\n\n;
 
 putenv(GNUPGHOME=/home/account_name/.gnupg);
 
 $username = passey;
 
 $tmpToken = md5(uniqid(rand()));
 
 $plainTxt = /home/account_name/temp/input/ . $tmpToken . data;
 $crypted = /home/account_name/output/ . gpgdata;
 
 $fp = fopen($plainTxt, w+);
 fputs($fp, $msg);
 fclose($fp);
 
 system(/usr/bin/gpg  --encrypt -ao $crypted -r 'ted passey'
 
  $plainTxt);
 
 $fd = fopen($crypted, r);
 $mail_cont = fread($fd, filesize($crypted));
 fclose($fd);
 
 unlink($plainTxt);
 unlink($crypted);
 
 $recipient = [EMAIL PROTECTED];
 $subject = Stupid Secret Message;
 
 $mailheaders = From: www.yourwebsite.com\n;
 $mailheaders .= Reply-To: $sender_email\n\n;
 
 mail($recipient, $subject, $mail_cont, $mailheaders);
 
 echo 
 H1 align=centerThank You, $sender_name/h1
 p align=centerYour secret message has been sent./p;
 
 ?
 
 
 -- 
 John C. Nichel IV
 Programmer/System Admin (ÜberGeek)
 Dot Com Holdings of Buffalo
 716.856.9675
 [EMAIL PROTECTED]
 
 


 -- 
 John C. Nichel IV
 Programmer/System Admin (ÜberGeek)
 Dot Com Holdings of Buffalo
 716.856.9675
 [EMAIL PROTECTED]

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



Re: [PHP] Re: php script running as a cgi

2006-01-16 Thread John Nichel

zedleon wrote:

Thank you -- brain freeze..

I am getting emply results from print_r

Array
(
)



Don't know what to tell you then.  I tried you script on a cgi box here, 
and the post variables came thru fine.  Only difference I noticed is 
that in your path to the script, you're running thru a folder called 
suid.  Are you changing userids there?  If so, this _might_ be causing 
the problem (just guessing now).


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] Re: php script running as a cgi

2006-01-16 Thread zedleon
Thanks for the help John...That's more information than I had before..
I will keep working at it..

Zed


John Nichel [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 zedleon wrote:
  Thank you -- brain freeze..
 
  I am getting emply results from print_r
 
  Array
  (
  )
 

 Don't know what to tell you then.  I tried you script on a cgi box here,
 and the post variables came thru fine.  Only difference I noticed is
 that in your path to the script, you're running thru a folder called
 suid.  Are you changing userids there?  If so, this _might_ be causing
 the problem (just guessing now).

 -- 
 John C. Nichel IV
 Programmer/System Admin (ÜberGeek)
 Dot Com Holdings of Buffalo
 716.856.9675
 [EMAIL PROTECTED]

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