$b)
// { print “{$a}:{$b}
“; };

$libraryid = $_REQUEST[‘libraryid’];

if ($libraryid == ”)
{ $libraryid = 2; };

$type = strtolower($_REQUEST[‘type’]);

if (($type <> ‘print’) and ($type <> ‘pdf’))
{ $type = ‘print’; };

$lrow = mfetch(mquery(“SELECT * FROM `libraries` WHERE `libraryid` = {$libraryid}”));

// Look for guides to order
$gresult = mquery(“SELECT * FROM `guides` WHERE `libraryid` = {$libraryid} ORDER BY `guidename`”);
$guideorders = array();
while ($grow = mfetch($gresult)) {
if ($_REQUEST[“guide_{$grow[‘guideid’]}”] == ‘on’)
{ $guideorders[$grow[‘guideid’]] = $grow[‘guidename’]; };
};

if ((count($guideorders) > 0) and ($_REQUEST[‘proceed_x’] <> ”)) {
// Checkout page

$gc = mrows(mquery(“SELECT * FROM `guides` WHERE `libraryid` = {$libraryid}”));

if ($type == ‘print’) {
$ordertype = ‘Print’;
$orderprice = $lrow[‘guidepriceprint’];
}
else {
$ordertype = ‘PDF’;
$orderprice = $lrow[‘guidepricepdf’];
};
$totalprice = $orderprice * count($guideorders);

$email = trim($_REQUEST[’email’]);
$firstname = trim($_REQUEST[‘firstname’]);
$mi = trim($_REQUEST[‘mi’]);
$lastname = trim($_REQUEST[‘lastname’]);
$firm = trim($_REQUEST[‘firm’]);
$profession = trim($_REQUEST[‘profession’]);
$address1 = trim($_REQUEST[‘address1’]);
$address2 = trim($_REQUEST[‘address2’]);
$city = trim($_REQUEST[‘city’]);
$state = $_REQUEST[‘state’];
$zip = trim($_REQUEST[‘zip’]);
$country = $_REQUEST[‘country’];
$telephone = trim($_REQUEST[‘telephone’]);
$cctype = $_REQUEST[‘cctype’];
$ccname = trim($_REQUEST[‘ccname’]);
$ccnumber = trim($_REQUEST[‘ccnumber’]);
$ccmonth = $_REQUEST[‘ccmonth’];
$ccyear = $_REQUEST[‘ccyear’];
$terms = $_REQUEST[‘terms’];
$copybilling = ($_REQUEST[‘copybilling’] == ‘on’);
if ($copybilling) {
$s_firstname = $firstname;
$s_mi = $mi;
$s_lastname = $lastname;
$s_address1 = $address1;
$s_address2 = $address2;
$s_city = $city;
$s_state = $state;
$s_zip = $zip;
$s_country = $country;
}
else {
$s_firstname = trim($_REQUEST[‘s_firstname’]);
$s_mi = trim($_REQUEST[‘s_mi’]);
$s_lastname = trim($_REQUEST[‘s_lastname’]);
$s_address1 = trim($_REQUEST[‘s_address1’]);
$s_address2 = trim($_REQUEST[‘s_address2’]);
$s_city = trim($_REQUEST[‘s_city’]);
$s_state = $_REQUEST[‘s_state’];
$s_zip = trim($_REQUEST[‘s_zip’]);
$s_country = $_REQUEST[‘s_country’];
};

$transaction = false;

if (($email <> ”) or ($firstname <> ”) or ($lastname <> ”) or ($firm <> ”)) {
$error = ”;
if ($email == ”)
{ $error .= ‘You must enter an email address
‘; }
elseif ((strpos($email,’@’) == 0) or (strpos($email,’.’) == 0) or
(strpos($email,’ ‘) > 0))
{ $error .= ‘Email address is not valid.
‘; };
if ($firstname == ”)
{ $error .= ‘You must enter a First Name.
‘; };
if ($lastname == ”)
{ $error .= ‘You must enter a Last Name.
‘; };
if ($address1 == ”)
{ $error .= ‘You must enter an Address.
‘; };
if ($city == ”)
{ $error .= ‘You must enter a City.
‘; };
if ($state == ”)
{ $error .= ‘You must select a State/Province.
‘; };
if ($zip == ”)
{ $error .= ‘You must enter a Zip Code.
‘; };
if (($type == ‘print’) and (!$copybilling)) {
if ($s_firstname == ”)
{ $error .= ‘You must enter a Shipping First Name.
‘; };
if ($s_lastname == ”)
{ $error .= ‘You must enter a Shipping Last Name.
‘; };
if ($s_address1 == ”)
{ $error .= ‘You must enter a Shipping Address.
‘; };
if ($s_city == ”)
{ $error .= ‘You must enter a Shipping City.
‘; };
if ($s_state == ”)
{ $error .= ‘You must select a Shipping State/Province.
‘; };
if ($s_zip == ”)
{ $error .= ‘You must enter a Shipping Zip Code.
‘; };
};
if ($ccnumber == ”)
{ $error .= ‘You must enter a Credit Card Number.
‘; };
if ($terms <> ‘agree’)
{ $error .= ‘You must agree to the Terms of Use Agreement in order to complete your order.
‘; };
if ($error == ”) {
// Process credit card transaction
// Add record
$aquery = “INSERT INTO `guideorders` (`email`,`firstname`,`mi`,`lastname`,`firm`,`profession`,`address1`,`address2`,`city`,`state`,`zip`,`country`,`telephone`,`paymentmethod`,`ccname`,`ccnumber`,`ccmonth`,`ccyear`,`amount`,`active`,`libraryid`,`s_firstname`,`s_mi`,`s_lastname`,`s_address1`,`s_address2`,`s_city`,`s_state`,`s_zip`,`s_country`) VALUES (”
. ‘”‘ . addslashes($email) . ‘”,”‘ . addslashes($firstname) . ‘”,”‘ . addslashes($mi) . ‘”,”‘ . addslashes($lastname) . ‘”,”‘ . addslashes($firm) . “\”,\”{$profession}\”,\”” . addslashes($address1) . ‘”,”‘ . addslashes($address2)
. ‘”,”‘ . addslashes($city) . ‘”,”‘ . addslashes($state) . ‘”,”‘ . addslashes($zip) . ‘”,”‘ . addslashes($country) . ‘”,”‘ . addslashes($telephone) . “\”,\”{$cctype}\”,\”” . addslashes($ccname) . ‘”,”‘ . addslashes($ccnumber) . “\”,{$ccmonth},{$ccyear},{$totalprice},”
. “0,{$libraryid},\”” . addslashes($s_firstname) . ‘”,”‘ . addslashes($s_mi) . ‘”,”‘ . addslashes($s_lastname) . ‘”,”‘ . addslashes($s_address1) . ‘”,”‘ . addslashes($s_address2) . ‘”,”‘ . addslashes($s_city) . ‘”,”‘
. addslashes($s_state) . ‘”,”‘ . addslashes($s_zip) . ‘”,”‘ . addslashes($s_country) . ‘”)’;
$aresult = mquery($aquery) or die(“Error adding subscription information!”);
$orderid = mysql_insert_id();

// Add guides
foreach ($guideorders as $guideid => $guidename) {
$aresult = mquery(“INSERT INTO `guideorderdetails` (`guideorderid`,`guideid`) VALUES ({$orderid},{$guideid})”);
};

$status = process_credit($orderid,’guideorder’);
if ($status) {
// Show receipt page
$transaction = true;
sendguideorderemail($orderid);
}
else {
$error = ‘Credit card transaction did not complete successfully.
‘;
};
};
};

if (!$transaction) {
print “

{$lrow[‘libraryname’]}

Your Order

“;

if ($error <> ”) {
print “

Your transaction could not be completed due to the following errors:

{$error}
“;
print “Please check your information and submit your transaction again, or call us toll-free at 800-965-3002.
“;
};

print ‘
‘;

print ‘

‘;
foreach ($guideorders as $guideid => $guidename)
{ print ““; };
print ““;
print ““;

print ‘

‘;
foreach ($guideorders as $guideid => $guidename) {
print “

“;
};

if ($type == ‘print’) {
print ‘

‘;
print ‘

‘;
print ‘

‘;
print ‘

‘;
print ‘

‘;
};

print ‘

Guide Title Format Price
{$guidename} {$ordertype} $” . number_format($orderprice,2) . “
When you order the PRINT format of a particular Guide, you will also receive the PDF version of the same Guide absolutely FREE of charge. Instructions for downloading the free PDF will be provided when you complete your transaction.

Shipping & Handling
Shipping Method Price
U.S. Priority Mail FREE
Please allow 4-6 business days after order placement for delivery of your Guide(s).
Total Price $’;

print number_format($totalprice,2);
print ‘

‘;

?>

Your Billing Information
* Email Address * First Name Middle Initial * Last Name Law Firm/Company Profession
* Address Line 1 Address Line 2 * City * State/Province
* Zip/Postal Code * Country
Telephone Your Shipping Information
> Please check this box if the Shipping address is the same as the Billing address
* First Name Middle Initial * Last Name * Address Line 1 Address Line 2 * City * State/Province
* Zip/Postal Code * Country
Payment Method
* Credit Card Type
* Name as it appears on Card * Card Number
(No spaces or dashes)
* Card Expiration Date

Terms of Use Agreement

I have read and agree to the Terms of Use Agreement associated with this order and I understand that my credit card will be charged $ for my order. I understand that I can cancel my order subject to the terms and conditions of the cancellation policy.


Your Order Confirmation

Thank you for becoming ordering Guides the online . Please print and save this page, which serves as your order confirmation.

“;
};
?>

Order Number:
 
Guides Ordered
Guide Title Format
{$drow[‘guidename’]} “;
if ($type == ‘print’)
{ print ‘Print’; }
else
{ print ‘PDF’; };
print ” Download (PDF)“;
print “
 
Billing Information
Email Address:
Name:
Law Firm/Company:
Address:

,
Telephone:
 
Shipping Information
Name:
Address:

,
 
Payment Method
Credit Card Type:
Name on Credit Card:
Credit Card Number:
Expiration Date: /
Total Price: $

{$lrow[‘libraryname’]}

“;

print “

Purchasing Individual Guides

“;

print “Individual Guides from the {$lrow[‘libraryname’]} are available for purchase in either PRINT or PDF formats.

“;

print “

  • Print Format – You may order a printed, soft-cover bound copy of one or more Guides at a cost of $” . number_format($lrow[‘guidepriceprint’],2) . ” per Guide. When you order a Print copy of a Guide, you will also receive via Email the PDF version of the same Guide absolutely FREE of charge.
     
  • “;
    print “

  • PDF Format – You can immediately download individual Guides (PDF) from the {$lrow[‘libraryname’]} at a cost of $” . number_format($lrow[‘guidepricepdf’],2) . ” per Guide.

“;

print ‘

‘;
print ““;

print “Step 1: Please select your preference (PRINT or PDF):

“;

print ‘ PRINT (includes FREE SHIPPING; please allow 4-6 business days for delivery)

‘;

print ‘ PDF (available for immediate download)

‘;

print ‘Step 2: Please select the Guide(s) you wish to order from the list below:’;

$gc = mrows(mquery(“SELECT * FROM `guides` WHERE `libraryid` = {$libraryid}”));
$rightgc = floor($gc/2);
$leftgc = $gc – $rightgc;

print ‘

‘;
print ‘

‘;

$leftresult = mquery(“SELECT * FROM `guides` WHERE `libraryid` = {$libraryid} ORDER BY `guidename` LIMIT 0,{$rightgc}”);
$rightresult = mquery(“SELECT * FROM `guides` WHERE `libraryid` = {$libraryid} ORDER BY `guidename` LIMIT {$rightgc},{$leftgc}”);
while ($grow = mfetch($leftresult)) {
print “ ”)
{ print ‘ checked=”checked”‘; };
print “\”> {$grow[‘guidename’]}
“;
};

print ‘

‘;

while ($grow = mfetch($rightresult)) {
print “ ”)
{ print ‘ checked=”checked”‘; };
print “\”> {$grow[‘guidename’]}
“;
};

print ‘

‘;

print ‘Step 3: Please click on the “Proceed to Checkout” button and complete your order:

‘;

print ‘

‘;

print ‘

‘;
};

?>