public static function sendMail($id) { $event = CEvents::getDetails($id); $headers = 'From: GSC' . "\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $to = ""; $subject = "GSC Event Update"; $message = "<html>\n <head>\n </head>\n <body>\n <p>Hey there! have a look at the new event</p>\n <h4><p>{$event['title']}</p></h4>\n <h5><p>{$event['description']}</p></h5>\n <img src='http://www.gscwebsite.esy.es/admin/scripts/php/photo.php?id={$event['id']}' alt='Event Image'></img>\n <p>To be held at {$event['venue']}</p>\n <p>Scheduled on {$event['date']} at {$event['time']}</p>\n <h5><p>This is an automated email do not reply</p></h5> \n <h5><b><i>-Sincierly the GSC team</i></b></h5> \n </body>\n </html>"; $sql = "SELECT * FROM members"; if ($result = mysql_query($sql)) { while ($subscriber = mysql_fetch_assoc($result)) { if ($to == "") { $to = $subscriber['email']; } else { $to .= "," . $subscriber['email']; } } if (mail($to, $subject, $message, $headers)) { return true; } else { return false; } } else { return false; } }
<?php session_start(); require '../../include/login.inc.php'; require '../../include/events.inc.php'; if (isset($_SESSION['user'])) { $login = new CLogin($_SESSION['user']['username'], $_SESSION['user']['password']); if ($login->isAuthentiated()) { if (isset($_POST['id'])) { $eventid = $_POST['id']; if ($details = CEvents::getDetails($eventid)) { $response = $details; } else { } } else { $response = array('error' => true, 'title' => 'Error!', 'message' => 'Invalid event details', 'style' => 'error'); } } else { $response = array('error' => true, 'title' => 'Access Denied', 'message' => 'You are not authentiated', 'style' => 'error'); } } else { $response = array('error' => true, 'title' => 'Access Denied', 'message' => 'You are not authentiated', 'style' => 'error'); } echo json_encode($response);