$myfilter = " and (to_address=\"" . $luser . "\" or from_address=\"" . $luser . "\") ";
// I don't know why the following line causes things to puke. :-(
// $myfilter = " and (timestamp>(now() - interval 3 day)) and (to_address=\"".$luser."\" or from_address=\"".$luser."\") ";
$refresh = luser_html_start("Message Listing");
$dbh = DB::connect(DB_DSN, true);
if (DB::isError($dbh)) {
    die($dbh->getMessage());
}
$sth = $dbh->query("\n     SELECT\n      DATE_FORMAT(timestamp, '%d/%m/%y %H:%i:%s') AS datetime,\n      id AS id,\n      from_address,\n      to_address,\n      subject,\n      size,\n      CASE WHEN isspam=1 THEN 'Y' ELSE 'N' END AS isspam,\n      CASE WHEN ishighspam=1 THEN 'Y' ELSE 'N' END AS ishighspam,\n      CASE WHEN isrblspam=1 THEN 'Y' ELSE 'N' END AS isrblspam,\n      CASE WHEN spamwhitelisted=1 THEN 'Y' ELSE 'N' END AS iswhitelisted,\n      sascore,\n      CASE WHEN virusinfected=1 THEN 'Y' ELSE 'N' END AS virusinfected,\n      CASE WHEN nameinfected=1 THEN 'Y' ELSE 'N' END AS nameinfected,\n      CASE WHEN otherinfected=1 THEN 'Y' ELSE 'N' END AS otherinfected,\n      report\n     FROM\n      maillog\n     WHERE\n      1=1\n    " . $myfilter . "\n ORDER BY \n  date DESC, time DESC\n") or die("Error executing query: " . mysql_error());
//"); // or die("Error executing query: ".mysql_error());
//  and to_address='*****@*****.**'
//".$_SESSION["filter"]->CreateSQL()."
// print_r($sth);
$offset = intval($_REQUEST['offset']);
$per_page = MAX_RESULTS;
$pager = new DB_Pager($sth, $offset, $per_page);
$data = $pager->build();
// Display table headings
echo "<TABLE CLASS=\"mail\" BORDER=0 WIDTH=100% CELLSPACING=2 CELLPADDING=2>\n";
echo " <THEAD>\n";
// Previous page link
// tgf - Don't show a Prev link on the first page.
if ($data['current'] != '1') {
    printf('<TH ALIGN="CENTER"><A HREF="%s?offset=%d">&lt;&lt;Prev</A></TH>', sanitizeInput($_SERVER['PHP_SELF']), $data['prev']);
} else {
    printf('<TH ALIGN="CENTER">&nbsp;</TH>');
}
echo "  <TH COLSPAN=6>Showing records " . $data['from'] . " to " . $data['to'] . " of " . $data['numrows'] . "\n";
// Next page link
// tgf - Don't show a Next link on the last page.
if ($data['current'] != $data['numpages']) {
Example #2
0
    echo html_header("Proof Card");
    echo '<div align="center">
' . $render . '
</div>';
} elseif ($_GET["action"] == "Mistakes") {
    $intPropID = $_GET["propID"];
    $sql = "SELECT * FROM property, area, state_of_trade, proptype, branch WHERE property.prop_ID = " . $intPropID . " AND ";
    $sql .= " property.area_id = area.area_ID AND property.state_of_trade_id = state_of_trade.state_ID ";
    $sql .= " AND property.type_id = proptype.type_ID ";
    $sql .= " AND property.Branch = branch.Branch_ID";
    if (DB::isError($res = $con->query($sql))) {
        die(DB::errorMessage($res));
    }
    $from = isset($_GET['from']) ? (int) $_GET['from'] : 0;
    $limit = 1;
    $pager = new DB_Pager($res, $from, $limit);
    $data = $pager->build();
    if (DB::isError($data)) {
        die(DB::errorMessage($data));
    }
    while ($row = $pager->fetchRow(DB_FETCHMODE_ASSOC)) {
        $pc = explode(" ", $row['Postcode']);
        $intOSX = $row["osx"];
        $intOSY = $row["osy"];
        $SQLTrans = "SELECT places.place_ID, places.place_type, places.place_title, places.place_desc, places.place_osx, places.place_osy, pl_type.pl_type_id, pl_type_title FROM places, pl_type WHERE (places.place_type = 1 OR places.place_type = 2) AND places.place_type = pl_type.pl_type_id  ORDER BY sqrt((abs(places.place_osx-" . $intOSX . ")*abs(places.place_osx-" . $intOSX . "))+(abs(places.place_osy-" . $intOSY . ")*abs(places.place_osy-" . $intOSY . "))) LIMIT 1";
        $rowTrans = $con->getRow($SQLTrans, DB_FETCHMODE_ASSOC);
        if (DB::isError($resTrans = $con->query($SQLTrans))) {
            die(DB::errorMessage($resTrans));
        }
        $intTransType = $rowTrans['place_type'];
        $strTransType = $rowTrans['pl_type_title'];
 function get($query, $from = 0, $class = "")
 {
     $res = $this->db->query($query);
     $pager = new DB_Pager($res, $from, $this->limit);
     $data = $pager->build();
     if (DB::isError($data)) {
         return $this->raiseError(DB::errorMessage($data));
     }
     if (!$data) {
         //return $this->raiseError("There were no results");
         return $this->str_emptyresult;
     }
     if ($this->heading) {
         $this->table_Header($class);
     }
     $this->table_Body($pager, $from, $class);
     $this->table_Footer($class);
     if ($class) {
         $row1Style = array("class" => $class);
         if ($this->alternate_background) {
             $row2Style = array("class" => $class . $this->alternate_background_style);
             $this->table->altRowAttributes(1, $row1Style, $row2Style);
         }
     }
     return $this->meta_head($data) . "<br>" . $this->get_nav($data) . $this->table->toHTML() . $this->get_nav($data);
 }