public static function reply($id, $message)
 {
     $suggestion = CSuggestion::getSuggesion($id);
     $headers = "From: GSC \r\n";
     $to = $suggestion['email'];
     $subject = "GSC Event Request Reply";
     if (mail($to, $subject, $message, $headers)) {
         return true;
     } else {
         return false;
     }
 }
<?php

session_start();
require_once '../../include/suggestion.inc.php';
require_once '../../include/login.inc.php';
if (isset($_SESSION['user'])) {
    $login = new CLogin($_SESSION['user']['username'], $_SESSION['user']['password']);
    if ($login->isAuthentiated()) {
        foreach ($_POST as $value) {
            if ($value == "") {
                $response = array('title' => 'Error!', 'message' => 'Make sure you filled all the field', 'style' => 'error');
                echo json_encode($response);
                exit;
            }
        }
        $id = $_POST['id'];
        $message = $_POST['message'];
        if ($suggestions = CSuggestion::reply($id, $message)) {
            $response = array('error' => false, 'title' => 'Done!', 'message' => 'The reply was sent', 'style' => 'notice');
        } else {
            $response = array('error' => true, 'title' => 'Internal Error!', 'message' => 'There was an internal error', '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);
<?php

session_start();
require_once '../../include/suggestion.inc.php';
require_once '../../include/login.inc.php';
if (isset($_SESSION['user'])) {
    $login = new CLogin($_SESSION['user']['username'], $_SESSION['user']['password']);
    if ($login->isAuthentiated()) {
        if ($suggestions = CSuggestion::clear()) {
            $response = array('error' => false);
        } else {
            $response = array('error' => true, 'title' => 'Internal Error!', 'message' => 'There was an internal error', '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);
<?php

session_start();
require_once '../../include/suggestion.inc.php';
require_once '../../include/login.inc.php';
if (isset($_SESSION['user'])) {
    $login = new CLogin($_SESSION['user']['username'], $_SESSION['user']['password']);
    if ($login->isAuthentiated()) {
        if ($suggestions = CSuggestion::getSuggestions()) {
            $html = "";
            $count = CSuggestion::count();
            while ($suggestion = mysql_fetch_assoc($suggestions)) {
                $html .= "<li record-id={$suggestion['id']} class='suggestion'>\n                            <div class='container-fluid'>\n                                <div class='row'><b>{$suggestion['name']}</b></div>\n                                <div class='row'><i>{$suggestion['reason']}</i></div>\n                                <div clas='row'><div class='pull-right'><a record-id='{$suggestion['id']}' class='reply-suggest' data-toggle='modal' data-target='#modal-reply-suggest' href='#'>Reply</a></div></div>\n                            </div>\n                        </li>";
            }
            if ($html != "") {
                $html .= "<li class='text-center'><a href='#' id='clear-suggestions'>Clear All</a></li>";
            }
            $response = array('error' => false, 'html' => $html, 'count' => $count);
        } else {
            $response = array('error' => true, 'title' => 'Internal Error!', 'message' => 'There was an internal error', '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);
Beispiel #5
0
<?php

require_once '../../include/suggestion.inc.php';
foreach ($_POST as $values) {
    if ($values == "") {
        $response = array('title' => 'Error!', 'message' => 'Make sure you filled all the field', 'style' => 'error');
        echo json_encode($response);
        exit;
    }
}
if (CSuggestion::suggest($_POST)) {
    $response = array('title' => 'Thank You', 'message' => 'Thanks for your suggestion', 'style' => 'notice');
} else {
    $response = array('title' => 'Internal Error!', 'message' => 'There was an internal error', 'style' => 'error');
}
echo json_encode($response);