Exemplo n.º 1
0
<?php

header('Content-Type: text/html; charset=utf-8');
ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once '../includes/simple_html_dom.php';
require_once "../includes/session.php";
require_once "../includes/functions.php";
require_once "../includes/connect.php";
/* php grabber for BibleGateway */
$book_id = $_GET['book'];
$chapter = $_GET['chapter'];
$verse = $_GET['verse'];
$version_id = $_GET['version_id'];
$lookup = $_GET['lookup'];
$book = getBookName($book_id);
$versionName = getVersionName($version_id);
$url = getUrl($book, $chapter, $verse, $versionName);
if ($lookup == 0) {
    $verse_text = "";
    showTextArea($verse_text, $url);
} else {
    $verse_text = getBGVerseText($book, $chapter, $verse, $url);
    if ($verse_text != "") {
        showTextArea($verse_text, $url);
    } else {
        echo "<div class='error'>There seems to have been a problem. getVerse line 27.</div>";
    }
}
function showTextArea($verse_text, $url)
{
Exemplo n.º 2
0
        if ($booksInfo[$i]['bookId'] == $_POST['bookId']) {
            $booksInfo[$i]['quantity'] = $_POST['quantity'];
            $bookFound = true;
            break;
        }
    }
}
if (!$bookFound) {
    $book = array('bookId' => $_POST['bookId'], 'quantity' => $_POST['quantity']);
    array_push($booksInfo, $book);
}
$_SESSION['cart'] = $booksInfo;
$grossTotal = 0;
for ($i = 0; $i < count($booksInfo); $i++) {
    $aBook = $booksInfo[$i];
    $bookName = getBookName($booksInfo[$i]['bookId']);
    $bookPrice = getPriceForBook($booksInfo[$i]['bookId']);
    $totalPrice = $bookPrice * $booksInfo[$i]['quantity'];
    $grossTotal += $totalPrice;
    $str .= '<strong>Name - </strong>' . $bookName;
    $str .= '<br/>';
    $str .= ' <strong>Copies - </strong>' . $booksInfo[$i]['quantity'];
    $str .= '<br/>';
    $str .= '<strong>Price - </strong>$' . $bookPrice . ' * ' . $booksInfo[$i]['quantity'] . ' = $' . $totalPrice;
    $str .= '<br/><br/>';
}
$str .= '<strong>Net Amount - </strong>$' . $grossTotal;
echo $str;
function getBookName($id)
{
    $objXML = simplexml_load_file('books.xml');