File: /home/mckernan/public_html/iJournal/includes/notes/clientlist.php
<?php
// fetch client notes list
// init database name
$database = DB_PREFIX;
// process request
if ($sid != '')
{
// sid check
require "includes/session/sidck.php";
// init return value
$rv = '<root>' . PHP_EOL;
$rv .= '<notes>' . PHP_EOL;
// fetch database name / open db
$db = '';
if ( isset($_POST['db']) ) $db = $_POST['db'];
if ( isset($_GET['db']) ) $db = $_GET['db'];
if ($db == '') die();
$database .= $db;
require "includes/db.php";
$per = getvar($db, 'per', 'int');
// fetch notes
$query = "SELECT cnot_id, cnot_note FROM notes_client WHERE cnot_per = " . $per;
if ($result = $db->query($query))
{
while ($row = $result->fetch_assoc())
{
$rv .= '<note>';
$rv .= '<id>' . $row['cnot_id'] . '</id>' . PHP_EOL;
$rv .= '<text>' . $row['cnot_note'] . '</text>' . PHP_EOL;
$rv .= '</note>';
}
}
// finish output
$rv .= '</notes>' . PHP_EOL;
$rv .= '</root>' . PHP_EOL;
// return data
echo $rv;
die;
}
else
{
header('Server: ');
header('X-Powered-By: ');
header("HTTP/1.0 404 Not Found");
}
?>