$productdata) { $productinfo = getproductinfo ($productdata['pid']); $productdata['productinfo'] = $productinfo; $customfields = getcustomfields ('product', $productdata['pid'], '', '', 'on', $productdata['customfields']); $productdata['customfields'] = $customfields; $query = 'SELECT * FROM tblproducts WHERE id=\'' . $productdata['pid'] . '\''; $result = mysql_query ($query); $data = mysql_fetch_array ($result); $productname = $data['name']; $paytype = $data['paytype']; $msetupfee = $data['msetupfee']; $qsetupfee = $data['qsetupfee']; $ssetupfee = $data['ssetupfee']; $asetupfee = $data['asetupfee']; $bsetupfee = $data['bsetupfee']; $monthly = $data['monthly']; $quarterly = $data['quarterly']; $semiannual = $data['semiannual']; $annual = $data['annual']; $biennial = $data['biennial']; $proratabilling = $data['proratabilling']; $proratadate = $data['proratadate']; $proratachargenextmonth = $data['proratachargenextmonth']; $tax = $data['tax']; $servertype = $data['servertype']; $defaultserver = $data['defaultserver']; $autosetup = $data['autosetup']; $stockcontrol = $data['stockcontrol']; $freedomain = $data['freedomain']; $freedomainpaymentterms = $data['freedomainpaymentterms']; $freedomaintlds = $data['freedomaintlds']; $freedomainpaymentterms = explode (',', $freedomainpaymentterms); $freedomaintlds = explode (',', $freedomaintlds); if (!$CONFIG['TaxEnabled']) { $tax = ''; } if ($paytype == 'recurring') { $billingcycle = $productdata['billingcycle']; if ((((($billingcycle == 'monthly' OR $billingcycle == 'quarterly') OR $billingcycle == 'semiannually') OR $billingcycle == 'annually') OR $billingcycle == 'biennially')) { } else { if ($monthly != '0.00') { $billingcycle = 'monthly'; } else { if ($quarterly != '0.00') { $billingcycle = 'quarterly'; } else { if ($semiannual != '0.00') { $billingcycle = 'semiannually'; } else { if ($annual != '0.00') { $billingcycle = 'annually'; } else { if ($biennial != '0.00') { $billingcycle = 'biennially'; } } } } } } } else { if ($paytype == 'onetime') { $billingcycle = 'onetime'; } else { $billingcycle = 'free'; } } $productdata['billingcycle'] = $billingcycle; if ($billingcycle == 'free') { $product_setup = '0'; $product_onetime = '0'; $product_recurring = '0'; $databasecycle = 'Free Account'; } else { if ($billingcycle == 'onetime') { $product_setup = $msetupfee; $product_onetime = $monthly; $product_recurring = 0; $databasecycle = 'One Time'; } else { if ($billingcycle == 'monthly') { $product_setup = $msetupfee; $product_onetime = $monthly; $product_recurring = $monthly; $databasecycle = 'Monthly'; } else { if ($billingcycle == 'quarterly') { $product_setup = $qsetupfee; $product_onetime = $quarterly; $product_recurring = $quarterly; $databasecycle = 'Quarterly'; } else { if ($billingcycle == 'semiannually') { $product_setup = $ssetupfee; $product_onetime = $semiannual; $product_recurring = $semiannual; $databasecycle = 'Semi-Annually'; } else { if ($billingcycle == 'annually') { $product_setup = $asetupfee; $product_onetime = $annual; $product_recurring = $annual; $databasecycle = 'Annually'; } else { if ($billingcycle == 'biennially') { $product_setup = $bsetupfee; $product_onetime = $biennial; $product_recurring = $biennial; $databasecycle = 'Biennially'; } } } } } } } $configurableoptions = array (); $configurableoptions = getconfigurableproductoptions ($productdata['pid'], $productdata['configoptions'], $billingcycle); $configoptions = ''; if ($configurableoptions) { foreach ($configurableoptions as $confkey => $value) { $configoptions[] = array ('name' => $value['optionname'], 'option' => $value['selectedoption']); $configoptionsdb[$value['id']] = $value['selectedvalue']; $product_setup += $value['selectedsetup']; $product_onetime += $value['selectedrecurring']; $product_recurring += $value['selectedrecurring']; } } $productdata['configoptions'] = $configoptions; if (in_array ($billingcycle, $freedomainpaymentterms)) { $domain = $productdata['domain']; $domainparts = explode ('.', $domain, 2); $tld = '.' . $domainparts[1]; if (in_array ($tld, $freedomaintlds)) { $freedomains[] = $domain; } } if ($proratabilling) { if ($billingcycle == 'monthly') { $proratamonths = 1; } else { if ($billingcycle == 'quarterly') { $proratamonths = 3; } else { if ($billingcycle == 'semiannually') { $proratamonths = 6; } else { if ($billingcycle == 'annually') { $proratamonths = 12; } else { if ($billingcycle == 'biennially') { $proratamonths = 24; } } } } } if ($billingcycle != 'monthly') { $proratachargenextmonth = 0; } $prorataamount = $product_onetime / $proratamonths; if (date ('d') < $proratadate) { $proratamonth = date ('m'); } else { $proratamonth = date ('m') + 1; } $days = (strtotime (date ('Y-m-d', mktime (0, 0, 0, $proratamonth, $proratadate, date ('Y')))) - strtotime (date ('Y-m-d'))) / (60 * 60 * 24); $totaldays = 30; $product_onetime = $prorataamount * ($days / $totaldays); $product_onetime = format_as_currency ($product_onetime); $proratadateuntil = date ('Y-m-d', mktime (0, 0, 0, $proratamonth, $proratadate, date ('Y'))); if (($proratachargenextmonth <= date ('d') AND $days < 31)) { $product_onetime += $product_recurring; $proratadateuntil = date ('Y-m-d', mktime (0, 0, 0, $proratamonth + $proratamonths, $proratadate, date ('Y'))); } $productdata['proratadate'] = frommysqldate ($proratadateuntil); } if (($product_onetime == '0' AND $product_recurring == '0')) { $pricing_text = $_LANG['orderfree']; } else { $pricing_text = $CONFIG['CurrencySymbol'] . format_as_currency ($product_onetime) . ' ' . $CONFIG['Currency']; if ($product_setup != '0.00') { $pricing_text .= ' + ' . $CONFIG['CurrencySymbol'] . format_as_currency ($product_setup) . ' ' . $CONFIG['Currency'] . ' ' . $_LANG['ordersetupfee']; } } $productdata['pricingtext'] = $pricing_text; $thisproductfirstpaymentamount = $product_setup + $product_onetime; $thisproductrecurringamount = $product_recurring; $total_onetime += $thisproductfirstpaymentamount; $total_recurring += $thisproductrecurringamount; if (((($promo_item == 'Product' AND !$promo_used) AND in_array ($productdata['pid'], $promo_packages)) AND (($promo_applies AND $databasecycle == $promo_applies) OR !$promo_applies))) { if ($promo_discount == 'Money Value') { if ($thisproductfirstpaymentamount < $promo_value) { $discount = $thisproductfirstpaymentamount; } else { $discount = $promo_value; } } else { $percent = $promo_value / 100; $discount = $thisproductfirstpaymentamount * $percent; } $thisproductfirstpaymentamount -= $discount; $total_onetime -= $discount; if ($promo_type == 'Recurring') { if ($promo_discount == 'Money Value') { if ($thisproductrecurringamount < $promo_value) { $recdiscount = $thisproductrecurringamount; } else { $recdiscount = $promo_value; } } else { $percent = $promo_value / 100; $recdiscount = $thisproductrecurringamount * $percent; } $thisproductrecurringamount -= $recdiscount; $total_recurring -= $recdiscount; } $promo_used = true; } if ($tax) { $total_tax = $total_onetime; if ($CONFIG['TaxType'] == 'Exclusive') { $total_recurring += $thisproductrecurringamount * $taxrate; } } if ($billingcycle == 'monthly') { $total_recurringmonthly += $thisproductrecurringamount; } else { if ($billingcycle == 'quarterly') { $total_recurringquarterly += $thisproductrecurringamount; } else { if ($billingcycle == 'semiannually') { $total_recurringsemiannually += $thisproductrecurringamount; } else { if ($billingcycle == 'annually') { $total_recurringannually += $thisproductrecurringamount; } else { if ($billingcycle == 'biennially') { $total_recurringbiennially += $thisproductrecurringamount; } } } } } if ($checkout) { if ($servertype) { if ($defaultserver == '0') { $query = '' . 'SELECT id,maxaccounts FROM tblservers WHERE type=\'' . $servertype . '\' AND active=\'1\''; $result = mysql_query ($query); $data = mysql_fetch_array ($result); $serverid = $data['id']; $maxaccounts = $data['maxaccounts']; $query = '' . 'SELECT COUNT(id) FROM tblhosting WHERE server=\'' . $serverid . '\' AND (domainstatus=\'Active\' OR domainstatus=\'Suspended\')'; $result = mysql_query ($query); $data = mysql_fetch_array ($result); $usagecount = $data[0]; if ($usagecount == $maxaccounts) { $query = '' . 'SELECT id FROM tblservers WHERE type=\'' . $servertype . '\' AND id!=\'' . $serverid . '\''; $result = mysql_query ($query); $data = mysql_fetch_array ($result); $newserverid = $data['id']; $query = '' . 'UPDATE tblservers SET active=\'\' WHERE type=\'' . $servertype . '\''; $result = mysql_query ($query); $query = '' . 'UPDATE tblservers SET active=\'1\' WHERE type=\'' . $servertype . '\' AND id=\'' . $newserverid . '\''; $result = mysql_query ($query); } if ($newserverid != '') { $serverid = $newserverid; } } else { $serverid = $defaultserver; } } if ($databasecycle == 'Free Account') { $hostingquerydates = '00000000,00000000'; } else { $hostingquerydates = 'now(),now()'; } $productid = $productdata['pid']; $domain = $productdata['domain']; $serverhostname = $productdata['server']['hostname']; $serverns1prefix = $productdata['server']['ns1prefix']; $serverns2prefix = $productdata['server']['ns2prefix']; $serverrootpw = encrypt ($productdata['server']['rootpw']); if ($serverhostname) { $domain = $serverhostname . '.' . $domain; } if ($serverns1prefix) { $serverns1prefix = $serverns1prefix . '.' . $domain; } if ($serverns2prefix) { $serverns2prefix = $serverns2prefix . '.' . $domain; } $query = '' . 'INSERT INTO tblhosting (userid,orderid,regdate,server,domain,paymentmethod,firstpaymentamount,amount,billingcycle,nextduedate,nextinvoicedate,domainstatus,packageid,ns1,ns2,rootpassword) VALUES (\'' . $userid . '\',\'' . $orderid . '\',now(),\'' . $serverid . '\',\'' . $domain . '\',\'' . $paymentmethod . '\',\'' . $thisproductfirstpaymentamount . '\',\'' . $thisproductrecurringamount . '\',\'' . $databasecycle . '\',' . $hostingquerydates . ',\'Pending\',\'' . $productid . '\',\'' . $serverns1prefix . '\',\'' . $serverns2prefix . '\',\'' . $serverrootpw . '\')'; $result = mysql_query ($query); $clientproductid = mysql_insert_id (); $orderproductids[] = $clientproductid; $adminemailitems .= $_LANG['orderproduct'] . ('' . ': ' . $productname . '
') . $_LANG['orderdomain'] . ('' . ': ' . $domain . '
') . $_LANG['firstpaymentamount'] . ': ' . $CONFIG['CurrencySymbol'] . ('' . $thisproductfirstpaymentamount . '
') . $_LANG['recurringamount'] . ': ' . $CONFIG['CurrencySymbol'] . ('' . $thisproductrecurringamount . '
') . $_LANG['orderbillingcycle'] . ': ' . $_LANG['orderpaymentterm' . str_replace ('-', '', strtolower ($databasecycle))] . '

'; if ($stockcontrol == 'on') { $query = '' . 'UPDATE tblproducts SET qty=qty-1 WHERE id=\'' . $productid . '\''; $result = mysql_query ($query); } if ($configoptionsdb) { foreach ($configoptionsdb as $key => $value) { $query = '' . 'INSERT INTO tblhostingconfigoptions (relid,configid,optionid) VALUES (\'' . $clientproductid . '\',\'' . $key . '\',\'' . $value . '\')'; $result = mysql_query ($query); } } foreach ($productdata['customfields'] as $key => $value) { $query = 'INSERT INTO tblcustomfieldsvalues (fieldid,relid,value) VALUES (\'' . $value['id'] . ('' . '\',\'' . $clientproductid . '\',\'') . $value['rawvalue'] . '\')'; $result = mysql_query ($query); } if ($autosetup == 'order') { $servertype = getservertype ($serverid); include_once dirname (__FILE__) . ('' . '/modules/servers/' . $servertype . '/' . $servertype . '.php'); $result = servercreateaccount ($clientproductid); if ($result == 'success') { sendmessage ('defaultnewacc', $clientproductid); logactivity ('Automatic Setup of Account on Order Successful'); } else { logactivity ('' . 'Automatic Setup of Account on Order Failed (' . $result . ')'); } } } if ($CONFIG['TaxAddons']) { $tax = '1'; } unset ($addonsarray); $addons = $productdata['addons']; if ($addons) { foreach ($addons as $addonid) { $query = '' . 'SELECT * FROM tbladdons WHERE id=\'' . $addonid . '\''; $result = mysql_query ($query); $data = mysql_fetch_array ($result); $addon_name = $data['name']; $addon_description = $data['description']; $addon_recurring = $data['recurring']; $addon_setupfee = $data['setupfee']; $addon_billingcycle = $data['billingcycle']; $total_onetime += $addon_setupfee + $addon_recurring; $rawaddononetime = $addon_setupfee + $addon_recurring; $rawaddonrecurring = $addon_recurring; if ((($promo_item == 'Addon' AND !$promo_used) AND in_array ($addonid, $promo_addons))) { if ($promo_discount == 'Money Value') { if ($rawaddononetime < $promo_value) { $discount = $rawaddononetime; } else { $discount = $promo_value; } } else { $percent = $promo_value / 100; $discount = $rawaddononetime * $percent; } $rawaddononetime -= $discount; if ($promo_type == 'Recurring') { if ($promo_discount == 'Money Value') { if ($rawaddonrecurring < $promo_value) { $recdiscount = $rawaddonrecurring; } else { $recdiscount = $promo_value; } } else { $percent = $promo_value / 100; $recdiscount = $rawaddonrecurring * $percent; } $rawaddonrecurring -= $recdiscount; } $promo_used = true; } if ($checkout) { if ($addon_billingcycle == 'Free') { $querydates = '00000000,00000000'; } else { $querydates = 'now(),now()'; } $addonsetupfee = $rawaddononetime - $rawaddonrecurring; $query = '' . 'INSERT INTO tblhostingaddons (hostingid,orderid,regdate,name,setupfee,recurring,billingcycle,status,nextduedate,nextinvoicedate,paymentmethod) VALUES (\'' . $clientproductid . '\',\'' . $orderid . '\',now(),\'' . $addon_name . '\',\'' . $addonsetupfee . '\',\'' . $rawaddonrecurring . '\',\'' . $addon_billingcycle . '\',\'Pending\',' . $querydates . ',\'' . $paymentmethod . '\')'; $result = mysql_query ($query); $addonid = mysql_insert_id (); $orderaddonids[] = $addonid; $adminemailitems .= $_LANG['clientareaaddon'] . ('' . ': ' . $addon_name . '
') . $_LANG['ordersetupfee'] . ': ' . $CONFIG['CurrencySymbol'] . ('' . $addonsetupfee . '
') . $_LANG['recurringamount'] . ': ' . $CONFIG['CurrencySymbol'] . ('' . $rawaddonrecurring . '
') . $_LANG['orderbillingcycle'] . ': ' . $_LANG['orderpaymentterm' . str_replace ('-', '', strtolower ($addon_billingcycle))] . '

'; } if ($tax) { $total_tax += $addon_setupfee + $addon_recurring; if ($CONFIG['TaxType'] == 'Exclusive') { $rawaddonrecurring = $rawaddonrecurring + $rawaddonrecurring * $taxrate; } } if ($addon_billingcycle == 'Monthly') { $total_recurringmonthly += $rawaddonrecurring; } else { if ($addon_billingcycle == 'Quarterly') { $total_recurringquarterly += $rawaddonrecurring; } else { if ($addon_billingcycle == 'Semi-Annually') { $total_recurringsemiannually += $rawaddonrecurring; } else { if ($addon_billingcycle == 'Annually') { $total_recurringannually += $rawaddonrecurring; } else { if ($addon_billingcycle == 'Biennially') { $total_recurringbiennially += $rawaddonrecurring; } } } } } if (($addon_setupfee == '0' AND $addon_recurring == '0')) { $pricing_text = $_LANG['orderfree']; } else { $pricing_text = $CONFIG['CurrencySymbol'] . format_as_currency ($addon_recurring) . ' ' . $CONFIG['Currency']; if ($addon_setupfee != '0.00') { $pricing_text .= ' + ' . $CONFIG['CurrencySymbol'] . format_as_currency ($addon_setupfee) . ' ' . $CONFIG['Currency'] . ' ' . $_LANG['ordersetupfee']; } } $addonsarray[] = array ('name' => $addon_name, 'pricingtext' => $pricing_text); } } $productdata['addons'] = $addonsarray; $productsarray[$key] = $productdata; } } $cartdata['products'] = $productsarray; if ($_SESSION['cart']['addons']) { if ($CONFIG['TaxAddons']) { $tax = '1'; } foreach ($_SESSION['cart']['addons'] as $key => $addon) { $addonid = $addon['id']; $productid = $addon['productid']; $query = '' . 'SELECT * FROM tbladdons WHERE id=\'' . $addonid . '\''; $result = mysql_query ($query); $data = mysql_fetch_array ($result); $addon_name = $data['name']; $addon_description = $data['description']; $addon_recurring = $data['recurring']; $addon_setupfee = $data['setupfee']; $addon_billingcycle = $data['billingcycle']; $total_onetime += $addon_setupfee + $addon_recurring; $rawaddononetime = $addon_setupfee + $addon_recurring; $rawaddonrecurring = $addon_recurring; if ((($promo_item == 'Addon' AND !$promo_used) AND in_array ($addonid, $promo_addons))) { if ($promo_discount == 'Money Value') { if ($rawaddononetime < $promo_value) { $discount = $rawaddononetime; } else { $discount = $promo_value; } } else { $percent = $promo_value / 100; $discount = $rawaddononetime * $percent; } $rawaddononetime -= $discount; if ($promo_type == 'Recurring') { if ($promo_discount == 'Money Value') { if ($rawaddonrecurring < $promo_value) { $recdiscount = $rawaddonrecurring; } else { $recdiscount = $promo_value; } } else { $percent = $promo_value / 100; $recdiscount = $rawaddonrecurring * $percent; } $rawaddonrecurring -= $recdiscount; } $promo_used = true; } if ($checkout) { if ($addon_billingcycle == 'Free') { $querydates = '00000000,00000000'; } else { $querydates = 'now(),now()'; } $addonsetupfee = $rawaddononetime - $rawaddonrecurring; $query = '' . 'INSERT INTO tblhostingaddons (hostingid,orderid,regdate,name,setupfee,recurring,billingcycle,status,nextduedate,nextinvoicedate,paymentmethod) VALUES (\'' . $productid . '\',\'' . $orderid . '\',now(),\'' . $addon_name . '\',\'' . $addonsetupfee . '\',\'' . $rawaddonrecurring . '\',\'' . $addon_billingcycle . '\',\'Pending\',' . $querydates . ',\'' . $paymentmethod . '\')'; $result = mysql_query ($query); $addonid = mysql_insert_id (); $orderaddonids[] = $addonid; $adminemailitems .= $_LANG['clientareaaddon'] . ('' . ': ' . $addon_name . '
') . $_LANG['ordersetupfee'] . ': ' . $CONFIG['CurrencySymbol'] . ('' . $addonsetupfee . '
') . $_LANG['recurringamount'] . ': ' . $CONFIG['CurrencySymbol'] . ('' . $rawaddonrecurring . '
') . $_LANG['orderbillingcycle'] . ': ' . $_LANG['orderpaymentterm' . str_replace ('-', '', strtolower ($addon_billingcycle))] . '

'; } if ($tax) { $total_tax += $addon_setupfee + $addon_recurring; if ($CONFIG['TaxType'] == 'Exclusive') { $rawaddonrecurring = $rawaddonrecurring + $rawaddonrecurring * $taxrate; } } if ($addon_billingcycle == 'Monthly') { $total_recurringmonthly += $rawaddonrecurring; } else { if ($addon_billingcycle == 'Quarterly') { $total_recurringquarterly += $rawaddonrecurring; } else { if ($addon_billingcycle == 'Semi-Annually') { $total_recurringsemiannually += $rawaddonrecurring; } else { if ($addon_billingcycle == 'Annually') { $total_recurringannually += $rawaddonrecurring; } else { if ($addon_billingcycle == 'Biennially') { $total_recurringbiennially += $rawaddonrecurring; } } } } } if (($addon_setupfee == '0' AND $addon_recurring == '0')) { $pricing_text = $_LANG['orderfree']; } else { $pricing_text = $CONFIG['CurrencySymbol'] . format_as_currency ($addon_recurring) . ' ' . $CONFIG['Currency']; if ($addon_setupfee != '0.00') { $pricing_text .= ' + ' . $CONFIG['CurrencySymbol'] . format_as_currency ($addon_setupfee) . ' ' . $CONFIG['Currency'] . ' ' . $_LANG['ordersetupfee']; } } $query = '' . 'SELECT domain,name FROM tblhosting INNER JOIN tblproducts ON tblproducts.id=tblhosting.packageid WHERE tblhosting.id=\'' . $productid . '\''; $result = mysql_query ($query); $data = mysql_fetch_array ($result); $productname = $data['name']; $domainname = $data['domain']; $addonsarray[] = array ('name' => $addon_name, 'productname' => $productname, 'domainname' => $domainname, 'pricingtext' => $pricing_text); $cartdata['addons'] = $addonsarray; } } include 'includes/additionaldomainfields.php'; if ($_SESSION['cart']['domains']) { foreach ($_SESSION['cart']['domains'] as $key => $domain) { $domaintype = $domain['type']; $domainname = $domain['domain']; $regperiod = $domain['regperiod']; $domainparts = explode ('.', $domainname, 2); $sld = $domainparts[0]; $tld = $domainparts[1]; if (in_array ($domainname, $freedomains)) { $temppricelist = gettldpricelist ('.' . $tld); $regperiod = $temppricelist[0]['period']; $domainprice = '0.00'; $renewprice = '0.00'; } else { $domainprice = getregprice ('.' . $tld, $regperiod, $domaintype); $renewprice = getregprice ('.' . $tld, $regperiod, 'renew'); } if ($domain['dnsmanagement']) { $dnsmanagement = true; $domainprice += $CONFIG['DomainDNSManagement'] * $regperiod; $renewprice += $CONFIG['DomainDNSManagement'] * $regperiod; } else { $dnsmanagement = false; } if ($domain['emailforwarding']) { $emailforwarding = true; $domainprice += $CONFIG['DomainEmailForwarding'] * $regperiod; $renewprice += $CONFIG['DomainEmailForwarding'] * $regperiod; } else { $emailforwarding = false; } if ($domain['idprotection']) { $idprotection = true; $domainprice += $CONFIG['DomainIDProtection'] * $regperiod; $renewprice += $CONFIG['DomainIDProtection'] * $regperiod; } else { $idprotection = false; } $rawdomainprice = $domainprice; $rawrenewprice = $renewprice; if (((($promo_item == 'Domain' AND !$promo_used) AND $domainprice != '0') AND $renewprice != '0')) { if ($promo_discount == 'Money Value') { if ($rawdomainprice < $promo_value) { $discount = $rawdomainprice; } else { $discount = $promo_value; } } else { $percent = $promo_value / 100; $discount = $rawdomainprice * $percent; } $rawdomainprice -= $discount; $totaldomainprice -= $discount; if ($promo_type == 'Recurring') { if ($promo_discount == 'Money Value') { if ($rawrenewprice < $promo_value) { $recdiscount = $rawrenewprice; } else { $recdiscount = $promo_value; } } else { $percent = $promo_value / 100; $recdiscount = $rawrenewprice * $percent; } $rawrenewprice -= $recdiscount; } $promo_used = true; } if ($checkout) { $query = '' . 'INSERT INTO tbldomains (userid,orderid,type,registrationdate,domain,firstpaymentamount,recurringamount,registrationperiod,status,paymentmethod,expirydate,nextduedate,nextinvoicedate,dnsmanagement,emailforwarding,idprotection) VALUES (\'' . $userid . '\',\'' . $orderid . '\',\'' . $domaintype . '\',now(),\'' . $domainname . '\',\'' . $rawdomainprice . '\',\'' . $rawrenewprice . '\',\'' . $regperiod . '\',\'Pending\',\'' . $paymentmethod . '\',\'00000000\',now(),now(),\'' . $dnsmanagement . '\',\'' . $emailforwarding . '\',\'' . $idprotection . '\')'; $result = mysql_query ($query); $domainid = mysql_insert_id (); $orderdomainids[] = $domainid; $adminemailitems .= $_LANG['orderdomainregistration'] . ': ' . ucfirst ($domaintype) . '
' . $_LANG['orderdomain'] . ('' . ': ' . $domainname . '
') . $_LANG['firstpaymentamount'] . ': ' . $CONFIG['CurrencySymbol'] . ('' . $rawdomainprice . '
') . $_LANG['recurringamount'] . ': ' . $CONFIG['CurrencySymbol'] . ('' . $rawrenewprice . '
') . $_LANG['orderregperiod'] . ('' . ': ' . $regperiod . ' ') . $_LANG['orderyears'] . '
'; if ($dnsmanagement) { $adminemailitems .= ' + DNS Management
'; } if ($emailforwarding) { $adminemailitems .= ' + Email Forwarding
'; } if ($idprotection) { $adminemailitems .= ' + ID Protection
'; } $adminemailitems .= '
'; if ($domaintype == 'register') { unset ($tempdomainfields); $tempdomainfields = $additionaldomainfields['.' . $tld]; if ($tempdomainfields) { foreach ($tempdomainfields as $fieldkey => $value) { $storedvalue = $domain['fields'][$fieldkey]; $query = '' . 'INSERT INTO tbldomainsadditionalfields (domainid,name,value) VALUES (\'' . $domainid . '\',\'' . $value['Name'] . ('' . '\',\'' . $storedvalue . '\')'); $result = mysql_query ($query); } } } if ($domaintype == 'transfer') { $ordertransfersecrets .= $domainname . '=' . $domain['eppcode'] . ','; } } $tempdomains[$key] = array ('type' => $domaintype, 'domain' => $domainname, 'regperiod' => $regperiod, 'price' => $CONFIG['CurrencySymbol'] . format_as_currency ($domainprice) . ' ' . $CONFIG['Currency'], 'renewprice' => $CONFIG['CurrencySymbol'] . format_as_currency ($renewprice) . ' ' . $CONFIG['Currency'], 'dnsmanagement' => $dnsmanagement, 'emailforwarding' => $emailforwarding, 'idprotection' => $idprotection, 'eppvalue' => $domain['eppcode']); $totaldomainprice += $domainprice; } } $cartdata['domains'] = $tempdomains; $total_onetime += $totaldomainprice; if ($CONFIG['TaxDomains']) { $total_tax += $totaldomainprice; } if ($CONFIG['TaxEnabled']) { if ($CONFIG['TaxType'] == 'Inclusive') { $total_without_tax = $total_tax / $inctaxrate; $total_tax -= $total_without_tax; $total_onetime -= $total_tax; } else { $total_tax *= $taxrate; } } else { $total_tax = 0; } $subtotal = $total_onetime + $discount; $total_onetime += $total_tax; $subtotal = format_as_currency ($subtotal); $discount = format_as_currency ($discount); $total_tax = format_as_currency ($total_tax); $total_onetime = format_as_currency ($total_onetime); $total_recurring = format_as_currency ($total_recurring); $total_recurringmonthly = format_as_currency ($total_recurringmonthly); $total_recurringquarterly = format_as_currency ($total_recurringquarterly); $total_recurringsemiannually = format_as_currency ($total_recurringsemiannually); $total_recurringannually = format_as_currency ($total_recurringannually); $total_recurringbiennially = format_as_currency ($total_recurringbiennially); if ($checkout) { $adminemailitems .= $_LANG['ordertotalduetoday'] . ': ' . $CONFIG['CurrencySymbol'] . ('' . $total_onetime . ' ') . $CONFIG['Currency'] . ''; include dirname (__FILE__) . '/includes/processinvoices.php'; $invoiceid = createinvoices ($userid); if ($CONFIG['OrderDaysGrace']) { $new_time = mktime (0, 0, 0, date ('m'), date ('d') + $CONFIG['OrderDaysGrace'], date ('Y')); $duedate = date ('Y-m-d', $new_time); $query = '' . 'UPDATE tblinvoices SET duedate=\'' . $duedate . '\' WHERE id=\'' . $invoiceid . '\''; $result = mysql_query ($query); } $ordernameservers = $_SESSION['cart']['ns1'] . ',' . $_SESSION['cart']['ns2']; if ($_SESSION['cart']['ns3']) { $ordernameservers .= ',' . $_SESSION['cart']['ns3']; } if ($_SESSION['cart']['ns4']) { $ordernameservers .= ',' . $_SESSION['cart']['ns4']; } $query = '' . 'UPDATE tblorders SET amount=\'' . $total_onetime . '\',invoiceid=\'' . $invoiceid . '\',nameservers=\'' . $ordernameservers . '\',transfersecret=\'' . $ordertransfersecrets . '\' WHERE id=\'' . $orderid . '\''; $result = mysql_query ($query); if ($invoiceid) { $query = '' . 'SELECT status FROM tblinvoices WHERE id=\'' . $invoiceid . '\''; $result = mysql_query ($query); $data = mysql_fetch_array ($result); $status = $data['status']; if ($status == 'Paid') { $invoiceid = ''; } } $query = 'SELECT clientid FROM tblaffiliates WHERE id=\'' . $_COOKIE['WHMCSAffiliateID'] . '\''; $result = mysql_query ($query); $data = mysql_fetch_array ($result); $clientid = $data['clientid']; if (((isset ($_COOKIE['WHMCSAffiliateID']) AND !$_SESSION['adminloggedinstatus']) AND $_SESSION['uid'] != $clientid)) { foreach ($orderproductids as $orderproductid) { $query = '' . 'SELECT name,domain,billingcycle,amount FROM tblhosting INNER JOIN tblproducts ON tblproducts.id=tblhosting.packageid WHERE id=\'' . $orderproductid . '\''; $result = mysql_query ($query); $data = mysql_fetch_array ($result); $package = $data['name']; $domain = $data['domain']; $productbillingcycle = $data['billingcycle']; $rawproductrecurring = $data['amount']; $query = 'INSERT INTO tblaffiliatesaccounts (affiliateid,domain,package,billingcycle,regdate,amount,commission,relid) VALUES (\'' . $_COOKIE['WHMCSAffiliateID'] . '\',\'' . $domain . '\',\'' . $package . '\',\'' . $productbillingcycle . '\',now(),\'' . $rawproductrecurring . '\',\'' . calculateaffiliatecommission ($_COOKIE['WHMCSAffiliateID'], $orderproductid) . ('' . '\',\'' . $orderproductid . '\')'); $result = mysql_query ($query); } } $query = '' . 'SELECT firstname, lastname, companyname, email, address1, address2, city, state, postcode, country, phonenumber, ip, host FROM tblclients WHERE id=\'' . $userid . '\''; $result = mysql_query ($query); $data = mysql_fetch_array ($result); list ($firstname, $lastname, $companyname, $email, $address1, $address2, $city, $state, $postcode, $country, $phonenumber, $ip, $host) = $data; $query = '' . 'SELECT value FROM tblpaymentgateways WHERE gateway=\'' . $paymentmethod . '\' AND setting=\'Name\''; $result = mysql_query ($query); $data = mysql_fetch_array ($result); $nicegatewayname = $data['value']; $orderinfo = '' . 'Order Information

Order ID: ' . $orderid . '
Order Number: ' . $order_number . '
Date/Time: ' . date ('d/m/Y H:i:s') . ('' . '
Invoice Number: ' . $invoiceid . '
Payment Method: ' . $nicegatewayname . '

Customer Information

Customer ID: ' . $userid . '
Name: ' . $firstname . ' ' . $lastname . '
Email: ' . $email . '
Company: ' . $companyname . '
Address 1: ' . $address1 . '
Address 2: ' . $address2 . '
City: ' . $city . '
State: ' . $state . '
Postcode: ' . $postcode . '
Country: ' . $country . '
Phone Number: ' . $phonenumber . '

Order Items

' . $adminemailitems . ' ISP Information

IP: ' . $ip . '
Host: ' . $host); sendmessage ('Order Confirmation', $userid, array ('OrderID' => $orderid, 'OrderNumber' => $order_number, 'OrderDetails' => $adminemailitems)); sendadminnotification ('sales', 'WHMCS New Order Notification', $orderinfo); $_SESSION['orderdetails']['OrderID'] = $orderid; $_SESSION['orderdetails']['OrderNumber'] = $order_number; $_SESSION['orderdetails']['Products'] = $orderproductids; $_SESSION['orderdetails']['Domains'] = $orderdomainids; $_SESSION['orderdetails']['Addons'] = $orderaddonids; $_SESSION['orderdetails']['PaymentMethod'] = $paymentmethod; $_SESSION['orderdetails']['InvoiceID'] = $invoiceid; unset ($_SESSION[cart]); if (!defined ('ACTIONHOOKSINC')) { require dirname (__FILE__) . '/includes/actionhooks.php'; } actionhook_shoppingcartcheckout (array ('OrderID' => $_SESSION['orderdetails']['OrderID'], 'OrderNumber' => $_SESSION['orderdetails']['OrderNumber'], 'InvoiceID' => $_SESSION['orderdetails']['InvoiceID'], 'Products' => $_SESSION['orderdetails']['Products'], 'Addons' => $_SESSION['orderdetails']['Addons'], 'Domains' => $_SESSION['orderdetails']['Domains'])); } if ($total_recurringmonthly == '0.00') { $total_recurringmonthly = ''; } else { $total_recurringmonthly = $CONFIG['CurrencySymbol'] . $total_recurringmonthly . ' ' . $CONFIG['Currency']; } if ($total_recurringquarterly == '0.00') { $total_recurringquarterly = ''; } else { $total_recurringquarterly = $CONFIG['CurrencySymbol'] . $total_recurringquarterly . ' ' . $CONFIG['Currency']; } if ($total_recurringsemiannually == '0.00') { $total_recurringsemiannually = ''; } else { $total_recurringsemiannually = $CONFIG['CurrencySymbol'] . $total_recurringsemiannually . ' ' . $CONFIG['Currency']; } if ($total_recurringannually == '0.00') { $total_recurringannually = ''; } else { $total_recurringannually = $CONFIG['CurrencySymbol'] . $total_recurringannually . ' ' . $CONFIG['Currency']; } if ($total_recurringbiennially == '0.00') { $total_recurringbiennially = ''; } else { $total_recurringbiennially = $CONFIG['CurrencySymbol'] . $total_recurringbiennially . ' ' . $CONFIG['Currency']; } $subtotal = $CONFIG['CurrencySymbol'] . $subtotal . ' ' . $CONFIG['Currency']; $discount = '-' . $CONFIG['CurrencySymbol'] . $discount . ' ' . $CONFIG['Currency']; $total_tax = $CONFIG['CurrencySymbol'] . $total_tax . ' ' . $CONFIG['Currency']; $total_onetime = $CONFIG['CurrencySymbol'] . $total_onetime . ' ' . $CONFIG['Currency']; $cartdata['subtotal'] = $subtotal; $cartdata['discount'] = $discount; $cartdata['promodiscount'] = $promo_discount; $cartdata['promovalue'] = $promo_value; $cartdata['promotype'] = $promo_type; $cartdata['taxrate'] = $rawtaxrate; $cartdata['taxname'] = $taxname; $cartdata['totaltax'] = $total_tax; $cartdata['totalonetime'] = $total_onetime; $cartdata['totalrecurringmonthly'] = $total_recurringmonthly; $cartdata['totalrecurringquarterly'] = $total_recurringquarterly; $cartdata['totalrecurringsemiannually'] = $total_recurringsemiannually; $cartdata['totalrecurringannually'] = $total_recurringannually; $cartdata['totalrecurringbiennially'] = $total_recurringbiennially; return $cartdata; } function setpromocode ($promotioncode) { global $_LANG; $_SESSION['cart']['promo'] = ''; $query = '' . 'SELECT * FROM tblpromotions WHERE code=\'' . $promotioncode . '\''; $result = mysql_query ($query); $data = mysql_fetch_array ($result); $id = $data['id']; $maxuses = $data['maxuses']; $uses = $data['uses']; $expiredate = $data['expirationdate']; if (!$id) { $promoerrormessage = $_LANG['ordercodenotfound']; return $promoerrormessage; } if ($maxuses != '0') { if ($maxuses <= $uses) { $promoerrormessage = $_LANG['orderpromomaxusesreached']; return $promoerrormessage; } } if ($expiredate != '0000-00-00') { $year = substr ($expiredate, 0, 4); $month = substr ($expiredate, 5, 2); $day = substr ($expiredate, 8, 2); $validuntil = $year . $month . $day; $dayofmonth = date ('d'); $monthnum = date ('m'); $yearnum = date ('Y'); $todaysdate = $yearnum . $monthnum . $dayofmonth; if ($validuntil < $todaysdate) { $promoerrormessage = $_LANG['orderpromoexpired']; return $promoerrormessage; } } $_SESSION['cart']['promo'] = $promotioncode; } define ('CLIENTAREA', true); require 'dbconnect.php'; require 'includes/functions.php'; require 'includes/orderfunctions.php'; require 'includes/domainfunctions.php'; require 'includes/whoisfunctions.php'; require 'includes/configoptionsfunctions.php'; require 'includes/customfieldfunctions.php'; require 'includes/clientfunctions.php'; require 'includes/invoicefunctions.php'; require 'includes/gatewayfunctions.php'; require 'includes/fraudfunctions.php'; require 'includes/serverfunctions.php'; $frontendaccess = 'true'; $orderform = 'true'; $errormessage = ''; $CONFIG['OrderFormTemplate'] = 'cart'; $pagetitle = $_LANG['carttitle']; $breadcrumbnav = '' . $_LANG['carttitle'] . ''; $pageicon = 'images/support/order.gif'; require 'init.php'; if ($step == 'fraudcheck') { $a = 'fraudcheck'; } if ($a == 'empty') { unset ($_SESSION[cart]); header ('Location: cart.php?a=view'); exit (); } if ($a == 'remove') { if ($r == 'p') { unset ($_SESSION['cart']['products'][$i]); } else { if ($r == 'a') { unset ($_SESSION['cart']['addons'][$i]); } else { if ($r == 'd') { unset ($_SESSION['cart']['domains'][$i]); } } } header ('Location: cart.php?a=view'); exit (); } if (!$a) { if ($gid == 'addons') { $templatefile = 'addons'; $productgroups = getproductgroups (); $smarty->assign ('productgroups', $productgroups); $productids = array (); $query = 'SELECT tblhosting.id,domain,packageid,name FROM tblhosting INNER JOIN tblproducts ON tblproducts.id=tblhosting.packageid WHERE userid=\'' . $_SESSION['uid'] . '\''; $result = mysql_query ($query); while ($data = mysql_fetch_array ($result)) { $productstoids[$data['packageid']][] = array ('id' => $data['id'], 'product' => $data['name'], 'domain' => $data['domain']); if (!in_array ($data['packageid'], $productids)) { $productids[] = $data['packageid']; continue; } } $addonids = array (); $query = 'SELECT id,packages FROM tbladdons ORDER BY name ASC'; $result = mysql_query ($query); while ($data = mysql_fetch_array ($result)) { $id = $data['id']; $packages = $data['packages']; $packages = explode (',', $packages); foreach ($productids as $productid) { if (in_array ($productid, $productids)) { if (!in_array ($id, $addonids)) { $addonids[] = $id; continue; } continue; } } } $addons = array (); foreach ($addonids as $addonid) { $query = '' . 'SELECT * FROM tbladdons WHERE id=\'' . $addonid . '\''; $result = mysql_query ($query); $data = mysql_fetch_array ($result); $packages = $data['packages']; $packages = explode (',', $packages); $name = $data['name']; $description = $data['description']; $recurring = $data['recurring']; $setupfee = $data['setupfee']; if ($setupfee == '0.00') { $setupfee = ''; } $billingcycle = $data['billingcycle']; $newproductbillingcycle = strtolower ($billingcycle); $newproductbillingcycle = str_replace ('-', '', $newproductbillingcycle); $billingcycle = $_LANG['orderpaymentterm' . $newproductbillingcycle]; $free = $data['free']; $packageids = array (); foreach ($packages as $packageid) { $thisaddonspackages = ''; $thisaddonspackages = $productstoids[$packageid]; if ($thisaddonspackages) { $packageids = array_merge ($packageids, $thisaddonspackages); continue; } } if (count ($packageids)) { $addons[] = array ('id' => $addonid, 'name' => $name, 'description' => $description, 'free' => $free, 'setupfee' => $setupfee, 'recurringamount' => $recurring, 'billingcycle' => $billingcycle, 'productids' => $packageids); continue; } } $smarty->assign ('addons', $addons); if (!count ($addons)) { $smarty->assign ('noaddons', true); } } else { $templatefile = 'products'; $productgroups = getproductgroups (); $products = getproducts ($gid); if (!$gid) { $query = 'SELECT * FROM tblproductgroups WHERE hidden!=\'on\' ORDER BY `order` ASC'; $result = mysql_query ($query); $data = mysql_fetch_array ($result); $gid = $data['id']; } $smarty->assign ('gid', $gid); $smarty->assign ('productgroups', $productgroups); $smarty->assign ('products', $products); } } if ($a == 'add') { if ($pid) { $templatefile = 'configureproductdomain'; $smartyvalues['pid'] = $pid; $query = '' . 'SELECT * FROM tblproducts WHERE id=\'' . $pid . '\''; $result = mysql_query ($query); $data = mysql_fetch_array ($result); $type = $data['type']; $subdomain = $data['subdomain']; $freedomain = $data['freedomain']; $freedomaintlds = $data['freedomaintlds']; $showdomainoptions = $data['showdomainoptions']; $stockcontrol = $data['stockcontrol']; $qty = $data['qty']; if (!$billingcycle) { $paytype = $data['paytype']; $monthly = $data['monthly']; $quarterly = $data['quarterly']; $semiannual = $data['semiannual']; $annual = $data['annual']; $biennial = $data['biennial']; if ($paytype == 'free') { $billingcycle = 'free'; } else { if ($paytype == 'onetime') { $billingcycle = 'onetime'; } else { if ($paytype == 'recurring') { if ($monthly != '0.00') { $billingcycle = 'monthly'; } else { if ($quarterly != '0.00') { $billingcycle = 'quarterly'; } else { if ($semiannual != '0.00') { $billingcycle = 'semiannually'; } else { if ($annual != '0.00') { $billingcycle = 'annually'; } else { if ($biennial != '0.00') { $billingcycle = 'biennially'; } } } } } } } } } if (($configure AND $previousbillingcycle == $billingcycle)) { $errormessage = ''; if ($type == 'server') { if (!$hostname) { $errormessage .= '
  • ' . $_LANG['ordererrorservernohostname']; } if ((!$ns1prefix OR !$ns2prefix)) { $errormessage .= '
  • ' . $_LANG['ordererrorservernonameservers']; } if (!$rootpw) { $errormessage .= '
  • ' . $_LANG['ordererrorservernorootpw']; } $serverarray = array ('hostname' => $hostname, 'ns1prefix' => $ns1prefix, 'ns2prefix' => $ns2prefix, 'rootpw' => $rootpw); } $errormessage .= checkcustomfields ($customfield); if ($errormessage) { $smartyvalues['errormessage'] = $errormessage; } else { if ($customfield) { foreach ($customfield as $key => $value) { $customfieldsarray[sanitize ($key)] = sanitize ($value); } } if ($configoption) { foreach ($configoption as $opid => $opid2) { $configoptionsarray[sanitize ($opid)] = sanitize ($opid2); } } if ($addons) { foreach ($addons as $addonid => $discard) { $addonsarray[] = $addonid; } } $_SESSION['cart']['products'][] = array ('pid' => $pid, 'domain' => $domains[0], 'billingcycle' => $billingcycle, 'server' => $serverarray, 'configoptions' => $configoptionsarray, 'customfields' => $customfieldsarray, 'addons' => $addonsarray); if (($domainoption == 'register' OR $domainoption == 'transfer')) { foreach ($domains as $domainname) { $_SESSION['cart']['domains'][] = array ('type' => $domainoption, 'domain' => $domainname, 'regperiod' => $domainsregperiod[$domainname]); } header ('Location: cart.php?a=confdomains'); exit (); } header ('Location: cart.php?a=view'); exit (); } } if (($stockcontrol AND $qty <= 0)) { exit ('No Stock Available'); } if (($showdomainoptions AND !$domains)) { $cartproducts = $_SESSION['cart']['products']; $cartdomains = $_SESSION['cart']['domains']; if ($cartdomains) { foreach ($cartdomains as $cartdomain) { $domainname = $cartdomain['domain']; if ($cartproducts) { foreach ($cartproducts as $cartproduct) { if ($cartproduct['domain'] == $domainname) { $domainname = ''; continue; } } } if ($domainname) { $incartdomains[] = $domainname; continue; } } } if ($incartdomains) { if (!$domainoption) { $domainoption = 'incart'; } } if ($CONFIG['AllowRegister']) { if (!$domainoption) { $domainoption = 'register'; } } if ($CONFIG['AllowTransfer']) { if (!$domainoption) { $domainoption = 'transfer'; } } if ($CONFIG['AllowOwnDomain']) { if (!$domainoption) { $domainoption = 'owndomain'; } } if ($subdomain) { if (!$domainoption) { $domainoption = 'subdomain'; } } $registertlds = gettldlist (); $transfertlds = gettldlist ('transfer'); $smartyvalues['listtld'] = $registertlds; $smartyvalues['registertlds'] = $registertlds; $smartyvalues['transfertlds'] = $transfertlds; $smartyvalues['showdomainoptions'] = true; $smartyvalues['domainoption'] = $domainoption; $smartyvalues['registerdomainenabled'] = $CONFIG['AllowRegister']; $smartyvalues['transferdomainenabled'] = $CONFIG['AllowTransfer']; $smartyvalues['owndomainenabled'] = $CONFIG['AllowOwnDomain']; $smartyvalues['subdomain'] = $subdomain; $smartyvalues['incartdomains'] = $incartdomains; if (($freedomain AND $freedomaintlds)) { $smartyvalues['freedomaintlds'] = $freedomaintlds; } if (is_array ($tld)) { if ($domainoption == 'register') { $tld = $tld[0]; $sld = $sld[0]; } else { if ($domainoption == 'transfer') { $tld = $tld[1]; $sld = $sld[1]; } else { if ($domainoption == 'owndomain') { $tld = $tld[2]; $sld = $sld[2]; } else { if ($domainoption == 'subdomain') { $tld = $subdomain; $sld = $sld[3]; } else { if ($domainoption == 'incart') { $incartdomain = explode ('.', $incartdomain, 2); $tld = $incartdomain[1]; $sld = $incartdomain[0]; } } } } } } $smartyvalues['sld'] = $sld; $smartyvalues['tld'] = $tld; if (($sld AND $tld)) { checkdomainisvalid ($sld); if (($domainoption == 'register' OR $domainoption == 'transfer')) { checkextisvalid ($tld); } $smartyvalues['errormessage'] = $errormessage; } if (!$errormessage) { if ((($domainoption == 'register' OR $domainoption == 'transfer') AND ($sld AND $tld))) { if ($domainoption == 'register') { $searchvar = 'available'; } else { $searchvar = 'unavailable'; } $smartyvalues['searchvar'] = $searchvar; $result = lookupdomain ($sld, $tld); $regoptions = ''; if ($result['result'] == $searchvar) { $tlds = gettldpricelist ($tld, $domainoption); foreach ($tlds as $listtld) { $regoptions[] = array ('period' => $listtld['period'], 'price' => $listtld['price']); } } $availabilityresults[] = array ('domain' => $sld . $tld, 'status' => $result['result'], 'regoptions' => $regoptions); $tldslist = $CONFIG['BulkCheckTLDs']; if ($tldslist) { $tldslist = explode (',', $tldslist); foreach ($tldslist as $lookuptld) { if ($lookuptld != $tld) { $result = lookupdomain ($sld, $lookuptld); $regoptions = ''; if ($result['result'] == $searchvar) { $tlds = gettldpricelist ($lookuptld, $domainoption); foreach ($tlds as $listtld) { $regoptions[] = array ('period' => $listtld['period'], 'price' => $listtld['price']); } } $availabilityresults[] = array ('domain' => $sld . $lookuptld, 'status' => $result['result'], 'regoptions' => $regoptions); continue; } } } $smartyvalues['availabilityresults'] = $availabilityresults; $smartyvalues['domains'] = $domains; } if (((($domainoption == 'owndomain' OR $domainoption == 'subdomain') OR $domainoption == 'incart') AND ($sld AND $tld))) { $smartyvalues['showdomainoptions'] = false; if ($domainoption == 'subdomain') { $domains = array ('domain' => $sld . $tld); } else { $domains = array ('domain' => $sld . '.' . $tld); } $productconfig = true; } } } else { $productconfig = true; } if ($productconfig) { $templatefile = 'configureproduct'; if ($addons) { foreach ($addons as $addonid => $discard) { $selectedaddons[] = $addonid; } } $productinfo = getproductinfo ($pid); $pricing = getpricinginfo ($pid); $configurableoptions = getconfigurableproductoptions ($pid, $configoption, $billingcycle); $addons = getaddons ($pid, $selectedaddons); $customfields = getcustomfields ('product', $pid, '', '', 'on', $customfield); if ($domains) { foreach ($domains as $domainname) { $domainparts = explode ('.', $domainname, 2); $sld = $domainparts[0]; $tld = $domainparts[1]; $query = '' . 'SELECT * FROM tbldomainpricing WHERE extension=\'.' . $tld . '\' ORDER BY registrationperiod ASC'; $result = mysql_query ($query); $data = mysql_fetch_array ($result); if (($data['eppcode'] AND $domainoption == 'transfer')) { $eppenabled = true; } else { $eppenabled = false; } $domainsarray[] = array ('domain' => $domainname, 'regperiod' => $domainsregperiod[$domainname], 'eppenabled' => $eppenabled, 'eppvalue' => ''); } } $smartyvalues['productinfo'] = $productinfo; $smartyvalues['pricing'] = $pricing; $smartyvalues['billingcycle'] = $billingcycle; if ($productinfo['type'] == 'server') { $smartyvalues['server'] = array ('hostname' => $hostname, 'ns1prefix' => $ns1prefix, 'ns2prefix' => $ns2prefix, 'rootpw' => $rootpw); } $smartyvalues['configurableoptions'] = $configurableoptions; $smartyvalues['addons'] = $addons; $smartyvalues['customfields'] = $customfields; $smartyvalues['domainoption'] = $domainoption; $smartyvalues['domains'] = $domainsarray; } } else { if ($aid) { $_SESSION['cart']['addons'][] = array ('id' => $aid, 'productid' => $productid); header ('Location: cart.php?a=view'); exit (); } else { if ($domain) { if ($domains) { $addtocartok = true; if ($domain == 'transfer') { $query = '' . 'SELECT * FROM tbldomainpricing WHERE extension=\'' . $tld . '\' ORDER BY registrationperiod ASC'; $result = mysql_query ($query); $data = mysql_fetch_array ($result); if (($data['eppcode'] AND !$eppcode)) { $addtocartok = ''; } } if ($addtocartok) { foreach ($domains as $domainname) { $_SESSION['cart']['domains'][] = array ('type' => $domain, 'domain' => $domainname, 'regperiod' => $domainsregperiod[$domainname], 'eppcode' => $eppcode); } header ('Location: cart.php?a=confdomains'); exit (); } } $templatefile = 'adddomain'; $productgroups = getproductgroups (); $smarty->assign ('productgroups', $productgroups); $smartyvalues['domain'] = $domain; if (!$domains) { $domains[] = $sld . $tld; } $smartyvalues['domains'] = $domains; if ($domain == 'register') { $tldslist = gettldlist (); } else { $tldslist = gettldlist ('transfer'); } $smartyvalues['tlds'] = $tldslist; $smartyvalues['sld'] = $sld; $smartyvalues['tld'] = $tld; if (($sld AND $tld)) { checkdomainisvalid ($sld); checkextisvalid ($tld); $smartyvalues['errormessage'] = $errormessage; } if ((($sld AND $tld) AND !$errormessage)) { if ($domain == 'register') { $searchvar = 'available'; } else { $searchvar = 'unavailable'; } $smarty->assign ('searchvar', $searchvar); $result = lookupdomain ($sld, $tld); $regoptions = ''; if ($result['result'] == $searchvar) { $tlds = gettldpricelist ($tld, $domain); foreach ($tlds as $listtld) { $regoptions[] = array ('period' => $listtld['period'], 'price' => $listtld['price']); } } $availabilityresults[] = array ('domain' => $sld . $tld, 'status' => $result['result'], 'regoptions' => $regoptions); if ($domain == 'register') { $tldslist = $CONFIG['BulkCheckTLDs']; if ($tldslist) { $tldslist = explode (',', $tldslist); foreach ($tldslist as $lookuptld) { if ($lookuptld != $tld) { $result = lookupdomain ($sld, $lookuptld); $regoptions = ''; if ($result['result'] == $searchvar) { $tlds = gettldpricelist ($lookuptld, $domain); foreach ($tlds as $listtld) { $regoptions[] = array ('period' => $listtld['period'], 'price' => $listtld['price']); } } $availabilityresults[] = array ('domain' => $sld . $lookuptld, 'status' => $result['result'], 'regoptions' => $regoptions); continue; } } } } else { $query = '' . 'SELECT * FROM tbldomainpricing WHERE extension=\'' . $tld . '\' ORDER BY registrationperiod ASC'; $sqlresult = mysql_query ($query); $data = mysql_fetch_array ($sqlresult); if (($data['eppcode'] AND $result['result'] == 'unavailable')) { $smarty->assign ('eppcode', true); } } $smarty->assign ('availabilityresults', $availabilityresults); } } } } } if ($a == 'confproduct') { $templatefile = 'configureproduct'; if ($configure) { $errormessage = ''; if ($_SESSION['cart']['products'][$i]['server']['hostname']) { if (!$hostname) { $errormessage .= '
  • ' . $_LANG['ordererrorservernohostname']; } if ((!$ns1prefix OR !$ns2prefix)) { $errormessage .= '
  • ' . $_LANG['ordererrorservernonameservers']; } if (!$rootpw) { $errormessage .= '
  • ' . $_LANG['ordererrorservernorootpw']; } $serverarray = array ('hostname' => $hostname, 'ns1prefix' => $ns1prefix, 'ns2prefix' => $ns2prefix, 'rootpw' => $rootpw); } $errormessage .= checkcustomfields ($customfield); if ($errormessage) { $smartyvalues['errormessage'] = $errormessage; } else { if ($customfield) { foreach ($customfield as $key => $value) { $customfieldsarray[sanitize ($key)] = sanitize ($value); } } if ($configoption) { foreach ($configoption as $opid => $opid2) { $configoptionsarray[sanitize ($opid)] = sanitize ($opid2); } } if ($addons) { foreach ($addons as $addonid => $discard) { $addonsarray[] = $addonid; } } $_SESSION['cart']['products'][$i]['billingcycle'] = $billingcycle; $_SESSION['cart']['products'][$i]['server'] = $serverarray; $_SESSION['cart']['products'][$i]['configoptions'] = $configoptionsarray; $_SESSION['cart']['products'][$i]['customfields'] = $customfieldsarray; $_SESSION['cart']['products'][$i]['addons'] = $addonsarray; if ($previousbillingcycle != $billingcycle) { header ('' . 'Location: cart.php?a=confproduct&i=' . $i); exit (); } else { header ('Location: cart.php?a=view'); exit (); } } } $pid = $_SESSION['cart']['products'][$i]['pid']; $billingcycle = $_SESSION['cart']['products'][$i]['billingcycle']; $server = $_SESSION['cart']['products'][$i]['server']; $customfields = $_SESSION['cart']['products'][$i]['customfields']; $configoptions = $_SESSION['cart']['products'][$i]['configoptions']; $addons = $_SESSION['cart']['products'][$i]['addons']; $productinfo = getproductinfo ($pid); $pricing = getpricinginfo ($pid); $configurableoptions = getconfigurableproductoptions ($pid, $configoptions, $billingcycle); $addons = getaddons ($pid, $addons); $customfields = getcustomfields ('product', $pid, '', '', 'on', $customfields); if ($domains) { foreach ($domains as $domainname) { $domainparts = explode ('.', $domainname, 2); $sld = $domainparts[0]; $tld = $domainparts[1]; $query = '' . 'SELECT * FROM tbldomainpricing WHERE extension=\'.' . $tld . '\' ORDER BY registrationperiod ASC'; $result = mysql_query ($query); $data = mysql_fetch_array ($result); if (($data['eppcode'] AND $domainoption == 'transfer')) { $eppenabled = true; } else { $eppenabled = false; } $domainsarray[] = array ('domain' => $domainname, 'regperiod' => $domainsregperiod[$domainname], 'eppenabled' => $eppenabled, 'eppvalue' => ''); } } $serverarray = array ('hostname' => $server['hostname'], 'ns1prefix' => $server['ns1prefix'], 'ns2prefix' => $server['ns2prefix'], 'rootpw' => $server['rootpw']); $smartyvalues['editconfig'] = true; $smartyvalues['i'] = $i; $smartyvalues['productinfo'] = $productinfo; $smartyvalues['pricing'] = $pricing; $smartyvalues['billingcycle'] = $billingcycle; $smartyvalues['server'] = $serverarray; $smartyvalues['configurableoptions'] = $configurableoptions; $smartyvalues['addons'] = $addons; $smartyvalues['customfields'] = $customfields; $smartyvalues['domainoption'] = $domainoption; $smartyvalues['domains'] = $domainsarray; } if ($a == 'confdomains') { $templatefile = 'configuredomains'; $skipstep = true; include 'includes/additionaldomainfields.php'; if ($update) { $domains = $_SESSION['cart']['domains']; foreach ($domains as $key => $domainname) { $_SESSION['cart']['domains'][$key]['dnsmanagement'] = $_POST['dnsmanagement'][$key]; $_SESSION['cart']['domains'][$key]['emailforwarding'] = $_POST['emailforwarding'][$key]; $_SESSION['cart']['domains'][$key]['idprotection'] = $_POST['idprotection'][$key]; $_SESSION['cart']['domains'][$key]['eppcode'] = $_POST['epp'][$key]; $domainparts = explode ('.', $domainname['domain'], 2); if ($domainname['type'] == 'register') { $tempdomainfields = $additionaldomainfields['.' . $domainparts[1]]; $domainfields = $domainfield[$key]; if ($domainfields) { foreach ($domainfields as $fieldnum => $value) { if (($tempdomainfields[$fieldnum]['Required'] AND !$value)) { $errormessage .= '
  • ' . $tempdomainfields[$fieldnum]['Name'] . ' ' . $_LANG['clientareaerrorisrequired'] . ' (' . $domainname['domain'] . ')'; } $_SESSION['cart']['domains'][$key]['fields'][$fieldnum] = $value; } continue; } continue; } else { $query = 'SELECT * FROM tbldomainpricing WHERE extension=\'.' . $domainparts[1] . '\' ORDER BY registrationperiod ASC'; $result = mysql_query ($query); $data = mysql_fetch_array ($result); if ($data['eppcode']) { if (!$_POST['epp'][$key]) { $errormessage .= '
  • ' . $_LANG['domaineppcoderequired'] . ' ' . $domainname['domain']; continue; } continue; } continue; } } $_SESSION['cart']['ns1'] = $domainns1; $_SESSION['cart']['ns2'] = $domainns2; $_SESSION['cart']['ns3'] = $domainns3; $_SESSION['cart']['ns4'] = $domainns4; if ($errormessage) { $smartyvalues['errormessage'] = $errormessage; } else { header ('Location: cart.php?a=view'); exit (); } } $domains = $_SESSION['cart']['domains']; if ($domains) { foreach ($domains as $key => $domainname) { $regperiod = $domainname['regperiod']; $domainparts = explode ('.', $domainname['domain'], 2); $sld = $domainparts[0]; $tld = $domainparts[1]; $query = '' . 'SELECT * FROM tbldomainpricing WHERE extension=\'.' . $tld . '\' ORDER BY registrationperiod ASC'; $result = mysql_query ($query); $data = mysql_fetch_array ($result); $domainconfigsshowing = false; if ($data['dnsmanagement']) { $domainconfigsshowing = true; } if ($data['emailforwarding']) { $domainconfigsshowing = true; } if ($data['idprotection']) { $domainconfigsshowing = true; } if ($CONFIG['DomainDNSManagement'] == '0.00') { $domaindnsmanagementprice = $_LANG['orderfree']; } else { $domaindnsmanagementprice = $CONFIG['CurrencySymbol'] . format_as_currency ($CONFIG['DomainDNSManagement'] * $regperiod) . ' ' . $CONFIG['Currency']; } if ($CONFIG['DomainEmailForwarding'] == '0.00') { $domainemailforwardingprice = $_LANG['orderfree']; } else { $domainemailforwardingprice = $CONFIG['CurrencySymbol'] . format_as_currency ($CONFIG['DomainEmailForwarding'] * $regperiod) . ' ' . $CONFIG['Currency']; } if ($CONFIG['DomainIDProtection'] == '0.00') { $domainidprotectionprice = $_LANG['orderfree']; } else { $domainidprotectionprice = $CONFIG['CurrencySymbol'] . format_as_currency ($CONFIG['DomainIDProtection'] * $regperiod) . ' ' . $CONFIG['Currency']; } if (($data['eppcode'] AND $domainname['type'] == 'transfer')) { $eppenabled = true; $domainconfigsshowing = true; } else { $eppenabled = false; } unset ($domainfields); unset ($tempdomainfields); if ($domainname['type'] == 'register') { $tempdomainfields = $additionaldomainfields['.' . $tld]; if ($tempdomainfields) { $domainconfigsshowing = true; foreach ($tempdomainfields as $fieldkey => $value) { $storedvalue = $domainname['fields'][$fieldkey]; if ($storedvalue) { $value['Default'] = $storedvalue; } if ($value['Type'] == 'text') { $input = ''; if ($value['Required']) { $input .= ' *'; } } else { if ($value['Type'] == 'dropdown') { $input = ((('' . ''; } else { if ($value['Type'] == 'tickbox') { $input = (((('' . ' ' . $optionvalue . '
    '; } } } } } $domainfields[$value['Name']] = $input; } } } $products = $_SESSION['cart']['products']; $hashosting = false; if ($products) { foreach ($products as $product) { if ($product['domain'] == $domainname['domain']) { $hashosting = true; continue; } } } if (!$hashosting) { $atleastonenohosting = true; } $domainsarray[$key] = array ('domain' => $domainname['domain'], 'regperiod' => $domainname['regperiod'], 'dnsmanagement' => $data['dnsmanagement'], 'emailforwarding' => $data['emailforwarding'], 'idprotection' => $data['idprotection'], 'dnsmanagementprice' => $domaindnsmanagementprice, 'emailforwardingprice' => $domainemailforwardingprice, 'idprotectionprice' => $domainidprotectionprice, 'dnsmanagementselected' => $domainname['dnsmanagement'], 'emailforwardingselected' => $domainname['emailforwarding'], 'idprotectionselected' => $domainname['idprotection'], 'eppenabled' => $eppenabled, 'eppvalue' => $domainname['eppcode'], 'fields' => $domainfields, 'configtoshow' => $domainconfigsshowing, 'hosting' => $hashosting); if (((((($domainconfigsshowing OR $eppenabled) OR $domainfields) OR $data['dnsmanagement']) OR $data['emailforwarding']) OR $data['idprotection'])) { $skipstep = false; continue; } } } $smartyvalues['domains'] = $domainsarray; $smartyvalues['atleastonenohosting'] = $atleastonenohosting; if ((!$_SESSION['cart']['ns1'] AND !$_SESSION['cart']['ns2'])) { $_SESSION['cart']['ns1'] = $CONFIG['DefaultNameserver1']; $_SESSION['cart']['ns2'] = $CONFIG['DefaultNameserver2']; $_SESSION['cart']['ns3'] = $CONFIG['DefaultNameserver3']; $_SESSION['cart']['ns4'] = $CONFIG['DefaultNameserver4']; } $smartyvalues['domainns1'] = $_SESSION['cart']['ns1']; $smartyvalues['domainns2'] = $_SESSION['cart']['ns2']; $smartyvalues['domainns3'] = $_SESSION['cart']['ns3']; $smartyvalues['domainns4'] = $_SESSION['cart']['ns4']; if ($skipstep) { header ('Location: cart.php?a=view'); exit (); } } if ($a == 'removepromo') { $_SESSION['cart']['promo'] = ''; header ('Location: cart.php?a=view'); exit (); } if ($a == 'checkout') { $checkout = true; $a = view; } if ($a == 'addcontact') { $checkout = true; $addcontact = true; $a = view; } if ($a == 'view') { $templatefile = 'viewcart'; $readytocompletecheckout = ''; if ($submit) { $_SESSION['cart']['paymentmethod'] = $paymentmethod; if ($_SESSION['loggedinstatus'] != 'true') { $_SESSION['cart']['user'] = array ('firstname' => sanitize ($firstname), 'lastname' => sanitize ($lastname), 'companyname' => sanitize ($companyname), 'email' => sanitize ($email), 'address1' => sanitize ($address1), 'address2' => sanitize ($address2), 'city' => sanitize ($city), 'state' => sanitize ($state), 'postcode' => sanitize ($postcode), 'country' => sanitize ($country), 'phonenumber' => sanitize ($phonenumber)); $errormessage = checkdetailsarevalid ($firstname, $lastname, $email, $address1, $city, $state, $postcode, $phonenumber, $password, $password2); if ($password == '') { $errormessage .= '
  • ' . $_LANG['ordererrorpassword']; } $errormessage .= checkcustomfields ($customfield); } if ($contact == 'new') { header ('Location: cart.php?a=addcontact'); exit (); } if ($contact == 'addingnew') { $errormessage .= checkcontactdetails ($domaincontactfirstname, $domaincontactlastname, $domaincontactemail, $domaincontactaddress1, $domaincontactcity, $domaincontactstate, $domaincontactpostcode, $domaincontactphonenumber); } if (($CONFIG['EnableTOSAccept'] == 'on' AND $accepttos != 'on')) { $errormessage .= '
  • ' . $_LANG['ordererroraccepttos']; } if (!$errormessage) { $readytocompletecheckout = true; } if ($readytocompletecheckout) { if ($_SESSION['loggedinstatus'] != 'true') { $userid = addclient ($firstname, $lastname, $companyname, $email, $address1, $address2, $city, $state, $postcode, $country, $phonenumber, $password); savecustomfields ($_SESSION['uid'], $customfield); } if ($contact == 'addingnew') { $contact = addcontact ($_SESSION['uid'], $domaincontactfirstname, $domaincontactlastname, $domaincontactcompanyname, $domaincontactemail, $domaincontactaddress1, $domaincontactaddress2, $domaincontactcity, $domaincontactstate, $domaincontactpostcode, $domaincontactcountry, $domaincontactphonenumber); } $_SESSION['cart']['contact'] = $contact; $carttotals = calccarttotals (true); header ('Location: cart.php?a=fraudcheck'); exit (); } } $smartyvalues['errormessage'] = $errormessage; if ($promocode) { $promoerrormessage = setpromocode ($promocode); if ($promoerrormessage) { $smartyvalues['errormessage'] = '
  • ' . $promoerrormessage; } } $smartyvalues['promotioncode'] = $_SESSION['cart']['promo']; $carttotals = calccarttotals (); $promodiscount = $carttotals['promodiscount']; $promovalue = $carttotals['promovalue']; $promotype = $carttotals['promotype']; if ($promodiscount == 'Money Value') { $promodescription = $CONFIG['CurrencySymbol'] . $promovalue; } else { $promodescription = $promovalue . '%'; } $promodescription .= ' ' . $promotype . ' ' . $_LANG['orderdiscount']; $smartyvalues['promotiondescription'] = $promodescription; $smartyvalues['products'] = $carttotals['products']; $smartyvalues['addons'] = $carttotals['addons']; $smartyvalues['domains'] = $carttotals['domains']; $smartyvalues['subtotal'] = $carttotals['subtotal']; $smartyvalues['discount'] = $carttotals['discount']; $smartyvalues['taxenabled'] = $CONFIG['TaxEnabled']; $smartyvalues['taxrate'] = $carttotals['taxrate']; $smartyvalues['taxname'] = $carttotals['taxname']; $smartyvalues['taxtotal'] = $carttotals['totaltax']; $smartyvalues['total'] = $carttotals['totalonetime']; $smartyvalues['totalrecurringmonthly'] = $carttotals['totalrecurringmonthly']; $smartyvalues['totalrecurringquarterly'] = $carttotals['totalrecurringquarterly']; $smartyvalues['totalrecurringsemiannually'] = $carttotals['totalrecurringsemiannually']; $smartyvalues['totalrecurringannually'] = $carttotals['totalrecurringannually']; $smartyvalues['totalrecurringbiennially'] = $carttotals['totalrecurringbiennially']; $smartyvalues['proratadate'] = $carttotals['proratadate']; $paymentmethod = $_SESSION['cart']['paymentmethod']; $gatewayslist = showpaymentgatewayslist (); if (!$paymentmethod) { $paymentmethod = $gatewayslist[0]['sysname']; } $smartyvalues['selectedgateway'] = $paymentmethod; $smartyvalues['gateways'] = $gatewayslist; $cartitems = count ($_SESSION['cart']['products']) + count ($_SESSION['cart']['addons']) + count ($_SESSION['cart']['domains']); $smartyvalues['cartitems'] = $cartitems; $smartyvalues['checkout'] = $checkout; $smartyvalues['ipaddress'] = $_SERVER['REMOTE_ADDR']; include 'includes/countries.php'; if ($_SESSION['loggedinstatus'] == 'true') { $clientsdetails = getclientsdetails (); } else { $clientsdetails = $_SESSION['cart']['user']; $customfields = getcustomfields ('client', '', '', '', 'on', $customfield); } $smartyvalues['clientsdetails'] = $clientsdetails; $smartyvalues['clientcountrydropdown'] = getcountriesdropdown ($country); $smartyvalues['customfields'] = $customfields; $smartyvalues['accepttos'] = $CONFIG['EnableTOSAccept']; $smartyvalues['tosurl'] = $CONFIG['TermsOfService']; if (count ($_SESSION['cart']['domains'])) { $smartyvalues['domainsinorder'] = true; } if ($contact == 'addingnew') { $addcontact = true; } $query = 'SELECT * FROM tblcontacts WHERE userid=\'' . $_SESSION['uid'] . '\' ORDER BY firstname ASC,lastname ASC'; $result = mysql_query ($query); while ($data = mysql_fetch_array ($result)) { $domaincontacts[] = array ('id' => $data['id'], 'name' => $data['firstname'] . ' ' . $data['lastname']); } $smartyvalues['domaincontacts'] = $domaincontacts; $smartyvalues['addcontact'] = $addcontact; $smartyvalues['domaincontact'] = array ('firstname' => $domaincontactfirstname, 'lastname' => $domaincontactlastname, 'companyname' => $domaincontactcompanyname, 'email' => $domaincontactemail, 'address1' => $domaincontactaddress1, 'address2' => $domaincontactaddress2, 'city' => $domaincontactcity, 'state' => $domaincontactstate, 'postcode' => $domaincontactpostcode, 'country' => $domaincontactcountry, 'phonenumber' => $domaincontactphonenumber); $smartyvalues['domaincontactcountrydropdown'] = getcountriesdropdown ($domaincontactcountry, 'domaincontactcountry'); } if ($a == 'login') { $templatefile = 'login'; if ($func) { $smartyvalues['incorrect'] = true; } } if ($a == 'fraudcheck') { $fraudmodule = getactivefraudmodule (); if (!$fraudmodule) { header ('Location: cart.php?a=complete'); exit (); } logactivity ('Order ID ' . $_SESSION['orderdetails']['OrderID'] . ' Fraud Check Initiated'); $query = 'UPDATE tblorders SET status=\'Fraud\' WHERE id=\'' . $_SESSION['orderdetails']['OrderID'] . '\''; $result = mysql_query ($query); if ($_SESSION['orderdetails']['Products']) { foreach ($_SESSION['orderdetails']['Products'] as $productid) { $query = '' . 'UPDATE tblhosting SET domainstatus=\'Fraud\' WHERE id=\'' . $productid . '\''; $result = mysql_query ($query); } } if ($_SESSION['orderdetails']['Addons']) { foreach ($_SESSION['orderdetails']['Addons'] as $addonid) { $query = '' . 'UPDATE tblhostingaddons SET status=\'Fraud\' WHERE id=\'' . $addonid . '\''; $result = mysql_query ($query); } } if ($_SESSION['orderdetails']['Domains']) { foreach ($_SESSION['orderdetails']['Domains'] as $domainid) { $query = '' . 'UPDATE tbldomains SET status=\'Fraud\' WHERE id=\'' . $domainid . '\''; $result = mysql_query ($query); } } $query = 'UPDATE tblinvoices SET status=\'Cancelled\' WHERE id=\'' . $_SESSION['orderdetails']['InvoiceID'] . '\''; $result = mysql_query ($query); include 'includes/countriescallingcodes.php'; $clientsdetails = getclientsdetails ($_SESSION['uid']); $params = getfraudconfigoptions ($fraudmodule); $params['ip'] = $remote_ip; $params['forwardedip'] = $_SERVER['HTTP_X_FORWARDED_FOR']; $params['clientsdetails'] = $clientsdetails; $countrycode = $params['clientsdetails']['country']; $params['clientsdetails']['countrycode'] = $countrycallingcodes[$countrycode]; $params['clientsdetails']['phonenumber'] = str_replace ('(', '', $params['clientsdetails']['phonenumber']); $params['clientsdetails']['phonenumber'] = str_replace (')', '', $params['clientsdetails']['phonenumber']); $params['clientsdetails']['phonenumber'] = str_replace (' ', '', $params['clientsdetails']['phonenumber']); $params['clientsdetails']['phonenumber'] = str_replace ('-', '', $params['clientsdetails']['phonenumber']); include '' . 'modules/fraud/' . $fraudmodule . '/' . $fraudmodule . '.php'; $results = dofraudcheck ($params); $error = $results['error']; $fraudoutput = ''; if ($results) { foreach ($results as $key => $value) { if (((($key != 'userinput' AND $key != 'title') AND $key != 'description') AND $key != 'error')) { $fraudoutput .= ('' . $key . ' => ' . $value . ' '); continue; } } } $query = '' . 'UPDATE tblorders SET fraudmodule=\'' . $fraudmodule . '\',fraudoutput=\'' . mysql_real_escape_string ($fraudoutput) . '\' WHERE id=\'' . $_SESSION['orderdetails']['OrderID'] . '\''; $result = mysql_query ($query); if ($results['userinput']) { logactivity ('Order ID ' . $_SESSION['orderdetails']['OrderID'] . ' Fraud Check Awaiting User Input'); $templatefile = 'fraudcheck'; $smarty->assign ('errortitle', $results['title']); $smarty->assign ('error', $results['description']); require 'display.php'; exit (); } if ($error) { logactivity ('Order ID ' . $_SESSION['orderdetails']['OrderID'] . ' Failed Fraud Check'); $templatefile = 'fraudcheck'; $smarty->assign ('errortitle', $error['title']); $smarty->assign ('error', $error['description']); require 'display.php'; exit (); } else { $query = 'UPDATE tblorders SET status=\'Pending\' WHERE id=\'' . $_SESSION['orderdetails']['OrderID'] . '\''; $result = mysql_query ($query); if ($_SESSION['orderdetails']['Products']) { foreach ($_SESSION['orderdetails']['Products'] as $productid) { $query = '' . 'UPDATE tblhosting SET domainstatus=\'Pending\' WHERE id=\'' . $productid . '\''; $result = mysql_query ($query); } } if ($_SESSION['orderdetails']['Addons']) { foreach ($_SESSION['orderdetails']['Addons'] as $addonid) { $query = '' . 'UPDATE tblhostingaddons SET status=\'Pending\' WHERE id=\'' . $addonid . '\''; $result = mysql_query ($query); } } if ($_SESSION['orderdetails']['Domains']) { foreach ($_SESSION['orderdetails']['Domains'] as $domainid) { $query = '' . 'UPDATE tbldomains SET status=\'Pending\' WHERE id=\'' . $domainid . '\''; $result = mysql_query ($query); } } $query = 'UPDATE tblinvoices SET status=\'Unpaid\' WHERE id=\'' . $_SESSION['orderdetails']['InvoiceID'] . '\''; $result = mysql_query ($query); logactivity ('Order ID ' . $_SESSION['orderdetails']['OrderID'] . ' Passed Fraud Check'); header ('Location: cart.php?a=complete'); exit (); } } if ($a == 'complete') { $params = getvariables ($_SESSION['orderdetails']['PaymentMethod']); if ((($params['type'] == 'CC' OR $params['type'] == 'OfflineCC') AND ($CONFIG['AutoRedirectoInvoice'] == 'on' OR $CONFIG['AutoRedirectoInvoice'] == 'gateway'))) { header ('Location: creditcard.php?invoiceid=' . $_SESSION['orderdetails']['InvoiceID']); exit (); } if (($_SESSION['orderdetails']['InvoiceID'] AND $CONFIG['AutoRedirectoInvoice'] == 'on')) { header ('Location: viewinvoice.php?id=' . $_SESSION['orderdetails']['InvoiceID']); exit (); } if (($_SESSION['orderdetails']['InvoiceID'] AND $CONFIG['AutoRedirectoInvoice'] == 'gateway')) { $query = 'SELECT * FROM tblinvoices WHERE userid=\'' . $_SESSION['uid'] . '\' AND id=\'' . $_SESSION['orderdetails']['InvoiceID'] . '\''; $result = mysql_query ($query); $data = mysql_fetch_array ($result); $id = $data['id']; $duedate = $data['duedate']; $total = $data['total']; $paymentmethod = $data['paymentmethod']; include_once 'modules/gateways/' . $_SESSION['orderdetails']['PaymentMethod'] . '.php'; $params['description'] = $CONFIG['CompanyName'] . ' - ' . $_LANG['invoicenumber'] . $id; $params['amount'] = $total; $params['invoiceid'] = $id; $params['duedate'] = $duedate; if ($CONFIG['SystemSSLURL']) { $systemurl = $CONFIG['SystemSSLURL']; } else { $systemurl = $CONFIG['SystemURL']; } $params['systemurl'] = $systemurl; $params['returnurl'] = $systemurl . '/viewinvoice.php?id=' . $id; $params['clientdetails'] = getclientsdetails ($_SESSION['uid']); eval ('$paymentbutton=' . $paymentmethod . '_link($params);'); unset ($orderform); $templatefile = 'forwardpage'; $smarty->assign ('message', $_LANG['forwardingtogateway']); $smarty->assign ('code', $paymentbutton); require 'display.php'; exit (); } $templatefile = 'complete'; $smartyvalues = array ('orderid' => $_SESSION['orderdetails']['OrderID'], 'ordernumber' => $_SESSION['orderdetails']['OrderNumber'], 'invoiceid' => $_SESSION['orderdetails']['InvoiceID']); } require 'display.php'; ?>