|
Posted by PeacePipe on 10/27/06 19:25
Oops must change nick. I see there is another "Happy" already in here.
Hello folks. My colleague and I are unable to figure out what is wrong
with some code. We can't make it do what we want. Perhaps some kind
person can help please.
I run a particular pay-to-view web site. For credit card processing, we
signed on with PayPal.
The process is generally working ok. An interested person clicks the
"join" button on the site and is transported to PayPal where he enters
his card data and so on.
PayPal generates access codes for the new member and emails them to
him. PayPal also sends us an email announcing a new join.
The problem is that, so far, I must update the .htpasswd file manually
to liven up access to the member area.
My colleague has good PHP skills and has written code to try to enable
PayPal to update the file automatically but all attempts fail so far.
The relevant section of the code is reproduced below. (This is not the
entire file, only the reelvant lines.)
We have proper permissions to write to the .htaccess file (777)
===============
<?php
$username = $_POST['username'];
$password = $_POST['password'];
$filename = '.htpasswd';
$pass = crypt($password, substr($password, 0, 2));
$pwf = $username.":".$pass;
if ($pwf) {
$fp = fopen($filename, 'a');
$pwf = $pwf."\n";
fputs($fp, $pwf, strlen($pwf));
fclose($fp);
$fp = fopen($filename, 'r');
fpassthru($fp);
}
?>
Navigation:
[Reply to this message]
|