Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
urgently required to Encrypt plz look
Old 06-14-2007, 03:41 AM urgently required to Encrypt plz look
Experienced Talker

Posts: 33
Name: subhash garai
Trades: 0
please loook at the following code where i am encrypting a data.

<?php

$sender_name=$_POST['sender_name'];
$sender_email=$_POST['sender_email'];
$secret_msg=$_POST['secret_msg'];

//build the message string
$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";

//generate token for unique filenames
$tmpToken = md5(uniqid(rand()));

//create vars to hold paths and filenames
$plainTxt = "tmp/" . "$tmpToken" . "data";
$crypted = "tmp/" . "$tmpToken" . "pgpdata";

//open file and dump in plaintext contents
$fp = fopen($plainTxt, "w+");
fputs($fp, $msg);
fclose($fp);

//set the environment variable for PGPPATH
putenv("GNUPGHOME=/home/www/.gnupg");

//invoke PGP to encrypt file contents
system("/usr/bin/gpg -r 'subhas_xgen@yahoo.co.in' -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 target recipient.
$recipient = "subhas_xgen@yahoo.co.in";
$subject = "Secret Message";

$mailheaders = "From: My Web Site\n";
$mailheaders .= "Reply-To: $sender_email\n\n";

mail("$recipient", "$subject", $mail_cont, $mailheaders);

// Print confirmation to screen.
echo "
<H1 align=center>Thank You, $sender_name</h1>
<p align=center>Your secret message has been sent.</p>
";

?>


it will take the contents of $plainTxt and write in Encrypted format to another file called $crypted .



But its not going on . Please help me as soon as possible
subhash_garai is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-14-2007, 07:50 AM Re: urgently required to Encrypt plz look
solomongaby's Avatar
Webmaster Talker

Latest Blog Post:
How Do You Find Music Online ?
Posts: 522
Name: Gabe Solomon
Location: Romania
Trades: 1
my guess would be :
- the path of the files are not corect
- the user php is running on does not have acces to those files
- try seing the system response
Quote:
$comand = system("/usr/bin/gpg -r 'subhas_xgen@yahoo.co.in' -o $crypted -a $plainTxt", $response);

echo 'comand: ['.$comand.']<br />
Response: ' . $response;
__________________
If you like my posts ... TK is appreciated:)

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
solomongaby is offline
Reply With Quote
View Public Profile Visit solomongaby's homepage!
 
Reply     « Reply to urgently required to Encrypt plz look
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.17021 seconds with 12 queries