hi, I have this form that uses phpmailer to send the input to an email and now I need to have it gpg’d before sending. it’s on iis. It’s beyond my level of expertise so I’m willing to pay a few bucks to have it fixed. How do I find help please? thanks.
@scragarFeb 25.2009 — #[code=php] function gpg_encrypt($txt, $owner, $flags=''){ $uniqueName = uniqid();// generate a unique name $gpg = "gpg";// I've no idea what this will be on windows, sorry.
file_put_contents($uniqueName, $txt, FILE_TEXT);// save the current file
$output = shell_exec("$gpg -e -r $owner $uniqueName");// gpg encrypt it.
echo $output;// remove or leave, up to you. I'd use it for debug.
$gpged = file_get_contents($uniqueName.'.gpg', FILE_BINARY); unlink($uniqueName); unlink($uniqueName.'gpg');// delete the files we don't need
@jackmiauthorFeb 26.2009 — #thank you. unless you see it you can't help me so here it is. windows does it a little different. I checked the gpg command line and it works fine. it creates the temp file in windows/temp folder. but when executed the script throws an error about $contents as not recognized. it seems to me it's in the gpg command line but I just don't know how to trouble shoot. I went through quite a few examples and before I give up I figured I'll give it a shot here.
//start phpmailer code (data that gets sent to my email address) $response = "$namen$emailn$messagen";
//Tell gnupg where the key ring is. Home dir of user web server is running as. putenv("GNUPGHOME=D:wwwtest");
//PGP user name or e-mail address that was used to generate the PGP keypair $pgpuser = "**********";
//create a unique file name $infile = tempnam("/tmp", "PGP.asc"); $outfile = $infile.".asc";
//write form variables to email $fp = fopen($infile, "w"); fwrite($fp, $message); fclose($fp);
//set up the gnupg command. Note: Remember to put e-mail address on the gpg keyring. $command = "gpg.exe -a --always-trust --batch --no-secmem-warning -e -r $pgpuser -o $outfile $infile";
//execute the gnupg command system($command, $result);
//delete the unencrypted temp file //unlink($infile);
@jackmiauthorFeb 28.2009 — #I have now spent quite a few nights on this.
I enabled php.ini to show all errors and there was nothing. I tried not writing to a file and it basically does the same thing. Looks like the gpg command doesn't get exectued. the script used to complain: unable to fork - but I fixed it by giving permissions to iusr and iis. I've added correct paths and put gpg.exe in all appropriate folders. php code is fine I think. What am I missing? Is there a way to show or log all output either from php and/or cmd?