Re: How to use Gnupg with PHP in windows 2000?
| From: | Gabor Hojtsy | Date: | Sat, 08 Mar 2003 12:23:35 +0000 |
| Subject: | Re: How to use Gnupg with PHP in windows 2000? | ||
| References: | 1 | Groups: | php.mirrors |
| Request: | Send a blank email to php-mirrors+get-16210@lists.php.net to get a copy of this message | ||
Please direct support questions to php-general@lists.php.net
Goba
丸 丸 wrote:
> What's wrong in my codes?
>
> <?
> $to_email = "xxxxxx@yahoo.com";
>
> putenv("GNUPGHOME = F:\\gnupg");
>
> $infile = tempnam("", "pgp");
>
> $outfile = $infile.".asc";
>
> $fp = fopen($infile, "w");
>
> fwrite($fp, $body);
> fclose($fp);
>
> $command ="f:\\gpg --output $outfile --compress-algo
> 1 --cipher-algo cast5 --recipient yyyyy@yahoo.com
> --encrypt $infile";
>
>
> system($command, $result)
> system("del $infile");
>
> if($result==0)
> {
> $fp = fopen($outfile, "r");
> if(!$fp||filesize ($outfile)==0)
> {
> $result = -1;
> }
> else
> {
> //read the encrypted file
> $contents = fread ($fp, filesize ($outfile));
> //delete the encrypted temp file
> system("del $outfile");
>
> mail($to_email, $title, $contents, "From:
> $from\n");
> echo "<h1>Message Sent</h1>
> <p>Your message was encrypted and sent.
> <p>Thank you.";
> }
> }
>
> if($result!=0)
> {
> echo "<h1>Error:</h1>
> <p>Your message could not be encrypted, so
> has not been sent.
> <p>Sorry.";
> }
> ?>
>
>
> _________________________________________________________
> 我的驕傲(容祖兒),左鄰右里(李克勤),你最紅(Twins)...
> 過千首手機鈴聲 點Ring都得
> http://ringtone.yahoo.com.hk
>