include_once './partials/header.php'; require_once './../config/constants.php'; require_once './../class/NewsletterManager.class.php'; require_once './../includes/functions.inc.php'; require_once './../includes/SSMTP.inc.php'; require_once './../class/NewsletterSubscriberManager.class.php'; ?> <body> <?php if (isset($_POST['subject']) && isset($_POST['content'])) { extract($_POST); $NManager = new NewsletterManager(); $NSManager = new NewsletterSubscriberManager(); $newsletter = new Newsletter($subject, $content); if ($NManager->Create($newsletter)) { $subscribers = $NSManager->Read(); $mail = SSMTP::getInstance(); for ($i = 0; $i < count($subscribers); $i++) { $mail->sendEmail("*****@*****.**", $subscribers[$i]->Email, $subject, $content); } } header('Location: newsletterlist.php'); } include './partials/main_admin.php'; include './partials/createform.php'; ?> </body> <?php include_once './partials/footer.php';
include_once './partials/main_admin.php'; if (!isset($_SESSION["Admin"]) || $_SESSION["Admin"] == null) { header('Location: login.php'); } require_once './../class/NewsletterSubscriberManager.class.php'; ?> <div class="container"> <?php $NSManager = new NewsletterSubscriberManager(); if (isset($_POST['newsletterSubscriberEmail']) && isset($_POST['id']) && isset($_POST['token'])) { extract($_POST); $NSManager->Update($id, $newsletterSubscriberEmail, $token); header('Location: subscriberlist.php'); } if (isset($_GET['id'])) { $subscriber = $NSManager->Read($_GET['id']); ?> <form action="edit.php" method="POST"> <div class="row"> <div class="col-md-9"> <div class="form-group"> <input type="email" placeholder="Mon email" class="form-control" id="email" name="newsletterSubscriberEmail" value="<?php echo $subscriber[0]->Email; ?> " /> </div> </div> <input type="hidden" value="<?php echo $subscriber[0]->NewsletterSubscriberID; ?> " name="id"/>