Hi
I have a specific need to run a function, or similar, in a form as follows:
function encryptccdetails($msg)
{
//set the environment variable for PGPPATH
putenv("PGPPATH=/home/ambitire/.pgp");
//generate token for unique filenames
echo "New file";
$tmpToken = md5(uniqid(rand()));
//create vars to hold paths and filenames
$plainTxt = "/home/ambitire/reservationsnetwork_html/respix/" . "$tmpToken" . "data";
$crypted = "/home/ambitire/reservationsnetwork_html/respix/" . "$tmpToken" . "pgp";
//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 'Julie Meloni <julie@thickbook.com>' -o $crypted -a $plainTxt");
system("/usr/local/bin/pgpe -r 'Reservations Network <info@reservationsnetwork.ie>' -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);
echo $mail_cont;
return $mail_cont;
}
This function needs to be called from a different form, and return the value of the encryption directly back to the originating form.
Would it be something like this?
exec("http://www.etcetc./formb.cgi",codes)
encryptedvalue=codes[0];
???
I'm really not sure what to do - can anyone help me with this please?
The function has to run in cgi mode in order to work, but I don't want to put the whole form into cgi since I work with another person who does the art-stuff on the html in dreamweaver.
Regards and thanks in advace
Elizabeth