Hey all,
I have been trying to encrypt a form and write it to a file but there seems to be some error in it. I have no scripting background nor PGP knowledge whatsoever, so it's a bit difficult for me to trace my error.
Here's a piece of code which I've wrote based on Julie Meloni's tutorial. Can somebody please help me out on this??
Thanks a lot...
//set the environment variable for PGPPATH
putenv("PGPPATH=C:\My Documents\PGP");
//generate token for unique filenames
$tmpToken = md5(uniqid(rand()));
//create vars to hold paths and filenames
$plainTxt = "C:/temp/" . "$tmpToken" . "data";
$crypted = "C:/temp/" . "$tmpToken" . "pgpdata";
//open file and dump in plaintext contents
$fp = fopen($plainTxt, "w+");
fputs($fp, $msg);
fclose($fp);
//invoke PGP to encrypt file contents
system("/usr/local/bin/pgpe -r 'c:/Program Files/Apache Group/Apache/htdocs/msg' -o $crypted -a $plainTxt");
//open file and read encrypted contents into var
$fd = fopen($crypted, "r");
$mail_cont = fread($fd, filesize($crypted));
fclose($fd);
//delete files!
unlink($plainTxt);
unlink($crypted);
// Build mail message and send it to a file $recipient = "c:/Program Files/Apache Group/Apache/htdocs/msg";