echo fc_text('esdnodl'); echo fc_text('esdcustsvc'); exit; } $esddlcnt = (int) $fcesd->f('esddlcnt') + 1; $esddlmax = (int) $fcesd->f('esddlmax'); $esddlexp = (int) $fcesd->f('esddlexp'); $esddlfile = $fcesd->f('esddlfile'); $fcesd->free_result(); if ($esddlcnt > $esddlmax || $now > $esddlexp) { echo fc_text('esddlmax'); echo fc_text('esdcustsvc'); exit; } $fcesd->query("update esd set esddlcnt={$esddlcnt} where esdid={$esdid}"); $fcesd->commit(); $file = substr(strrchr($esddlfile, '/'), 1); set_magic_quotes_runtime(0); $fd = fopen($esddlfile, 'rb'); if ($fd) { $size = filesize($esddlfile); header("Content-Disposition: attachment; filename={$file}"); header("Content-Length: {$size}"); header("Content-Type: application/download"); while ($buf = fread($fd, 16384)) { echo $buf; } fclose($fd); } else { echo fc_text('esdnofile'); echo fc_text('esdcustsvc');
} $fcn = new FC_SQL(); $fcu = new FC_SQL(); if ($act == 'insert') { $fcu->query("select count(*) as cnt from nprod where nprodsku='{$sku}'"); $fcu->next_record(); if ($fcu->f('cnt') == 0) { $fcn->query("insert into nprod (nprodsku,nstart,nend,nzid) " . "values ('{$sku}',{$sdate},{$ndate},{$zoneid})"); } $fcu->free_result(); } elseif ($act == 'update') { $fcn->query("update nprod " . "set nprodsku='{$sku}',nstart={$sdate},nend={$ndate} where nprodsku='{$oldsku}'"); } elseif ($act == 'delete') { $fcn->query("delete from nprod where nprodsku='{$sku}'"); } $fcn->commit(); ?> <br /> The <?php echo $act; ?> action is complete. <br /> <?php if ($act == 'insert') { ?> <a href="newprodadd.php?zoneid=<?php
} // get the Web table $fcw->query("select webback,webtext,weblink,webvlink,webalink,webbg,webfree,websort " . "from web where webzid={$zid} and weblid={$lid}"); $fcw->next_record(); $srt = $fcw->f("websort"); // get the language templates $fcl->query("select langgeo,langshow,langproc from lang where langid={$lid}"); $fcl->next_record(); $geo = $fcl->f("langgeo"); $show = $fcl->f("langshow"); $proc = $fcl->f("langproc"); $fcl->free_result(); $fasz->query("select subzflag0,subztaxpern,subztaxpers,subztaxcmtn,subztaxcmts " . "from subzone where subzid={$zid} and subzsid={$subz}"); if (!$fasz->next_record()) { $fasz->query("update ohead set subz=0 where orderid='{$cartid}'"); $fasz->commit(); header("Location: {$nsecurl}{$cartdir}/{$geo}?cartid={$cartid}&zid={$zid}&lid={$lid}"); exit; } $fco->query("select aid,contrib,shipid,couponid from ohead " . "where orderid='{$cartid}'"); if (!$fco->next_record()) { echo fc_text('invalidorder'); exit; } else { $contamt = (double) $fco->f("contrib"); $aid = stripslashes($fco->f("aid")); $curshipid = (int) $fco->f("shipid"); $couponid = stripslashes($fco->f("couponid")); } $fcol->query("select * from oline where orderid='{$cartid}'"); if (!$fcol->next_record()) {
} elseif ($act == "del") { $res = $fcc->query("delete from auxtext " . "where rid={$rid}"); } elseif ($act == "seq") { $i = 0; while ($i < $scount) { $seq = (int) getparam('lseq' . $i); $rid = (int) getparam('link' . $i); $res = $fcc->query("update auxtext set seq={$seq} where rid='{$rid}'"); $i++; } } if (!$res) { $fcc->rollback(); echo "<b>failure updating auxtext: {$res}</b><br />\n"; } else { $fcc->commit(); echo "Work committed.<br />\n"; } ?> <p></p> <?php if ($act == "add") { ?> <a href="auxtextadd.php?zoneid=<?php echo $zoneid; ?> &langid=<?php echo $langid; ?>
} $fco = new FC_SQL(); $fcu = new FC_SQL(); if ($act == "insert") { $fcu->query("select count(*) as cnt from oprod where oprodsku='{$sku}'"); $fcu->next_record(); if ($fcu->f('cnt') == 0) { $fco->query("insert into oprod (oprodsku,ostart,oend,ozid) " . "values ('{$sku}',{$sdate},{$ndate},{$zoneid})"); } $fcu->free_result(); } elseif ($act == "update") { $fco->query("update oprod " . "set oprodsku='{$sku}',ostart={$sdate},oend={$ndate} where oprodsku='{$sku}'"); } elseif ($act == "delete") { $fco->query("delete from oprod where oprodsku='{$sku}'"); } $fco->commit(); ?> <p> The <?php echo $act; ?> action is complete. </p> <p> <?php if ($act == "insert") { ?> <a href="oldprodadd.php?zoneid=<?php
$i++; } } if (!empty($key1)) { // log keyword search results $key1 = strtolower($key1); $fck->Auto_free = 1; $fck->query("select keycnt,keyres from keyword where keyval='{$key1}'"); if (!$fck->next_record) { $fck->query("insert into keyword (keyval,keycnt,keyres) values ('{$key1}',1,{$total})"); } else { $tmp = (int) $fck->f("keycnt") + 1; $kres = (int) $fck->f("keyres") + $count; $fck->query("update keyword set keycnt={$tmp},keyres={$kres} where keyval='{$key1}'"); } $fck->commit(); } // END OF ESSENTIAL CART DISPLAY CODE ?> <html><head> <link rel="stylesheet" ID href="style.css" type="text/css" /> <title><?php if ($cat && !$cscat) { echo stripslashes($fcs->f("catdescr")); } elseif ($cat && $cscat) { echo stripslashes($fcs->f("scatdescr")); } ?> </title></head> <body<?php
if ($act == "update") { $res = $fcw->query("update web set " . "webautodom='{$autodom}'," . "realhome='{$realhome}', carthome='{$carthome}'," . "webback='{$back}', webtitle='{$webtitle}', " . "weblogo='{$logo}', weblogow={$logow}, weblogoh={$logoh}," . "webbg='{$webbg}', webtext='{$webtext}', weblink='{$weblink}'," . "webvlink='{$webvlink}', webalink='{$webalink}'," . "webhdsku='{$headsku}', webhdtext='{$headtext}'," . "webhdgraph='{$headgraph}',webhdgraphh={$headgraphh}," . "webhdgraphw={$headgraphw},webftsku='{$footsku}', " . "webfttext='{$foottext}', webftgraph='{$footgraph}'," . "webftgraphh={$footgraphh},webftgraphw={$footgraphw}," . "webdaysinnew={$daysinnew},webcattext='{$cattext}'," . "webnewlogo='{$newlogo}', webnewlogoh={$newlogoh}," . "webnewlogow={$newlogow}, webnewmast='{$newmast}'," . "webnewmasth={$newmasth}, webnewmastw={$newmastw}," . "webspeclogo='{$speclogo}',webspeclogoh={$speclogoh}," . "webspeclogow={$speclogow},webspecmast='{$specmast}'," . "webspecmasth={$specmasth},webspecmastw={$specmastw}," . "webviewlogo='{$viewlogo}',webviewlogow={$viewlogow}," . "webviewlogoh={$viewlogoh},websort='{$websort}'," . "webdescr='{$webdescr}', webzid={$zoneid}, " . "weblid={$langid}, webfree='{$webfree}', " . "webdesctmpl='{$webdesctmpl}'," . "webflags1={$webflags1}, webprodpage={$prodpage} " . "where webid={$webid} and webzid={$zoneid} and weblid={$langid}"); } elseif ($act == "new") { if ($databaseeng == 'odbc' && $dialect == 'solid') { $res = $fcw->query("call web_ins ({$zoneid},{$langid}," . "'{$webdescr}','{$realhome}', '{$carthome}', '{$webtitle}'," . "'{$back}', '{$logo}', {$logow}, {$logoh}, '{$webbg}'," . "'{$webtext}', '{$weblink}', '{$webvlink}', '{$webalink}', '{$headsku}'," . "'{$headtext}','{$headgraph}', {$headgraphw}, {$headgraphh},'{$footsku}'," . "'{$foottext}','{$footgraph}', {$footgraphw}, {$footgraphh}, {$daysinnew}," . "'{$newlogo}', {$newlogow}, {$newlogoh}, '{$newmast}', {$newmastw}," . " {$newmasth}, '{$speclogo}', {$speclogow}, {$speclogoh}, '{$specmast}'," . " {$specmastw}, {$specmasth}, '{$viewlogo}', {$viewlogow}, {$viewlogoh}," . "'{$cattext}', '{$autodom}', '{$websort}', '{$webfree}'," . "'{$webdesctmpl}',{$webflags1},{$prodpage})"); } else { $res = $fcw->query("insert into web (" . "webzid,weblid,webdescr,realhome,carthome,webtitle,webback," . "weblogo,weblogow,weblogoh,webbg,webtext,weblink,webvlink," . "webalink," . "webhdsku,webhdtext,webhdgraph,webhdgraphw,webhdgraphh," . "webftsku,webfttext,webftgraph,webftgraphw,webftgraphh," . "webdaysinnew," . "webnewlogo,webnewlogow,webnewlogoh," . "webnewmast,webnewmastw,webnewmasth," . "webspeclogo,webspeclogow,webspeclogoh," . "webspecmast,webspecmastw,webspecmasth," . "webviewlogo,webviewlogow,webviewlogoh," . "webcattext,webautodom,websort,webfree," . "webdesctmpl,webflags1,webprodpage)" . " values " . "({$zoneid},{$langid}," . "'{$webdescr}','{$realhome}', '{$carthome}', '{$webtitle}'," . "'{$back}', '{$logo}', {$logow}, {$logoh}, '{$webbg}'," . "'{$webtext}', '{$weblink}', '{$webvlink}', '{$webalink}', '{$headsku}'," . "'{$headtext}','{$headgraph}', {$headgraphw}, {$headgraphh},'{$footsku}'," . "'{$foottext}','{$footgraph}', {$footgraphw}, {$footgraphh}, {$daysinnew}," . "'{$newlogo}', {$newlogow}, {$newlogoh}, '{$newmast}', {$newmastw}," . " {$newmasth}, '{$speclogo}', {$speclogow}, {$speclogoh}, '{$specmast}'," . " {$specmastw}, {$specmasth}, '{$viewlogo}', {$viewlogow}, {$viewlogoh}," . "'{$cattext}', '{$autodom}', '{$websort}', '{$webfree}'," . "'{$webdesctmpl}',{$webflags1},{$prodpage})"); } } elseif ($act == "delete") { $res = $fcw->query("delete from web " . "where webid={$webid} and webzid={$zoneid} and weblid={$langid}"); } if (!$res) { $fcw->rollback(); echo "<b>failure updating web: {$res}</b><br>\n"; } else { $fcw->commit(); echo "Work committed.<br>\n"; } ?> <p> <form method=post action="index.php"> <input type=hidden name=zoneid value=<?php echo $zoneid; ?> > <input type=hidden name=langid value=<?php echo $langid; ?> >
} if (!$res) { $fcl->rollback(); echo "<b>failure updating lang: {$res}</b><br>\n"; } else { $fcl->commit(); echo "Work committed.<br>\n"; } if ($res && $act == "update" && ($langfppromo != $oldfppromo || $oldfppromo == "")) { //update cattable first set catact to 0 (bvo) $fctb->query("update cat set catact=0 where catval={$langfppromo}"); $fctb->commit(); //set the oldfppromo cat back to active if it existed if ($oldfppromo) { $fctc->query("update cat set catact=1 where catval={$oldfppromo}"); $fctc->commit(); } } ?> <p> <?php if ($act == "new") { ?> You have added a new language to this zone. When you return to the central maintenance page, you will immediately be prompted for a minimal set of support profiles for this new language. This will include a new web profile, at least one new category profile, and so forth. Please fill these in as they are presented. <p> Categories are language dependent, and new categories for this language
$sedate = 0; } // end if if ($act == "update") { $res = $coupon->query("update coupon set " . "cpnid='{$cpnid}', cpnsku='{$cpnsku}', cpnstart={$ssdate}, " . "cpnstop={$sedate}, cpnminqty={$cpnminqty}, cpnminamt={$cpnminamt}, " . "discount={$discount}, cpnredeem={$cpnredeem}, cpnmaximum={$cpnmaximum} " . "where cpnid='{$oldcpnid}'"); } elseif ($act == "new") { $res = $coupon->query("insert into coupon " . "(cpnid,cpnsku,cpnstart,cpnstop,cpnminqty,cpnminamt,discount," . "cpnredeem,cpnmaximum)" . " values " . "('{$cpnid}','{$cpnsku}',{$ssdate},{$sedate},{$cpnminqty},{$cpnminamt}," . "{$discount},0,{$cpnmaximum})"); } elseif ($act == "delete") { $res = $coupon->query("delete from coupon where cpnid='{$cpnid}'"); } // end update & insert queries if (!$res) { $coupon->rollback(); echo "<b>failure updating coupon: {$res}</b><br />\n"; } else { $coupon->commit(); echo "Work committed.<br />\n"; } // end if ?> <p> <form method="post" action="couponndx.php"> <input type="hidden" name="zoneid" value="<?php echo $zoneid; ?> " /> <input type="hidden" name="langid" value="<?php echo $langid; ?>
$res = $fcs->query("insert into subzship " . "(shipszid,shipid,shipdef,shiplid)" . " values " . "({$subzsid},{$this_subzshipid},0,{$langid})"); } } $i++; } } } elseif ($act == 'delete') { $res = $fcs->query("delete from subzone " . "where subzid={$zoneid} and subzsid={$subzsid}"); $res = $fcs->query("delete from subzship " . "where shipszid={$subzsid} and shiplid={$langid}"); } // if ($act == 'update') if (!$res) { $fcs->rollback(); echo "<b>Failure updating subzone: {$res}</b><br />\n"; } else { $fcs->commit(); echo "Work Committed.<br />\n"; } if ($act == 'insert') { ?> <form method=post action="subzoneadd.php"> <?php } else { ?> <form method=post action="subzonendx.php"> <?php } ?> <input type="hidden" name="zoneid" value="<?php echo $zoneid; ?>
> <input type=hidden name=langid value=<?php echo $langid; ?> > <input type=submit value="Return"> </form> <?php $fcc->rollback(); exit; } // add the association $pr = $fcc->query("insert into prodcat (pcatval,pcatsku,pcatzid,pcatseq) " . "values ({$val},'{$newsku}',{$zoneid},{$newseq})"); if ($pr) { $fcc->commit(); echo "Work committed.\n"; } else { $fcc->rollback(); echo "Error: work rolled back.\n"; } } if ($delsku) { $pr = $fcc->query("delete from prodcat " . "where pcatval={$val} and pcatsku='{$delsku}' and pcatzid={$zoneid}"); if ($pr) { $fcc->commit($sd); echo "Work committed.\n"; } else { $fcc->rollback($sd); echo "Error: work rolled back.\n"; }
$fcl->query("select count(*) as cnt from ohead " . "where complete=1 and tstamp<{$today}"); $fcl->next_record(); $oheadcomp = (int) $fcl->f("cnt"); $fcl->free_result(); $prod_total = rnd($order_total - $contrib_total); // ADD TOTALS TAX AND SHIPPING, SUBTRACT FROM TOTAL PRODUCT ORDERS $tmp = sprintf("\n" . "Initialized Orders: %4d\n" . "Incomplete Orders: %4d\n" . "Completed Orders: %4d\n" . "Total All Orders: %4d\n" . "\n" . "Total Sales: %10.2f\n" . "Total Sales Tax: %10.2f\n" . "Total Shipping: %10.2f\n" . "Total Product Orders: %10.2f\n" . "Total Contributions: %10.2f\n" . "Total Amount: %10.2f (products and contributions)\n", $oheadinit, $oheadaban, $oheadcomp, $oheadtot, $prod_subtotal, $stax_total, $ship_total, $prod_total, $contrib_total, $order_total); mail($errorEmail, " FishCart Summary for {$today_mdy}", $tmp); // check for stranded orders, i.e. orders that are older than // yesterday that have not been processed $fcl->query("select count(*) as cnt from ohead " . "where complete=1 and tstamp < {$ysday}"); $fcl->next_record(); $oheadcnt = (int) $fcl->f("cnt"); $fcl->free_result(); if ($oheadcnt > 0) { mail($errorEmail, " STRANDED ORDERS: {$oheadcnt}", "Found {$oheadcnt} stranded orders prior to {$today_mdy}, timeval {$ysday}"); } // update just processed orders to complete = 2 status $fcl->query("update ohead set complete=2 where {$select}"); $fcl->commit(); // clear the order file of all abandoned orders over 2 days old $num_days = 2; $create = (int) (time() - 86400 * $num_days); // subtract # of days $fcl->query("select ohead.orderid as orderid from ohead,oline " . "where ohead.tstamp < {$create} and ohead.orderid=oline.orderid " . "and complete < 1"); while ($fcl->next_record()) { $oid = $fcl->f('orderid'); $fcp->query("delete from oline where orderid='{$oid}'"); } $fcl->query("delete from ohead where tstamp < {$create} and complete < 1"); $fcl->commit();
$lterms = $fcl->f("langterms"); $fcl->free_result(); $fcsz = new FC_SQL(); $fcsz->query("select count(*) as cnt from subzone " . "where subzid={$zid} and subzparent={$subzparent}"); $fcsz->next_record(); $zt = $fcsz->f("cnt"); if ($zt == 1 && !($zflag1 & $flag_zonezipshowgeo)) { $fcsz->free_result(); // if only one shipping zone, default it. $fcsz->query("select subzid,subzsid,subzdescr from subzone " . "where subzid={$zid} and subzparent={$subzparent}"); $fcsz->next_record(); $cat = (string) $cat; $szid = (int) $fcsz->f("subzsid"); $fcsz->free_result(); $fcsz->query("update ohead set subz={$szid},shipid=0 where orderid='{$cartid}'"); $fcsz->commit(); header("Location: {$nsecurl}{$cartdir}/{$show}?cartid={$cartid}&zid={$zid}" . "&lid={$lid}&olimit={$olimit}&nlst={$nlst}&olst={$olst}&key1={$key1}" . "&cat={$cat}&szid={$szid}&oszid={$szid}&option_violation={$option_violation}&" . "return_product={$return_product}"); exit; } if ($zflag1 & $flag_zonezipshowgeo) { $fcsz->query("select scity,sstate,szip,scountry from ohead where\n\torderid='{$cartid}'"); if ($fcsz->next_record()) { $city = stripslashes($fcsz->f("scity")); $state = stripslashes($fcsz->f("sstate")); $zip = stripslashes($fcsz->f("szip")); $country = stripslashes($fcsz->f("scountry")); $fcsz->free_result(); } if (!$city && !$state && !$zip && !$country && isset($CookieCustID)) { @(list($custid, $cookie_email) = explode(":", base64_decode($CookieCustID))); $custid = (int) $custid;
if ($fcp->next_record()) { $fcp->free_result(); } else { if ($act == 'insert') { $fcp->query("insert into prodcat (pcatval,pcatsku," . "pcatzid,pcatseq) values ({$pc},'{$prodsku}',{$zid},{$psq})"); } elseif ($act == 'update') { $fcp->query("update prodcat set pcatval={$pc},pcatsku='{$prodsku}'," . "pcatzid={$zid},pcatseq={$psq} " . "where pcatsku='{$oldsku}' and pcatzid={$zid}"); } } } $k++; } $i++; } // end of language process loop $fcp->commit(); echo "Work committed to zone {$zid}.<br />\n"; } // if ( !$proderr ) $z++; } // end of zone process loop $fcz->free_result(); ?> <p> <form method="post" action="productaddm.php"> <input type="hidden" name="ssku" value="<?php echo $ssku; ?>
$fct->next_record(); $scnt = (int) $fct->f("scnt"); $fct->free_result(); // get the current or default shipping option if ($scnt) { if ($curshipid) { // a shipping profile is already selected $fct->query("select ship.shipid,shipcalc,shipdescr,shippercent,shipitem,shipitem2," . "shipsvccode from ship,subzship " . "where shipzid={$zid} " . "and shipszid={$subz} " . "and ship.shiplid={$lid} " . "and subzship.shiplid={$lid} " . "and subzship.shipid=ship.shipid " . "and subzship.shiplid=ship.shiplid " . "and ship.shipid={$curshipid}"); } else { // get the default profile $fct->query("select ship.shipid,shipcalc,shipdescr,shippercent,shipitem," . "shipitem2,shipsvccode,active from ship,subzship " . "where shipzid={$zid} " . "and shipszid={$subz} " . "and shipdef=1 " . "and ship.shiplid={$lid} " . "and subzship.shiplid={$lid} " . "and subzship.shipid=ship.shipid " . "and subzship.shiplid=ship.shiplid"); } if ($fct->next_record()) { $curshipid = (int) $fct->f("shipid"); $fap->query("update ohead set shipid={$curshipid} where orderid='{$cartid}'"); $fap->commit(); $defshipdesc = stripslashes($fct->f("shipdescr")); $tmp = stripslashes($fct->f("shipcalc")); $shipcalc = './' . $tmp; if (empty($tmp) || !file_exists($shipcalc)) { $shipcalc = ""; } } else { $shipcalc = ""; } } else { $shipcalc = ""; } ?> </td></tr> <form name="showcart" method="post" action="modcart.php">
} if ($prodflag1 & $flag_genesd) { $flag1 |= (int) $flag_genesd; } if ($prodflag1 & $flag_persvc) { $flag1 |= (int) $flag_persvc; } if ($prodflag1 & $flag_package) { $flag1 |= (int) $flag_package; } if ($prelf) { $flag1 |= (int) $flag_hasrel; } $fccr = new FC_SQL(); $fccr->query("update prod set prodflag1={$flag1} where prodsku='{$relsku}'" . " and prodzid={$zoneid}"); $fccr->commit(); if ($act == 'insert') { ?> <form method="post" action="prodreladd.php"> <?php } else { ?> <form method="post" action="prodrelndx.php"> <?php } ?> <input type="hidden" name="zoneid" value="<?php echo $zoneid; ?> " /> <input type="hidden" name="langid" value="<?php
$fm->query("select cartseq,lastday from seq {$forupd}"); $fm->next_record(); $seq = (int) $fm->f('cartseq') + 1; $lastday = (int) $fm->f('lastday'); $fm->free_result(); if ($currday != $lastday) { $seq = 1; // reset the sequence upon day turnover } $fm->query("update seq set cartseq={$seq},lastday={$currday}"); if ($databaseeng == 'mysql') { $fm->query('unlock tables'); } elseif ($databaseeng == 'postgres') { $fm->query('commit work'); } elseif ($databaseeng == 'mssql' || $databaseeng == 'oracle') { $fm->commit(); } elseif ($databaseeng == 'odbc' && $dialect == 'solid') { $fm->commit(); } } else { // randomly assign the 7 digit cart id sequence number $i = 0; $collision = 1; srand((double) microtime() * 1000000); while ($collision) { // limit the sequence number to 7 digits, 0-9999999 $seq = rand() % 10000000; // uncomment to use alphanumeric sequence; the cartid // sprintf format string below must be changed also //$seq=substr(0,7,uniqid()); $fm->query("select count(*) as cnt from ohead where orderid='{$cartid}'");
$lterms = $fcl->f("langterms"); $fcl->free_result(); if (!empty($doit)) { if ($zflag1 & $flag_zonetcpage) { // set for inline terms and conditions $ordr = 'terms.php'; } $contrib = str_replace("\$", "", $contrib); $contrib = str_replace(",", "", $contrib); $c = (double) $contrib; if ($c < 0) { $c = (double) 0; } $fch = new FC_SQL(); $fch->query("update ohead set contrib={$c} where orderid='{$cartid}'"); $fch->commit(); header("Location: {$securl}{$secdir}/{$ordr}?" . "cartid={$cartid}&zid={$zid}&lid={$lid}&subz={$subz}"); exit; } else { $contamt = (double) $fco->f("contrib"); } // END OF ESSENTIAL CART DISPLAY CODE FROM LINE 1 TO HERE ?> <html> <head> <link rel="stylesheet" ID href="style.css" type="text/css" /> <title></title></head> <body bgcolor="#FFFFFF" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0"> <?php // START OF ESSENTIAL CART DISPLAY CODE
exit; } // build up vflag1 $vflag1 = 0; if ($act == "update") { $fcv->query("update vend set " . "vendname='{$vendname}', vendaddr1='{$vendaddr1}', vendaddr2='{$vendaddr2}', " . "vendcity='{$vendcity}', vendstate='{$vendstate}', vendzip='{$vendzip}', " . "vendphone='{$vendphone}', vendfax='{$vendfax}', vendemail='{$vendemail}', " . "vsvcname='{$vsvcname}', vsvcaddr1='{$vsvcaddr1}', vsvcaddr2='{$vsvcaddr2}', " . "vsvccity='{$vsvccity}', vsvcstate='{$vsvcstate}', vsvczip='{$vsvczip}', " . "vsvcphone='{$vsvcphone}', vsvcfax='{$vsvcfax}', vsvcemail='{$vsvcemail}'," . "vendnatl='{$vendnatl}', vsvcnatl='{$vsvcnatl}', vendonline='{$vendonline}'," . "vendofline='{$vendofline}',vendoemail='{$vendoemail}'," . "vendconfirm='{$vendconfirm}',vflag1={$vflag1} " . "where vendid={$vendid}"); } elseif ($act == "new") { if ($databaseeng == 'odbc' && $dialect == 'solid') { $fcv->query("call vendor_ins ({$zoneid}," . "'{$vendname}' ,'{$vendaddr1}','{$vendaddr2}','{$vendcity}', " . "'{$vendstate}','{$vendzip}' ,'{$vendnatl}', '{$vendphone}'," . "'{$vendfax}' ,'{$vendemail}','{$vsvcname}' ,'{$vsvcaddr1}'," . "'{$vsvcaddr2}','{$vsvccity}' ,'{$vsvcstate}','{$vsvczip}' ," . "'{$vsvcnatl}' ,'{$vsvcphone}','{$vsvcfax}' ,'{$vsvcemail}'," . "'{$vendonline}','{$vendofline}','{$vendoemail}','{$vendconfirm}',{$vflag1})"); } else { $fcv->query("insert into vend (vendzid," . "vendname,vendaddr1,vendaddr2,vendcity,vendstate,vendzip," . "vendnatl,vendphone,vendfax,vendemail," . "vsvcname,vsvcaddr1,vsvcaddr2,vsvccity,vsvcstate,vsvczip," . "vsvcnatl,vsvcphone,vsvcfax,vsvcemail," . "vendonline,vendofline,vendoemail,vendconfirm,vflag1)" . " values " . "({$zoneid}," . "'{$vendname}' ,'{$vendaddr1}','{$vendaddr2}','{$vendcity}', " . "'{$vendstate}','{$vendzip}' ,'{$vendnatl}', '{$vendphone}'," . "'{$vendfax}' ,'{$vendemail}','{$vsvcname}' ,'{$vsvcaddr1}'," . "'{$vsvcaddr2}','{$vsvccity}' ,'{$vsvcstate}','{$vsvczip}' ," . "'{$vsvcnatl}' ,'{$vsvcphone}','{$vsvcfax}' ,'{$vsvcemail}'," . "'{$vendonline}','{$vendofline}','{$vendoemail}','{$vendconfirm}',{$vflag1})"); } } elseif ($act == "delete") { $fcv->query("delete from vend where vendid={$vendid}"); } $fcv->commit(); echo "Work committed.<br>\n"; ?> <p> <form method=post action="index.php"> <input type=hidden name=zoneid value="<?php echo $zoneid; ?> "> <input type=hidden name=langid value="<?php echo $langid; ?> "> <input type=submit value="Return to Maintenance">
} $fcm = new FC_SQL(); $fcm->Auto_commit = 0; $fcm->query("select count(*) as cnt from master"); $fcm->next_record(); if ($fcm->f("cnt") > 0) { $fcm->free_result(); $res = $fcm->query("update master set zoneid={$zoneid}"); } else { $res = $fcm->query("insert into master (zoneid) values ({$zoneid})"); } if (!$res) { $fcm->rollback(); echo "<b>Failure updating master: {$res}</b><br>\n"; } else { $fcm->commit(); echo "Work Committed.<br>\n"; } ?> <p> <?php if ($zoneid != $oldzid) { ?> The default zone/catalog has changed. Click below to enter language profile modification to select the default language for this zone. <p>
function fc_open() { global $instid, $cartid, $zid, $lid, $aid, $CookieCart, $CookieCustID; global $fc_csym, $fc_webfree, $fc_webflags1; $custid = ""; if (isset($CookieCart)) { list($cartid, $czid, $clid) = explode(":", $CookieCart); if (empty($zid)) { $zid = $czid; } if (empty($lid)) { $lid = $clid; } } if (isset($CookieCustID)) { list($purchid, $purch_email) = explode(":", base64_decode($CookieCustID)); } else { $purchid = 0; } $fm = new FC_SQL(); $fm->Auto_free = 1; if (empty($zid)) { // get the default zone $fm->query("select zoneid from master"); $fm->next_record(); $zid = $fm->f("zoneid"); $fm->free_result(); } if (empty($lid)) { // get default language from zone record $fm->query("select zonedeflid from zone where zoneid={$zid}"); $fm->next_record(); $lid = $fm->f("zonedeflid"); $fm->free_result(); } if (!empty($cartid)) { // see if this order is still valid $fm->query("select aid from ohead where orderid='{$cartid}'"); if (!$fm->next_record()) { // order no longer exists $cartid = ""; setcookie("Cookie{$instid}Cart"); } else { // the order still exists $tmp_aid = str_replace(" ", "", $fm->f("aid")); $fm->free_result(); } } if (empty($aid)) { $aid = ""; } if (empty($cartid)) { $tstamp = time(); if ('' == 'solid') { $fid = new FC_SQL(); $fid->query("call order_ins"); $fid->next_record(); $cartid = date("Y", $tstamp) . sprintf("%02d", date("m", $tstamp)) . sprintf("%02d", date("d", $tstamp)) . sprintf("%07d", $fid->f("cartid_seq")); } else { $cartid = uniqid(""); } $fm->query("insert into ohead " . "(custid,orderid,zone,subz,tstamp,contrib,trans1,aid,purchid,complete) " . " values " . "('{$custid}','{$cartid}',{$zid},0,{$tstamp},0,'{$trans1}','{$aid}',{$purchid},0)"); $fm->commit(); } elseif (!$tmp_aid) { // order AID was null, update with the current one $fm->query("update ohead set aid='{$aid}' where orderid='{$cartid}'"); } // keep the cookie 48 hours setcookie("Cookie{$instid}Cart", $cartid . ":" . $zid . ":" . $lid, time() + 172800); $fcw = new FC_SQL(); $fcz = new FC_SQL(); $fcw->query("select webfree,webflags1 from web " . "where webzid={$zid} and weblid={$lid}"); $fcw->next_record(); $fc_webfree = $fcw->f('webfree'); $fc_webflags1 = $fcw->f('webflags1'); $fcw->free_result(); $fcz->query("select zonecurrsym from zone " . "where zoneid={$zid}"); $fcz->next_record(); $fc_csym = $fcz->f('zonecurrsym'); $fcz->free_result(); }
function do_esd() { global $cartid, $zid, $lid, $custid, $flag_useesd, $flag_genesd; global $billing_first, $billing_mi, $billing_last, $billing_email; global $download_pw, $download_user; $fcesd = new FC_SQL(); $fcesn = new FC_SQL(); $fcesp = new FC_SQL(); $dlmax = 10; // 10 maximum downloads $dlmaxdays = 30; // 30 days before download expiration $now = time(); $end = $now + $dlmaxdays * 86400; // I don't think we care about compsku, but pull for possible reference $fcesd->query("select olid,sku,compsku from oline where orderid='{$cartid}'"); $esd_count = 0; while ($fcesd->next_record()) { $olid = (int) $fcesd->f("olid"); $sku = $fcesd->f("sku"); $compsku = $fcesd->f("compsku"); $fcesp->query("select prodflag1 from prod where prodzid={$zid} and " . "prodsku='{$sku}'"); $fcesp->next_record(); $flag1 = (int) $fcesp->f("prodflag1"); $fcesp->free_result(); $fcesp->query("select proddload from prodlang where prodlzid={$zid} and " . "prodlid={$lid} and prodlsku='{$sku}'"); $fcesp->next_record(); $proddload = $fcesp->f("proddload"); $fcesp->free_result(); if ($flag1 & $flag_useesd && $flag1 & $flag_genesd) { $esd_count++; // use fishcart internal ESD process $fcesp->query("insert into esd ( " . "esdoid,esdact,esdolid,esdpurchid,esddlact,esddlexp," . "esddlcnt,esddlmax,esdsernum,esddlfile" . ") values (" . "'{$cartid}',1,{$olid},{$custid},{$now},{$end}," . "0,{$dlmax},'','{$proddload}')"); $esdid = (int) $fcesp->insert_id('esdid', 'kmtesd', 'esdolid'); $fcesn->query("update oline set olesd={$esdid} where olid={$olid}"); } elseif ($flag1 & $flag_useesd) { $esd_count++; // use external process for ESD items // must set $esdid for the ESD table ID upon exit require './esd_external.php'; } } $fcesd->free_result(); if ($esd_count) { $cname = $billing_first . ' ' . $billing_mi . ' ' . $billing_last; // use the cart id as the download username $download_user = $cartid; // create a random number as a password // check for random number collisions; start by assuming a collision $i = 0; $collision = 1; while ($collision) { srand((double) microtime() * 1000000); $download_pw = (int) rand() + 1; $fcesn->query("select count(*) as cnt from pw where pwpw='{$download_pw}'"); $fcesn->next_record(); // collision is the count of rows found, leave loop when 0 $collision = (int) $fcesn->f('cnt'); $fcesn->free_result(); $i++; if ($i % 10 == 0) { global $gBitSystem; mail($gBitSystem->getErrorEmail(), " SERIAL NUMBER COLLISION LOOP", "Serial Number: {$download_pw}\nLoop count: {$i}\n"); sleep(1); // try a 1 second sleep } } $fcesp->query("insert into pw ( " . "pwactive,pwzone," . "pwjan,pwfeb,pwmar,pwapr,pwmay, pwjun," . "pwjul,pwaug,pwsep,pwoct,pwnov,pwdec," . "pwexp,pwdescr,pwemail,pwuid,pwpw,pwoid" . ") values (" . "1,{$zid}," . "0,0,0,0,0,0," . "0,0,0,0,0,0," . "{$end},'{$cname}','{$billing_email}','{$download_user}','{$download_pw}'," . "'{$cartid}')"); $fcesd->commit(); } return $esd_count; }
// index.php will see the 0 default, force a new language, // and langupd.php will force the new language as the default // for this zone when it sees that zonedeflid is 0 if ($databaseeng == 'odbc' && $dialect == 'solid') { $res = $fcz->query("call zone_ins " . "('{$zonedescr}','{$zonecurrsym}',{$zoneact},{$zflag1},0)"); } else { $res = $fcz->query("insert into zone " . "(zonedescr,zonecurrsym,zoneact,zflag1,zonedeflid)" . " values " . "('{$zonedescr}','{$zonecurrsym}',{$zoneact},{$zflag1},0)"); } } elseif ($act == "delete") { $res = $fcz->query("delete from zone where zoneid={$zoneid}"); } if (!$res) { $fcz->rollback(); echo "<b>Failure updating zone: {$res}</b><br>\n"; } else { $fcz->commit(); echo "Work Committed.<br>\n"; } ?> <p> <?php if ($act == "new") { ?> You have added a new zone. When you return to the central maintenance page, you will immediately be prompted for a minimal set of support profiles for this new zone. This will include a new language profile, web profile, vendor profile, at least one subzone profile, and so forth. Please fill these in as they are presented. <p> <?php