Needs help with old PHP scrips on new server with update version of PHP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • laurie

    Needs help with old PHP scrips on new server with update version of PHP

    Hi all,

    I'm trying to help out a friend who has inherited a client with a PHP
    shopping cart application. Neither of us know PHP, but I've been
    muddling my way through, trying to get these old scripts working on a
    new server with the most recent version of PHP. I've pretty much
    taken care of all the various errors that were popping up. Most only
    pointed out out non-fatal undefined or assumed variables. I've been
    able to cure most of them by adding single quotes to array variables
    and pre-defining variables that weren't being defined previously. But
    I'm absolutely stumped on one last error that I can't seem to shake.

    The error itself is:

    Notice: Undefined index: cart.sum.tax.6 in
    G:\squaretwo\in c.specialscart. php on line 54

    Line 54 of the above mentioned script is:

    $cart->tabulate_items ("\$",0,($st ate == "NJ" ?
    $values['cart.sum.tax.6 '] : 0));

    I don't know enough PHP to even know what cart.sum.tax.6 is supposed
    to be. As I said, most of the problems I've encountered thus far have
    been solved by adding single quotes (this line already has them) or
    pre-defining variables (I don't even know what to define here!)

    Any help would be much appreciated. The entire script in question is
    below. Line 54 marked with **.

    Thanks!
    -laurie
    thetreefrog@yah oo.com

    <?php

    // if we're in the checkout
    if (isset($checkou t))
    {
    if (!isset($idhash ))
    {
    // show cart
    // create md5 hash as unique key and add to db with date
    // show form for contact/delivery details

    echo "<p>Current order status:</p>\n";
    $cart->tabulate_items ("\$");
    echo "<p><a href=\"specials .php\">Continue shopping</a></p><br>\n";
    $hash = md5(uniqid(micr otime(),1));
    echo "<p>Please complete your details:</p>\n";
    show_contact_fo rm($hash);
    }
    else
    {
    // when form submitted add details to db with md5 hash
    // show form for credit card details

    if (isset($firstst age))
    {
    if ($lname=="" || $fname=="" || $address=="" || $city=="" ||
    $state=="" || $zip=="" || $phone=="" || $email=="")
    {
    echo "<p>Current order status:</p>\n";
    $cart->tabulate_items ("\$");
    echo "<p><a href=\"specials .php\">Continue
    shopping</a></p><br>\n";
    echo "<p>You must complete the entire form.</p>\n";
    $sf->odSlashes($gpc Vars,1);
    show_contact_fo rm($idhash);
    }
    else if (!$sf->validate_email ($email))
    {
    echo "<p>Current order status:</p>\n";
    $cart->tabulate_items ("\$");
    echo "<p><a href=\"specials .php\">Continue
    shopping</a></p><br>\n";
    echo "<p>That email address is invalid. You must enter your full
    and correct email address.</p>\n";
    $sf->odSlashes($gpc Vars,1);
    show_contact_fo rm($idhash);
    }
    else
    {
    $gpcVars = string_function s::doSlashes($g pcVars,1);
    $db->Insert("INSE RT INTO {$cfgVars['tbl_purchases']}
    (id,added,lname ,fname,address, city,state,zip, phone,email) " .
    "VALUES('{$idha sh}',NOW(),'{$g pcVars['lname']}','{$gpcVars['fname']}','{$gpcVars['address']}','{$gpcVars['city']}','{$gpcVars['state']}','{$gpcVars['zip']}','{$gpcVars['phone']}','{$gpcVars['email']}')");
    $values = $cart->sum();
    $ship->SetQuantity($c art->item_count() );
    $ship->setList($car t->print_list() );
    echo "<p>Current order status:</p>\n";
    ** $cart->tabulate_items ("\$",0,($st ate == "NJ" ?
    $values['cart.sum.tax.6 '] : 0));
    echo "<hr noshade>\n";
    echo "<p>Shippin g details:</p>\n";
    show_shipping_f orm($idhash);
    shipping_detail s();
    echo "<hr noshade>\n";
    echo "<p>Please enter your credit card details:</p>\n";
    show_creditcard _form($idhash);
    }
    }

    // get contact details

    if (isset($seconds tage))
    {
    //echo "<h1>List: ".$cart->print_list()." </h1>";
    $ship->SetQuantity($c art->item_count() );
    $ship->setList($car t->print_list() );
    if (isset($shipcha nge))
    {
    echo "<h1>Shipch arge set</h2>";
    $ship->SetOption($shi pping);
    $cart->tabulate_items ("\$",0,($st ate == "NJ" ?
    $values['cart.sum.tax.6 '] : 0));
    echo "<hr noshade>\n";
    echo "<p>Shippin g details:</p>\n";
    show_shipping_f orm($idhash);
    shipping_detail s();
    echo "<hr noshade>\n";
    echo "<p>Please enter your credit card details:</p>\n";
    show_creditcard _form($idhash);
    }
    //commented out for testing
    else if ($cc_name=="" || $cc_type=="" || $cc_number=="" ||
    $cc_exp_mm=="" || $cc_exp_yy=="")
    {
    $cart->tabulate_items ("\$",0,($st ate == "NJ" ?
    $values['cart.sum.tax.6 '] : 0));
    echo "<hr noshade>\n";
    echo "<p>Shippin g details:</p>\n";
    show_shipping_f orm($idhash);
    shipping_detail s();
    echo "<hr noshade>\n";
    echo "<p>You must complete all of the form.</p>\n";
    show_creditcard _form($idhash);
    }
    else if (!$cc->CheckCard($cc_ type, $cc_number, $cc_exp_mm,
    $cc_exp_yy))
    {
    $cart->tabulate_items ("\$",0,($st ate == "NJ" ?
    $values['cart.sum.tax.6 '] : 0));
    echo "<hr noshade>\n";
    echo "<p>Shippin g details:</p>\n";
    show_shipping_f orm($idhash);
    shipping_detail s();
    echo "<hr noshade>\n";
    echo "<p>That credit card number could not be verfied because of
    an {$cc->CCerror}.</p>\n";
    show_creditcard _form($idhash);
    }

    else
    {
    $db->QueryRow("SELE CT * FROM {$cfgVars['tbl_purchases']} WHERE id
    = '$idhash'");
    $db->data = $sf->odSlashes($d b->data);
    $gpcVars = $sf->odSlashes($gpc Vars);
    echo "<p>Please verify the following information you
    entered.</p>\n";

    echo "<p><b>Addr ess</b></p>\n";
    echo "<p>{$db->data['fname']} {$db->data['lname']}<br>\n";
    echo "{$db->data['address']}<br>\n";
    echo "{$db->data['city']}, {$db->data['state']},
    {$db->data['zip']}</p>\n";
    echo "{$db->data['phone']}<br>{$db->data['email']}</p>\n";

    echo "<p><b>Cred it card details</b></p>\n";
    echo "<p>{$gpcVa rs['cc_name']}<br>\n";
    echo $cc->CardName($gpcV ars['cc_type']),"<br>\n";
    echo $gpcVars['cc_number'],"<br>\n";
    echo "Expires on
    {$gpcVars['cc_exp_mm']}/{$gpcVars['cc_exp_yy']}</p>\n";

    echo "<p><b>Shop ping Cart</b></p>\n";
    $cart->tabulate_items ("\$",0,($db->data['state'] == "NJ" ?
    $values['cart.sum.tax.6 '] : 0));

    echo "<p><b>Ship ping details</b><p>\n";
    // if ($ship->ShowShippingDe tails()) echo
    "<p>",$ship->GetName(),": ", $ship->GetStrAtCost(1 ), "</p>\n";
    if ($ship->ShowShippingDe tails()) echo "<p>",$ship->GetName(),":
    ", $ship->GetStrAtCost(1 ), "</p>\n";

    echo "<br>\n";

    echo "<table border=\"0\" cellpadding=\"0 \"
    cellspacing=\"0 \"><tr>";
    echo "<td>",okay_for m($db->data['id']),"</td><td>&nbsp;</td><td>",cancel _form($db->data['id']),"</td>";
    echo "</tr></table>\n";
    }
    }

    // cancel order
    // remove from database

    if (isset($cancel) )
    {
    $db->Delete("DELE TE FROM {$cfgVars['tbl_purchases']} WHERE id =
    '$idhash'");
    $ship->Reset();
    echo "<p>You have cancelled the order form process. <a
    href=\"$PHP_SEL F\">Click here</a> to return to the shopping
    cart.</p>\n";
    }

    // store cart
    // compose and send email to wgu
    // compose and send email to user
    // give thank you

    if (isset($complet e))
    {
    $thecart = urlencode(base6 4_encode(gzcomp ress(serialize( $cart))));

    $db->Update("UPDA TE {$cfgVars['tbl_purchases']} SET
    cart='$thecart' ,shipping='{$sh ip->SOusing}' WHERE id='$idhash'");

    $cc_name = string_function s::odSlashes($c c_name);
    $db->QueryRow("SELE CT * FROM {$cfgVars['tbl_purchases']} WHERE id
    = '$idhash'");
    $db->data = $sf->odSlashes($d b->data);
    $details = "";
    $details .= "Contact Information\n\n ";
    $details .= "{$db->data['fname']} {$db->data['lname']}\n";
    $details .= "{$db->data['address']}\n";
    $details .= "{$db->data['city']}, {$db->data['state']},
    {$db->data['zip']}\n\n";
    $details .= "Phone: {$db->data['phone']}\nEmail:
    {$db->data['email']}\n\n";
    $ccdetails = "";
    $ccdetails .= "Credit Card Information\n\n ";
    $ccdetails .= "Name on card : {$cc_name}\n";
    $ccdetails .= "CC Type : " . $cc->CardName($cc_t ype) . "\n";
    $ccdetails .= "CC Number : {$cc_number}\n" ;
    $ccdetails .= "CC Expiration : {$cc_exp_mm}/{$cc_exp_yy}\n\ n";
    $cartdetails = "";
    $cartdetails .= "Cart details\n\n";
    while ($values = $cart->show_next_item ())
    {
    $values = string_function s::odSlashes($v alues);
    // JohnO: Replace certain characters for readability
    $patterns = array ("/&#176;/");
    $replace = array (" Deg.");
    $values = preg_replace ($patterns, $replace, $values);

    $cartdetails .= "SKU : {$values['cart.inumber']}\n";
    $cartdetails .= "Name : {$values['cart.name']}\n";
    $cartdetails .= "Size : {$values['cart.size']}\n";
    $cartdetails .= "Descriptio n : {$values['cart.descr.0']}\n";
    $cartdetails .= "Quantity : {$values['cart.quant']}\n";
    $cartdetails .= "Price each : \${$values['cart.price']}\n\n";
    }
    $values = $cart->sum();
    $tax = ($db->data['state'] == "NJ" ? $values['cart.sum.tax.6 '] :
    0);
    $cartdetails .= "Total pre tax :
    \${$values['cart.sum.gtotp rice']}\n";
    $cartdetails .= "Tax : \${$tax}\n";
    $cartdetails .= "Total post tax : \$" .
    ($values['cart.sum.gtotp rice'] + $tax) . "\n\n";
    $shipdetails = "";
    $shipdetails .= "Shipping Information\n\n ";
    if ($ship->GetType()=="E" ) {
    $shipdetails .= "Shipping type : ***" . $ship->GetName() . "***
    - " . $ship->GetDesc() . "\n";
    }else{
    $shipdetails .= "Shipping type : " . $ship->GetName() . " - " .
    $ship->GetDesc() . "\n";
    }
    $shipdetails .= "Shipping cost : " . $ship->GetStrCost(1 ) .
    "\n\n";
    $total = "";
    $total .= "Grand total : \$" .
    sprintf("%.02f" ,$values['cart.sum.gtotp rice'] + $tax +
    ($ship->GetTotalCost() ==-1?0:$ship->GetTotalCost() )) . "\n\n";

    // do email to WGU

    $headers = "From: {$db->data['fname']} {$db->data['lname']}
    <{$db->data['email']}>\n";
    $headers .= "X-Mailer: Specials Purchase Email\n";
    $msg = "ATTENTION:\n\n A purchase was made from Square Two Golf
    website. The details are as follows:\n\n";
    $msg .= "---------------------------------------------------------------------------\n\n";
    $msg .= $details;
    $msg .= "---------------------------------------------------------------------------\n\n";
    $msg .= $ccdetails;
    $msg .= "---------------------------------------------------------------------------\n\n";
    $msg .= $cartdetails;
    $msg .= "---------------------------------------------------------------------------\n\n";
    $msg .= $shipdetails;
    $msg .= "---------------------------------------------------------------------------\n\n";
    $msg .= $total;
    $msg .= "---------------------------------------------------------------------------\n\n";
    $msg .= "Purchase was made on " . date("l, F jS, Y \a\\t g:i a"
    ,time()) . ".\n\n";
    $msg = wordwrap($msg,7 5);
    @mail($cfgVars['email_purchase '],"PURCHASE MADE:
    Specials",$msg, $headers);
    //@mail("andrew@i nnismaggiore.co m","PURCHASE MADE:
    Specials",$msg, $headers);
    //@mail("johno@in nismaggiore.com ","PURCHASE MADE:
    Specials",$msg, $headers);

    // do email to user

    $headers = "From: Square Two Golf Specials Confirmation
    <{$cfgVars['email_purchase ']}>\n";
    $headers .= "X-Mailer: Specials Purchase Confirmation Email\n";
    $msg = "Thank you for your purchase from the Square Two Golf
    website. This is your receipt, so please ";
    $msg .= "save it or make a print out for your records.\n\n";
    $msg .= "The details are as follows:\n\n";
    $msg .= "--------------------------------------------------------------------------\n\n";
    $msg .= $details;
    $msg .= "---------------------------------------------------------------------------\n\n";
    $msg .= $cartdetails;
    $msg .= "---------------------------------------------------------------------------\n\n";
    $msg .= $shipdetails;
    $msg .= "---------------------------------------------------------------------------\n\n";
    $msg .= $total;
    $msg .= "---------------------------------------------------------------------------\n\n";
    $msg .= "Purchase was made on " . date("l, F jS, Y \a\\t g:i a"
    ,time()) . ".\n\n";
    $msg .= "Thank you very much for your order. We will ship your
    merchandise promptly.\n";
    $msg = wordwrap($msg,7 5);
    @mail($db->data['email'],"PURCHASE CONFIRMATION: Square Two Golf
    Specials",$msg, $headers);

    // do finish up
    $cart->Clear();
    $ship->Reset();
    echo "<p>Thank you for your order! We will ship your merchandise
    promptly. A receipt has been ";
    echo "sent to your email address. Please save or print it out for
    your records.</p>\n";
    }
    }
    }
    else
    {
    // add a new product into the cart
    if (isset($additem ))
    {
    if ($cart->in_cart($itemi d)) $cart->add_one($itemi d);
    else $cart->add_item($item id, $itemname, 1, $itemprice, $itemtax,
    array($itemdesc ), $itemsize);
    }
    // update quantities
    if (isset($update) )
    {
    foreach ($inumber as $id => $quant)
    {
    $cart->update_item($i d,$quant);
    }
    }
    // remove all
    if (isset($dellall ))
    {
    $cart->clear();
    $ship->Reset();
    }
    // show all products from the cart
    if ($cart->show())
    {
    echo "<form action=\"$PHP_S ELF\" method=\"post\" >\n";
    echo "<table border=\"0\" cellpadding=\"0 \" cellspacing=\"0 \">\n";
    echo "<tr>\n<td> \n";
    $cart->tabulate_items ("\$",1);
    echo "</td>\n</tr>\n";
    echo "<tr>\n<td>\n<b r>";
    echo "<p>If you alter the quantities listed above, please be sure
    to click on the 'update quantities' button.</p>\n";
    echo "<input type=\"submit\" name=\"dellall\ " value=\"remove all
    items\"> &nbsp; <input type=\"submit\" name=\"update\" value=\"update
    quantities\"> &nbsp; <input type=\"submit\" name=\"checkout \"
    value=\"go to checkout\">\n";
    echo "</td>\n</tr>\n</table>\n";
    echo "</form>\n";
    echo "<p><a href=\"specials .php\">Continue shopping</a></p><br>\n";
    policies();
    }
    else
    {
    echo "<p>There are currently no items in your shopping
    basket.</p>\n";
    echo "<p><a href=\"specials .php\">Continue shopping</a></p><br>\n";
    policies();
    }
    }


    function show_contact_fo rm($hash)
    {
    global $gpcVars,$state List,$PHP_SELF;

    if (!array_key_exi sts('fname',$gp cVars)) {
    $gpcVars['fname'] = "";
    $gpcVars['lname'] = "";
    $gpcVars['address'] = "";
    $gpcVars['city'] = "";
    $gpcVars['state'] = "";
    $gpcVars['zip'] = "";
    $gpcVars['phone'] = "";
    $gpcVars['email'] = "";
    }

    echo "<form action=\"$PHP_S ELF\" method=\"post\" >\n";
    echo "<input type=\"hidden\" name=\"checkout \" value=\"1\">\n" ;
    echo "<input type=\"hidden\" name=\"idhash\" value=\"{$hash} \">\n";
    echo "<table border=\"0\" cellpadding=\"0 \" cellspacing=\"1 0\">\n";
    echo "<tr>\n";
    echo " <td valign=\"middle \" align=\"right\" >First name</td>\n";
    echo " <td valign=\"middle \" align=\"left\"> <input type=\"text\"
    name=\"fname\" size=\"30\" maxlength=\"48\ " style=\"width: 200px;\"
    value=\"{$gpcVa rs['fname']}\"></td>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo " <td valign=\"middle \" align=\"right\" >Last name</td>\n";
    echo " <td valign=\"middle \" align=\"left\"> <input type=\"text\"
    name=\"lname\" size=\"30\" maxlength=\"48\ " style=\"width: 200px;\"
    value=\"{$gpcVa rs['lname']}\"></td>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo " <td valign=\"middle \" align=\"right\" >Address</td>\n";
    echo " <td valign=\"middle \" align=\"left\"> <input type=\"text\"
    name=\"address\ " size=\"30\" maxlength=\"128 \" style=\"width: 200px;\"
    value=\"{$gpcVa rs['address']}\"></td>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo " <td valign=\"middle \" align=\"right\" >City</td>\n";
    echo " <td valign=\"middle \" align=\"left\"> <input type=\"text\"
    name=\"city\" size=\"30\" maxlength=\"64\ " style=\"width: 200px;\"
    value=\"{$gpcVa rs['city']}\"></td>\n";
    echo "</tr>\n";

    echo "<tr>\n";
    echo " <td valign=\"middle \" align=\"right\" >State</td>\n";
    echo " <td valign=\"middle \" align=\"left\"> <select
    name=\"state\"> ";
    foreach ($stateList as $abbr => $state)
    {
    echo "<option value=\"{$abbr} \"",($gpcVar s['state'] == $abbr?"
    selected":"")," >{$state}</option>";
    }
    echo "</select></td>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo " <td valign=\"middle \" align=\"right\" >Zipcode</td>\n";
    echo " <td valign=\"middle \" align=\"left\"> <input type=\"text\"
    name=\"zip\" size=\"30\" maxlength=\"5\" style=\"width: 200px;\"
    value=\"{$gpcVa rs['zip']}\"></td>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo " <td valign=\"middle \" align=\"right\" >Phone number</td>\n";
    echo " <td valign=\"middle \" align=\"left\"> <input type=\"text\"
    name=\"phone\" size=\"30\" maxlength=\"32\ " style=\"width: 200px;\"
    value=\"{$gpcVa rs['phone']}\"></td>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo " <td valign=\"middle \" align=\"right\" >Email address</td>\n";
    echo " <td valign=\"middle \" align=\"left\"> <input type=\"text\"
    name=\"email\" size=\"30\" maxlength=\"256 \" style=\"width: 200px;\"
    value=\"{$gpcVa rs['email']}\"></td>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo " <td valign=\"middle \" align=\"right\" >&nbsp;</td>\n";
    echo " <td valign=\"middle \" align=\"right\" ><input type=\"submit\"
    name=\"firststa ge\" value=\"continu e with order\"></td>\n";
    echo "</tr>\n";
    echo "</table>\n";
    echo "</form>\n";
    }

    function show_creditcard _form($hash)
    {
    global $gpcVars,$state List,$PHP_SELF;

    if (!array_key_exi sts('cc_name',$ gpcVars)) {
    $gpcVars['cc_name'] = "";
    $gpcVars['cc_number'] = "";
    $gpcVars['cc_type'] = "";
    $gpcVars['cc_exp_mm'] = "";
    $gpcVars['cc_exp_yy'] = "";
    }

    echo "<form action=\"$PHP_S ELF\" method=\"post\" >\n";
    echo "<input type=\"hidden\" name=\"checkout \" value=\"1\">\n" ;
    echo "<input type=\"hidden\" name=\"idhash\" value=\"{$hash} \">\n";
    echo "<table border=\"0\" cellpadding=\"0 \" cellspacing=\"1 0\">\n";
    echo "<tr>\n";
    echo " <td valign=\"middle \" align=\"right\" >Name on card</td>\n";
    echo " <td valign=\"middle \" align=\"left\"> <input type=\"text\"
    name=\"cc_name\ " size=\"30\" maxlength=\"128 \" style=\"width: 200px;\"
    value=\"{$gpcVa rs['cc_name']}\"></td>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo " <td valign=\"middle \" align=\"right\" >Card type</td>\n";
    echo " <td valign=\"middle \" align=\"left\"> <select
    name=\"cc_type\ ">";
    echo "<option value=\"M\"",($ gpcVars['cc_type']=="M"?"
    selected":"")," >Mastercard</option>";
    echo "<option value=\"V\"",($ gpcVars['cc_type']=="V"?"
    selected":"")," >Visa</option>";
    //echo "<option value=\"A\"",($ gpcVars['cc_type']=="A"?"
    selected":"")," >American Express</option>";
    echo "</select></td>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo " <td valign=\"middle \" align=\"right\" >Card number</td>\n";
    echo " <td valign=\"middle \" align=\"left\"> <input type=\"text\"
    name=\"cc_numbe r\" size=\"30\" maxlength=\"48\ " style=\"width:
    200px;\" value=\"{$gpcVa rs['cc_number']}\"></td>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo " <td valign=\"middle \" align=\"right\" >Card
    expiration</td>\n";
    echo " <td valign=\"middle \" align=\"left\"> <select
    name=\"cc_exp_m m\"><option value=\"\">MM</option>";
    for ($i=1; $i<=12; $i++) echo "<option
    value=\"",sprin tf("%02d",$i)," \"",($i==$gpcVa rs['cc_exp_mm']?"
    selected":"")," >",sprintf("%02 d",$i),"</option>";
    echo "</select> / <select name=\"cc_exp_y y\"><option
    value=\"\">YYYY </option>";
    for ($i=2002; $i<=2022; $i++) echo "<option
    value=\"{$i}\"" ,($i==$gpcVars['cc_exp_yy']?"
    selected":"")," >$i</option>";
    echo "</select></td>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo " <td valign=\"middle \" align=\"right\" >&nbsp;</td>\n";
    echo " <td valign=\"middle \" align=\"right\" ><input type=\"submit\"
    name=\"secondst age\" value=\"verify order\"></td>\n";
    echo "</tr>\n";
    echo "</table>\n";
    echo "</form>\n";
    }

    function show_shipping_f orm($hash)
    {
    global $gpcVars,$ship, $PHP_SELF;

    echo "<form action=\"$PHP_S ELF\" method=\"post\" >\n";
    echo "<input type=\"hidden\" name=\"checkout \" value=\"1\">\n" ;
    echo "<input type=\"hidden\" name=\"shipchan ge\" value=\"1\">\n" ;
    echo "<input type=\"hidden\" name=\"idhash\" value=\"{$hash} \">\n";
    echo "<p><select name=\"shipping \">";
    $ship->ShowOptions( );
    echo "</select> <input type=\"submit\" name=\"secondst age\"
    value=\"change shipping option\"></p>\n";
    echo "</form>\n";
    }

    function okay_form($hash )
    {
    global $gpcVars,$PHP_S ELF;

    echo "<form action=\"$PHP_S ELF\" method=\"post\" >\n";
    echo "<input type=\"hidden\" name=\"checkout \" value=\"1\">\n" ;
    echo "<input type=\"hidden\" name=\"idhash\" value=\"{$hash} \">\n";
    echo "<input type=\"hidden\" name=\"cc_name\ "
    value=\"{$gpcVa rs['cc_name']}\">\n";
    echo "<input type=\"hidden\" name=\"cc_type\ "
    value=\"{$gpcVa rs['cc_type']}\">\n";
    echo "<input type=\"hidden\" name=\"cc_numbe r\"
    value=\"{$gpcVa rs['cc_number']}\">\n";
    echo "<input type=\"hidden\" name=\"cc_exp_m m\"
    value=\"{$gpcVa rs['cc_exp_mm']}\">\n";
    echo "<input type=\"hidden\" name=\"cc_exp_y y\"
    value=\"{$gpcVa rs['cc_exp_yy']}\">\n";
    echo "<input type=\"submit\" name=\"complete \" value=\"complet e
    order\">\n";
    echo "</form>\n";
    }

    function cancel_form($ha sh)
    {
    global $gpcVars,$PHP_S ELF;

    echo "<form action=\"$PHP_S ELF\" method=\"post\" >\n";
    echo "<input type=\"hidden\" name=\"checkout \" value=\"1\">\n" ;
    echo "<input type=\"hidden\" name=\"idhash\" value=\"{$hash} \">\n";
    echo "<input type=\"submit\" name=\"cancel\" value=\"cancel
    order\">\n";
    echo "</form>\n";
    }

    function shipping_detail s()
    {
    echo "<p class='bit_bigg er'><b>Standard Shipping (UPS Ground):</b>
    All in-stock items will ship within 24 business hours.</p>\n";
    echo "<p class='bit_bigg er'><b>Expedite d Shipping (UPS Next Day Air
    Saver):</b> All in-stock orders must be received by 1:00 p.m. EST
    (Monday-Friday) to guarantee next day delivery. <b>Although most items
    can be expedited, some items cannot be guranteed for Next Day
    Delivery. We recommend you contact Customer Service directly at
    800.526.2250 to place orders to be expedited to ensure desired
    delivery.</b> Please call our Customer Service Department for rates on
    items shipped outside the U.S., Alaska and Hawaii. ";
    //echo "Expedited Shipping (UPS Next Day Air Saver): All orders
    must be received by 1:00 p.m. EST (Monday-Friday) to guarantee next
    day delivery. Please call our Customer Service Department for rates
    on items shipped outside the U.S., Alaska and Hawaii.</p>\n";
    echo "<p class='bit_bigg er'><b>2nd Business Day Shipping (UPS 2nd
    Day Air):</b> All orders must be received by 1:00 p.m. EST
    (Monday-Friday) to guarantee 2nd day delivery. Please call our
    Customer Service Department for rates on items shipped outside the
    U.S., Alaska and Hawaii.</p>\n";
    }

    function policies()
    {
    ?>
    <p class="map_main ">Return Policy</p>
    <p>We are unable to accept product for return if it has been used.
    If you feel a product is defective, please contact Customer Service
    (800) 526-2250 to obtain an RMA# to return for evaluation.
    A Return Authorization number must be obtained prior to returning
    merchandise. If items are returned without a Return Authorization
    number, neither a credit nor exchange can be processed.</p>
    <p>If you have a problem with your order (came in wrong), please <a
    href="contact.p hp">contact Customer Service</a>.</p>
    <?
    }

    ?>
  • Chung Leong

    #2
    Re: Needs help with old PHP scrips on new server with update version of PHP

    Look for where $values['cart.sum.tax.6 '] is defined. Search for the string
    'cart.sum.tax.6 ' and see if there's something resembling
    $xxxxxx['cart.sum.tax.6 '] = ...

    Uzytkownik "laurie" <thetreefrog@ya hoo.com> napisal w wiadomosci
    news:9a10e286.0 401111939.2c33c 10a@posting.goo gle.com...[color=blue]
    > Hi all,
    >
    > I'm trying to help out a friend who has inherited a client with a PHP
    > shopping cart application. Neither of us know PHP, but I've been
    > muddling my way through, trying to get these old scripts working on a
    > new server with the most recent version of PHP. I've pretty much
    > taken care of all the various errors that were popping up. Most only
    > pointed out out non-fatal undefined or assumed variables. I've been
    > able to cure most of them by adding single quotes to array variables
    > and pre-defining variables that weren't being defined previously. But
    > I'm absolutely stumped on one last error that I can't seem to shake.
    >
    > The error itself is:
    >
    > Notice: Undefined index: cart.sum.tax.6 in
    > G:\squaretwo\in c.specialscart. php on line 54
    >
    > Line 54 of the above mentioned script is:
    >
    > $cart->tabulate_items ("\$",0,($st ate == "NJ" ?
    > $values['cart.sum.tax.6 '] : 0));
    >
    > I don't know enough PHP to even know what cart.sum.tax.6 is supposed
    > to be. As I said, most of the problems I've encountered thus far have
    > been solved by adding single quotes (this line already has them) or
    > pre-defining variables (I don't even know what to define here!)
    >
    > Any help would be much appreciated. The entire script in question is
    > below. Line 54 marked with **.
    >
    > Thanks!
    > -laurie
    > thetreefrog@yah oo.com
    >
    > <?php
    >
    > // if we're in the checkout
    > if (isset($checkou t))
    > {
    > if (!isset($idhash ))
    > {
    > // show cart
    > // create md5 hash as unique key and add to db with date
    > // show form for contact/delivery details
    >
    > echo "<p>Current order status:</p>\n";
    > $cart->tabulate_items ("\$");
    > echo "<p><a href=\"specials .php\">Continue shopping</a></p><br>\n";
    > $hash = md5(uniqid(micr otime(),1));
    > echo "<p>Please complete your details:</p>\n";
    > show_contact_fo rm($hash);
    > }
    > else
    > {
    > // when form submitted add details to db with md5 hash
    > // show form for credit card details
    >
    > if (isset($firstst age))
    > {
    > if ($lname=="" || $fname=="" || $address=="" || $city=="" ||
    > $state=="" || $zip=="" || $phone=="" || $email=="")
    > {
    > echo "<p>Current order status:</p>\n";
    > $cart->tabulate_items ("\$");
    > echo "<p><a href=\"specials .php\">Continue
    > shopping</a></p><br>\n";
    > echo "<p>You must complete the entire form.</p>\n";
    > $sf->odSlashes($gpc Vars,1);
    > show_contact_fo rm($idhash);
    > }
    > else if (!$sf->validate_email ($email))
    > {
    > echo "<p>Current order status:</p>\n";
    > $cart->tabulate_items ("\$");
    > echo "<p><a href=\"specials .php\">Continue
    > shopping</a></p><br>\n";
    > echo "<p>That email address is invalid. You must enter your full
    > and correct email address.</p>\n";
    > $sf->odSlashes($gpc Vars,1);
    > show_contact_fo rm($idhash);
    > }
    > else
    > {
    > $gpcVars = string_function s::doSlashes($g pcVars,1);
    > $db->Insert("INSE RT INTO {$cfgVars['tbl_purchases']}
    > (id,added,lname ,fname,address, city,state,zip, phone,email) " .
    >[/color]
    "VALUES('{$idha sh}',NOW(),'{$g pcVars['lname']}','{$gpcVars['fname']}','{$gpc
    Vars['address']}','{$gpcVars['city']}','{$gpcVars['state']}','{$gpcVars['zip
    ']}','{$gpcVars['phone']}','{$gpcVars['email']}')");[color=blue]
    > $values = $cart->sum();
    > $ship->SetQuantity($c art->item_count() );
    > $ship->setList($car t->print_list() );
    > echo "<p>Current order status:</p>\n";
    > ** $cart->tabulate_items ("\$",0,($st ate == "NJ" ?
    > $values['cart.sum.tax.6 '] : 0));
    > echo "<hr noshade>\n";
    > echo "<p>Shippin g details:</p>\n";
    > show_shipping_f orm($idhash);
    > shipping_detail s();
    > echo "<hr noshade>\n";
    > echo "<p>Please enter your credit card details:</p>\n";
    > show_creditcard _form($idhash);
    > }
    > }
    >
    > // get contact details
    >
    > if (isset($seconds tage))
    > {
    > //echo "<h1>List: ".$cart->print_list()." </h1>";
    > $ship->SetQuantity($c art->item_count() );
    > $ship->setList($car t->print_list() );
    > if (isset($shipcha nge))
    > {
    > echo "<h1>Shipch arge set</h2>";
    > $ship->SetOption($shi pping);
    > $cart->tabulate_items ("\$",0,($st ate == "NJ" ?
    > $values['cart.sum.tax.6 '] : 0));
    > echo "<hr noshade>\n";
    > echo "<p>Shippin g details:</p>\n";
    > show_shipping_f orm($idhash);
    > shipping_detail s();
    > echo "<hr noshade>\n";
    > echo "<p>Please enter your credit card details:</p>\n";
    > show_creditcard _form($idhash);
    > }
    > //commented out for testing
    > else if ($cc_name=="" || $cc_type=="" || $cc_number=="" ||
    > $cc_exp_mm=="" || $cc_exp_yy=="")
    > {
    > $cart->tabulate_items ("\$",0,($st ate == "NJ" ?
    > $values['cart.sum.tax.6 '] : 0));
    > echo "<hr noshade>\n";
    > echo "<p>Shippin g details:</p>\n";
    > show_shipping_f orm($idhash);
    > shipping_detail s();
    > echo "<hr noshade>\n";
    > echo "<p>You must complete all of the form.</p>\n";
    > show_creditcard _form($idhash);
    > }
    > else if (!$cc->CheckCard($cc_ type, $cc_number, $cc_exp_mm,
    > $cc_exp_yy))
    > {
    > $cart->tabulate_items ("\$",0,($st ate == "NJ" ?
    > $values['cart.sum.tax.6 '] : 0));
    > echo "<hr noshade>\n";
    > echo "<p>Shippin g details:</p>\n";
    > show_shipping_f orm($idhash);
    > shipping_detail s();
    > echo "<hr noshade>\n";
    > echo "<p>That credit card number could not be verfied because of
    > an {$cc->CCerror}.</p>\n";
    > show_creditcard _form($idhash);
    > }
    >
    > else
    > {
    > $db->QueryRow("SELE CT * FROM {$cfgVars['tbl_purchases']} WHERE id
    > = '$idhash'");
    > $db->data = $sf->odSlashes($d b->data);
    > $gpcVars = $sf->odSlashes($gpc Vars);
    > echo "<p>Please verify the following information you
    > entered.</p>\n";
    >
    > echo "<p><b>Addr ess</b></p>\n";
    > echo "<p>{$db->data['fname']} {$db->data['lname']}<br>\n";
    > echo "{$db->data['address']}<br>\n";
    > echo "{$db->data['city']}, {$db->data['state']},
    > {$db->data['zip']}</p>\n";
    > echo "{$db->data['phone']}<br>{$db->data['email']}</p>\n";
    >
    > echo "<p><b>Cred it card details</b></p>\n";
    > echo "<p>{$gpcVa rs['cc_name']}<br>\n";
    > echo $cc->CardName($gpcV ars['cc_type']),"<br>\n";
    > echo $gpcVars['cc_number'],"<br>\n";
    > echo "Expires on
    > {$gpcVars['cc_exp_mm']}/{$gpcVars['cc_exp_yy']}</p>\n";
    >
    > echo "<p><b>Shop ping Cart</b></p>\n";
    > $cart->tabulate_items ("\$",0,($db->data['state'] == "NJ" ?
    > $values['cart.sum.tax.6 '] : 0));
    >
    > echo "<p><b>Ship ping details</b><p>\n";
    > // if ($ship->ShowShippingDe tails()) echo
    > "<p>",$ship->GetName(),": ", $ship->GetStrAtCost(1 ), "</p>\n";
    > if ($ship->ShowShippingDe tails()) echo "<p>",$ship->GetName(),":
    > ", $ship->GetStrAtCost(1 ), "</p>\n";
    >
    > echo "<br>\n";
    >
    > echo "<table border=\"0\" cellpadding=\"0 \"
    > cellspacing=\"0 \"><tr>";
    > echo[/color]
    "<td>",okay_for m($db->data['id']),"</td><td>&nbsp;</td><td>",cancel _form($db
    ->data['id']),"</td>";[color=blue]
    > echo "</tr></table>\n";
    > }
    > }
    >
    > // cancel order
    > // remove from database
    >
    > if (isset($cancel) )
    > {
    > $db->Delete("DELE TE FROM {$cfgVars['tbl_purchases']} WHERE id =
    > '$idhash'");
    > $ship->Reset();
    > echo "<p>You have cancelled the order form process. <a
    > href=\"$PHP_SEL F\">Click here</a> to return to the shopping
    > cart.</p>\n";
    > }
    >
    > // store cart
    > // compose and send email to wgu
    > // compose and send email to user
    > // give thank you
    >
    > if (isset($complet e))
    > {
    > $thecart = urlencode(base6 4_encode(gzcomp ress(serialize( $cart))));
    >
    > $db->Update("UPDA TE {$cfgVars['tbl_purchases']} SET
    > cart='$thecart' ,shipping='{$sh ip->SOusing}' WHERE id='$idhash'");
    >
    > $cc_name = string_function s::odSlashes($c c_name);
    > $db->QueryRow("SELE CT * FROM {$cfgVars['tbl_purchases']} WHERE id
    > = '$idhash'");
    > $db->data = $sf->odSlashes($d b->data);
    > $details = "";
    > $details .= "Contact Information\n\n ";
    > $details .= "{$db->data['fname']} {$db->data['lname']}\n";
    > $details .= "{$db->data['address']}\n";
    > $details .= "{$db->data['city']}, {$db->data['state']},
    > {$db->data['zip']}\n\n";
    > $details .= "Phone: {$db->data['phone']}\nEmail:
    > {$db->data['email']}\n\n";
    > $ccdetails = "";
    > $ccdetails .= "Credit Card Information\n\n ";
    > $ccdetails .= "Name on card : {$cc_name}\n";
    > $ccdetails .= "CC Type : " . $cc->CardName($cc_t ype) . "\n";
    > $ccdetails .= "CC Number : {$cc_number}\n" ;
    > $ccdetails .= "CC Expiration : {$cc_exp_mm}/{$cc_exp_yy}\n\ n";
    > $cartdetails = "";
    > $cartdetails .= "Cart details\n\n";
    > while ($values = $cart->show_next_item ())
    > {
    > $values = string_function s::odSlashes($v alues);
    > // JohnO: Replace certain characters for readability
    > $patterns = array ("/&#176;/");
    > $replace = array (" Deg.");
    > $values = preg_replace ($patterns, $replace, $values);
    >
    > $cartdetails .= "SKU : {$values['cart.inumber']}\n";
    > $cartdetails .= "Name : {$values['cart.name']}\n";
    > $cartdetails .= "Size : {$values['cart.size']}\n";
    > $cartdetails .= "Descriptio n : {$values['cart.descr.0']}\n";
    > $cartdetails .= "Quantity : {$values['cart.quant']}\n";
    > $cartdetails .= "Price each : \${$values['cart.price']}\n\n";
    > }
    > $values = $cart->sum();
    > $tax = ($db->data['state'] == "NJ" ? $values['cart.sum.tax.6 '] :
    > 0);
    > $cartdetails .= "Total pre tax :
    > \${$values['cart.sum.gtotp rice']}\n";
    > $cartdetails .= "Tax : \${$tax}\n";
    > $cartdetails .= "Total post tax : \$" .
    > ($values['cart.sum.gtotp rice'] + $tax) . "\n\n";
    > $shipdetails = "";
    > $shipdetails .= "Shipping Information\n\n ";
    > if ($ship->GetType()=="E" ) {
    > $shipdetails .= "Shipping type : ***" . $ship->GetName() . "***
    > - " . $ship->GetDesc() . "\n";
    > }else{
    > $shipdetails .= "Shipping type : " . $ship->GetName() . " - " .
    > $ship->GetDesc() . "\n";
    > }
    > $shipdetails .= "Shipping cost : " . $ship->GetStrCost(1 ) .
    > "\n\n";
    > $total = "";
    > $total .= "Grand total : \$" .
    > sprintf("%.02f" ,$values['cart.sum.gtotp rice'] + $tax +
    > ($ship->GetTotalCost() ==-1?0:$ship->GetTotalCost() )) . "\n\n";
    >
    > // do email to WGU
    >
    > $headers = "From: {$db->data['fname']} {$db->data['lname']}
    > <{$db->data['email']}>\n";
    > $headers .= "X-Mailer: Specials Purchase Email\n";
    > $msg = "ATTENTION:\n\n A purchase was made from Square Two Golf
    > website. The details are as follows:\n\n";
    > $msg .=[/color]
    "---------------------------------------------------------------------------
    \n\n";[color=blue]
    > $msg .= $details;
    > $msg .=[/color]
    "---------------------------------------------------------------------------
    \n\n";[color=blue]
    > $msg .= $ccdetails;
    > $msg .=[/color]
    "---------------------------------------------------------------------------
    \n\n";[color=blue]
    > $msg .= $cartdetails;
    > $msg .=[/color]
    "---------------------------------------------------------------------------
    \n\n";[color=blue]
    > $msg .= $shipdetails;
    > $msg .=[/color]
    "---------------------------------------------------------------------------
    \n\n";[color=blue]
    > $msg .= $total;
    > $msg .=[/color]
    "---------------------------------------------------------------------------
    \n\n";[color=blue]
    > $msg .= "Purchase was made on " . date("l, F jS, Y \a\\t g:i a"
    > ,time()) . ".\n\n";
    > $msg = wordwrap($msg,7 5);
    > @mail($cfgVars['email_purchase '],"PURCHASE MADE:
    > Specials",$msg, $headers);
    > //@mail("andrew@i nnismaggiore.co m","PURCHASE MADE:
    > Specials",$msg, $headers);
    > //@mail("johno@in nismaggiore.com ","PURCHASE MADE:
    > Specials",$msg, $headers);
    >
    > // do email to user
    >
    > $headers = "From: Square Two Golf Specials Confirmation
    > <{$cfgVars['email_purchase ']}>\n";
    > $headers .= "X-Mailer: Specials Purchase Confirmation Email\n";
    > $msg = "Thank you for your purchase from the Square Two Golf
    > website. This is your receipt, so please ";
    > $msg .= "save it or make a print out for your records.\n\n";
    > $msg .= "The details are as follows:\n\n";
    > $msg .=[/color]
    "---------------------------------------------------------------------------
    \n\n";[color=blue]
    > $msg .= $details;
    > $msg .=[/color]
    "---------------------------------------------------------------------------
    \n\n";[color=blue]
    > $msg .= $cartdetails;
    > $msg .=[/color]
    "---------------------------------------------------------------------------
    \n\n";[color=blue]
    > $msg .= $shipdetails;
    > $msg .=[/color]
    "---------------------------------------------------------------------------
    \n\n";[color=blue]
    > $msg .= $total;
    > $msg .=[/color]
    "---------------------------------------------------------------------------
    \n\n";[color=blue]
    > $msg .= "Purchase was made on " . date("l, F jS, Y \a\\t g:i a"
    > ,time()) . ".\n\n";
    > $msg .= "Thank you very much for your order. We will ship your
    > merchandise promptly.\n";
    > $msg = wordwrap($msg,7 5);
    > @mail($db->data['email'],"PURCHASE CONFIRMATION: Square Two Golf
    > Specials",$msg, $headers);
    >
    > // do finish up
    > $cart->Clear();
    > $ship->Reset();
    > echo "<p>Thank you for your order! We will ship your merchandise
    > promptly. A receipt has been ";
    > echo "sent to your email address. Please save or print it out for
    > your records.</p>\n";
    > }
    > }
    > }
    > else
    > {
    > // add a new product into the cart
    > if (isset($additem ))
    > {
    > if ($cart->in_cart($itemi d)) $cart->add_one($itemi d);
    > else $cart->add_item($item id, $itemname, 1, $itemprice, $itemtax,
    > array($itemdesc ), $itemsize);
    > }
    > // update quantities
    > if (isset($update) )
    > {
    > foreach ($inumber as $id => $quant)
    > {
    > $cart->update_item($i d,$quant);
    > }
    > }
    > // remove all
    > if (isset($dellall ))
    > {
    > $cart->clear();
    > $ship->Reset();
    > }
    > // show all products from the cart
    > if ($cart->show())
    > {
    > echo "<form action=\"$PHP_S ELF\" method=\"post\" >\n";
    > echo "<table border=\"0\" cellpadding=\"0 \" cellspacing=\"0 \">\n";
    > echo "<tr>\n<td> \n";
    > $cart->tabulate_items ("\$",1);
    > echo "</td>\n</tr>\n";
    > echo "<tr>\n<td>\n<b r>";
    > echo "<p>If you alter the quantities listed above, please be sure
    > to click on the 'update quantities' button.</p>\n";
    > echo "<input type=\"submit\" name=\"dellall\ " value=\"remove all
    > items\"> &nbsp; <input type=\"submit\" name=\"update\" value=\"update
    > quantities\"> &nbsp; <input type=\"submit\" name=\"checkout \"
    > value=\"go to checkout\">\n";
    > echo "</td>\n</tr>\n</table>\n";
    > echo "</form>\n";
    > echo "<p><a href=\"specials .php\">Continue shopping</a></p><br>\n";
    > policies();
    > }
    > else
    > {
    > echo "<p>There are currently no items in your shopping
    > basket.</p>\n";
    > echo "<p><a href=\"specials .php\">Continue shopping</a></p><br>\n";
    > policies();
    > }
    > }
    >
    >
    > function show_contact_fo rm($hash)
    > {
    > global $gpcVars,$state List,$PHP_SELF;
    >
    > if (!array_key_exi sts('fname',$gp cVars)) {
    > $gpcVars['fname'] = "";
    > $gpcVars['lname'] = "";
    > $gpcVars['address'] = "";
    > $gpcVars['city'] = "";
    > $gpcVars['state'] = "";
    > $gpcVars['zip'] = "";
    > $gpcVars['phone'] = "";
    > $gpcVars['email'] = "";
    > }
    >
    > echo "<form action=\"$PHP_S ELF\" method=\"post\" >\n";
    > echo "<input type=\"hidden\" name=\"checkout \" value=\"1\">\n" ;
    > echo "<input type=\"hidden\" name=\"idhash\" value=\"{$hash} \">\n";
    > echo "<table border=\"0\" cellpadding=\"0 \" cellspacing=\"1 0\">\n";
    > echo "<tr>\n";
    > echo " <td valign=\"middle \" align=\"right\" >First name</td>\n";
    > echo " <td valign=\"middle \" align=\"left\"> <input type=\"text\"
    > name=\"fname\" size=\"30\" maxlength=\"48\ " style=\"width: 200px;\"
    > value=\"{$gpcVa rs['fname']}\"></td>\n";
    > echo "</tr>\n";
    > echo "<tr>\n";
    > echo " <td valign=\"middle \" align=\"right\" >Last name</td>\n";
    > echo " <td valign=\"middle \" align=\"left\"> <input type=\"text\"
    > name=\"lname\" size=\"30\" maxlength=\"48\ " style=\"width: 200px;\"
    > value=\"{$gpcVa rs['lname']}\"></td>\n";
    > echo "</tr>\n";
    > echo "<tr>\n";
    > echo " <td valign=\"middle \" align=\"right\" >Address</td>\n";
    > echo " <td valign=\"middle \" align=\"left\"> <input type=\"text\"
    > name=\"address\ " size=\"30\" maxlength=\"128 \" style=\"width: 200px;\"
    > value=\"{$gpcVa rs['address']}\"></td>\n";
    > echo "</tr>\n";
    > echo "<tr>\n";
    > echo " <td valign=\"middle \" align=\"right\" >City</td>\n";
    > echo " <td valign=\"middle \" align=\"left\"> <input type=\"text\"
    > name=\"city\" size=\"30\" maxlength=\"64\ " style=\"width: 200px;\"
    > value=\"{$gpcVa rs['city']}\"></td>\n";
    > echo "</tr>\n";
    >
    > echo "<tr>\n";
    > echo " <td valign=\"middle \" align=\"right\" >State</td>\n";
    > echo " <td valign=\"middle \" align=\"left\"> <select
    > name=\"state\"> ";
    > foreach ($stateList as $abbr => $state)
    > {
    > echo "<option value=\"{$abbr} \"",($gpcVar s['state'] == $abbr?"
    > selected":"")," >{$state}</option>";
    > }
    > echo "</select></td>\n";
    > echo "</tr>\n";
    > echo "<tr>\n";
    > echo " <td valign=\"middle \" align=\"right\" >Zipcode</td>\n";
    > echo " <td valign=\"middle \" align=\"left\"> <input type=\"text\"
    > name=\"zip\" size=\"30\" maxlength=\"5\" style=\"width: 200px;\"
    > value=\"{$gpcVa rs['zip']}\"></td>\n";
    > echo "</tr>\n";
    > echo "<tr>\n";
    > echo " <td valign=\"middle \" align=\"right\" >Phone number</td>\n";
    > echo " <td valign=\"middle \" align=\"left\"> <input type=\"text\"
    > name=\"phone\" size=\"30\" maxlength=\"32\ " style=\"width: 200px;\"
    > value=\"{$gpcVa rs['phone']}\"></td>\n";
    > echo "</tr>\n";
    > echo "<tr>\n";
    > echo " <td valign=\"middle \" align=\"right\" >Email address</td>\n";
    > echo " <td valign=\"middle \" align=\"left\"> <input type=\"text\"
    > name=\"email\" size=\"30\" maxlength=\"256 \" style=\"width: 200px;\"
    > value=\"{$gpcVa rs['email']}\"></td>\n";
    > echo "</tr>\n";
    > echo "<tr>\n";
    > echo " <td valign=\"middle \" align=\"right\" >&nbsp;</td>\n";
    > echo " <td valign=\"middle \" align=\"right\" ><input type=\"submit\"
    > name=\"firststa ge\" value=\"continu e with order\"></td>\n";
    > echo "</tr>\n";
    > echo "</table>\n";
    > echo "</form>\n";
    > }
    >
    > function show_creditcard _form($hash)
    > {
    > global $gpcVars,$state List,$PHP_SELF;
    >
    > if (!array_key_exi sts('cc_name',$ gpcVars)) {
    > $gpcVars['cc_name'] = "";
    > $gpcVars['cc_number'] = "";
    > $gpcVars['cc_type'] = "";
    > $gpcVars['cc_exp_mm'] = "";
    > $gpcVars['cc_exp_yy'] = "";
    > }
    >
    > echo "<form action=\"$PHP_S ELF\" method=\"post\" >\n";
    > echo "<input type=\"hidden\" name=\"checkout \" value=\"1\">\n" ;
    > echo "<input type=\"hidden\" name=\"idhash\" value=\"{$hash} \">\n";
    > echo "<table border=\"0\" cellpadding=\"0 \" cellspacing=\"1 0\">\n";
    > echo "<tr>\n";
    > echo " <td valign=\"middle \" align=\"right\" >Name on card</td>\n";
    > echo " <td valign=\"middle \" align=\"left\"> <input type=\"text\"
    > name=\"cc_name\ " size=\"30\" maxlength=\"128 \" style=\"width: 200px;\"
    > value=\"{$gpcVa rs['cc_name']}\"></td>\n";
    > echo "</tr>\n";
    > echo "<tr>\n";
    > echo " <td valign=\"middle \" align=\"right\" >Card type</td>\n";
    > echo " <td valign=\"middle \" align=\"left\"> <select
    > name=\"cc_type\ ">";
    > echo "<option value=\"M\"",($ gpcVars['cc_type']=="M"?"
    > selected":"")," >Mastercard</option>";
    > echo "<option value=\"V\"",($ gpcVars['cc_type']=="V"?"
    > selected":"")," >Visa</option>";
    > //echo "<option value=\"A\"",($ gpcVars['cc_type']=="A"?"
    > selected":"")," >American Express</option>";
    > echo "</select></td>\n";
    > echo "</tr>\n";
    > echo "<tr>\n";
    > echo " <td valign=\"middle \" align=\"right\" >Card number</td>\n";
    > echo " <td valign=\"middle \" align=\"left\"> <input type=\"text\"
    > name=\"cc_numbe r\" size=\"30\" maxlength=\"48\ " style=\"width:
    > 200px;\" value=\"{$gpcVa rs['cc_number']}\"></td>\n";
    > echo "</tr>\n";
    > echo "<tr>\n";
    > echo " <td valign=\"middle \" align=\"right\" >Card
    > expiration</td>\n";
    > echo " <td valign=\"middle \" align=\"left\"> <select
    > name=\"cc_exp_m m\"><option value=\"\">MM</option>";
    > for ($i=1; $i<=12; $i++) echo "<option
    > value=\"",sprin tf("%02d",$i)," \"",($i==$gpcVa rs['cc_exp_mm']?"
    > selected":"")," >",sprintf("%02 d",$i),"</option>";
    > echo "</select> / <select name=\"cc_exp_y y\"><option
    > value=\"\">YYYY </option>";
    > for ($i=2002; $i<=2022; $i++) echo "<option
    > value=\"{$i}\"" ,($i==$gpcVars['cc_exp_yy']?"
    > selected":"")," >$i</option>";
    > echo "</select></td>\n";
    > echo "</tr>\n";
    > echo "<tr>\n";
    > echo " <td valign=\"middle \" align=\"right\" >&nbsp;</td>\n";
    > echo " <td valign=\"middle \" align=\"right\" ><input type=\"submit\"
    > name=\"secondst age\" value=\"verify order\"></td>\n";
    > echo "</tr>\n";
    > echo "</table>\n";
    > echo "</form>\n";
    > }
    >
    > function show_shipping_f orm($hash)
    > {
    > global $gpcVars,$ship, $PHP_SELF;
    >
    > echo "<form action=\"$PHP_S ELF\" method=\"post\" >\n";
    > echo "<input type=\"hidden\" name=\"checkout \" value=\"1\">\n" ;
    > echo "<input type=\"hidden\" name=\"shipchan ge\" value=\"1\">\n" ;
    > echo "<input type=\"hidden\" name=\"idhash\" value=\"{$hash} \">\n";
    > echo "<p><select name=\"shipping \">";
    > $ship->ShowOptions( );
    > echo "</select> <input type=\"submit\" name=\"secondst age\"
    > value=\"change shipping option\"></p>\n";
    > echo "</form>\n";
    > }
    >
    > function okay_form($hash )
    > {
    > global $gpcVars,$PHP_S ELF;
    >
    > echo "<form action=\"$PHP_S ELF\" method=\"post\" >\n";
    > echo "<input type=\"hidden\" name=\"checkout \" value=\"1\">\n" ;
    > echo "<input type=\"hidden\" name=\"idhash\" value=\"{$hash} \">\n";
    > echo "<input type=\"hidden\" name=\"cc_name\ "
    > value=\"{$gpcVa rs['cc_name']}\">\n";
    > echo "<input type=\"hidden\" name=\"cc_type\ "
    > value=\"{$gpcVa rs['cc_type']}\">\n";
    > echo "<input type=\"hidden\" name=\"cc_numbe r\"
    > value=\"{$gpcVa rs['cc_number']}\">\n";
    > echo "<input type=\"hidden\" name=\"cc_exp_m m\"
    > value=\"{$gpcVa rs['cc_exp_mm']}\">\n";
    > echo "<input type=\"hidden\" name=\"cc_exp_y y\"
    > value=\"{$gpcVa rs['cc_exp_yy']}\">\n";
    > echo "<input type=\"submit\" name=\"complete \" value=\"complet e
    > order\">\n";
    > echo "</form>\n";
    > }
    >
    > function cancel_form($ha sh)
    > {
    > global $gpcVars,$PHP_S ELF;
    >
    > echo "<form action=\"$PHP_S ELF\" method=\"post\" >\n";
    > echo "<input type=\"hidden\" name=\"checkout \" value=\"1\">\n" ;
    > echo "<input type=\"hidden\" name=\"idhash\" value=\"{$hash} \">\n";
    > echo "<input type=\"submit\" name=\"cancel\" value=\"cancel
    > order\">\n";
    > echo "</form>\n";
    > }
    >
    > function shipping_detail s()
    > {
    > echo "<p class='bit_bigg er'><b>Standard Shipping (UPS Ground):</b>
    > All in-stock items will ship within 24 business hours.</p>\n";
    > echo "<p class='bit_bigg er'><b>Expedite d Shipping (UPS Next Day Air
    > Saver):</b> All in-stock orders must be received by 1:00 p.m. EST
    > (Monday-Friday) to guarantee next day delivery. <b>Although most items
    > can be expedited, some items cannot be guranteed for Next Day
    > Delivery. We recommend you contact Customer Service directly at
    > 800.526.2250 to place orders to be expedited to ensure desired
    > delivery.</b> Please call our Customer Service Department for rates on
    > items shipped outside the U.S., Alaska and Hawaii. ";
    > //echo "Expedited Shipping (UPS Next Day Air Saver): All orders
    > must be received by 1:00 p.m. EST (Monday-Friday) to guarantee next
    > day delivery. Please call our Customer Service Department for rates
    > on items shipped outside the U.S., Alaska and Hawaii.</p>\n";
    > echo "<p class='bit_bigg er'><b>2nd Business Day Shipping (UPS 2nd
    > Day Air):</b> All orders must be received by 1:00 p.m. EST
    > (Monday-Friday) to guarantee 2nd day delivery. Please call our
    > Customer Service Department for rates on items shipped outside the
    > U.S., Alaska and Hawaii.</p>\n";
    > }
    >
    > function policies()
    > {
    > ?>
    > <p class="map_main ">Return Policy</p>
    > <p>We are unable to accept product for return if it has been used.
    > If you feel a product is defective, please contact Customer Service
    > (800) 526-2250 to obtain an RMA# to return for evaluation.
    > A Return Authorization number must be obtained prior to returning
    > merchandise. If items are returned without a Return Authorization
    > number, neither a credit nor exchange can be processed.</p>
    > <p>If you have a problem with your order (came in wrong), please <a
    > href="contact.p hp">contact Customer Service</a>.</p>
    > <?
    > }
    >
    > ?>[/color]


    Comment

    • laurie

      #3
      Re: Needs help with old PHP scrips on new server with update version of PHP

      "Chung Leong" <chernyshevsky@ hotmail.com> wrote in message news:<suCdnR__r qdgo57dRVn-jg@comcast.com> ...[color=blue]
      > Look for where $values['cart.sum.tax.6 '] is defined. Search for the string
      > 'cart.sum.tax.6 ' and see if there's something resembling
      > $xxxxxx['cart.sum.tax.6 '] = ...[/color]

      There isn't. However, there are "class" files being included at the
      top of the page, and in those files are what appears to be classes
      being defined. Rather than defining a function, such as this:

      function myfunction {
      ....
      }

      they're this:

      class myclass {
      ....
      }

      In that class are variables being defined (with var) called $cart,
      $tax, etc. Is cart.sum.tax.6 some funky way of referencing values in
      those classes? And is there something different between an old
      version of PHP and the latest version that would make variables being
      defined with "var" inaccessible when they're included in another file?

      Thanks for your help,

      -laurie

      Comment

      • Chung Leong

        #4
        Re: Needs help with old PHP scrips on new server with update version of PHP

        No. $values['cart.sum.tax.6 '] means "getting the value from an associative
        array with the key cart.sum.tax.6" .

        I seems to me that whoever wrote the code was being too clever. Insert this
        snippet at the line where the error and trace backward through the code to
        see where $values is set.

        $backtrace = debug_backtrace ();
        foreach($backtr ace as $call) {
        extract($call);
        if($class) {
        echo "{$class}->";
        }
        echo "$function( ) <i>$file, line $line </i><br>";
        }

        Uzytkownik "laurie" <thetreefrog@ya hoo.com> napisal w wiadomosci
        news:9a10e286.0 401130757.db492 1b@posting.goog le.com...[color=blue]
        > In that class are variables being defined (with var) called $cart,
        > $tax, etc. Is cart.sum.tax.6 some funky way of referencing values in
        > those classes? And is there something different between an old
        > version of PHP and the latest version that would make variables being
        > defined with "var" inaccessible when they're included in another file?
        >
        > Thanks for your help,
        >
        > -laurie[/color]


        Comment

        Working...