0) unsetPostRequestElement('ok'); } // END - if if ((isFormSent()) && (count($formErrors) == 0)) { // Generate message array $messageArray = array( 'failed' => '{--SPONSOR_REGISTRATION_FAILED--}', 'added' => '{--SPONSOR_REGISTRATION_COMPLETED--}', ); // Calulate points $result = SQL_QUERY_ESC('SELECT (`pay_rate` * `pay_min_count`) AS `points`, `pay_min_count`, `pay_currency` FROM `{?_MYSQL_PREFIX?}_sponsor_paytypes` WHERE `id`=%s LIMIT 1', array(postRequestElement('pay_type')), __FILE__, __LINE__); list($points, $pay, $curr) = SQL_FETCHROW($result); // Free memory SQL_FREERESULT($result); // Add points to array postRequestElement('points_amount', $points); postRequestElement('points_used' , '0.00000'); postRequestElement('last_payment' , $pay); postRequestElement('last_currency', $curr); // Register sponsor but never ever update here! $message = doProcessSponsorFormRequest($messageArray); // Display message displayMessage($message); } else { // Check for payment types $result = SQL_QUERY('SELECT `id`,`pay_name`,`pay_rate`,`pay_currency`,`pay_min_count` FROM `{?_MYSQL_PREFIX?}_sponsor_paytypes` ORDER BY `pay_name` ASC', __FILE__, __LINE__); if (!SQL_HASZERONUMS($result)) { // Load all types... $OUT = ''; while ($content = SQL_FETCHARRAY($result)) { // Prepare content for output $content['res'] = translateComma($content['pay_rate'] * $content['pay_min_count']); // Load row template and switch color $OUT .= loadTemplate('guest_sponsor_payment_row', true, $content); } // END - while // Remember the list in table $content['payment_list'] = loadTemplate('guest_sponsor_payment', true, $OUT); // Init a lot array elements foreach (array('company','position','tax_ident','gender_m','gender_f','gender_c','surname','family','street_nr1','street_nr2','country','zip','city','phone','fax','cell','email','url','receive_warnings_y','receive_warnings_n','form_errors','refid') as $entry) { $content[$entry] = ''; } // END - foreach // Check for invalid entries if (count($formErrors) > 0) { // Some found... :-( foreach (array('company','position','tax_ident','surname','family','street_nr1','street_nr2','country','zip','city','phone','fax','cell','email','url') as $entry) { $content[$entry] = postRequestElement($entry); } // END - foreach // Init receive selection $content['receive_warnings_y'] = ''; $content['receive_warnings_n'] = ''; // Check for receive_warnings $content['receive_warnings_' . strtolower(postRequestElement('receive_warnings'))] = ' selected="selected"'; $OUT = ''; // Errors found? if (count($formErrors) > 0) { $OUT = displayMessage('{--SPONSOR_REGISTER_SOMETHING_MISSING--}', true); $OUT .= '
    '; foreach ($formErrors as $error) { $OUT .= '
  1. ' . $error . '
  2. '; } // END - foreach $OUT .= '
'; } // END - if $content['form_errors'] = $OUT; // @TODO Maybe a default referral id? $content['refid'] = 0; // Is the referral id valid? if ((isPostRequestElementSet('refid')) && (isValidUserId(postRequestElement('refid')))) { // Transfer referral id $content['refid'] = bigintval(postRequestElement('refid')); } // END - if } // END - if // Display registration form loadTemplate('guest_sponsor_reg', false, $content); } else { // Nothing added so far displayMessage('{--SPONSOR_PAYMENT_LIST_EMPTY--}'); } // Free memory SQL_FREERESULT($result); } // [EOF] ?>