Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- function adderror ($error)
- {
- global $errormessage;
- $errormessage .= '<li>' . $error;
- }
- function makehostingpayment ($func_domainid, $paidamount, $fees, $invoice = '', $gateway = '', $transid = '')
- {
- global $CONFIG;
- $query = '' . 'SELECT * FROM tblhosting WHERE id=\'' . $func_domainid . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $userid = $data['userid'];
- $billingcycle = $data['billingcycle'];
- $domain = $data['domain'];
- $packageid = $data['packageid'];
- $regdate = $data['regdate'];
- $nextduedate = $data['nextduedate'];
- $status = $data['domainstatus'];
- $server = $data['server'];
- $paymentmethod = $data['paymentmethod'];
- if ($gateway)
- {
- $paymentmethod = $gateway;
- }
- if ($nextduedate == $regdate)
- {
- $amount = $data['firstpaymentamount'];
- }
- else
- {
- $amount = $data['amount'];
- }
- $year = substr ($nextduedate, 0, 4);
- $month = substr ($nextduedate, 5, 2);
- $day = substr ($nextduedate, 8, 2);
- $query = '' . 'SELECT * FROM tblproducts WHERE id=\'' . $packageid . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $producttype = $data['type'];
- $package = $data['name'];
- $proratabilling = $data['proratabilling'];
- $proratadate = $data['proratadate'];
- $proratachargenextmonth = $data['proratachargenextmonth'];
- $tax = $data['tax'];
- if (($tax AND $CONFIG['TaxEnabled']))
- {
- if (!function_exists ('getClientsDetails'))
- {
- require dirname (__FILE__) . '/clientfunctions.php';
- }
- $clientsdetails = getclientsdetails ($userid);
- $state = $clientsdetails['state'];
- $country = $clientsdetails['country'];
- $taxrate = gettaxrate ($state, $country);
- }
- if (($regdate == $nextduedate AND $proratabilling))
- {
- if ($billingcycle == 'Monthly')
- {
- $proratamonths = 1;
- }
- else
- {
- if ($billingcycle == 'Quarterly')
- {
- $proratamonths = 3;
- }
- else
- {
- if ($billingcycle == 'Semi-Annually')
- {
- $proratamonths = 6;
- }
- else
- {
- if ($billingcycle == 'Annually')
- {
- $proratamonths = 12;
- }
- else
- {
- if ($billingcycle == 'Biennially')
- {
- $proratamonths = 24;
- }
- }
- }
- }
- }
- if ($billingcycle != 'Monthly')
- {
- $proratachargenextmonth = 0;
- }
- $orderyear = substr ($regdate, 0, 4);
- $ordermonth = substr ($regdate, 5, 2);
- $orderday = substr ($regdate, 8, 2);
- if ($orderday < $proratadate)
- {
- $proratamonth = $ordermonth;
- }
- else
- {
- $proratamonth = $ordermonth + 1;
- }
- $days = (strtotime (date ('Y-m-d', mktime (0, 0, 0, $proratamonth, $proratadate, $orderyear))) - strtotime (date ('Y-m-d'))) / (60 * 60 * 24);
- $totaldays = 30;
- $proratadateuntil = date ('Y-m-d', mktime (0, 0, 0, $proratamonth, $proratadate, $orderyear));
- if (($proratachargenextmonth <= $orderday AND $days < 31))
- {
- $proratadateuntil = date ('Y-m-d', mktime (0, 0, 0, $proratamonth + $proratamonths, $proratadate, $orderyear));
- }
- }
- if ($billingcycle == 'Monthly')
- {
- $new_time = mktime (0, 0, 0, $month + 1, $day, $year);
- $day = date ('d', $new_time);
- $month = date ('m', $new_time);
- $year = date ('Y', $new_time);
- }
- else
- {
- if ($billingcycle == 'Quarterly')
- {
- $new_time = mktime (0, 0, 0, $month + 3, $day, $year);
- $day = date ('d', $new_time);
- $month = date ('m', $new_time);
- $year = date ('Y', $new_time);
- }
- else
- {
- if ($billingcycle == 'Semi-Annually')
- {
- $new_time = mktime (0, 0, 0, $month + 6, $day, $year);
- $day = date ('d', $new_time);
- $month = date ('m', $new_time);
- $year = date ('Y', $new_time);
- }
- else
- {
- if ($billingcycle == 'Annually')
- {
- $new_time = mktime (0, 0, 0, $month, $day, $year + 1);
- $day = date ('d', $new_time);
- $month = date ('m', $new_time);
- $year = date ('Y', $new_time);
- }
- else
- {
- if ($billingcycle == 'Biennially')
- {
- $new_time = mktime (0, 0, 0, $month, $day, $year + 2);
- $day = date ('d', $new_time);
- $month = date ('m', $new_time);
- $year = date ('Y', $new_time);
- }
- else
- {
- if ($billingcycle == 'One Time')
- {
- $day = '00';
- $month = '00';
- $year = '0000';
- }
- }
- }
- }
- }
- }
- $nextduedate = $year . '-' . $month . '-' . $day;
- if ($proratadateuntil)
- {
- $nextduedate = $proratadateuntil;
- }
- $query = '' . 'UPDATE tblhosting SET nextduedate=\'' . $nextduedate . '\',nextinvoicedate=\'' . $nextduedate . '\' WHERE id=\'' . $func_domainid . '\'';
- $result = mysql_query ($query);
- if ($producttype == 'hostingaccount')
- {
- $productdescription = '' . 'Hosting Payment (' . $package . ' Package) - ' . $domain;
- }
- else
- {
- if ($producttype == 'reselleraccount')
- {
- $productdescription = '' . 'Reseller Payment (' . $package . ' Package) - ' . $domain;
- }
- else
- {
- if ($producttype == 'server')
- {
- $productdescription = '' . 'Server Payment (' . $package . ') - ' . $domain;
- }
- else
- {
- $productdescription = '' . 'Product/Service Payment (' . $package . ')';
- }
- }
- }
- if ($invoice == '')
- {
- if (!$paidamount)
- {
- $newtaxrate = $taxrate / 100 + 1;
- $paidamount = $amount * $newtaxrate;
- }
- accountin ($userid, $productdescription, $paidamount, $fees, $paymentmethod, $transid);
- sendmessage ('Subscription Payment Confirmation', $func_domainid, $nextduedate);
- }
- logactivity ('' . 'Updated Next Due Date for Account (Hosting ID: ' . $func_domainid . ')');
- if (!function_exists ('getServerType'))
- {
- require_once dirname (__FILE__) . '/serverfunctions.php';
- }
- $servertype = getservertype ($server);
- if ($status == 'Pending')
- {
- $query = '' . 'SELECT * FROM tblproducts WHERE id=\'' . $packageid . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $autosetup = $data['autosetup'];
- if ($autosetup == 'payment')
- {
- global $silent;
- if ($server != '')
- {
- require_once dirname (__FILE__) . '/../modules/servers/' . $servertype . '/' . $servertype . '.php';
- $result = servercreateaccount ($func_domainid);
- if ($result == 'success')
- {
- sendmessage ('defaultnewacc', $func_domainid);
- sendadminnotification ('admin', 'WHMCS Automatic Setup Notification', '' . '<p>The order placed for ' . $domain . ' has received its first payment and has been automatically setup</p><p>Client ID: ' . $userid . '<br>Product/Service: ' . $package . '<br>Domain: ' . $domain . '</p>');
- logactivity ('' . 'Automatic Account Setup on First Payment Successful (Hosting Account ID: ' . $func_domainid . ')');
- }
- else
- {
- sendadminnotification ('admin', 'WHMCS Automatic Setup Notification', '' . '<p>The order placed for ' . $domain . ' has received its first payment but an error occured and the account could not be automatically setup on the server</p><p>Client ID: ' . $userid . '<br>Product/Service: ' . $package . '<br>Domain: ' . $domain . '<br>Error: ' . $result . '</p>');
- logactivity ('' . 'Automatic Account Setup on First Payment Failed (Hosting Account ID: ' . $func_domainid . ' Error: ' . $result . ')');
- }
- }
- }
- }
- if ($status == 'Suspended')
- {
- global $CONFIG;
- if ($CONFIG['AutoUnsuspend'] == 'on')
- {
- if ($server != '')
- {
- if (!function_exists ('getServerType'))
- {
- require_once dirname (__FILE__) . '/serverfunctions.php';
- }
- require_once dirname (__FILE__) . '/../modules/servers/' . $servertype . '/' . $servertype . '.php';
- serverunsuspendaccount ($func_domainid);
- sendadminnotification ('admin', 'WHMCS Automatic Unsuspension Notification', '' . '<p>The order placed for ' . $domain . ' has received its next payment and has been automatically unsuspended</p><p>Client ID: ' . $userid . '<br>Product/Service: ' . $package . '<br>Domain: ' . $domain . '</p>');
- logactivity ('' . 'Automatic Unsuspension on Payment Performed (Hosting ID: ' . $func_domainid . ')');
- }
- }
- }
- affiliatepayment ('', $func_domainid);
- }
- function makedomainpayment ($func_domainid, $paidamount, $fees, $invoice = '', $gateway = '', $transid = '')
- {
- global $CONFIG;
- $query = '' . 'SELECT * FROM tbldomains WHERE id=\'' . $func_domainid . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $userid = $data['userid'];
- $domaintype = $data['type'];
- $orderid = $data['orderid'];
- $registrationperiod = $data['registrationperiod'];
- $registrationdate = $data['registrationdate'];
- $nextduedate = $data['nextduedate'];
- $amount = $data['amount'];
- $domain = $data['domain'];
- $paymentmethod = $data['paymentmethod'];
- $registrar = $data['registrar'];
- $year = substr ($nextduedate, 0, 4);
- $month = substr ($nextduedate, 5, 2);
- $day = substr ($nextduedate, 8, 2);
- $year = $year + $registrationperiod;
- $newnextduedate = $year . $month . $day;
- $query = '' . 'UPDATE tbldomains SET nextduedate=\'' . $newnextduedate . '\' WHERE id=\'' . $func_domainid . '\'';
- $result = mysql_query ($query);
- if ($gateway)
- {
- $paymentmethod = $gateway;
- }
- if ($CONFIG['TaxEnabled'])
- {
- if (!function_exists ('getClientsDetails'))
- {
- require dirname (__FILE__) . '/clientfunctions.php';
- }
- $clientsdetails = getclientsdetails ($userid);
- $state = $clientsdetails['state'];
- $country = $clientsdetails['country'];
- $taxrate = gettaxrate ($state, $country);
- $tax = 1;
- }
- if ($invoice == '')
- {
- if (!$paidamount)
- {
- $newtaxrate = $taxrate / 100 + 1;
- $paidamount = $amount * $newtaxrate;
- }
- accountin ($userid, '' . 'Domain Payment - ' . $domain, $paidamount, $fees, $paymentmethod, $transid);
- sendmessage ('Domain Subscription Payment Confirmation', $func_domainid);
- }
- logactivity ('' . 'Updated Next Due Date for Domain (Domain ID: ' . $func_domainid . ')');
- $domainparts = explode ('.', $domain, 2);
- $sld = $domainparts[0];
- $tld = $domainparts[1];
- $table = 'tbldomainpricing';
- $fields = 'autoreg';
- $where = '' . 'extension=\'.' . $tld . '\'';
- $result = select_query ($table, $fields, $where);
- $data = mysql_fetch_array ($result);
- $autoreg = $data['autoreg'];
- if ($autoreg)
- {
- require_once dirname (__FILE__) . '/registrarfunctions.php';
- $params['domainid'] = $func_domainid;
- $params['sld'] = $sld;
- $params['tld'] = $tld;
- if ($nextduedate <= $registrationdate)
- {
- $table = 'tbldomains';
- $fields = '';
- $fields = array ('registrar' => $autoreg);
- $where = '' . 'id=\'' . $func_domainid . '\'';
- update_query ($table, $fields, $where);
- $params['registrar'] = $autoreg;
- if ($domaintype == 'Register')
- {
- $result = regregisterdomain ($params);
- $emailmessage = 'Domain Registration Confirmation';
- }
- else
- {
- if ($domaintype == 'Transfer')
- {
- $result = regtransferdomain ($params);
- $emailmessage = 'Domain Transfer Initiated';
- }
- }
- $result = $result['error'];
- if ($result)
- {
- sendadminnotification ('admin', 'WHMCS Automatic Domain Registration Failure Notification', '' . '<p>The order placed for ' . $domain . ' has received its first payment and has been automatically submitted to the registrar</p><p>Client ID: ' . $userid . '<br>Domain: ' . $domain . '<br>Error: ' . $result . '</p>');
- return null;
- }
- sendmessage ($emailmessage, $func_domainid);
- sendadminnotification ('admin', 'WHMCS Automatic Domain Registration Success Notification', '' . '<p>The order placed for ' . $domain . ' has received its first payment and has been automatically submitted to the registrar</p><p>Client ID: ' . $userid . '<br>Domain: ' . $domain . '</p>');
- return null;
- }
- $params['registrar'] = $registrar;
- $result = regrenewdomain ($params);
- $result = $result['error'];
- if ($result)
- {
- sendadminnotification ('admin', 'WHMCS Automatic Domain Renewal Failure Notification', '' . '<p>The invoice for the renewal of ' . $domain . ' has been paid and the renewal request has been automatically submitted to the registrar</p><p>Client ID: ' . $userid . '<br>Domain: ' . $domain . '<br>Error: ' . $result . '</p>');
- return null;
- }
- sendmessage ('Domain Renewal Confirmation', $func_domainid);
- sendadminnotification ('admin', 'WHMCS Automatic Domain Renewal Success Notification', '' . '<p>The invoice for the renewal of ' . $domain . ' has been paid and the renewal request has been automatically submitted to the registrar</p><p>Client ID: ' . $userid . '<br>Domain: ' . $domain . '</p>');
- }
- }
- function accountin ($userid, $description, $amount, $fees, $gateway = '', $transid = '', $invoiceid = '', $date = '')
- {
- if ($date)
- {
- $date = '\'' . tomysqldate ($date) . '\'';
- }
- else
- {
- $date = 'now()';
- }
- $query = '' . 'INSERT INTO tblaccounts (userid,gateway,date,description,amountin,fees,amountout,transid,invoiceid) VALUES (\'' . $userid . '\',\'' . $gateway . '\',' . $date . ',\'' . $description . '\',\'' . $amount . '\',\'' . $fees . '\',\'0.00\',\'' . $transid . '\',\'' . $invoiceid . '\')';
- $result = mysql_query ($query);
- }
- function accountout ($userid, $description, $amount)
- {
- $query = '' . 'INSERT INTO tblaccounts (userid,date,description,amountin,fees,amountout) VALUES (\'' . $userid . '\',now(),\'' . $description . '\',\'0.00\',\'0.00\',\'' . $amount . '\')';
- $result = mysql_query ($query);
- }
- function sendmessage ($func_messagename, $func_id, $extra = '')
- {
- global $silent;
- global $CONFIG;
- global $_LANG;
- global $encryption_key;
- $wordreplace_numbers = array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
- $wordreplace_words = array ('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine');
- if ($func_messagename == 'defaultnewacc')
- {
- $query = '' . 'SELECT tblproducts.welcomeemail FROM tblproducts INNER JOIN tblhosting ON tblhosting.packageid=tblproducts.id WHERE tblhosting.id=\'' . $func_id . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $query = 'SELECT name FROM tblemailtemplates WHERE id=\'' . $data['welcomeemail'] . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $func_messagename = $data['name'];
- }
- $query = '' . 'SELECT * FROM tblemailtemplates WHERE name=\'' . $func_messagename . '\' AND language=\'\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $type = $data['type'];
- $subject = $data['subject'];
- $message = $data['message'];
- $fromname = $data['fromname'];
- $fromemail = $data['fromemail'];
- $disabled = $data['disabled'];
- $copyto = $data['copyto'];
- $plaintext = $data['plaintext'];
- if (($type != 'support' AND !$func_id))
- {
- return false;
- }
- if ($disabled)
- {
- if (!$silent)
- {
- echo '' . '<p>This email message has been disabled (' . $subject . ')</p>';
- }
- return false;
- }
- if ($type == 'invoice')
- {
- $query = '' . 'SELECT tblinvoices.*,tblpaymentgateways.value FROM tblinvoices INNER JOIN tblpaymentgateways ON tblpaymentgateways.gateway=tblinvoices.paymentmethod WHERE tblpaymentgateways.setting=\'name\' AND tblinvoices.id=\'' . $func_id . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $id = $data['id'];
- $invoicenum = $data['invoicenum'];
- $userid = $data['userid'];
- $date = $data['date'];
- $duedate = $data['duedate'];
- $datepaid = $data['datepaid'];
- if ($datepaid != '0000-00-00 00:00:00')
- {
- $datepaid = frommysqldate ($datepaid);
- }
- else
- {
- $datepaid = '-';
- }
- $subtotal = $data['subtotal'];
- $credit = $data['credit'];
- $total = $data['total'];
- $status = $data['status'];
- $randomstring = $data['randomstring'];
- $gateway = $data['paymentmethod'];
- $taxrate = $data['taxrate'];
- $tax = $data['tax'];
- $paymentmethod = $data['value'];
- $date = frommysqldate ($date);
- $duedate = frommysqldate ($duedate);
- if (!$invoicenum)
- {
- $invoicenum = $id;
- }
- $query = '' . 'SELECT SUM(amountin) FROM tblaccounts WHERE invoiceid=\'' . $id . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $amountpaid = $data[0];
- $query = '' . 'SELECT * FROM tblaccounts WHERE invoiceid=\'' . $id . '\' ORDER BY id DESC';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $lastpaymentamount = $data['amountin'];
- $transactionid = $data['transid'];
- $invoicedescription = '';
- $query = '' . 'SELECT * FROM tblinvoiceitems WHERE invoiceid=\'' . $func_id . '\'';
- $result = mysql_query ($query);
- while ($data = mysql_fetch_array ($result))
- {
- $description = $data['description'];
- $amount = $data['amount'];
- $invoicedescription .= '' . $description . ' ' . $CONFIG['CurrencySymbol'] . $amount . ' ' . $CONFIG['Currency'] . '<br>
- ';
- }
- $invoicedescription .= '------------------------------------------------------<br>
- ';
- $invoicedescription .= $_LANG['invoicessubtotal'] . ': ' . $CONFIG['CurrencySymbol'] . $subtotal . ' ' . $CONFIG['Currency'] . '<br>
- ';
- $invoicedescription .= $_LANG['invoicescredit'] . ': ' . $CONFIG['CurrencySymbol'] . $credit . ' ' . $CONFIG['Currency'] . '<br>
- ';
- if (($CONFIG['TaxEnabled'] AND $taxrate))
- {
- $invoicedescription .= $taxrate . '% ' . $_LANG['invoicestax'] . ': ' . $CONFIG['CurrencySymbol'] . $tax . ' ' . $CONFIG['Currency'] . '<br>
- ';
- }
- $invoicedescription .= $_LANG['invoicestotal'] . ': ' . $CONFIG['CurrencySymbol'] . $total . ' ' . $CONFIG['Currency'] . '';
- if ($gateway)
- {
- if (!function_exists ('paymentMethodsSelection'))
- {
- require_once dirname (__FILE__) . '/gatewayfunctions.php';
- }
- require_once dirname (__FILE__) . '/../modules/gateways/' . $gateway . '.php';
- $params = getvariables ('' . $gateway);
- $params['description'] = $CONFIG['CompanyName'] . ' - ' . $_LANG['invoicestitle'] . ' ' . $id;
- $params['amount'] = $total;
- $params['invoiceid'] = $id;
- if ($CONFIG['SystemSSLURL'])
- {
- $params['systemurl'] = $CONFIG['SystemSSLURL'];
- }
- else
- {
- $params['systemurl'] = $CONFIG['SystemURL'];
- }
- $params['returnurl'] = $params['systemurl'] . '/viewinvoice.php?id=' . $id;
- $params['clientdetails'] = $clientsdetails;
- eval ('$paymentbutton=' . $gateway . '_link($params);');
- }
- $email_merge_fields['InvoiceID'] = $id;
- $email_merge_fields['InvoiceNo'] = $invoicenum;
- $email_merge_fields['InvoiceNum'] = $invoicenum;
- $email_merge_fields['InvoiceDate'] = $date;
- $email_merge_fields['DueDate'] = $duedate;
- $email_merge_fields['DatePaid'] = $datepaid;
- $email_merge_fields['Description'] = $invoicedescription;
- $email_merge_fields['AmountPaid'] = $CONFIG['CurrencySymbol'] . ('' . $amountpaid . ' ') . $CONFIG['Currency'];
- $email_merge_fields['AmountDue'] = $CONFIG['CurrencySymbol'] . ('' . $total . ' ') . $CONFIG['Currency'];
- $email_merge_fields['SubTotal'] = $CONFIG['CurrencySymbol'] . ('' . $subtotal . ' ') . $CONFIG['Currency'];
- $email_merge_fields['Credit'] = $CONFIG['CurrencySymbol'] . ('' . $credit . ' ') . $CONFIG['Currency'];
- $email_merge_fields['Tax'] = $CONFIG['CurrencySymbol'] . ('' . $tax . ' ') . $CONFIG['Currency'];
- $email_merge_fields['TaxRate'] = $taxrate . '%';
- $email_merge_fields['Total'] = $CONFIG['CurrencySymbol'] . ('' . $total . ' ') . $CONFIG['Currency'];
- $email_merge_fields['Status'] = $status;
- $email_merge_fields['LastPaymentAmount'] = $lastpaymentamount;
- $email_merge_fields['TransactionID'] = $transactionid;
- $email_merge_fields['PayButton'] = $paymentbutton;
- $email_merge_fields['PaymentMethod'] = $paymentmethod;
- $email_merge_fields['InvoiceLink'] = '<a href="' . $CONFIG['SystemURL'] . ('' . '/viewinvoice.php?id=' . $id . '">') . $CONFIG['SystemURL'] . ('' . '/viewinvoice.php?id=' . $id . '</a>');
- $query = '' . 'SELECT SUM(total) FROM tblinvoices WHERE userid=\'' . $userid . '\' AND status=\'Unpaid\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $alldueinvoices = $data[0];
- $email_merge_fields['PreviousBalance'] = $CONFIG['CurrencySymbol'] . format_as_currency ($alldueinvoices - $total) . ' ' . $CONFIG['Currency'];
- $email_merge_fields['AllDueInvoices'] = $CONFIG['CurrencySymbol'] . format_as_currency ($alldueinvoices) . ' ' . $CONFIG['Currency'];
- $query = '' . 'SELECT amountin FROM tblaccounts WHERE userid=\'' . $userid . '\' ORDER BY id DESC';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $lastpaymentamount = $data[0];
- $email_merge_fields['LastPaymentAmount'] = $CONFIG['CurrencySymbol'] . format_as_currency ($lastpaymentamount) . ' ' . $CONFIG['Currency'];
- if (((($func_messagename == 'Invoice Created' OR $func_messagename == 'Credit Card Invoice Created') OR $func_messagename == 'Invoice Payment Confirmation') OR $func_messagename == 'Credit Card Payment Confirmation'))
- {
- if ($CONFIG['EnablePDFInvoices'])
- {
- require_once dirname (__FILE__) . '/countries.php';
- if (strtoupper ($CONFIG['Charset']) == 'UTF-8')
- {
- require dirname (__FILE__) . '/tcpdf' . substr (phpversion (), 0, 1) . '.php';
- }
- else
- {
- require dirname (__FILE__) . '/fpdf.php';
- }
- $attachmentfilename = $invoicenum . '.pdf';
- $attachmentdata = pdfinvoice ($id);
- }
- }
- }
- else
- {
- if ($type == 'addon')
- {
- $query = '' . 'SELECT tblhostingaddons.*,tblpaymentgateways.value FROM tblhostingaddons INNER JOIN tblpaymentgateways ON tblpaymentgateways.gateway=tblhostingaddons.paymentmethod WHERE tblpaymentgateways.setting=\'name\' AND tblhostingaddons.id=\'' . $func_id . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $id = $data['id'];
- $hostingid = $data['hostingid'];
- $regdate = $data['regdate'];
- $name = $data['name'];
- $setupfee = $data['setupfee'];
- $recurring = $data['recurring'];
- $billingcycle = $data['billingcycle'];
- $free = $data['free'];
- $paymentmethod = $data['value'];
- $status = $data['status'];
- $nextduedate = $data['nextduedate'];
- $regdate = frommysqldate ($regdate);
- $nextduedate = frommysqldate ($nextduedate);
- $query = '' . 'SELECT * FROM tblhosting WHERE id=\'' . $hostingid . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $userid = $data['userid'];
- $domain = $data['domain'];
- $package = $data['package'];
- $email_merge_fields['RegDate'] = $regdate;
- $email_merge_fields['Product'] = $package;
- $email_merge_fields['Domain'] = $domain;
- $email_merge_fields['AddonName'] = $name;
- $email_merge_fields['SetupFee'] = $CONFIG['CurrencySymbol'] . ('' . $setupfee . ' ') . $CONFIG['Currency'];
- $email_merge_fields['Amount'] = $CONFIG['CurrencySymbol'] . ('' . $recurring . ' ') . $CONFIG['Currency'];
- $email_merge_fields['BillingCycle'] = $billingcycle;
- $email_merge_fields['PaymentMethod'] = $paymentmethod;
- $email_merge_fields['NextDueDate'] = $nextduedate;
- $email_merge_fields['Status'] = $status;
- }
- else
- {
- if ($type == 'support')
- {
- $query = '' . 'SELECT * FROM tbltickets WHERE id=\'' . $func_id . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $id = $data['id'];
- $deptid = $data['did'];
- $tid = $data['tid'];
- $c = $data['c'];
- $userid = $data['userid'];
- $date = $data['date'];
- $title = $data['title'];
- $tmessage = $data['message'];
- $status = $data['status'];
- $urgency = $data['urgency'];
- $attachment = $data['attachment'];
- if ($urgency == 'Low')
- {
- $urgency = $_LANG['supportticketsticketurgencylow'];
- }
- else
- {
- if ($urgency == 'Medium')
- {
- $urgency = $_LANG['supportticketsticketurgencymedium'];
- }
- else
- {
- if ($urgency == 'High')
- {
- $urgency = $_LANG['supportticketsticketurgencyhigh'];
- }
- }
- }
- if ($status == 'Open')
- {
- $status = $_LANG['supportticketsstatusopen'];
- }
- else
- {
- if ($status == 'Answered')
- {
- $status = $_LANG['supportticketsstatusanswered'];
- }
- else
- {
- if ($status == 'On Hold')
- {
- $status = $_LANG['supportticketsstatusonhold'];
- }
- else
- {
- if ($status == 'In Progress')
- {
- $status = $_LANG['supportticketsstatusinprogress'];
- }
- else
- {
- if ($status == 'Customer-Reply')
- {
- $status = $_LANG['supportticketsstatuscustomerreply'];
- }
- else
- {
- if ($status == 'Closed')
- {
- $status = $_LANG['supportticketsstatusclosed'];
- }
- }
- }
- }
- }
- }
- if ($userid == '0000000000')
- {
- $firstname = $data['name'];
- $email = $data['email'];
- }
- $query = '' . 'SELECT * FROM tblticketdepartments WHERE id=\'' . $deptid . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $fromname = $CONFIG['CompanyName'] . ' ' . $data['name'];
- $fromemail = $data['email'];
- if ($extra != '')
- {
- $query = '' . 'SELECT * FROM tblticketreplies WHERE id=\'' . $extra . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $tmessage = $data['message'];
- $attachment = $data['attachment'];
- }
- if ($attachment)
- {
- global $attachments_dir;
- $attachdir = $attachments_dir;
- if (substr ($attachdir, 0, 1) != '/')
- {
- $attachdir = dirname (__FILE__) . '/../' . $attachdir;
- }
- $attachmentfilename = substr ($attachment, 7);
- $attachmentdata = file_get_contents ($attachdir . $attachment);
- }
- $date = frommysqldate ($date);
- $subject = '' . '[Ticket ID: ' . $tid . '] ' . $title;
- $email_merge_fields['TicketID'] = $tid;
- $email_merge_fields['DateOpened'] = $date;
- $email_merge_fields['Subject'] = $title;
- $email_merge_fields['Message'] = $tmessage;
- $email_merge_fields['Status'] = $status;
- $email_merge_fields['Priority'] = $urgency;
- $email_merge_fields['TicketURL'] = $CONFIG['SystemURL'] . ('' . '/viewticket.php?tid=' . $tid . '&c=' . $c);
- $email_merge_fields['TicketLink'] = '<a href="' . $CONFIG['SystemURL'] . ('' . '/viewticket.php?tid=' . $tid . '&c=' . $c . '">') . $CONFIG['SystemURL'] . ('' . '/viewticket.php?tid=' . $tid . '&c=' . $c . '</a>');
- }
- else
- {
- if ($type == 'domain')
- {
- $query = '' . 'SELECT * FROM tbldomains WHERE id=\'' . $func_id . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $id = $data['id'];
- $userid = $data['userid'];
- $orderid = $data['orderid'];
- $registrationdate = $data['registrationdate'];
- $status = $data['status'];
- $domain = $data['domain'];
- $firstpaymentamount = $data['firstpaymentamount'];
- $recurringamount = $data['recurringamount'];
- $registrar = $data['registrar'];
- $registrationperiod = $data['registrationperiod'];
- $expirydate = $data['expirydate'];
- $nextduedate = $data['nextduedate'];
- $registrationdate = frommysqldate ($registrationdate);
- $expirydate = frommysqldate ($expirydate);
- $nextduedate = frommysqldate ($nextduedate);
- $email_merge_fields['OrderID'] = $orderid;
- $email_merge_fields['OrderIDWords'] = str_replace ($wordreplace_numbers, $wordreplace_words, $orderid);
- $email_merge_fields['RegDate'] = $registrationdate;
- $email_merge_fields['Status'] = $status;
- $email_merge_fields['Domain'] = $domain;
- $email_merge_fields['Amount'] = $CONFIG['CurrencySymbol'] . ('' . $firstpaymentamount . ' ') . $CONFIG['Currency'];
- $email_merge_fields['FirstPaymentAmount'] = $CONFIG['CurrencySymbol'] . ('' . $firstpaymentamount . ' ') . $CONFIG['Currency'];
- $email_merge_fields['RecurringAmount'] = $CONFIG['CurrencySymbol'] . ('' . $recurringamount . ' ') . $CONFIG['Currency'];
- $email_merge_fields['Registrar'] = $registrar;
- $email_merge_fields['RegPeriod'] = $registrationperiod . ' ' . $_LANG['orderyears'];
- $email_merge_fields['ExpiryDate'] = $expirydate;
- $email_merge_fields['NextDueDate'] = $nextduedate;
- $email_merge_fields['DaysUntilExpiry'] = $extra;
- }
- else
- {
- if ($type == 'product')
- {
- $query = '' . 'SELECT tblhosting.*,tblproducts.name,tblpaymentgateways.value FROM tblhosting INNER JOIN tblproducts ON tblproducts.id=tblhosting.packageid INNER JOIN tblpaymentgateways ON tblpaymentgateways.gateway=tblhosting.paymentmethod WHERE tblpaymentgateways.setting=\'name\' AND tblhosting.id=\'' . $func_id . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $id = $data['id'];
- $userid = $data['userid'];
- $orderid = $data['orderid'];
- $regdate = $data['regdate'];
- $nextduedate = $data['nextduedate'];
- $orderno = $data['orderno'];
- $domain = $data['domain'];
- $server = $data['server'];
- $package = $data['name'];
- $packageid = $data['packageid'];
- $upgrades = $data['upgrades'];
- $gateway = $data['paymentmethod'];
- $paymentmethod = $data['value'];
- if ($regdate == $nextduedate)
- {
- $amount = $data['firstpaymentamount'];
- }
- else
- {
- $amount = $data['amount'];
- }
- $firstpaymentamount = $data['firstpaymentamount'];
- $recurringamount = $data['amount'];
- if ($func_messagename == 'Hosting Payment Confirmation')
- {
- if ($extra != '')
- {
- $nextduedate = $extra;
- }
- if ($nextduedate == '0000-00-00')
- {
- $nextduedate = '-';
- }
- }
- $billingcycle = $data['billingcycle'];
- $domainstatus = $data['domainstatus'];
- $username = $data['username'];
- $password = decrypt ($data['password'], $encryption_key);
- $rootpassword = decrypt ($data['rootpassword'], $encryption_key);
- $dedicatedip = $data['dedicatedip'];
- $assignedips = nl2br ($data['assignedips']);
- $dedi_ns1 = $data['ns1'];
- $dedi_ns2 = $data['ns2'];
- $regdate = frommysqldate ($regdate);
- if ($nextduedate != '-')
- {
- $nextduedate = frommysqldate ($nextduedate);
- }
- $query3 = '' . 'SELECT * FROM tblservers WHERE id=\'' . $server . '\'';
- $result3 = mysql_query ($query3);
- $data3 = mysql_fetch_array ($result3);
- $servername = $data3['name'];
- $serverip = $data3['ipaddress'];
- $ns1 = $data3['nameserver1'];
- $ns1ip = $data3['nameserver1ip'];
- $ns2 = $data3['nameserver2'];
- $ns2ip = $data3['nameserver2ip'];
- $ns3 = $data3['nameserver3'];
- $ns3ip = $data3['nameserver3ip'];
- $ns4 = $data3['nameserver4'];
- $ns4ip = $data3['nameserver4ip'];
- $configoptions = '';
- $query4 = '' . 'SELECT tblproductconfigoptions.optionname AS confoption,tblproductconfigoptionssub.optionname,tblproductconfigoptionssub.price FROM tblhostingconfigoptions INNER JOIN tblproductconfigoptions ON tblproductconfigoptions.id=tblhostingconfigoptions.configid INNER JOIN tblproductconfigoptionssub ON tblproductconfigoptionssub.id=tblhostingconfigoptions.optionid WHERE relid=\'' . $func_id . '\' ORDER BY tblproductconfigoptions.`order`,tblproductconfigoptions.id ASC';
- $result4 = mysql_query ($query4);
- while ($data4 = mysql_fetch_array ($result4))
- {
- $confoption = $data4['confoption'];
- if (strpos ($confoption, '|'))
- {
- $confoption = explode ('|', $confoption);
- $confoption = trim ($confoption[1]);
- }
- $optionname = $data4['optionname'];
- if (strpos ($optionname, '|'))
- {
- $optionname = explode ('|', $optionname);
- $optionname = trim ($optionname[1]);
- }
- $price = $data4['price'];
- $configoptions .= '' . $confoption . ': ' . $optionname . ' ' . $CONFIG['CurrencySymbol'] . $price . '<br>
- ';
- }
- $email_merge_fields['OrderID'] = $orderid;
- $email_merge_fields['OrderIDWords'] = str_replace ($wordreplace_numbers, $wordreplace_words, $orderid);
- $email_merge_fields['ProductID'] = ltrim ($id, 0);
- $email_merge_fields['RegDate'] = $regdate;
- $email_merge_fields['Domain'] = $domain;
- $email_merge_fields['ServerName'] = $servername;
- $email_merge_fields['ServerIP'] = $serverip;
- $email_merge_fields['DedicatedIP'] = $dedicatedip;
- $email_merge_fields['AssignedIPs'] = $assignedips;
- if ($dedi_ns1 != '')
- {
- $email_merge_fields['Nameserver1'] = $dedi_ns1;
- $email_merge_fields['Nameserver2'] = $dedi_ns2;
- }
- else
- {
- $email_merge_fields['Nameserver1'] = $ns1;
- $email_merge_fields['Nameserver2'] = $ns2;
- $email_merge_fields['Nameserver3'] = $ns3;
- $email_merge_fields['Nameserver4'] = $ns4;
- }
- $email_merge_fields['Nameserver1IP'] = $ns1ip;
- $email_merge_fields['Nameserver2IP'] = $ns2ip;
- $email_merge_fields['Nameserver3IP'] = $ns3ip;
- $email_merge_fields['Nameserver4IP'] = $ns4ip;
- $email_merge_fields['Product'] = $package;
- $email_merge_fields['Package'] = $package;
- $email_merge_fields['ConfigOptions'] = $configoptions;
- $email_merge_fields['Domain'] = $domain;
- $email_merge_fields['PaymentMethod'] = $paymentmethod;
- $email_merge_fields['Amount'] = $CONFIG['CurrencySymbol'] . ('' . $amount . ' ') . $CONFIG['Currency'];
- $email_merge_fields['FirstPaymentAmount'] = $CONFIG['CurrencySymbol'] . ('' . $firstpaymentamount . ' ') . $CONFIG['Currency'];
- $email_merge_fields['RecurringAmount'] = $CONFIG['CurrencySymbol'] . ('' . $recurringamount . ' ') . $CONFIG['Currency'];
- $email_merge_fields['BillingCycle'] = $billingcycle;
- $email_merge_fields['NextDueDate'] = $nextduedate;
- $email_merge_fields['Status'] = $domainstatus;
- $email_merge_fields['Username'] = $username;
- $email_merge_fields['Password'] = $password;
- $email_merge_fields['CpanelUsername'] = $username;
- $email_merge_fields['CpanelPassword'] = $password;
- $email_merge_fields['RootUsername'] = $username;
- $email_merge_fields['RootPassword'] = $rootpassword;
- include_once dirname (__FILE__) . '/customfieldfunctions.php';
- $customfields = getcustomfields ('product', $packageid, $func_id, '', '');
- foreach ($customfields as $customfield)
- {
- $email_merge_fields['ProductCustom-' . $customfield['name']] = $customfield['value'];
- }
- if ($func_messagename == 'Order Confirmation')
- {
- $userid = $func_id;
- foreach ($extra as $k => $v)
- {
- $email_merge_fields[$k] = $v;
- }
- }
- }
- else
- {
- if ($type == 'affiliate')
- {
- $query = '' . 'SELECT * FROM tblaffiliates WHERE id=\'' . $func_id . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $id = $data['id'];
- $userid = $data['clientid'];
- $visitors = $data['visitors'];
- $balance = $data['balance'];
- $withdrawn = $data['withdrawn'];
- $referralstable .= '<table cellspacing=1 bgcolor=#cccccc width=100%><tr bgcolor=#efefef style="text-align:center;font-weight:bold;"><td>' . $_LANG['orderproduct'] . '</td><td>' . $_LANG['orderbillingcycle'] . '</td><td>' . $_LANG['affiliatescommision'] . '</td></tr>';
- $query = '' . 'SELECT * FROM tblaffiliatesaccounts WHERE affiliateid=\'' . $id . '\' ORDER BY id ASC';
- $result = mysql_query ($query);
- while ($data = mysql_fetch_array ($result))
- {
- $package = $data['package'];
- $billingcycle = $data['billingcycle'];
- $amount = $data['amount'];
- $commission = $data['commission'];
- $referralstable .= '' . '<tr bgcolor=#ffffff style="text-align:center;"><td>' . $package . '</td><td>' . $billingcycle . '</td><td>' . $CONFIG['CurrencySymbol'] . $commission . '</td></tr>';
- }
- if ($status == '')
- {
- $referralstable .= '<tr bgcolor=#ffffff><td colspan=3 align=center>No Referral Signups</td></tr>';
- }
- $referralstable .= '</table>';
- $email_merge_fields['TotalVisitors'] = $visitors;
- $email_merge_fields['CurrentBalance'] = $CONFIG['CurrencySymbol'] . $balance . ' ' . $CONFIG['Currency'];
- $email_merge_fields['AmountWithdrawn'] = $CONFIG['CurrencySymbol'] . $withdrawn . ' ' . $CONFIG['Currency'];
- $email_merge_fields['ReferralsTable'] = $referralstable;
- $email_merge_fields['ReferralLink'] = $CONFIG['SystemURL'] . ('' . '/aff.php?aff=' . $id);
- }
- }
- }
- }
- }
- }
- if ($type == 'general')
- {
- $userid = $func_id;
- }
- $query2 = '' . 'SELECT * FROM tblclients WHERE id=\'' . $userid . '\'';
- $result2 = mysql_query ($query2);
- $data2 = mysql_fetch_array ($result2);
- if ((!$firstname AND !$email))
- {
- $firstname = $data2['firstname'];
- $email = $data2['email'];
- }
- $lastname = $data2['lastname'];
- $companyname = $data2['companyname'];
- $address1 = $data2['address1'];
- $address2 = $data2['address2'];
- $city = $data2['city'];
- $state = $data2['state'];
- $postcode = $data2['postcode'];
- $country = $data2['country'];
- $phonenumber = $data2['phonenumber'];
- $language = $data2['language'];
- $credit = $data2['credit'];
- $password = decrypt ($data2['password'], $encryption_key);
- if ($companyname == '')
- {
- $fname = '' . $firstname . ' ' . $lastname;
- }
- else
- {
- $fname = '' . $firstname . ' ' . $lastname . ' (' . $companyname . ')';
- }
- if (!$email)
- {
- return false;
- }
- $query = '' . 'SELECT * FROM tblemailtemplates WHERE name=\'' . $func_messagename . '\' AND language=\'' . $language . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- if ((substr ($subject, 0, 10) != '[Ticket ID' AND $data['subject']))
- {
- $subject = $data['subject'];
- }
- if ($data['message'])
- {
- $message = $data['message'];
- }
- $email_merge_fields['CustomerID'] = ltrim ($userid, 0);
- $email_merge_fields['CustomerName'] = $fname;
- $email_merge_fields['CustomerFirstName'] = $firstname;
- $email_merge_fields['CompanyName'] = $companyname;
- $email_merge_fields['CustomerEmail'] = $email;
- $email_merge_fields['Address1'] = $address1;
- $email_merge_fields['Address2'] = $address2;
- $email_merge_fields['City'] = $city;
- $email_merge_fields['State'] = $state;
- $email_merge_fields['Postcode'] = $postcode;
- $email_merge_fields['Country'] = $country;
- $email_merge_fields['PhoneNumber'] = $phonenumber;
- $email_merge_fields['MAPassword'] = $password;
- $email_merge_fields['CAPassword'] = $password;
- $email_merge_fields['CreditBalance'] = $credit;
- include_once dirname (__FILE__) . '/customfieldfunctions.php';
- $customfields = getcustomfields ('client', '', $userid, 'on', '');
- foreach ($customfields as $customfield)
- {
- $email_merge_fields['Custom-' . $customfield['name']] = $customfield['value'];
- }
- $email_merge_fields['CompanyName'] = $CONFIG['CompanyName'];
- $email_merge_fields['ClientAreaLink'] = '<a href="' . $CONFIG['SystemURL'] . '">' . $CONFIG['SystemURL'] . '</a>';
- $email_merge_fields['Signature'] = nl2br ($CONFIG['Signature']);
- if ($fromname == '')
- {
- $fromname = $CONFIG['CompanyName'];
- }
- if ($fromemail == '')
- {
- $fromemail = $CONFIG['Email'];
- }
- foreach ($email_merge_fields as $mergefield => $mergevalue)
- {
- $subject = str_replace ((('' . '[') . $mergefield . ']'), $mergevalue, $subject);
- $message = str_replace ((('' . '[') . $mergefield . ']'), $mergevalue, $message);
- }
- $mail = new PHPMailer ();
- if ($CONFIG['MailType'] == 'mail')
- {
- $mail->Mailer = 'mail';
- $mail->From = $fromemail;
- $mail->FromName = $fromname;
- }
- else
- {
- if ($CONFIG['MailType'] == 'smtp')
- {
- $mail->IsSMTP ();
- $mail->Host = $CONFIG['SMTPHost'];
- $mail->SMTPAuth = true;
- $mail->Port = $CONFIG['SMTPPort'];
- $mail->Username = $CONFIG['SMTPUsername'];
- $mail->Password = $CONFIG['SMTPPassword'];
- $mail->From = $CONFIG['SMTPUsername'];
- $mail->FromName = $fromname;
- $mail->Sender = $mail->Username;
- $mail->AddReplyTo ($fromemail, $fromname);
- }
- }
- $mail->CharSet = $CONFIG['Charset'];
- if ($CONFIG['BCCMessages'] != '')
- {
- $bcc = $CONFIG['BCCMessages'] . ',';
- $bcc = explode (',', $bcc);
- foreach ($bcc as $value)
- {
- if ($value != '')
- {
- $mail->AddBCC ($value);
- continue;
- }
- }
- }
- $mail->AddAddress ($email, $firstname . ' ' . $lastname);
- $query = '' . 'SELECT * FROM tblcontacts WHERE userid=\'' . $userid . '\' AND ' . $type . 'emails=\'1\'';
- $result = mysql_query ($query);
- while ($data = mysql_fetch_array ($result))
- {
- $mail->AddAddress ($data['email'], $data['firstname'] . ' ' . $data['lastname']);
- }
- if ($copyto)
- {
- if ($CONFIG['MailType'] == 'mail')
- {
- $mail->AddBCC ($copyto, $CONFIG['CompanyName']);
- }
- else
- {
- $mail->AddCC ($copyto, $CONFIG['CompanyName']);
- }
- }
- $mail->Subject = stripslashes ($subject);
- if ($plaintext)
- {
- $message = stripslashes ($message);
- $message = strip_tags ($message);
- $mail->Body = $message;
- $message = nl2br ($message);
- }
- else
- {
- $message = stripslashes ($message);
- $message_text = str_replace ('<p>', '', $message);
- $message_text = str_replace ('</p>', '
- ', $message_text);
- $message_text = str_replace ('<br>', '
- ', $message_text);
- $message_text = str_replace ('<br />', '
- ', $message_text);
- $message_text = strip_tags ($message_text);
- if ($CONFIG['LogoURL'] != '')
- {
- $message = '<p><a href="' . $CONFIG['Domain'] . '" target="_blank"><img src="' . $CONFIG['LogoURL'] . '" alt="' . $CONFIG['CompanyName'] . '" border="0"></a></p><font style="font-family:Verdana;font-size:11px">' . $message;
- }
- else
- {
- $message = '<font style="font-family:Verdana;font-size:11px">' . $message;
- }
- $mail->Body = $message;
- $mail->AltBody = $message_text;
- }
- if ($attachmentfilename)
- {
- $mail->AddStringAttachment ($attachmentdata, $attachmentfilename);
- }
- global $smtp_debug;
- if ($smtp_debug == 'on')
- {
- $mail->SMTPDebug = true;
- }
- if (CLIENTAREA == '1')
- {
- $silent = 'true';
- }
- if (!$mail->Send ())
- {
- if ($silent != 'true')
- {
- echo '' . '<p>There has been an error sending the email (' . $subject . ')</p>';
- }
- }
- else
- {
- if ($silent != 'true')
- {
- echo '' . '<p>Email Sent Successfully to <a href="clientssummary.php?userid=' . $userid . '">' . $firstname . ' ' . $lastname . '</a></p>';
- }
- $subject = addslashes ($subject);
- $message = addslashes ($message);
- $query = '' . 'INSERT INTO tblemails (userid,subject,message,date) VALUES (\'' . $userid . '\',\'' . $subject . '\',\'' . $message . '\',now())';
- $result = mysql_query ($query);
- logactivity ('' . 'Email Sent to ' . $firstname . ' ' . $lastname . ' (' . $subject . ')');
- }
- $mail->ClearAddresses ();
- }
- function sendadminnotification ($to = 'admin', $subject, $adminmessage, $deptid = '')
- {
- global $CONFIG;
- if ($CONFIG['LogoURL'] != '')
- {
- $message = '<p><a href="' . $CONFIG['Domain'] . '" target="_blank"><img src="' . $CONFIG['LogoURL'] . '" alt="' . $CONFIG['CompanyName'] . '" border="0"></a></p>';
- }
- $message .= '' . '<font style="font-family:Verdana;font-size:11px"><p>' . $adminmessage . '</p><p><a href="' . $CONFIG['SystemURL'] . '/admin/">' . $CONFIG['SystemURL'] . '/admin/</a></p>';
- $mail = new PHPMailer ();
- $mail->From = $CONFIG['SystemEmailsFromEmail'];
- $mail->FromName = $CONFIG['SystemEmailsFromName'];
- $mail->Subject = stripslashes ($subject);
- $mail->CharSet = $CONFIG['Charset'];
- if ($CONFIG['MailType'] == 'mail')
- {
- $mail->Mailer = 'mail';
- }
- else
- {
- if ($CONFIG['MailType'] == 'smtp')
- {
- $mail->IsSMTP ();
- $mail->Host = $CONFIG['SMTPHost'];
- $mail->SMTPAuth = true;
- $mail->Port = $CONFIG['SMTPPort'];
- $mail->Username = $CONFIG['SMTPUsername'];
- $mail->Password = $CONFIG['SMTPPassword'];
- $mail->From = $CONFIG['SystemEmailsFromEmail'];
- $mail->FromName = $CONFIG['SystemEmailsFromName'];
- $mail->Sender = $CONFIG['SMTPUsername'];
- $mail->AddReplyTo ($CONFIG['SystemEmailsFromEmail'], $CONFIG['SystemEmailsFromName']);
- }
- }
- $message = stripslashes ($message);
- $message_text = str_replace ('</p>', '
- ', $message);
- $message_text = str_replace ('<br>', '
- ', $message_text);
- $message_text = strip_tags ($message_text);
- $mail->Body = $message;
- $mail->AltBody = $message_text;
- $mailquery = 'SELECT * FROM tbladmins WHERE ';
- if ($deptid != '')
- {
- $query = '' . 'SELECT * FROM tblticketdepartments WHERE id=\'' . $deptid . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $mail->From = $data['email'];
- $deptid = str_pad ($deptid, 3, '0', STR_PAD_LEFT);
- $mailquery .= '' . 'ticketnotifications=\'on\' AND supportdepts LIKE \'%,' . $deptid . ',%\'';
- }
- else
- {
- $mailquery .= '(userlevel=\'3\'';
- if ($to == 'support')
- {
- $mailquery .= ' OR userlevel=\'1\'';
- }
- else
- {
- if ($to == 'sales')
- {
- $mailquery .= ' OR userlevel=\'2\'';
- }
- }
- $mailquery .= ')';
- if ($subject == 'WHMCS New Order Notification')
- {
- $mailquery .= ' AND ordernotifications=\'on\'';
- }
- }
- $mailresult = mysql_query ($mailquery);
- $i = 0;
- while ($maildata = mysql_fetch_array ($mailresult))
- {
- $mail->AddAddress ($maildata['email']);
- }
- $mail->Send ();
- $mail->ClearAddresses ();
- }
- function tomysqldate ($date)
- {
- global $CONFIG;
- if ($CONFIG['DateFormat'] == 'DD/MM/YYYY')
- {
- $day = substr ($date, 0, 2);
- $month = substr ($date, 3, 2);
- $year = substr ($date, 6, 4);
- $hours = substr ($date, 10, 2);
- $minutes = substr ($date, 13, 2);
- $seconds = substr ($date, 16, 2);
- }
- else
- {
- if ($CONFIG['DateFormat'] == 'MM/DD/YYYY')
- {
- $day = substr ($date, 3, 2);
- $month = substr ($date, 0, 2);
- $year = substr ($date, 6, 4);
- $hours = substr ($date, 10, 2);
- $minutes = substr ($date, 13, 2);
- $seconds = substr ($date, 16, 2);
- }
- else
- {
- if ($CONFIG['DateFormat'] == 'YYYY/MM/DD')
- {
- $day = substr ($date, 8, 2);
- $month = substr ($date, 5, 2);
- $year = substr ($date, 0, 4);
- $hours = substr ($date, 10, 2);
- $minutes = substr ($date, 13, 2);
- $seconds = substr ($date, 16, 2);
- }
- }
- }
- $date = $year . $month . $day . $hours . $minutes . $seconds;
- return $date;
- }
- function frommysqldate ($date, $format = '')
- {
- global $CONFIG;
- global $timeoffset;
- $year = substr ($date, 0, 4);
- $month = substr ($date, 5, 2);
- $day = substr ($date, 8, 2);
- $hours = substr ($date, 11, 2);
- $minutes = substr ($date, 14, 2);
- $seconds = substr ($date, 17, 2);
- if ($timeoffset)
- {
- $hours = $hours + $timeoffset;
- $new_time = mktime ($hours, $minutes, $seconds, $month, $day, $year);
- $year = date ('Y', $new_time);
- $month = date ('m', $new_time);
- $day = date ('d', $new_time);
- $hours = date ('H', $new_time);
- $minutes = date ('i', $new_time);
- $seconds = date ('s', $new_time);
- }
- if ($CONFIG['DateFormat'] == 'DD/MM/YYYY')
- {
- $date = '' . $day . '/' . $month . '/' . $year;
- }
- else
- {
- if ($CONFIG['DateFormat'] == 'MM/DD/YYYY')
- {
- $date = '' . $month . '/' . $day . '/' . $year;
- }
- else
- {
- if ($CONFIG['DateFormat'] == 'YYYY/MM/DD')
- {
- $date = '' . $year . '/' . $month . '/' . $day;
- }
- }
- }
- if ($format == 'time')
- {
- $date .= '' . ' ' . $hours . ':' . $minutes;
- }
- return $date;
- }
- function gettodaysdate ()
- {
- global $CONFIG;
- if ($CONFIG['DateFormat'] == 'DD/MM/YYYY')
- {
- $date = date ('d') . '/' . date ('m') . '/' . date ('Y');
- }
- else
- {
- if ($CONFIG['DateFormat'] == 'MM/DD/YYYY')
- {
- $date = date ('m') . '/' . date ('d') . '/' . date ('Y');
- }
- else
- {
- if ($CONFIG['DateFormat'] == 'YYYY/MM/DD')
- {
- $date = date ('Y') . '/' . date ('m') . '/' . date ('d');
- }
- }
- }
- return $date;
- }
- function makeaddonpayment ($func_addonid, $paidamount, $func_fees, $invoice = '', $gateway = '', $transid = '')
- {
- global $CONFIG;
- $query = '' . 'SELECT * FROM tblhostingaddons WHERE id=\'' . $func_addonid . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $id = $data['id'];
- $hostingid = $data['hostingid'];
- $regdate = $data['regdate'];
- $name = $data['name'];
- $setupfee = $data['setupfee'];
- $recurring = $data['recurring'];
- $billingcycle = $data['billingcycle'];
- $free = $data['free'];
- $status = $data['status'];
- $nextduedate = $data['nextduedate'];
- $paymentmethod = $data['paymentmethod'];
- if ($regdate == $nextduedate)
- {
- $amount = $setupfee + $recurring;
- }
- else
- {
- $amount = $recurring;
- }
- if ($gateway)
- {
- $paymentmethod = $gateway;
- }
- $query = '' . 'SELECT * FROM tblhosting WHERE id=\'' . $hostingid . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $userid = $data['userid'];
- $domain = $data['domain'];
- if (substr ($regdate, 0, 8) == substr ($nextduedate, 0, 8))
- {
- $recurring = $setupfee;
- }
- $year = substr ($nextduedate, 0, 4);
- $month = substr ($nextduedate, 5, 2);
- $day = substr ($nextduedate, 8, 2);
- if ($billingcycle == 'Monthly')
- {
- $new_time = mktime (0, 0, 0, $month + 1, $day, $year);
- $day = date ('d', $new_time);
- $month = date ('m', $new_time);
- $year = date ('Y', $new_time);
- }
- else
- {
- if ($billingcycle == 'Quarterly')
- {
- $new_time = mktime (0, 0, 0, $month + 3, $day, $year);
- $day = date ('d', $new_time);
- $month = date ('m', $new_time);
- $year = date ('Y', $new_time);
- }
- else
- {
- if ($billingcycle == 'Semi-Annually')
- {
- $new_time = mktime (0, 0, 0, $month + 6, $day, $year);
- $day = date ('d', $new_time);
- $month = date ('m', $new_time);
- $year = date ('Y', $new_time);
- }
- else
- {
- if ($billingcycle == 'Annually')
- {
- $new_time = mktime (0, 0, 0, $month, $day, $year + 1);
- $day = date ('d', $new_time);
- $month = date ('m', $new_time);
- $year = date ('Y', $new_time);
- }
- else
- {
- if ($billingcycle == 'Biennially')
- {
- $new_time = mktime (0, 0, 0, $month, $day, $year + 2);
- $day = date ('d', $new_time);
- $month = date ('m', $new_time);
- $year = date ('Y', $new_time);
- }
- else
- {
- if ($billingcycle == 'One Time')
- {
- $day = '00';
- $month = '00';
- $year = '0000';
- }
- }
- }
- }
- }
- }
- $nextduedate = $year . $month . $day;
- $query = '' . 'UPDATE tblhostingaddons SET nextduedate=\'' . $nextduedate . '\' WHERE id=\'' . $func_addonid . '\'';
- $result = mysql_query ($query);
- logactivity ('' . 'Updated Next Due Date for Hosting Addon (ID: ' . $func_addonid . ')');
- if ($CONFIG['TaxEnabled'])
- {
- $clientsdetails = getclientsdetails ($userid);
- $state = $clientsdetails['state'];
- $country = $clientsdetails['country'];
- $taxrate = gettaxrate ($state, $country);
- $tax = 1;
- }
- if ($invoice == '')
- {
- if (!$paidamount)
- {
- $newtaxrate = $taxrate / 100 + 1;
- $paidamount = $amount * $newtaxrate;
- }
- accountin ($userid, '' . 'Addon Payment (' . $domain . ') - ' . $name, $paidamount, $fees, $paymentmethod, $transid);
- sendmessage ('Addon Subscription Payment Confirmation', $func_addonid);
- }
- }
- function affiliatepayment ($affaccid, $hostingid)
- {
- global $CONFIG;
- if ($affaccid != '')
- {
- $query = '' . 'SELECT * FROM tblaffiliatesaccounts WHERE id=\'' . $affaccid . '\'';
- }
- else
- {
- $query = '' . 'SELECT * FROM tblaffiliatesaccounts WHERE relid=\'' . $hostingid . '\'';
- }
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $affaccid = $data['id'];
- $affid = $data['affiliateid'];
- $amount = $data['amount'];
- $lastpaid = $data['lastpaid'];
- $commission = $data['commission'];
- $relid = $data['relid'];
- $query = '' . 'SELECT tblproducts.*,tblhosting.amount FROM tblproducts INNER JOIN tblhosting ON tblhosting.packageid=tblproducts.id WHERE tblhosting.id=\'' . $relid . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $affiliateonetime = $data['affiliateonetime'];
- if ($affiliateonetime == 'on')
- {
- if ($lastpaid == '0000-00-00')
- {
- $payout = true;
- }
- else
- {
- $error = 'This product is setup for a one time affiliate payment only and the commission has already been paid';
- }
- }
- else
- {
- $payout = true;
- }
- if (($affaccid AND $payout))
- {
- if ($CONFIG['AffiliatesDelayCommission'])
- {
- $clearingdate = date ('Y-m-d', mktime (0, 0, 0, date ('m'), date ('d') + $CONFIG['AffiliatesDelayCommission'], date ('Y')));
- $query = '' . 'INSERT INTO tblaffiliatespending (affaccid,amount,clearingdate) VALUES (\'' . $affaccid . '\',\'' . $commission . '\',\'' . $clearingdate . '\')';
- $result = mysql_query ($query);
- }
- else
- {
- $query = '' . 'UPDATE tblaffiliates SET balance=balance+' . $commission . ' WHERE id=\'' . $affid . '\'';
- $result = mysql_query ($query);
- $query = '' . 'UPDATE tblaffiliatesaccounts SET lastpaid=now() WHERE id=\'' . $affaccid . '\'';
- $result = mysql_query ($query);
- $query = '' . 'INSERT INTO tblaffiliateshistory (affiliateid,date,affaccid,amount) VALUES (\'' . $affid . '\',now(),\'' . $affaccid . '\',\'' . $commission . '\')';
- $result = mysql_query ($query);
- }
- }
- return $error;
- }
- function calculateaffiliatecommission ($affid, $relid)
- {
- global $CONFIG;
- $query = '' . 'SELECT tblproducts.*,tblhosting.amount,tblhosting.firstpaymentamount FROM tblproducts INNER JOIN tblhosting ON tblhosting.packageid=tblproducts.id WHERE tblhosting.id=\'' . $relid . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $firstpaymentamount = $data['firstpaymentamount'];
- $amount = $data['amount'];
- $affiliateonetime = $data['affiliateonetime'];
- $affiliatepaytype = $data['affiliatepaytype'];
- $affiliatepayamount = $data['affiliatepayamount'];
- if ($affiliatepaytype)
- {
- if ($affiliatepaytype == 'percentage')
- {
- $percentage = $affiliatepayamount;
- }
- else
- {
- $fixedamount = $affiliatepayamount;
- }
- }
- else
- {
- $query = '' . 'SELECT * FROM tblaffiliates WHERE id=\'' . $affid . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $paytype = $data['paytype'];
- $payamount = $data['payamount'];
- if ($paytype)
- {
- if ($paytype == 'percentage')
- {
- $percentage = $payamount;
- }
- else
- {
- $fixedamount = $payamount;
- }
- }
- else
- {
- $percentage = $CONFIG['AffiliateEarningPercent'];
- }
- }
- if ($fixedamount)
- {
- $commission = $fixedamount;
- }
- else
- {
- $commission = $amount * ($percentage / 100);
- }
- $commission = number_format ($commission, 2, '.', '');
- return $commission;
- }
- function logactivity ($description)
- {
- global $CONFIG;
- if ($_SESSION['adminusername'] == '')
- {
- $username = 'System';
- }
- else
- {
- $username = $_SESSION['adminusername'];
- }
- $query = '' . 'INSERT INTO tblactivitylog (date,description,user) VALUES (now(),\'' . $description . '\',\'' . $username . '\')';
- $result = mysql_query ($query);
- $query = 'SELECT * FROM tblactivitylog ORDER BY id DESC LIMIT ' . $CONFIG['ActivityLimit'] . ',99999';
- $result = mysql_query ($query);
- while ($data = mysql_fetch_array ($result))
- {
- $result2 = mysql_query ('DELETE FROM tblactivitylog WHERE id=\'' . $data['id'] . '\'');
- }
- }
- function generateuniqueid ($type = '')
- {
- $z = 0;
- if ($type == '')
- {
- $length = 10;
- }
- else
- {
- $length = 6;
- }
- while ($z <= 0)
- {
- $seedsfirst = '123456789';
- $seeds = '0123456789';
- $str = null;
- $seeds_count = strlen ($seeds) - 1;
- $i = 0;
- while ($i < $length)
- {
- if ($i == 0)
- {
- $str .= $seedsfirst[rand (0, $seeds_count - 1)];
- }
- else
- {
- $str .= $seeds[rand (0, $seeds_count)];
- }
- ++$i;
- }
- if ($type == '')
- {
- $query = '' . 'SELECT ordernum FROM tblorders WHERE ordernum=\'' . $str . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $id = $data['id'];
- if ($id == '')
- {
- $z = 1;
- continue;
- }
- continue;
- }
- else
- {
- if ($type == 'tickets')
- {
- $query = '' . 'SELECT id FROM tbltickets WHERE tid=\'' . $str . '\'';
- $result = mysql_query ($query);
- $data = mysql_fetch_array ($result);
- $id = $data['id'];
- if ($id == '')
- {
- $z = 1;
- continue;
- }
- continue;
- }
- continue;
- }
- }
- return $str;
- }
- function getlicenseinformation ()
- {
- global $license;
- $url = 'http://www.whmcs.com/license/index.php';
- $query_string = 'licensekey=' . $license;
- $ch = curl_init ();
- curl_setopt ($ch, CURLOPT_URL, $url);
- curl_setopt ($ch, CURLOPT_POST, 1);
- curl_setopt ($ch, CURLOPT_TIMEOUT, 3);
- curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt ($ch, CURLOPT_POSTFIELDS, $query_string);
- $filecontents = curl_exec ($ch);
- curl_close ($ch);
- preg_match ('/\\<registeredto\\>(.*?)\\<\\/registeredto\\>/', $filecontents, $registeredto);
- preg_match ('/\\<pid\\>(.*?)\\<\\/pid\\>/', $filecontents, $pid);
- preg_match ('/\\<type\\>(.*?)\\<\\/type\\>/', $filecontents, $type);
- preg_match ('/\\<domain\\>(.*?)\\<\\/domain\\>/', $filecontents, $domain);
- preg_match ('/\\<ip\\>(.*?)\\<\\/ip\\>/', $filecontents, $ip);
- preg_match ('/\\<created\\>(.*?)\\<\\/created\\>/', $filecontents, $created);
- preg_match ('/\\<expires\\>(.*?)\\<\\/expires\\>/', $filecontents, $expires);
- preg_match ('/\\<latestversion\\>(.*?)\\<\\/latestversion\\>/', $filecontents, $latestversion);
- $registeredto = $registeredto[1];
- $pid = $pid[1];
- $type = $type[1];
- $domain = $domain[1];
- $ip = $ip[1];
- $created = $created[1];
- $expires = $expires[1];
- $latestversion = $latestversion[1];
- $licenseinfo['registeredto'] = $registeredto;
- $licenseinfo['pid'] = $pid;
- $licenseinfo['type'] = $type;
- $licenseinfo['domain'] = $domain;
- $licenseinfo['ip'] = $ip;
- $licenseinfo['created'] = $created;
- $licenseinfo['expires'] = $expires;
- $licenseinfo['latestversion'] = $latestversion;
- return $licenseinfo;
- }
- function titlecase ($string)
- {
- $len = strlen ($string);
- $i = 0;
- $last = '';
- $new = '';
- $string = strtoupper ($string);
- while ($i < $len)
- {
- $char = substr ($string, $i, 1);
- if (ereg ('[A-Z]', $last))
- {
- $new .= strtolower ($char);
- }
- else
- {
- $new .= strtoupper ($char);
- }
- $last = $char;
- ++$i;
- }
- return $new;
- }
- function server_addr ()
- {
- return ($_SERVER['SERVER_ADDR'] ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR']);
- }
- function path_translated ()
- {
- if ($_SERVER['PATH_TRANSLATED'])
- {
- return substr ($_SERVER['PATH_TRANSLATED'], 0, @strrpos ($_SERVER['PATH_TRANSLATED'], '/'));
- }
- if ($_SERVER['SCRIPT_FILENAME'])
- {
- return substr ($_SERVER['SCRIPT_FILENAME'], 0, @strrpos ($_SERVER['SCRIPT_FILENAME'], '/'));
- }
- return substr ($_SERVER['ORIG_PATH_TRANSLATED'], 0, @strrpos ($_SERVER['ORIG_PATH_TRANSLATED'], '\\'));
- }
- function encrypt ($string, $key = '')
- {
- if (!$key)
- {
- global $encryption_key;
- $key = $encryption_key;
- }
- $result = '';
- $i = 0;
- while ($i < strlen ($string))
- {
- $char = substr ($string, $i, 1);
- $keychar = substr ($key, $i % strlen ($key) - 1, 1);
- $char = chr (ord ($char) + ord ($keychar));
- $result .= $char;
- ++$i;
- }
- return base64_encode ($result);
- }
- function decrypt ($string, $key = '')
- {
- if (!$key)
- {
- global $encryption_key;
- $key = $encryption_key;
- }
- $result = '';
- $string = base64_decode ($string);
- $i = 0;
- while ($i < strlen ($string))
- {
- $char = substr ($string, $i, 1);
- $keychar = substr ($key, $i % strlen ($key) - 1, 1);
- $char = chr (ord ($char) - ord ($keychar));
- $result .= $char;
- ++$i;
- }
- return $result;
- }
- function sanitize ($str)
- {
- $str = strip_tags ($str);
- $str = htmlspecialchars ($str, ENT_NOQUOTES);
- $str = stripslashes ($str);
- return $str;
- }
- function xmltoarray ($rawxml)
- {
- $xml_parser = xml_parser_create ();
- xml_parse_into_struct ($xml_parser, $rawxml, $vals, $index);
- xml_parser_free ($xml_parser);
- $params = array ();
- $level = array ();
- foreach ($vals as $xml_elem)
- {
- if ($xml_elem['type'] == 'open')
- {
- $level[$xml_elem['level']] = $xml_elem['tag'];
- }
- if ($xml_elem['type'] == 'complete')
- {
- $start_level = 1;
- $php_stmt = '$params';
- while ($start_level < $xml_elem['level'])
- {
- $php_stmt .= '[$level[' . $start_level . ']]';
- ++$start_level;
- }
- $php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];';
- eval ($php_stmt);
- continue;
- }
- }
- return $params;
- }
- function format_as_currency ($amount)
- {
- $amount += 9.99999999999999954748112e-07;
- $amount = round ($amount, 2);
- $amount = sprintf ('%01.2f', $amount);
- return $amount;
- }
- function xencrypt ($ckey, $string)
- {
- $string = base64_encode ($string);
- $keys = array ();
- $c_key = base64_encode (sha1 (md5 ($ckey)));
- $c_key = substr ($c_key, 0, round (ord ($ckey[0]) / 5));
- $c2_key = base64_encode (md5 (sha1 ($ckey)));
- $last = strlen ($ckey) - 1;
- $c2_key = substr ($c2_key, 1, round (ord ($ckey[$last]) / 7));
- $c3_key = base64_encode (sha1 (md5 ($c_key) . md5 ($c2_key)));
- $mid = round ($last / 2);
- $c3_key = substr ($c3_key, 1, round (ord ($ckey[$mid]) / 9));
- $c_key = $c_key . $c2_key . $c3_key;
- $c_key = base64_encode ($c_key);
- $i = 0;
- while ($i < strlen ($c_key))
- {
- $keys[] = $c_key[$i];
- ++$i;
- }
- $i = 0;
- while ($i < strlen ($string))
- {
- $id = $i % count ($keys);
- $ord = ord ($string[$i]);
- ($ord = $ord OR ord ($keys[$id]));
- ++$id;
- ($ord = $ord AND ord ($keys[$id]));
- ++$id;
- $ord = $ord XOR ord ($keys[$id]);
- ++$id;
- $ord = $ord + ord ($keys[$id]);
- $string[$i] = chr ($ord);
- ++$i;
- }
- return base64_encode ($string);
- }
- function xdecrypt ($ckey, $string)
- {
- $string = base64_decode ($string);
- $keys = array ();
- $c_key = base64_encode (sha1 (md5 ($ckey)));
- $c_key = substr ($c_key, 0, round (ord ($ckey[0]) / 5));
- $c2_key = base64_encode (md5 (sha1 ($ckey)));
- $last = strlen ($ckey) - 1;
- $c2_key = substr ($c2_key, 1, round (ord ($ckey[$last]) / 7));
- $c3_key = base64_encode (sha1 (md5 ($c_key) . md5 ($c2_key)));
- $mid = round ($last / 2);
- $c3_key = substr ($c3_key, 1, round (ord ($ckey[$mid]) / 9));
- $c_key = $c_key . $c2_key . $c3_key;
- $c_key = base64_encode ($c_key);
- $i = 0;
- while ($i < strlen ($c_key))
- {
- $keys[] = $c_key[$i];
- ++$i;
- }
- $i = 0;
- while ($i < strlen ($string))
- {
- $id = $i % count ($keys);
- $ord = ord ($string[$i]);
- $ord = $ord XOR ord ($keys[$id]);
- ++$id;
- ($ord = $ord AND ord ($keys[$id]));
- ++$id;
- ($ord = $ord OR ord ($keys[$id]));
- ++$id;
- $ord = $ord - ord ($keys[$id]);
- $string[$i] = chr ($ord);
- ++$i;
- }
- return base64_decode ($string);
- }
- require dirname (__FILE__) . '/class.phpmailer.php';
- if (!@function_exists ('file_get_contents'))
- {
- function file_get_contents ($url)
- {
- return implode ('', @file ($url));
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement