Reply to Permission problem using php and gnupg on linux server

Your name:

Reply:


Posted by "zedleon" on 10/11/75 11:36

I have been writing a script in php for secure email gunpg. The script
requires writing a file to the server for encryption. The problem
i am facing is the permissions. After php writes the file it becomes read
only so gpg can't encrypted it or rewrite it. I'm not sure
which..

this is the permissions i am getting from the file that is created on the
server.

-rw-r--r-- 1 nobody nobody.

Since the file is created dynamicly, how does one set the permission using
php? Does anybody have
any suggestions or a code snippet that may help?

I have tried to change the permissions on the server and the user groups
using chmod and chgrp but that doesnt work. The tech at my hosting company
suggested a cgi script. Is their a workaround for this?

Thanks for the help,

zedleon

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@address.com>' -o $crypted -a
$clear");

unlink("$clear");

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

unlink("$crypted");


$recipient = "myemail@address.com";
$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>";

?>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация