acheron
06-17-2007, 03:57 PM
Hey,
I'm very new to PHP and I was just wondering if any of you can help me with this.
I already added the code below in the cron jobs page but it won't seem to run it. Existing php scripts in cron seem to be working fine.
I'm not sure if there's anything wrong with the code. Please do help me. Thanks for your time!
<?php
ob_start();
// prevent client-side caching: must be called before displaying any output/html headers
header("Expires: Sat, 22 Jul 1978 15:00:00 GMT"); // Any date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
require_once('configuration.php');
$conn = mysql_connect($mosConfig_host, $mosConfig_user, $mosConfig_password) or die(mysql_error());
mysql_select_db($mosConfig_db, $conn) or die(mysql_error());
function sendEmail($email, $firstName) {
$subject = "Your Request";
$message = read_file("templates/net/email.php");
$message = str_replace("{$name}", $firstName, $message);
$message = str_replace("\n.", "\n..", $message);
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: service@net.com' . "\r\n";
return mail($email, $subject, $message, $headers);
}
?>
<html>
<head>
<title>Send To Garden</title>
</head>
<body>
<?php
sendEmail("trial@trial.com", "trial");
?>
</body>
</html>
<?php
ob_end_flush();
?>
cheers,
acheron
I'm very new to PHP and I was just wondering if any of you can help me with this.
I already added the code below in the cron jobs page but it won't seem to run it. Existing php scripts in cron seem to be working fine.
I'm not sure if there's anything wrong with the code. Please do help me. Thanks for your time!
<?php
ob_start();
// prevent client-side caching: must be called before displaying any output/html headers
header("Expires: Sat, 22 Jul 1978 15:00:00 GMT"); // Any date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
require_once('configuration.php');
$conn = mysql_connect($mosConfig_host, $mosConfig_user, $mosConfig_password) or die(mysql_error());
mysql_select_db($mosConfig_db, $conn) or die(mysql_error());
function sendEmail($email, $firstName) {
$subject = "Your Request";
$message = read_file("templates/net/email.php");
$message = str_replace("{$name}", $firstName, $message);
$message = str_replace("\n.", "\n..", $message);
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: service@net.com' . "\r\n";
return mail($email, $subject, $message, $headers);
}
?>
<html>
<head>
<title>Send To Garden</title>
</head>
<body>
<?php
sendEmail("trial@trial.com", "trial");
?>
</body>
</html>
<?php
ob_end_flush();
?>
cheers,
acheron