Example #1
0
<?php

require "globals.php5";
require "cookies.php5";
$referrer = $_SERVER['HTTP_REFERER'];
$noteid = $_SESSION['delete_note'];
$qstr = $_SESSION['delete_note_str'];
$yr = $_SESSION['delete_note_yr'];
if ($UUID && $noteid) {
    try {
        $db = $yr == 2005 ? db_notes() : db_career();
        $sql = $ACCESS != 500 ? sprintf("delete from notes where note_id = '%s' and uid = %d", $noteid, $UUID) : sprintf("delete from notes where note_id = '%s'", $noteid);
        $result = $db->query($sql);
    } catch (Exception $e) {
        // $mesg = 'Error found: '.$e->getMessage().' ('.$e->getCode().')';
        // NOTHING, REALLY
    }
}
if (strpos($referrer, '?') === false) {
    $referrer .= '?' . $qstr;
}
unset($_SESSION['delete_note']);
header("Location: {$referrer}");
Example #2
0
     throw new Exception('Who am I? Who are you?', __LINE__);
 }
 while ($oper = $result->fetch_object()) {
     $opers[$oper->uid] = $oper->username;
 }
 $result->free();
 $result = $db->query("select uid,email from clients");
 if (!$result || !$result->num_rows) {
     throw new Exception('What happened to clients?', __LINE__);
 }
 while ($oper = $result->fetch_object()) {
     $opers[$oper->uid] = $oper->email;
 }
 $result->free();
 if (!isset($nodb)) {
     $nodb = db_notes();
 }
 $sql = "select note_id,date_format(dt,'%c/%e/%y %T') as datetim,n.uid,note,shared from notes n where res_id = {$docid} and shared <= {$ACCESS} and acct = 0 order by dt desc";
 $result = $nodb->query($sql);
 $firstnote = true;
 unset($_SESSION['delete_note']);
 unset($_SESSION['delete_note_yr']);
 if (!$result) {
     throw new Exception(DEBUG ? "{$nodb->error} : {$sql}" : 'Can not retrieve notes', __LINE__);
 }
 for ($i = 0; $i < $result->num_rows; $i++) {
     $row = $result->fetch_assoc();
     ?>
     <tr>
       <td><?php 
     echo $row['datetim'];