Help getting PHP and GPG to work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Has anybody had success using PHP and GPG to send encripted email from a
form?
Seems like people avoid this issue like the plague. Very little is written
about it.
 I am trying to get a script to work that was written in the book "php
essentials" by Julie Meloni.

Am I barking up the wrong tree? Any success stories? "Anything" would be
helpful

I can make it work half way, then run into the dreaded permission issues.
Some opinions or suggestions on what to do would be appreciated.


Here is the code I have presently.
<?

 $time = time();
 $msg = "Sender's Full Name:\t$sender_name\n";
 $msg .= "Sender's E-Mail:\t$sender_email\n";
 $msg .= "Secret Message?\t$secret_msg\n\n";

 putenv("GNUPGHOME=/home/path/.gnupg");

 $clear = "/home/path/temp/input/data";
 $clear .= "$time";

 $crypted = "/home/path/temp/output/data";
 $crypted .= "$time";

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

 system("/usr/bin/gpg -r my name <myemail@xxxxxxxxxxx>' -o $crypted -a
$clear");

 unlink("$clear");

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

 unlink("$crypted");


 $recipient = "myemail@xxxxxxxxxxx";
 $subject = "GnuPG Test";

 $mailheaders = "From: www.mywebsite.com <\"\">\n";
 $mailheaders .= "Reply-To: $sender_email\n\n";

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


 echo "<H1 align=center>Thank You, $sender_name</h1>";
 echo "<p align=center>Your message has been sent.</p>";

?>

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux