Hi
The code below works fine on my local machine , but on a live server "http://www.crestway.wcape.school.za/courselist/admin.php I get the following error message:
http://www.crestway.wcape.school.za/...n_transact.php
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /usr/vweb/www.crestway.wcape.school.za/courselist/class.SimpleMail.php on line 4
The admin transact code is the following:
<?php
require('config.php');
require('class.SimpleMail.php');
$conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS)
or die('Could not connect to MySQL database. ' . mysql_error());
mysql_select_db(SQL_DB, $conn);
if (isset($_POST['action'])) {
switch ($_POST['action']) {
case 'Add New Mailing List':
$sql = "INSERT INTO cl_lists (listname) " .
"VALUES ('" . $_POST['listname'] . "')";
mysql_query($sql)
or die('Could not add mailing list. ' . mysql_error());
break;
case 'Delete Mailing List':
$sql = "DELETE FROM cl_lists WHERE cl_id=" . $_POST['cl_id'];
mysql_query($sql)
or die('Could not delete mailing list. ' . mysql_error());
$sql = "DELETE FROM cl_subscriptions " .
"WHERE cl_id=" . $_POST['cl_id'];
mysql_query($sql)
or die('Could not delete mailing list subscriptions. ' .
mysql_error());
break;
case 'Send Message':
if (isset($_POST['msg'], $_POST['cl_id'])) {
if (is_numeric($_POST['cl_id'])) {
$sql = "SELECT listname FROM cl_lists " .
"WHERE cl_id='" . $_POST['cl_id'] . "'";
$result = mysql_query($sql, $conn)
or die(mysql_error());
$row = mysql_fetch_array($result);
$listname = $row['listname'];
} else {
$listname = "Master";
}
$sql = "SELECT DISTINCT usr.email1, usr.first_name, usr.person_id " .
"FROM person usr " .
"INNER JOIN cl_subscriptions mls " .
"ON usr.person_id = mls.person_id " .
"WHERE mls.pending=0";
if ($_POST['cl_id'] != 'all') {
$sql .= " AND mls.cl_id=" . $_POST['cl_id'];
}
$result = mysql_query($sql)
or die('Could not get list of email addresses. ' . mysql_error());
$headers = "From: " . ADMIN_EMAIL . "\r\n";
while ($row = mysql_fetch_array($result)) {
if (is_numeric($_POST['cl_id'])) {
$ft = "You are receiving this message as a member of the ";
$ft .= $listname . "\n mailing list. If you have received ";
$ft .= "this e-mail in error, or would like to\n remove your ";
$ft .= "name from this mailing list, please visit the ";
$ft .= "following URL:\n";
$ft .= "http://" . $_SERVER['HTTP_HOST'] .
dirname($_SERVER['PHP_SELF']) . "/remove.php?u=" .
$row['person_id'] . "&cl=" . $_POST['cl_id'];
} else {
$ft = "You are receiving this e-mail because you subscribed ";
$ft .= "to one or more\n mailing lists. Visit the following ";
$ft .= "URL to change your subscriptions:\n";
$ft .= "http://" . $_SERVER['HTTP_HOST'] .
dirname($_SERVER['PHP_SELF']) . "/user.php?u=" .
$row['person_id'];
}
$msg = stripslashes($_POST['msg']) . "\n\n";
$msg .= "--------------\n";
$msg .= $ft;
$email = new SimpleMail();
$email->send($row['email1'],
stripslashes($_POST['subject']),
$msg,
$headers)
or die('Could not send e-mail.');
}
}
break;
}
}
header('Location: admin.php');
?>
How can I resolve the problem. Any help is much appreciated.