Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by deZender.Net
- * @ deZender (PHP5 Decoder for ionCube Encoder)
- *
- * @ Version : 1.1.3.0
- * @ Author : DeZender
- * @ Release on : 17.05.2011
- * @ Official site : http://DeZender.Net
- *
- */
- function clientarea_CCLink() {
- global $CONFIG;
- $result = select_query( 'tblpaymentgateways', 'gateway', array( 'setting' => 'type', 'value' => 'CC' ) );
- while ($data = mysql_fetch_array( $result )) {
- $gateway = $data['gateway'];
- require_once( ROOTDIR . ( '' . '/modules/gateways/' . $gateway . '.php' ) );
- if (function_exists( $gateway . '_remoteupdate' )) {
- return true;
- }
- }
- if ($CONFIG['CCNeverStore']) {
- return false;
- }
- $result = select_query( 'tblpaymentgateways', 'COUNT(*)', 'setting=\'type\' AND (value=\'CC\' OR value=\'OfflineCC\')' );
- $data = mysql_fetch_array( $result );
- if ($data[0]) {
- return true;
- }
- return false;
- }
- define( 'CLIENTAREA', true );
- require( 'dbconnect.php' );
- require( 'includes/functions.php' );
- require( 'includes/clientareafunctions.php' );
- require( 'includes/clientfunctions.php' );
- require( 'includes/gatewayfunctions.php' );
- require( 'includes/ccfunctions.php' );
- require( 'includes/registrarfunctions.php' );
- require( 'includes/customfieldfunctions.php' );
- require( 'includes/invoicefunctions.php' );
- require( 'includes/configoptionsfunctions.php' );
- if (!is_numeric( $page )) {
- $page = 1;
- }
- $pagetitle = $_LANG['clientareatitle'];
- $pageicon = 'images/clientarea_big.gif';
- $breadcrumbnav = '<a href="index.php">' . $_LANG['globalsystemname'] . '</a> > <a href="clientarea.php">' . $_LANG['clientareatitle'] . '</a>';
- if ($action == 'details') {
- $breadcrumbnav .= ' > <a href="clientarea.php?action=details">' . $_LANG['clientareanavdetails'] . '</a>';
- }
- if ($action == 'hosting') {
- $breadcrumbnav .= ' > <a href="clientarea.php?action=hosting">' . $_LANG['clientareanavhosting'] . '</a>';
- }
- if ($action == 'products') {
- $breadcrumbnav .= ' > <a href="clientarea.php?action=products">' . $_LANG['clientareaproducts'] . '</a>';
- }
- if (( ( ( ( ( ( $action == 'domains' || $action == 'domaindetails' ) || $action == 'domaincontacts' ) || $action == 'domaindns' ) || $action == 'domainemailforwarding' ) || $action == 'domaingetepp' ) || $action == 'domainrenew' )) {
- $breadcrumbnav .= ' > <a href="clientarea.php?action=domains">' . $_LANG['clientareanavdomains'] . '</a>';
- }
- if ($action == 'domainwhois') {
- $breadcrumbnav .= ' > <a href="clientarea.php?action=domains">' . $_LANG['clientareanavdomains'] . '</a>';
- }
- if ($action == 'invoices') {
- $breadcrumbnav .= ' > <a href="clientarea.php?action=invoices">' . $_LANG['invoices'] . '</a>';
- }
- if ($action == 'emails') {
- $breadcrumbnav .= ' > <a href="clientarea.php?action=emails">' . $_LANG['clientareaemails'] . '</a>';
- }
- if ($action == 'cancel') {
- $breadcrumbnav .= ' > <a href="#">' . $_LANG['clientareacancelrequest'] . '</a>';
- }
- if ($action == 'addfunds') {
- $breadcrumbnav .= ' > <a href="clientarea.php?action=addfunds">' . $_LANG['addfunds'] . '</a>';
- }
- if ($action == 'masspay') {
- $breadcrumbnav .= ' > <a href="#">' . $_LANG['masspaytitle'] . '</a>';
- }
- if ($action == 'quotes') {
- $breadcrumbnav .= ' > <a href="clientarea.php?action=quotes">' . $_LANG['quotestitle'] . '</a>';
- }
- initialiseClientArea( $pagetitle, $pageicon, $breadcrumbnav );
- $content = '';
- if ($_SESSION['uid']) {
- $pagelimit = 10;
- if ($itemlimit == 'all') {
- $itemlimit = 99999999;
- }
- if (is_numeric( $itemlimit )) {
- setcookie( 'pagelimit', $itemlimit, time( ) + 90 * 24 * 60 * 60 );
- $_COOKIE['pagelimit'] = $itemlimit;
- }
- if (isset( $_COOKIE['pagelimit'] )) {
- if (is_numeric( $_COOKIE['pagelimit'] )) {
- $pagelimit = $_COOKIE['pagelimit'];
- }
- }
- $currency = getCurrency( $_SESSION['uid'] );
- $id = (int)$id;
- if ($action == '') {
- $templatefile = 'clientareahome';
- require( 'includes/ticketfunctions.php' );
- $tickets = array( );
- $statusfilter = '';
- $result = select_query( 'tblticketstatuses', 'title', array( 'showactive' => '1' ) );
- while ($data = mysql_fetch_array( $result )) {
- $statusfilter .= '\'' . $data[0] . '\',';
- }
- $statusfilter = substr( $statusfilter, 0, 0 - 1 );
- $result = select_query( 'tbltickets', '', 'userid=\'' . mysql_real_escape_string( $_SESSION['uid'] ) . ( '' . '\' AND status IN (' . $statusfilter . ')' ), 'lastreply', 'DESC' );
- while ($data = mysql_fetch_array( $result )) {
- $id = $data['id'];
- $tid = $data['tid'];
- $c = $data['c'];
- $deptid = $data['did'];
- $date = $data['date'];
- $date = fromMySQLDate( $date, 'time' );
- $subject = $data['title'];
- $tstatus = $data['status'];
- $urgency = $data['urgency'];
- $clientunread = $data['clientunread'];
- $tstatus = getStatusColour( $tstatus );
- $dept = getDepartmentName( $deptid );
- if ($urgency == 'Low') {
- $urgency = $_LANG['supportticketsticketurgencylow'];
- } else {
- if ($urgency == 'Medium') {
- $urgency = $_LANG['supportticketsticketurgencymedium'];
- } else {
- if ($urgency == 'High') {
- $urgency = $_LANG['supportticketsticketurgencyhigh'];
- }
- }
- }
- $tickets[] = array( 'id' => $id, 'tid' => $tid, 'c' => $c, 'date' => $date, 'department' => $dept, 'subject' => $subject, 'status' => $tstatus, 'urgency' => $urgency, 'unread' => $clientunread );
- }
- $smarty->assign( 'tickets', $tickets );
- $totalbalance = 0;
- $invoices = array( );
- $result = select_query( 'tblinvoices', 'tblinvoices.*,total-COALESCE((SELECT SUM(amountin) FROM tblaccounts WHERE tblaccounts.invoiceid=tblinvoices.id),0) AS balance', array( 'userid' => $_SESSION['uid'], 'status' => 'Unpaid', '(select count(id) from tblinvoiceitems where invoiceid=tblinvoices.id and type=\'Invoice\')' => array( 'sqltype' => '<=', 'value' => 0 ) ), 'id', 'DESC' );
- while ($data = mysql_fetch_array( $result )) {
- $id = $data['id'];
- $invoicenum = $data['invoicenum'];
- $date = $data['date'];
- $duedate = $data['duedate'];
- $total = $data['total'];
- $balance = $data['balance'];
- $status = $data['status'];
- $totalbalance += $balance;
- $date = fromMySQLDate( $date );
- $duedate = fromMySQLDate( $duedate );
- if (!$invoicenum) {
- $invoicenum = $id;
- }
- $invoices[] = array( 'id' => $id, 'invoicenum' => $invoicenum, 'datecreated' => $date, 'datedue' => $duedate, 'total' => formatCurrency( $total ), 'balance' => formatCurrency( $balance ), 'status' => getInvoiceStatusColour( $status ) );
- }
- $smarty->assign( 'invoices', $invoices );
- $smarty->assign( 'totalbalance', formatCurrency( $totalbalance ) );
- $smarty->assign( 'masspay', $CONFIG['EnableMassPay'] );
- $files = array( );
- $result = select_query( 'tblclientsfiles', '', array( 'userid' => $_SESSION['uid'], 'adminonly' => '' ), 'title', 'ASC' );
- while ($data = mysql_fetch_assoc( $result )) {
- $id = $data['id'];
- $title = $data['title'];
- $filename = $data['filename'];
- $filename = substr( $filename, 11 );
- $date = fromMySQLDate( $data['dateadded'] );
- $files[] = array( 'id' => $id, 'date' => $date, 'title' => $title, 'filename' => $filename );
- }
- $smarty->assign( 'files', $files );
- $smarty->assign( 'addfundsenabled', $CONFIG['AddFundsEnabled'] );
- $addons_html = run_hook( 'ClientAreaHomepage', array( ) );
- $smarty->assign( 'addons_html', $addons_html );
- } else {
- if ($action == 'details') {
- checkContactPermission( 'profile' );
- $templatefile = 'clientareadetails';
- $smartyvalues['ccenabled'] = clientarea_CCLink( );
- $uneditablefields = explode( ',', $CONFIG['ClientsProfileUneditableFields'] );
- $smartyvalues['uneditablefields'] = $uneditablefields;
- $updatefieldsarray = array( 'firstname' => 'First Name', 'lastname' => 'Last Name', 'companyname' => 'Company Name', 'email' => 'Email Address', 'address1' => 'Address 1', 'address2' => 'Address 2', 'city' => 'City', 'state' => 'State', 'postcode' => 'Postcode', 'country' => 'Country', 'phonenumber' => 'Phone Number', 'billingcid' => 'Billing Contact' );
- if ($save) {
- $existingclientsdetails = getClientsDetails( $_SESSION['uid'] );
- foreach ($updatefieldsarray as $field => $displayname) {
- if (in_array( $field, $uneditablefields )) {
- $$field = $existingclientsdetails[$field];
- continue;
- }
- }
- $errormessage = checkDetailsareValid( $firstname, $lastname, $email, $address1, $city, $state, $postcode, $phonenumber, '', '', '', true );
- $errormessage .= checkCustomFields( $_POST['customfield'] );
- if (!$errormessage) {
- $changelist = '';
- $old_customfieldsarray = getCustomFields( 'client', '', $_SESSION['uid'], '', '' );
- $updateqry = array( );
- foreach ($updatefieldsarray as $field => $displayname) {
- if (!in_array( $field, $uneditablefields )) {
- $updateqry[$field] = $$field;
- }
- if ($$field != $existingclientsdetails[$field]) {
- $changelist .= '' . $displayname . ': \'' . $existingclientsdetails[$field] . '\' to \'' . $$field . '\'<br>
- ';
- continue;
- }
- }
- update_query( 'tblclients', $updateqry, array( 'id' => $_SESSION['uid'] ) );
- $customfields = getCustomFields( 'client', '', $_SESSION['uid'], '', '' );
- foreach ($customfields as $v) {
- $k = $v['id'];
- $customfieldsarray[$k] = $_POST['customfield'][$k];
- }
- saveCustomFields( $_SESSION['uid'], $customfieldsarray );
- run_hook( 'ClientEdit', array_merge( array( 'userid' => $_SESSION['uid'], 'olddata' => $existingclientsdetails ), $updateqry ) );
- if ($CONFIG['SendEmailNotificationonUserDetailsChange'] == 'on') {
- foreach ($old_customfieldsarray as $values) {
- if ($values['value'] != $_POST['customfield'][$values['id']]) {
- $changelist .= $values['name'] . ': \'' . $values['value'] . '\' to \'' . $_POST['customfield'][$values['id']] . '\'<br>
- ';
- continue;
- }
- }
- if ($changelist) {
- $adminurl = ($CONFIG['SystemSSLURL'] ? $CONFIG['SystemSSLURL'] : $CONFIG['SystemURL']);
- if (!$customadminpath) {
- $customadminpath = 'admin';
- }
- $adminurl .= '/' . $customadminpath . '/clientssummary.php?userid=' . $_SESSION['uid'];
- sendAdminNotification( 'account', 'WHMCS User Details Change', '' . '<p>Client ID: <a href="' . $adminurl . '">' . $_SESSION['uid'] . ' - ' . $existingclientsdetails['firstname'] . ' ' . $existingclientsdetails['lastname'] . ( '' . '</a> has requested to change his/her details as indicated below:<br><br>' . $changelist . '<br>If you are unhappy with any of the changes, you need to login and revert them - this is the only record of the old details.</p>' ) );
- logActivity( 'Client Profile Modified - ' . substr( str_replace( '<br>
- ', ', ', $changelist ), 0, 0 - 2 ) . ' - User ID: ' . $_SESSION['uid'] );
- }
- }
- $smartyvalues['successful'] = true;
- } else {
- $smarty->assign( 'errormessage', $errormessage );
- }
- }
- if (!$errormessage) {
- $existingclientsdetails = getClientsDetails( $_SESSION['uid'] );
- foreach ($updatefieldsarray as $field => $displayname) {
- $$field = $existingclientsdetails[$field];
- }
- }
- include( 'includes/countries.php' );
- $countriesdropdown = getCountriesDropDown( $country );
- $smarty->assign( 'clientfirstname', $firstname );
- $smarty->assign( 'clientlastname', $lastname );
- $smarty->assign( 'clientcompanyname', $companyname );
- $smarty->assign( 'clientemail', $email );
- $smarty->assign( 'clientaddress1', $address1 );
- $smarty->assign( 'clientaddress2', $address2 );
- $smarty->assign( 'clientcity', $city );
- $smarty->assign( 'clientstate', $state );
- $smarty->assign( 'clientpostcode', $postcode );
- $smarty->assign( 'clientcountry', $countries[$country] );
- $smarty->assign( 'clientcountriesdropdown', $countriesdropdown );
- $smarty->assign( 'clientphonenumber', $phonenumber );
- $customfields = getCustomFields( 'client', '', $_SESSION['uid'], '', '', $_POST['customfield'] );
- $smarty->assign( 'customfields', $customfields );
- $result = select_query( 'tblcontacts', '', array( 'userid' => $_SESSION['uid'] ), 'firstname` ASC,`lastname', 'ASC' );
- while ($data = mysql_fetch_array( $result )) {
- $contactsarray[] = array( 'id' => $data['id'], 'name' => $data['firstname'] . ' ' . $data['lastname'], 'email' => $data['email'] );
- }
- $smartyvalues['contacts'] = $contactsarray;
- $smarty->assign( 'billingcid', $billingcid );
- } else {
- if ($action == 'contacts') {
- $templatefile = 'clientareacontacts';
- $smartyvalues['breadcrumbnav'] = '<a href="index.php">' . $_LANG['globalsystemname'] . '</a> > <a href="clientarea.php">' . $_LANG['clientareatitle'] . '</a> > <a href="clientarea.php?action=details">' . $_LANG['clientareanavdetails'] . '</a> > <a href="clientarea.php?action=contacts">' . $_LANG['clientareanavcontacts'] . '</a>';
- $smartyvalues['ccenabled'] = clientarea_CCLink( );
- checkContactPermission( 'contacts' );
- if ($id) {
- $result = select_query( 'tblcontacts', 'id,subaccount', array( 'userid' => $_SESSION['uid'], 'id' => $id ) );
- $data = mysql_fetch_array( $result );
- if (!$data['id']) {
- exit( 'Invalid Access Attempt' );
- }
- $oldsubaccountval = $data['subaccount'];
- }
- if ($delete) {
- delete_query( 'tblcontacts', array( 'userid' => $_SESSION['uid'], 'id' => $id ) );
- header( 'Location: clientarea.php?action=contacts' );
- exit( );
- }
- if ($submit) {
- $errormessage = checkContactDetails( $firstname, $lastname, $email, $address1, $city, $state, $postcode, $phonenumber );
- if ($subaccount) {
- $result = select_query( 'tblclients', 'COUNT(*)', array( 'email' => $email ) );
- $data = mysql_fetch_array( $result );
- $result = select_query( 'tblcontacts', 'COUNT(*)', array( 'email' => $email, 'id' => array( 'sqltype' => 'NEQ', 'value' => $id ) ) );
- $data2 = mysql_fetch_array( $result );
- if ($data[0] + $data2[0]) {
- $errormessage .= '<li>' . $_LANG['ordererroruserexists'];
- }
- if (( trim( $password ) || ( !$oldsubaccountval && $subaccount ) )) {
- if (!trim( $password2 )) {
- $errormessage .= '<li>' . $_LANG['clientareaerrorpasswordconfirm'];
- } else {
- if ($password != $password2) {
- $errormessage .= '<li>' . $_LANG['clientareaerrorpasswordnotmatch'];
- } else {
- $errormessage .= checkPasswordStrength( $password );
- }
- }
- }
- } else {
- $password = $permissions = '';
- }
- $smartyvalues['errormessage'] = $errormessage;
- if (!$errormessage) {
- $subaccount = ($subaccount ? '1' : '0');
- if ($permissions) {
- $permissions = implode( ',', $permissions );
- }
- $array = array( 'firstname' => $firstname, 'lastname' => $lastname, 'companyname' => $companyname, 'email' => $email, 'address1' => $address1, 'address2' => $address2, 'city' => $city, 'state' => $state, 'postcode' => $postcode, 'country' => $country, 'phonenumber' => $phonenumber, 'subaccount' => $subaccount, 'permissions' => $permissions, 'generalemails' => $generalemails, 'productemails' => $productemails, 'domainemails' => $domainemails, 'invoiceemails' => $invoiceemails, 'supportemails' => $supportemails );
- if ($password) {
- $array['password'] = generateClientPW( $password );
- }
- run_hook( 'ContactEdit', array_merge( array( 'userid' => $_SESSION['uid'], 'contactid' => $id ), $array ) );
- update_query( 'tblcontacts', $array, array( 'userid' => $_SESSION['uid'], 'id' => $id ) );
- logActivity( '' . 'Client Contact Modified - Contact ID: ' . $id . ' - User ID: ' . $_SESSION['uid'] );
- $smartyvalues['successful'] = true;
- }
- }
- if ($success) {
- $smartyvalues['successful'] = true;
- }
- $result = select_query( 'tblcontacts', '', array( 'userid' => $_SESSION['uid'] ) );
- while ($data = mysql_fetch_array( $result )) {
- if (!$id) {
- $id = $data['id'];
- }
- $contactsarray[] = array( 'id' => $data['id'], 'name' => $data['firstname'] . ' ' . $data['lastname'], 'email' => $data['email'] );
- }
- $smartyvalues['contacts'] = $contactsarray;
- include( 'includes/countries.php' );
- $smartyvalues['contactid'] = $id;
- if (!$errormessage) {
- $result = select_query( 'tblcontacts', '', array( 'userid' => $_SESSION['uid'], 'id' => $id ) );
- $data = mysql_fetch_array( $result );
- $id = $data['id'];
- $firstname = $data['firstname'];
- $lastname = $data['lastname'];
- $companyname = $data['companyname'];
- $email = $data['email'];
- $address1 = $data['address1'];
- $address2 = $data['address2'];
- $city = $data['city'];
- $state = $data['state'];
- $postcode = $data['postcode'];
- $country = $data['country'];
- $phonenumber = $data['phonenumber'];
- $subaccount = $data['subaccount'];
- $permissions = explode( ',', $data['permissions'] );
- $generalemails = $data['generalemails'];
- $productemails = $data['productemails'];
- $domainemails = $data['domainemails'];
- $invoiceemails = $data['invoiceemails'];
- $supportemails = $data['supportemails'];
- }
- $smartyvalues['contactfirstname'] = $firstname;
- $smartyvalues['contactlastname'] = $lastname;
- $smartyvalues['contactcompanyname'] = $companyname;
- $smartyvalues['contactemail'] = $email;
- $smartyvalues['contactaddress1'] = $address1;
- $smartyvalues['contactaddress2'] = $address2;
- $smartyvalues['contactcity'] = $city;
- $smartyvalues['contactstate'] = $state;
- $smartyvalues['contactpostcode'] = $postcode;
- $smartyvalues['contactphonenumber'] = $phonenumber;
- $smartyvalues['countriesdropdown'] = getCountriesDropDown( $country );
- $smartyvalues['subaccount'] = $subaccount;
- $smartyvalues['permissions'] = $permissions;
- $smartyvalues['generalemails'] = $generalemails;
- $smartyvalues['productemails'] = $productemails;
- $smartyvalues['domainemails'] = $domainemails;
- $smartyvalues['invoiceemails'] = $invoiceemails;
- $smartyvalues['supportemails'] = $supportemails;
- } else {
- if ($action == 'addcontact') {
- $templatefile = 'clientareaaddcontact';
- $smartyvalues['breadcrumbnav'] = '<a href="index.php">' . $_LANG['globalsystemname'] . '</a> > <a href="clientarea.php">' . $_LANG['clientareatitle'] . '</a> > <a href="clientarea.php?action=details">' . $_LANG['clientareanavdetails'] . '</a> > <a href="clientarea.php?action=addcontact">' . $_LANG['clientareanavaddcontact'] . '</a>';
- $smartyvalues['ccenabled'] = clientarea_CCLink( );
- checkContactPermission( 'contacts' );
- include( 'includes/countries.php' );
- if ($submit) {
- $errormessage = checkContactDetails( $firstname, $lastname, $email, $address1, $city, $state, $postcode, $phonenumber );
- if ($subaccount) {
- $result = select_query( 'tblclients', 'COUNT(*)', array( 'email' => $email ) );
- $data = mysql_fetch_array( $result );
- $result = select_query( 'tblcontacts', 'COUNT(*)', array( 'email' => $email ) );
- $data2 = mysql_fetch_array( $result );
- if ($data[0] + $data2[0]) {
- $errormessage .= '<li>' . $_LANG['ordererroruserexists'];
- }
- if (trim( $password )) {
- if (!trim( $password2 )) {
- $errormessage .= '<li>' . $_LANG['clientareaerrorpasswordconfirm'];
- } else {
- if ($password != $password2) {
- $errormessage .= '<li>' . $_LANG['clientareaerrorpasswordnotmatch'];
- } else {
- $errormessage .= checkPasswordStrength( $password );
- }
- }
- } else {
- $errormessage .= '<li>' . $_LANG['ordererrorpassword'];
- }
- } else {
- $password = $permissions = '';
- }
- $smartyvalues['errormessage'] = $errormessage;
- if (!$errormessage) {
- $contactid = addContact( $_SESSION['uid'], $firstname, $lastname, $companyname, $email, $address1, $address2, $city, $state, $postcode, $country, $phonenumber, $password, $permissions, $generalemails, $productemails, $domainemails, $invoiceemails, $supportemails );
- header( '' . 'Location: clientarea.php?action=contacts&id=' . $contactid . '&success=1' );
- exit( );
- }
- }
- if (!$permissions) {
- $permissions = array( );
- }
- $smartyvalues['contactfirstname'] = $firstname;
- $smartyvalues['contactlastname'] = $lastname;
- $smartyvalues['contactcompanyname'] = $companyname;
- $smartyvalues['contactemail'] = $email;
- $smartyvalues['contactaddress1'] = $address1;
- $smartyvalues['contactaddress2'] = $address2;
- $smartyvalues['contactcity'] = $city;
- $smartyvalues['contactstate'] = $state;
- $smartyvalues['contactpostcode'] = $postcode;
- $smartyvalues['contactphonenumber'] = $phonenumber;
- $smartyvalues['countriesdropdown'] = getCountriesDropDown( $country );
- $smartyvalues['subaccount'] = $subaccount;
- $smartyvalues['permissions'] = $permissions;
- $smartyvalues['generalemails'] = $generalemails;
- $smartyvalues['productemails'] = $productemails;
- $smartyvalues['domainemails'] = $domainemails;
- $smartyvalues['invoiceemails'] = $invoiceemails;
- $smartyvalues['supportemails'] = $supportemails;
- } else {
- if ($action == 'creditcard') {
- checkContactPermission( 'invoices' );
- $templatefile = 'clientareacreditcard';
- $smartyvalues['breadcrumbnav'] = '<a href="index.php">' . $_LANG['globalsystemname'] . '</a> > <a href="clientarea.php">' . $_LANG['clientareatitle'] . '</a> > <a href="clientarea.php?action=details">' . $_LANG['clientareanavdetails'] . '</a> > <a href="clientarea.php?action=creditcard">' . $_LANG['clientareanavchangecc'] . '</a>';
- if (!clientarea_CCLink( )) {
- header( 'Location: clientarea.php' );
- exit( );
- }
- $smartyvalues['ccenabled'] = true;
- $result = select_query( 'tblpaymentgateways', 'gateway', array( 'setting' => 'type', 'value' => 'CC' ) );
- while ($data = mysql_fetch_array( $result )) {
- $gateway = $data['gateway'];
- if (function_exists( $gateway . '_remoteupdate' )) {
- $params = getGatewayVariables( $gateway );
- $result = select_query( 'tblclients', 'gatewayid', array( 'id' => $_SESSION['uid'] ) );
- $data = mysql_fetch_array( $result );
- $params['gatewayid'] = $data['gatewayid'];
- $remoteupdatecode = call_user_func( $gateway . '_remoteupdate', $params );
- if (!$remoteupdatecode) {
- $remoteupdatecode = $_LANG['creditcardupdatenotpossible'];
- }
- $smartyvalues['remoteupdatecode'] = $remoteupdatecode;
- continue;
- }
- }
- if ($submit) {
- $errormessage = updateCCDetails( $_SESSION['uid'], $cctype, $ccnumber, $ccexpirymonth . $ccexpiryyear, $ccstartmonth . $ccstartyear, $ccissuenum );
- if (!$errormessage) {
- $smartyvalues['successful'] = true;
- }
- }
- if (( $delete && $CONFIG['CCAllowCustomerDelete'] )) {
- updateCCDetails( $_SESSION['uid'], '', '', '', '', '' );
- update_query( 'tblclients', array( 'gatewayid' => '' ), array( 'id' => $_SESSION['uid'] ) );
- $errormessage = '<li>' . $_LANG['creditcarddeleteconfirmation'];
- }
- $smartyvalues['errormessage'] = $errormessage;
- $data = getCCDetails( $_SESSION['uid'] );
- $smartyvalues['cardtype'] = $data['cardtype'];
- $smartyvalues['cardnum'] = $data['cardnum'];
- $smartyvalues['cardexp'] = $data['expdate'];
- $smartyvalues['cardstart'] = $data['startdate'];
- $smartyvalues['cardissuenum'] = $data['issuenumber'];
- $acceptedcctypes = $CONFIG['AcceptedCardTypes'];
- $acceptedcctypes = explode( ',', $acceptedcctypes );
- $smartyvalues['acceptedcctypes'] = $acceptedcctypes;
- $smartyvalues['showccissuestart'] = $CONFIG['ShowCCIssueStart'];
- $smartyvalues['allowcustomerdelete'] = $CONFIG['CCAllowCustomerDelete'];
- } else {
- if ($action == 'changepw') {
- $templatefile = 'clientareachangepw';
- $smartyvalues['breadcrumbnav'] = '<a href="index.php">' . $_LANG['globalsystemname'] . '</a> > <a href="clientarea.php">' . $_LANG['clientareatitle'] . '</a> > <a href="clientarea.php?action=details">' . $_LANG['clientareanavdetails'] . '</a> > <a href="clientarea.php?action=changepw">' . $_LANG['clientareanavchangepw'] . '</a>';
- $smartyvalues['ccenabled'] = clientarea_CCLink( );
- if ($submit) {
- $existingpw = html_entity_decode( $existingpw );
- $newpw = html_entity_decode( $newpw );
- $confirmpw = html_entity_decode( $confirmpw );
- if ($_SESSION['cid']) {
- $result = select_query( 'tblcontacts', 'password', array( 'id' => $_SESSION['cid'], 'userid' => $_SESSION['uid'] ) );
- } else {
- $result = select_query( 'tblclients', 'password', array( 'id' => $_SESSION['uid'] ) );
- }
- $data = mysql_fetch_array( $result );
- $pwderror = false;
- if ($CONFIG['NOMD5']) {
- $existingpwd = decrypt( $data['password'] );
- if ($existingpw != $existingpwd) {
- $pwderror = true;
- }
- } else {
- $existingpwd = $data['password'];
- $salt = explode( ':', $existingpwd );
- $salt = $salt[1];
- if (generateClientPW( $existingpw, $salt ) != $existingpwd) {
- $pwderror = true;
- }
- }
- ..........................
- ...............
- .......
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement