Parse error
Posted: Sun Oct 29, 2006 5:51 am
Hello,
This is my code:
when I run the script I get the error "Parse error: parse error in /home/httpd/vhosts/com/httpdocs/paypal7.php on line 130"
Line 130 is the first "$to = $payer_email;" directly after "if ($for_auction == "true")(" . Here is the part of the script where line 130 is included.
Best Regards
Oskar R
This is my code:
Code: Select all
if (!$fp) {
// HTTP ERROR
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {
// check the payment_status is Completed
if ($payment_status == "Completed")
{
//Connect to MySQL
mysql_connect("localhost", "test", "test") or die(mysql_error());
//Select file system database
mysql_select_db("test") or die(mysql_error());
//generate the password
function createRandomPassword() {
$chars = "abcdefghijkmnopqrstuvwxyz023456789";
srand((double)microtime()*1000000);
$i = 0;
$pass = '' ;
while ($i <= 7) {
$num = rand() % 30;
$tmp = substr($chars, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
$password = createRandomPassword();
$password_encrypt = md5("$password");
//Add group ID
$group_id="4";
//Add user to the download system
mysql_query("INSERT INTO dl_users (username, password, `group`, email) VALUES('$payer_email', '$password_encrypt', '$group_id', '$payer_email') ")
or die(mysql_error());
//Add transaction details to the database
//If it is an acution payment
if ($for_auction == "true")(
//Send welcome message if auction payment
$to = $payer_email;
$subject = ' delivery information';
$message = "
Hello,
Thank you for your purchase. You can now login to our download system and download the files.
Download system URL:
Authorized user: $first_name $last_name
Username: $payer_email (your Paypal email)
Password: $password
Best Regards
";
$headers = 'From: no-reply@test.com' . "\r\n" .
'Reply-To: test@test.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
unset($to, $subject, $message, $headers);
) else {
//Send welcome message if standard payment
$to = $payer_email;
$subject = 'delivery information';
$message = "
Hello,
Thank you for your purchase. You can now login to our download system and download the files.
Download system URL:
Authorized user: $first_name $last_name
Username: $payer_email (your Paypal email)
Password: $password
Best Regards
";
$headers = 'From: no-reply@test.com' . "\r\n" .
'Reply-To: test@test.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
unset($to, $subject, $message, $headers);
)
}
}
else if (strcmp ($res, "INVALID") == 0) {
// log for manual investigation
}
}
fclose ($fp);
}Line 130 is the first "$to = $payer_email;" directly after "if ($for_auction == "true")(" . Here is the part of the script where line 130 is included.
Code: Select all
//If it is an acution payment
if ($for_auction == "true")(
//Send welcome message (auction payment)
$to = $payer_email;
$subject = 'delivery information';
$message = "
Hello,
Congratulations! You have won auction $item_number ($item_name). You can now login to our download system and download the files.
Authorized user: $first_name $last_name
Username: $payer_email (your Paypal email)
Password: $password
Best Regards
";
$headers = 'From: no-reply@test.com' . "\r\n" .
'Reply-To: test@test.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
unset($to, $subject, $message, $headers);
//Else it is a standard payment
) else {Oskar R