示例#1
0
 function notesDispatch($op)
 {
     switch ($op) {
         case "notes":
             notes();
             break;
         case "displaynotes":
             displaynotes();
             break;
         case "addnotes":
             addnotes();
             break;
         case "insnotes":
             insnotes();
             break;
         case "modnotes":
             modnotes();
             break;
         case "upnotes":
             upnotes();
             break;
         case "delnotes":
             delnotes();
             break;
     }
 }
require_once "config/db.php";
if (!isset($_SESSION)) {
    session_start();
}
$db_connection = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT);
if ($db_connection->connect_errno) {
    $output = array('status' => 'error', 'type' => 'db connection error');
}
if (isset($_GET['method'])) {
    $method = $_GET['method'];
    if ($method == 'addnotes') {
        $data = $_GET['data'];
        $stat = $_GET['status'];
        $project = $_GET['project'];
        $status = addnotes($data, $stat, $project);
        if ($status != '') {
            $output = array('status' => 'success', 'id' => $status);
        } else {
            $output = array('status' => 'error');
        }
    } else {
        if ($method == 'ajaxloadnotes') {
            $name = $_GET['name'];
            $stat = $_GET['status'];
            $status = ajaxloadnotes($stat, $name);
            //loadchat($name);
            if ($status) {
                $output = array('status' => 'success', 'results' => $status);
            } else {
                $output = array('status' => 'error');