在以下代码中,变量$ filedownload应该是一个链接。它在文件夹singleuse之外调用时不显示。 当我在singleuse文件夹中执行类似的脚本并从包含代码更改删除文件夹时,它会显示。我想这可能是包含电话的待办事项? 我想从文件夹外部调用变量。
我测试了变量,它有一个值。它只是没有出现在电子邮件中。
<?php
/**
* This file creates the single use download link
* The query string should be the password (which is set in variables.php)
* If the password fails, then 404 is rendered
*
* Expects: generate.php?1234
*/
include("variables.php");
// Grab the query string as a password
$password = '1234';
/*
* Verify the admin password (in variables.php)
*/
if($password == ADMIN_PASSWORD) {
// Create a new key
$new = uniqid('key',TRUE);
/*
* Create a protected directory to store keys in
*/
if(!is_dir('keys')) {
mkdir('keys');
$file = fopen('keys/.htaccess','w');
fwrite($file,"Order allow,deny\nDeny from all");
fclose($file);
}
/*
* Write the key key to the keys list
*/
$file = fopen('keys/keys','a');
fwrite($file,"{$new}\n");
fclose($file);
?>
<html>
<head>
<title>Download created</title>
<style>
nl {
font-family: monospace
}
</style>
</head>
<body>
<h1>Payment Success</h1>
<?php
$filedownload = "http://" . $_SERVER['HTTP_HOST'] . DOWNLOAD_PATH . "?" . $new;
?>
</body>
</html>
<?php
} else {
/*
* Someone stumbled upon this link with the wrong password
* Fake a 404 so it does not look like this is a correct path
*/
header("HTTP/1.0 404 Not Found");
}
?>
&#13;
include('/singleuse/generate.php');
$mail_From = "From: me@mybiz.com";
$mail_To = "savisaar2@gmail.com";
$mail_Subject = "VERIFIED IPN";
$mail_Body = "Hello there, thank you for purchasing from us. \nPlease go to: " . $filedownload;
mail($mail_To, $mail_Subject, "\n\n" . $mail_Body, $mail_From);
答案 0 :(得分:1)
在最后的努力中,我决定尝试使用不同的PHP脚本来发送电子邮件,并且它有效!
if ($payment_status == 'Completed') {
include('singleuse/generate.php');
$to = 'savisaar2@gmail.com';
$subject = 'Transation Completed [Ref #' . $txn_id . ']';
$message = 'Thank you ' . $payer_email . '! Your payment status is: ' . $payment_status . ', your order number is #' . $txn_id . '. Please follow this link to get your download: ' . $filedownload;
$headers = 'From: webmaster@dev4you.hints.me' . "\r\n" .
'Reply-To: webmaster@dev4you.hints.me' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);