function mlm_payment_settings() { global $wpdb; //get database table prefix $table_prefix = mlm_core_get_table_prefix(); $error = ''; $chk = 'error'; $pageurl = get_bloginfo('url') . "/wp-admin/admin.php?page=admin-mlm-payment-settings"; // save Payment Method here if (isset($_POST['updateoption'])) { update_option('wp_mlm_payment_method', $_POST); } //Update Paypal settings if (isset($_POST['updatepaypaloption'])) { update_option('wp_mlm_paypal_settings', $_POST); } if (isset($_POST['fieldupdate'])) { update_option('wp_mlm_paypal_field_settings', $_POST); } //most outer if condition if (isset($_POST['mlm_payment_settings'])) { $site_address = sanitize_text_field($_POST['mlm-site-address']); $shared_key = sanitize_text_field($_POST['mlm-pre-shared-key']); $merchant_id = sanitize_text_field($_POST['mlm-merchant-id']); $password = sanitize_text_field($_POST['mlm-merchant-password']); if (checkInputField($site_address)) { $error .= "\n Please Select your website address."; } if (checkInputField($shared_key)) { $error .= "\n Please specify Pre Shared Key."; } if (checkInputField($merchant_id)) { $error .= "\n Please specify Merchant ID."; } if (checkInputField($password)) { $error .= "\n Please specify Password."; } //if any error occoured if (!empty($error)) { $error = nl2br($error); } else { $chk = ''; update_option('wp_mlm_payment_settings', $_POST); $url = get_bloginfo('url') . "/wp-admin/admin.php?page=admin-mlm-payment-settings"; _e("<script>window.location='{$url}'</script>"); $msg = "<span style='color:green;'>Your Payment settings has been successfully updated.</span>"; } } // end outer if condition if ($chk != '') { $mlm_settings = get_option('wp_mlm_payment_settings'); $mlm_paypal_settings = get_option('wp_mlm_paypal_payment_settings'); $mlm_method = get_option('wp_mlm_payment_method'); $paypal_settings = get_option('wp_mlm_paypal_settings'); $paypal_field_settings = get_option('wp_mlm_paypal_field_settings'); $paypalform = $paypal_field_settings['paypal_form']; ?> <div class='wrap1'> <h2><?php _e('Payment Setting', 'unilevel-mlm-pro'); ?> </h2> <table id="wpsc-payment-gateway-settings" class="wpsc-edit-module-options"> <tbody><tr> <td width="50%" valign="top"> <div class="postbox"> <h3 class="hndle">Select Payment Gateways</h3> <div class="inside"> <p>Activate the payment gateways that you want to make available to your customers by selecting them below.</p> <br> <form name="admin_payment_settings" method="post" action=""> <div class="wpsc-select-gateway"> <div class="wpsc-gateway-actions"> <span class="edit"> <a class="edit-payment-module" data-gateway-id="paypal" title="Edit this Payment Gateway's Settings" href="<?php echo $pageurl; ?> &payment_gateway_id=paypal">Edit</a></span></div> <p><input type="radio" name="mlm_payment_method" value="paypal" id="mlm_paypal_method" <?php if ($mlm_method['mlm_payment_method'] == 'paypal') { echo "checked='checked'"; } ?> > <label for="mlm_paypal_method">Paypal</label></p></div> <div class="wpsc-select-gateway"> <div class="wpsc-gateway-actions"> <span class="edit"> <a class="edit-payment-module" data-gateway-id="cardsave" title="Edit this Payment Gateway's Settings" href="<?php echo $pageurl; ?> &payment_gateway_id=cardsave">Edit</a></span></div> <p> <input type="radio" name="mlm_payment_method" value="cardsave" id="mlm_worldpay_id" <?php if ($mlm_method['mlm_payment_method'] == 'cardsave') { echo "checked='checked'"; } ?> > <label for="mlm_worldpay_id">cardsave</label></p></div> <div class="submit gateway_settings"> <input type="submit" value="Update" name="updateoption" class="button-primary"> </div> </form> </div> </div> </td> <td id="wpsc-payment-gateway-settings-panel" class="wpsc-module-settings" rowspan="2"> <?php if ($error) { ?> <div class="notibar msgerror"> <a class="close"></a> <p> <strong><?php _e('Please Correct the following Error', 'unilevel-mlm-pro'); ?> :</strong> <?php _e($error); ?> </p> </div> <?php } ?> <?php if (empty($mlm_settings) && isset($_GET['payment_gateway_id']) && $_GET['payment_gateway_id'] == 'cardsave') { ?> <div class="postbox"> <h3 class="hndle">Cardsave</h3> <div class="inside"> <form name="admin_payout_settings" method="post" action=""> <table border="0" cellpadding="0" cellspacing="0" width="60%" class="form-table"> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('admin-mlm-site-address');"><?php _e('Website Address', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <input type="text" name="mlm-site-address" id="mlm-site-address" size="30" value="<?php if (!empty($mlm_settings['mlm-site-address'])) { _e($mlm_settings['mlm-site-address']); } ?> "> <div class="toggle-visibility" id="admin-mlm-site-address"><?php _e('Please specify Website Address.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <tr> <th scope="row" class="admin-settings"><a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('admin-mlm-item_name');"><?php _e('Product Name:', 'unilevel-mlm-pro'); ?> </a> </th> <td> <input type="text" size="30" value="<?php if (!empty($mlm_settings['item_name'])) { _e($mlm_settings['item_name'], 'unilevel-mlm-pro'); } ?> " name="item_name"> <div class="toggle-visibility" id="admin-mlm-item_name"><?php _e('Please specify Product Name.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('admin-mlm-pre-shared-key');"><?php _e('Pre Shared Key', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <input type="text" name="mlm-pre-shared-key" id="mlm-pre-shared-key" size="30" value="<?php if (!empty($mlm_settings['mlm-pre-shared-key'])) { _e($mlm_settings['mlm-pre-shared-key']); } ?> "> <div class="toggle-visibility" id="admin-mlm-pre-shared-key"><?php _e('Please specify value of Pre Shared Key.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('admin-mlm-merchant-id');"><?php _e('Merchant ID', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <input type="text" name="mlm-merchant-id" id="mlm-merchant-id" size="30" value="<?php if (!empty($mlm_settings['mlm-merchant-id'])) { _e($mlm_settings['mlm-merchant-id']); } ?> "> <div class="toggle-visibility" id="admin-mlm-merchant-id"><?php _e('Please specify value of Merchant ID.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('admin-mlm-merchant-password');"><?php _e('Password', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <input type="password" name="mlm-merchant-password" id="mlm-merchant-password" size="30" value="<?php if (!empty($mlm_settings['mlm-merchant-password'])) { _e($mlm_settings['mlm-merchant-password']); } ?> "> <div class="toggle-visibility" id="admin-mlm-merchant-password"><?php _e('Please specify value of merchant Password.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> </table> <p class="submit"> <input type="submit" name="mlm_payment_settings" id="mlm_payment_settings" value="<?php _e('Update Options', 'unilevel-mlm-pro'); ?> »" class='button-primary' onclick="needToConfirm = false;"> </p> </form> </div> </div></div> <script language="JavaScript"> populateArrays(); </script> <?php } else { if (!empty($mlm_settings) && isset($_GET['payment_gateway_id']) && $_GET['payment_gateway_id'] == 'cardsave') { ?> <div class="postbox"> <h3 class="hndle">Cardsave</h3> <div class="inside"> <form name="admin_payout_settings" method="post" action=""> <table border="0" cellpadding="0" cellspacing="0" width="60%" class="form-table"> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('admin-mlm-site-address');"><?php _e('Website Address', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <input type="text" name="mlm-site-address" id="mlm-site-address" size="30" value="<?php if (!empty($mlm_settings['mlm-site-address'])) { _e($mlm_settings['mlm-site-address']); } ?> "> <div class="toggle-visibility" id="admin-mlm-site-address"><?php _e('Please specify Website Address.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <tr> <th scope="row" class="admin-settings"><a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('admin-mlm-item_name');"><?php _e('Product Name:', 'unilevel-mlm-pro'); ?> </a> </th> <td> <input type="text" size="30" value="<?php if (!empty($mlm_settings['item_name'])) { _e($mlm_settings['item_name'], 'unilevel-mlm-pro'); } ?> " name="item_name"> <div class="toggle-visibility" id="admin-mlm-item_name"><?php _e('Please specify Product Name.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('admin-mlm-pre-shared-key');"><?php _e('Pre Shared Key', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <input type="text" name="mlm-pre-shared-key" id="mlm-pre-shared-key" size="30" value="<?php if (!empty($mlm_settings['mlm-pre-shared-key'])) { _e($mlm_settings['mlm-pre-shared-key']); } ?> "> <div class="toggle-visibility" id="admin-mlm-pre-shared-key"><?php _e('Please specify value of Pre Shared Key.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('admin-mlm-merchant-id');"><?php _e('Merchant ID', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <input type="text" name="mlm-merchant-id" id="mlm-merchant-id" size="30" value="<?php if (!empty($mlm_settings['mlm-merchant-id'])) { _e($mlm_settings['mlm-merchant-id']); } ?> "> <div class="toggle-visibility" id="admin-mlm-merchant-id"><?php _e('Please specify value of Merchant ID.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('admin-mlm-merchant-password');"><?php _e('Password', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <input type="password" name="mlm-merchant-password" id="mlm-merchant-password" size="30" value="<?php if (!empty($mlm_settings['mlm-merchant-password'])) { _e($mlm_settings['mlm-merchant-password']); } ?> "> <div class="toggle-visibility" id="admin-mlm-merchant-password"><?php _e('Please specify value of merchant Password.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> </table> <p class="submit"> <input type="submit" name="mlm_payment_settings" id="mlm_payment_settings" value="<?php _e('Update Options', 'unilevel-mlm-pro'); ?> »" class='button-primary' onclick="needToConfirm = false;"> </p> </form> </div> </div></div> <?php } } if (empty($paypal_settings) && isset($_GET['payment_gateway_id']) && $_GET['payment_gateway_id'] == 'paypal' || empty($paypal_settings) && !isset($_GET['payment_gateway_id'])) { ?> <div class="postbox"> <h3 class="hndle"><?php _e('Paypal', 'unilevel-mlm-pro'); ?> </h3> <div class="inside"> <form action="" method="post" name="admin_paypal_settings" > <table class="form-table"> <tbody> <tr> <td><?php _e('Display Name', 'unilevel-mlm-pro'); ?> </td> <td> <input type="text" name="user_defined_name" value=""><br> <small><?php _e('The text that people see when making a purchase.', 'unilevel-mlm-pro'); ?> </small> </td> </tr> <tr> <td><?php _e('Product Name:', 'unilevel-mlm-pro'); ?> </td> <td> <input type="text" size="40" value="" name="item_name"> </td> </tr> <tr> <td></td> <td colspan="1"> <span class="description"> <?php _e('This will be shown Product Name at PayPal Gateway.', 'unilevel-mlm-pro'); ?> </span> </td> </tr> <tr> <td><?php _e('Username:'******'unilevel-mlm-pro'); ?> </td> <td> <input type="text" size="40" value="" name="paypal_business"> </td> </tr> <tr> <td></td> <td colspan="1"> <span class="description"> <?php _e('This is your PayPal email address.', 'unilevel-mlm-pro'); ?> </span> </td> </tr> <tr> <td><?php _e('Account Type:', 'unilevel-mlm-pro'); ?> </td> <td> <select name="paypal_multiple_url"><option value="https://www.paypal.com/cgi-bin/webscr" selected="selected"><?php _e('Live Account', 'unilevel-mlm-pro'); ?> </option><option value="https://www.sandbox.paypal.com/cgi-bin/webscr"><?php _e('Sandbox Account', 'unilevel-mlm-pro'); ?> </option></select> </td> </tr> <tr> <td colspan="1"> </td> <td> <span class="description"> <?php _e('If you have a PayPal developers Sandbox account please use Sandbox mode, if you just have a standard PayPal account then you will want to use Live mode.', 'unilevel-mlm-pro'); ?> </span> </td> </tr> <tr> <td><?php _e('IPN :', 'unilevel-mlm-pro'); ?> </td> <td> <input type="radio" value="1" name="paypal_ipn" id="paypal_ipn1"> <label for="paypal_ipn1"><?php _e('Yes', 'unilevel-mlm-pro'); ?> </label> <input type="radio" value="0" name="paypal_ipn" id="paypal_ipn2"> <label for="paypal_ipn2"><?php _e('No', 'unilevel-mlm-pro'); ?> </label> </td> </tr> <tr> <td colspan="2"> <span class="description"> <?php _e('IPN (instant payment notification ) will automatically update your sales logs to \'Accepted payment\' when a customers payment is successful. For IPN to work you also need to have IPN turned on in your Paypal settings. If it is not turned on, the sales sill remain as \'Order Pending\' status until manually changed. It is highly recommend using IPN, especially if you are selling digital products.', 'unilevel-mlm-pro'); ?> </span> </td> </tr> <tr class="update_gateway"> <td colspan="2"> <div class="submit"> <input type="submit" value="Update" name="updatepaypaloption"> </div> </td> </tr> </tbody></table> </form> </div> </div> <?php } else { if (!empty($paypal_settings) && isset($_GET['payment_gateway_id']) && $_GET['payment_gateway_id'] == 'paypal' || !empty($paypal_settings) && !isset($_GET['payment_gateway_id'])) { ?> <div class="postbox"> <h3 class="hndle"><?php _e('Paypal', 'unilevel-mlm-pro'); ?> </h3> <div class="inside"> <form action="" method="post" name="admin_paypal_settings" > <table class="form-table"> <tbody> <tr> <td><?php _e('Display Name', 'unilevel-mlm-pro'); ?> </td> <td> <input type="text" name="user_defined_name" value="<?php if (!empty($paypal_settings['user_defined_name'])) { _e($paypal_settings['user_defined_name'], 'unilevel-mlm-pro'); } ?> "><br> <small><?php _e('The text that people see when making a purchase.', 'unilevel-mlm-pro'); ?> </small> </td> </tr> <tr> <td><?php _e('Product Name:', 'unilevel-mlm-pro'); ?> </td> <td> <input type="text" size="40" value="<?php if (!empty($paypal_settings['item_name'])) { _e($paypal_settings['item_name'], 'unilevel-mlm-pro'); } ?> " name="item_name"> </td> </tr> <tr> <td></td> <td colspan="1"> <span class="description"> <?php _e('This will be shown Product Name at PayPal Gateway.', 'unilevel-mlm-pro'); ?> </span> </td> </tr> <tr> <td><?php _e('Username:'******'unilevel-mlm-pro'); ?> </td> <td> <input type="text" size="40" value="<?php if (!empty($paypal_settings['paypal_business'])) { _e($paypal_settings['paypal_business'], 'unilevel-mlm-pro'); } ?> " name="paypal_business"> </td> </tr> <tr> <td></td> <td colspan="1"> <span class="description"> <?php _e('This is your PayPal email address.', 'unilevel-mlm-pro'); ?> </span> </td> </tr> <tr> <td><?php _e('Account Type:', 'unilevel-mlm-pro'); ?> </td> <td> <select name="paypal_multiple_url"> <option value="https://www.paypal.com/cgi-bin/webscr" <?php if (!empty($paypal_settings['paypal_multiple_url']) && $paypal_settings['paypal_multiple_url'] == 'https://www.paypal.com/cgi-bin/webscr') { ?> selected="selected" <?php } ?> ><?php _e('Live Account', 'unilevel-mlm-pro'); ?> </option> <option value="https://www.sandbox.paypal.com/cgi-bin/webscr" <?php if (!empty($paypal_settings['paypal_multiple_url']) && $paypal_settings['paypal_multiple_url'] == 'https://www.sandbox.paypal.com/cgi-bin/webscr') { ?> selected="selected" <?php } ?> ><?php _e('Sandbox Account', 'unilevel-mlm-pro'); ?> </option></select> </td> </tr> <tr> <td colspan="1"> </td> <td> <span class="description"> <?php _e('If you have a PayPal developers Sandbox account please use Sandbox mode, if you just have a standard PayPal account then you will want to use Live mode.', 'unilevel-mlm-pro'); ?> </span> </td> </tr> <tr> <td><?php _e('IPN :', 'unilevel-mlm-pro'); ?> </td> <td> <input type="radio" value="1" name="paypal_ipn" id="paypal_ipn1" <?php if ($paypal_settings['paypal_ipn'] != '' && $paypal_settings['paypal_ipn'] == '1') { ?> checked="checked" <?php } ?> > <label for="paypal_ipn1"><?php _e('Yes', 'unilevel-mlm-pro'); ?> </label> <input type="radio" value="0" name="paypal_ipn" id="paypal_ipn2" <?php if ($paypal_settings['paypal_ipn'] != '' && $paypal_settings['paypal_ipn'] == '0') { ?> checked="checked" <?php } ?> > <label for="paypal_ipn2"><?php _e('No', 'unilevel-mlm-pro'); ?> </label> </td> </tr> <tr> <td colspan="2"> <span class="description"> <?php _e('IPN (instant payment notification ) will automatically update your sales logs to \'Accepted payment\' when a customers payment is successful. For IPN to work you also need to have IPN turned on in your Paypal settings. If it is not turned on, the sales sill remain as \'Order Pending\' status until manually changed. It is highly recommend using IPN, especially if you are selling digital products.', 'unilevel-mlm-pro'); ?> </span> </td> </tr> <tr class="update_gateway"> <td colspan="2"> <div class="submit"> <input type="submit" value="Update" name="updatepaypaloption"> </div> </td> </tr> </tbody></table> </form> </div> </div> <?php } } ?> </td> </tr> </tbody></table> <?php } else { _e($msg); } }
function mlmEligibility() { $error = ''; $chk = 'error'; //most outer if condition if (isset($_POST['mlm_eligibility_settings'])) { $direct_referral = sanitize_text_field($_POST['direct_referral']); $right_referral = sanitize_text_field($_POST['right_referral']); $left_referral = sanitize_text_field($_POST['left_referral']); //$member_in_group=sanitize_text_field( $_POST['member_in_group'] ); if (checkInputField($direct_referral)) { $error .= '<br/>' . __("\n Please specify your direct active referrals.", "binary-mlm-pro"); } if (checkInputField($right_referral)) { $error .= '<br/>' . __("\n Please specify your right leg active referrals.", "binary-mlm-pro"); } if (checkInputField($left_referral)) { $error .= '<br/>' . __("\n Please specify your left leg active referrals.", "binary-mlm-pro"); } //if any error occoured if (!empty($error)) { $error = nl2br($error); } else { $chk = ''; update_option('wp_mlm_eligibility_settings', $_POST); $url = get_bloginfo('url') . "/wp-admin/admin.php?page=admin-settings&tab=payout"; _e("<script>window.location='{$url}'</script>"); $msg = __("<span style='color:green;'>Your eligibility settings has been successfully updated.</span>", "binary-mlm-pro"); } } // end outer if condition if ($chk != '') { $mlm_settings = get_option('wp_mlm_eligibility_settings'); include 'js-validation-file.html'; ?> <div class='wrap1'> <h2><?php _e('Eligibility Settings', 'binary-mlm-pro'); ?> </h2> <div class="notibar msginfo"> <a class="close"></a> <p><?php _e('Use this screen to define the eligibility criteria for a member to start earning commissions in the network.', 'binary-mlm-pro'); ?> </p> <p><strong> <?php _e('No. of Direct Paid Referrals', 'binary-mlm-pro'); ?> -</strong> <?php _e('The number of members that a member will need to directly and personally refer in the network before he can start earning commissions.', 'binary-mlm-pro'); ?> </p> <p><strong> <?php _e('No. of paid referral(s) on right leg', 'binary-mlm-pro'); ?> -</strong> <?php _e('The number of paid direct and personal referrals a member needs to introduce in this right leg before he can start earning commissions.', 'binary-mlm-pro'); ?> </p> <p><strong><?php _e('No. of paid referral(s) on left leg', 'binary-mlm-pro'); ?> -</strong> <?php _e('The number of paid direct and personal referrals a member needs to introduce in this left leg before he can start earning commissions.', 'binary-mlm-pro'); ?> </p> </div> <?php if ($error) { ?> <div class="notibar msgerror"> <a class="close"></a> <p> <strong><?php _e('Please Correct the following Error', 'binary-mlm-pro'); ?> :</strong> <?php echo $error; ?> </p> </div> <?php } $direct_referral = isset($_POST['direct_referral']) ? $_POST['direct_referral'] : (isset($mlm_settings['direct_referral']) ? $mlm_settings['direct_referral'] : ''); $left_referral = isset($_POST['left_referral']) ? $_POST['left_referral'] : (isset($mlm_settings['left_referral']) ? $mlm_settings['left_referral'] : ''); $right_referral = isset($_POST['right_referral']) ? $_POST['right_referral'] : (isset($mlm_settings['right_referral']) ? $mlm_settings['right_referral'] : ''); ?> <form name="admin_eligibility_settings" method="post" action=""> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="form-table"> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;"title="Click for Help!" onclick="toggleVisibility('mlm_direct_referral');"> <?php _e('No. of direct paid referral(s)', 'binary-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <input type="text" name="direct_referral" id="direct_referral" size="10" value="<?php echo $direct_referral; ?> "> <div class="toggle-visibility" id="mlm_direct_referral"><?php _e('Please specify direct referral by you.', 'binary-mlm-pro'); ?> </div> </td> </tr> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;"title="Click for Help!" onclick="toggleVisibility('mlm_right_referral');"> <?php _e('No. of paid referral(s) on right leg', 'binary-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <input type="text" name="right_referral" id="right_referral" size="10" value="<?php echo $right_referral; ?> "> <div class="toggle-visibility" id="mlm_right_referral"><?php _e('Please specify no. of paid referrals on right leg.', 'binary-mlm-pro'); ?> </div> </td> </tr> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;"title="Click for Help!" onclick="toggleVisibility('mlm_left_referral');"> <?php _e('No. of paid referral(s) on left leg', 'binary-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <input type="text" name="left_referral" id="left_referral" size="10" value="<?php echo $left_referral; ?> "> <div class="toggle-visibility" id="mlm_left_referral"><?php _e('Please specify no. of paid referrals on left leg.', 'binary-mlm-pro'); ?> </div> </td> </tr> </table> <p class="submit"> <input type="submit" name="mlm_eligibility_settings" id="mlm_eligibility_settings" value="<?php _e('Update Options', 'binary-mlm-pro'); ?> »" class='button-primary' onclick="needToConfirm = false;"> </p> </form> <script language="JavaScript"> populateArrays(); </script> </div> <?php } else { echo $msg; } }
function register_user_html_page() { global $wpdb; $table_prefix = mlm_core_get_table_prefix(); $error = ''; $chk = 'error'; global $current_user; get_currentuserinfo(); $user_roles = $current_user->roles; $user_role = array_shift($user_roles); if (!empty($_GET['sp_name'])) { $sp_name = $_GET['sp_name']; ?> <script>$.cookie('s_name','<?php echo $sp_name; ?> ',{ path: '/' });</script> <?php //setcookie("s_name", $sp_name); } else { if (!empty($_GET['sp'])) { $sp_name = getusernamebykey($_GET['sp']); ?> <script>$.cookie('s_name','<?php echo $sp_name; ?> ',{ path: '/' });</script> <?php } else { $sp_name = $_COOKIE["s_name"]; } } //echo $_COOKIE["s_name"]."hello"; //get no. of level $mlm_general_settings = get_option('wp_mlm_general_settings'); $mlm_no_of_level = $mlm_general_settings['mlm-level']; $mlm_pay_settings = get_option('wp_mlm_payment_settings'); $mlm_method = get_option('wp_mlm_payment_method'); if (is_user_logged_in()) { $sponsor_name = $current_user->user_login; $readonly_sponsor = 'readonly'; $spnsr_set = 1; } else { if (isset($_REQUEST['sp_name']) && $_REQUEST['sp_name'] != '') { //$sponsorName = getusernamebykey($_REQUEST['sp']); $sponsorName = $_REQUEST['sp_name']; if (isset($sponsorName) && $sponsorName != '') { $readonly_sponsor = 'readonly'; $sponsor_name = $sponsorName; } else { redirectPage(home_url(), array()); exit; } } else { if (isset($_COOKIE["s_name"]) && $_COOKIE["s_name"] != '') { $readonly_sponsor = 'readonly'; $sponsor_name = $_COOKIE["s_name"]; } else { if (isset($_REQUEST['sp']) && $_REQUEST['sp'] != '') { //$sponsorName = getusernamebykey($_REQUEST['sp']); $sponsorName = getusernamebykey($_REQUEST['sp']); if (isset($sponsorName) && $sponsorName != '') { $readonly_sponsor = 'readonly'; $sponsor_name = $sponsorName; } else { redirectPage(home_url(), array()); exit; } } else { // $sponsor_name = get_top_level_user(); //$readonly_sponsor = 'readonly'; $readonly_sponsor = ''; } } } } //most outer if condition if (isset($_POST['submit'])) { $firstname = sanitize_text_field($_POST['firstname']); $lastname = sanitize_text_field($_POST['lastname']); $username = sanitize_text_field($_POST['username']); /******* check for the epin field ******/ if (isset($_POST['epin']) && !empty($_POST['epin'])) { $epin = sanitize_text_field($_POST['epin']); } else { if (isset($_POST['epin']) && empty($_POST['epin'])) { $epin = ''; } } /******* check for the epin field ******/ $password = sanitize_text_field($_POST['password']); $confirm_pass = sanitize_text_field($_POST['confirm_password']); $email = sanitize_text_field($_POST['email']); $confirm_email = sanitize_text_field($_POST['confirm_email']); $sponsor = sanitize_text_field($_POST['sponsor']); /*$address1 = sanitize_text_field( $_POST['address1'] ); $address2 = sanitize_text_field( $_POST['address2'] ); city = sanitize_text_field( $_POST['city'] ); $state = sanitize_text_field( $_POST['state'] ); $postalcode = sanitize_text_field( $_POST['postalcode'] ); $telephone = sanitize_text_field( $_POST['telephone'] ); $dob = sanitize_text_field( $_POST['dob'] );*/ //Add usernames we don't want used $invalid_usernames = array('admin'); //Do username validation $username = sanitize_user($username); if (!validate_username($username) || in_array($username, $invalid_usernames)) { $error .= "\n Username is invalid."; } if (username_exists($username)) { $error .= "\n Username already exists."; } /******* check for the epin field ******/ if (!empty($epin) && epin_exists($epin)) { $error .= "\n ePin already issued or wrong ePin."; } if (!empty($mlm_general_settings['sol_payment']) && empty($epin)) { $error .= "\n Please enter your ePin."; } else { if (empty($_POST['epin_value']) && empty($epin)) { $error .= "\n Please either enter the ePin or select the Product."; } } /******* check for the epin field ******/ if (checkInputField($password)) { $error .= "\n Please enter your password."; } if (confirmPassword($password, $confirm_pass)) { $error .= "\n Please confirm your password."; } //Do e-mail address validation if (!is_email($email)) { $error .= "\n E-mail address is invalid."; } if (email_exists($email)) { $error .= "\n E-mail address is already in use."; } if (confirmEmail($email, $confirm_email)) { $error .= "\n Please confirm your email address."; } if (checkInputField($firstname)) { $error .= "\n Please enter your first name."; } if (checkInputField($lastname)) { $error .= "\n Please enter your last name."; } if (checkInputField($sponsor) && !empty($sponsor)) { $error .= "\n Please enter your sponsor name."; } if (is_plugin_active('mlm-paypal-mass-pay/load-data.php')) { $paypalId = sanitize_text_field($_POST['paypal_id']); if (checkInputField($paypalId)) { $error .= "\n Please enter your Paypal id."; } } /*if ( checkInputField($address1) ) $error .= "\n Please enter your address."; if ( checkInputField($city) ) $error .= "\n Please enter your city."; if ( checkInputField($state) ) $error .= "\n Please enter your state."; if ( checkInputField($postalcode) ) $error .= "\n Please enter your postal code."; if ( checkInputField($telephone) ) $error .= "\n Please enter your contact number."; if ( checkInputField($dob) ) $error .= "\n Please enter your date of birth.";*/ //Case If User is not fill the Sponser field if (empty($_POST['sponsor'])) { $sponsor = get_top_level_user(); } $sql = "SELECT COUNT(*) num, `user_key` \n\t\t\t\tFROM {$table_prefix}mlm_users \n\t\t\t\tWHERE `username` = '" . $sponsor . "'"; $intro = $wpdb->get_row($sql); //generate random numeric key for new user registration $user_key = generateKey(); //if generated key is already exist in the DB then again re-generate key do { $check = $wpdb->get_var("SELECT COUNT(*) ck \n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM {$table_prefix}mlm_users \n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `user_key` = '" . $user_key . "'"); $flag = 1; if ($check == 1) { $user_key = generateKey(); $flag = 0; } } while ($flag == 0); // outer if condition if (empty($error)) { // inner if condition if ($intro->num == 1) { $sponsor = $intro->user_key; $sponsor1 = $sponsor; //find parent key if (!empty($_GET['k']) && $_GET['k'] != '') { $parent_key = $_GET['k']; } else { $readonly_sponsor = ''; $parent_key = $sponsor; } $user = array('user_login' => $username, 'user_pass' => $password, 'first_name' => $firstname, 'last_name' => $lastname, 'user_email' => $email, 'role' => 'mlm_user'); // return the wp_users table inserted user's ID $user_id = wp_insert_user($user); //get the selected country name from the country table $country = $_POST['country']; $sql = "SELECT name \n\t\t\t\t\t\tFROM {$table_prefix}mlm_country\n\t\t\t\t\t\tWHERE id = '" . $country . "'"; $country1 = $wpdb->get_var($sql); //insert the registration form data into user_meta table /*add_user_meta( $user_id, 'user_address1', $address1, FALSE ); add_user_meta( $user_id, 'user_address2', $address2, FALSE ); add_user_meta( $user_id, 'user_city', $city, FALSE ); add_user_meta( $user_id, 'user_state', $state, FALSE ); add_user_meta( $user_id, 'user_country', $country1, FALSE ); add_user_meta( $user_id, 'user_postalcode', $postalcode, FALSE ); add_user_meta( $user_id, 'user_telephone', $telephone, FALSE ); add_user_meta( $user_id, 'user_dob', $dob, FALSE);*/ /*Send e-mail to admin and new user - You could create your own e-mail instead of using this function*/ wp_new_user_notification($user_id, $password); if (!empty($epin)) { $pointResult = $wpdb->get_row("select p_id,point_status from {$table_prefix}mlm_epins where epin_no = '{$epin}'"); $pointStatus = $pointResult->point_status; $productPrice = $wpdb->get_var("SELECT product_price FROM {$table_prefix}mlm_product_price WHERE p_id = '" . $pointResult->p_id . "'"); // to epin point status 1 if ($pointStatus[0] == '1') { $paymentStatus = '1'; } else { if ($pointStatus[0] == '0') { $paymentStatus = '2'; } } } else { if (!empty($_POST['epin_value'])) { $productPrice = $wpdb->get_var("SELECT product_price FROM {$table_prefix}mlm_product_price WHERE p_id = '" . $_POST['epin_value'] . "'"); $paymentStatus = '0'; } else { // to non epin $paymentStatus = '0'; } } //insert the data into fa_user table $insert = "INSERT INTO {$table_prefix}mlm_users\n\t\t\t\t\t\t (\n\t\t\t\t\t\t\t\tuser_id, username, user_key, parent_key, sponsor_key, payment_status, product_price\n\t\t\t\t\t\t\t) \n\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t'" . $user_id . "','" . $username . "', '" . $user_key . "', '" . $parent_key . "', '" . $sponsor . "','" . $paymentStatus . "','" . $productPrice . "'\n\t\t\t\t\t\t\t)"; $wpdb->query($insert); //hierarchy code for genology InsertHierarchy($user_key, $sponsor); if (isset($epin) && !empty($epin)) { $sql = "update {$table_prefix}mlm_epins set user_key='{$user_key}', date_used=now(), status=1 where epin_no ='{$epin}' "; // Update epin according user_key (19-07-2013) mysql_query($sql); if ($paymentStatus == 1) { UserStatusUpdate($user_id); } } if (is_plugin_active('mlm-paypal-mass-pay/load-data.php')) { update_user_meta($user_id, 'mlm_user_paypalid', $paypalId, FALSE); } $chk = ''; $msg = "<span style='color:green;'>Congratulations! You have successfully registered in the system.</span>"; $check_paid = $wpdb->get_var("SELECT payment_status FROM {$table_prefix}mlm_users WHERE user_id = '" . $user_id . "'"); if ($check_paid == '0') { PayNowOptions($user_id, 'register_user'); } } else { $error = "\n Sponsor does not exist in the system."; } } //end outer if condition } //end most outer if condition //if any error occoured if (!empty($error)) { $error = nl2br($error); } if ($chk != '') { ?> <script type="text/javascript"> var popup1,popup2,splofferpopup1; var bas_cal, dp_cal1,dp_cal2, ms_cal; // declare the calendars as global variables window.onload = function() { dp_cal1 = new Epoch('dp_cal1','popup',document.getElementById('dob')); }; function checkUserNameAvailability(str) { //alert(url); return true; if(isSpclChar(str, 'username')==false) { document.getElementById('username').focus(); return false; } var xmlhttp; if (str!="") { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.status==200 && xmlhttp.readyState==4) { document.getElementById("check_user").innerHTML=xmlhttp.responseText; //alert(xmlhttp.responseText); } } xmlhttp.open("GET", "<?php echo MLM_PLUGIN_URL . 'ajax/check_username.php'; ?> "+"?action=username&q="+str,true); xmlhttp.send(); } } function checkReferrerAvailability(str) { if(isSpclChar(str, 'sponsor')==false) { document.getElementById('sponsor').focus(); return false; } var xmlhttp; if (str!="") { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.status==200 && xmlhttp.readyState==4) { document.getElementById("check_referrer").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET", "<?php echo MLM_PLUGIN_URL . 'ajax/check_username.php'; ?> "+"?action=sponsor&q="+str,true); xmlhttp.send(); } } function checkePinAvailability(str) { var iChars = "~`!@#$%^&*()+=[]\\\';,- ./{}|\":<>?abcdefghijklmnopqrstuvwxyz"; for (var i = 0; i < str.length; i++) { if (iChars.indexOf(str.charAt(i)) != -1) { alert("<?php _e('Please enter Valid ePin.', 'unilevel-mlm-pro'); ?> "); document.getElementById('epin').value=''; document.getElementById('epin').focus(); return false; } } var xmlhttp; if (str!="") { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.status==200 && xmlhttp.readyState==4) { document.getElementById("check_epin").innerHTML=xmlhttp.responseText; //alert(xmlhttp.responseText); } } xmlhttp.open("GET", "<?php echo plugins_url() . '/' . MLM_PLUGIN_NAME . '/ajax/check_epin.php'; ?> "+"?q="+str,true); xmlhttp.send(); } } function checkePinAvailability1(str) { var iChars = "~`!@#$%^&*()+=[]\\\';,- ./{}|\":<>?abcdefghijklmnopqrstuvwxyz"; for (var i = 0; i < str.length; i++) { if (iChars.indexOf(str.charAt(i)) != -1) { alert("<?php _e('Please enter Valid ePin.', 'unilevel-mlm-pro'); ?> "); document.getElementById('epin').value=''; document.getElementById('epin').focus(); return false; } } var xmlhttp; /*if (str=="") { alert("Please enter ePin."); document.getElementById('epin').focus(); return false; }*/ if (str!="") { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.status==200 && xmlhttp.readyState==4) { if(xmlhttp.responseText=='1'){ document.getElementById("check_epin").innerHTML="<span class='msg'>Congratulations! This ePin is available.</span>"; document.getElementById("epin_value").disabled=true; } else { document.getElementById("check_epin").innerHTML="<span class='errormsg'>Sorry! This ePin is not Valid or already Used .</span>"; document.getElementById("epin_value").disabled=false; } } } xmlhttp.open("GET", "<?php echo plugins_url() . '/' . MLM_PLUGIN_NAME . '/ajax/check_epin.php'; ?> "+"?r="+str,true); xmlhttp.send(); } } </script> <?php $general_setting = get_option('wp_mlm_general_settings'); if (is_user_logged_in()) { if (!empty($general_setting['wp_reg']) && !empty($general_setting['reg_url']) && $user_role != 'mlm_user') { echo "<script>window.location ='" . site_url() . '/' . $general_setting['reg_url'] . "'</script>"; } } else { if (!empty($general_setting['wp_reg']) && !empty($general_setting['reg_url'])) { echo "<script>window.location ='" . site_url() . '/' . $general_setting['reg_url'] . "'</script>"; } } ?> <span style='color:red;'><?php echo $error; ?> </span> <?php if (isset($msg) && $msg != "") { echo $msg; } ?> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <form name="frm" method="post" action="" onSubmit="return formValidationNewVer();"> <tr> <td><?php _e('Create Username', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="username" id="username" value="<?php if (!empty($_POST['username'])) { _e(htmlentities($_POST['username'])); } ?> " maxlength="20" size="37" onBlur="checkUserNameAvailability(this.value);"><br /><div id="check_user"></div></td> </tr> <?php if (isset($mlm_general_settings['ePin_activate']) && $mlm_general_settings['ePin_activate'] == '1' && isset($mlm_general_settings['sol_payment']) && $mlm_general_settings['sol_payment'] == '1') { ?> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Enter ePin', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="epin" id="epin" value="<?php if (!empty($_POST['epin'])) { _e(htmlentities($_POST['epin'])); } ?> " maxlength="20" size="37" onBlur="checkePinAvailability(this.value);"><br /><div id="check_epin"></div></td> </tr> <?php } else { if (isset($mlm_general_settings['ePin_activate']) && $mlm_general_settings['ePin_activate'] == '1') { ?> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Enter ePin', 'unilevel-mlm-pro'); ?> :</td> <td><input type="text" name="epin" id="epin" value="<?php if (!empty($_POST['epin'])) { _e(htmlentities($_POST['epin'])); } ?> " maxlength="20" size="37" onBlur="checkePinAvailability1(this.value);"><br /><div id="check_epin"></div></td> </tr> <?php } } if ($mlm_general_settings['sol_payment'] != '1' || empty($mlm_general_settings['sol_payment'])) { ?> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Product', 'unilevel-mlm-pro'); ?> :</td> <td> <?php $pro_price_settings = $wpdb->get_results("select * from {$table_prefix}mlm_product_price where p_id!='1'"); ?> <select name="epin_value" id="epin_value" > <option value="">Select Product</option> <?php foreach ($pro_price_settings as $pricedetail) { ?> <option value="<?php echo $pricedetail->p_id; ?> " <?php echo $epin_value == $pricedetail->p_id ? 'selected="selected"' : ''; ?> ><?php echo $pricedetail->product_name; ?> </option> <?php } ?> </select></td> </tr> <?php } ?> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Create Password', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td> <input type="password" name="password" id="password" maxlength="20" size="37" > <br /><span style="font-size:12px; font-style:italic; color:#006633"><?php _e('Password length atleast 6 character', 'unilevel-mlm-pro'); ?> </span> </td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Confirm Password', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="password" name="confirm_password" id="confirm_password" maxlength="20" size="37" ></td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Email Address', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="email" id="email" value="<?php if (!empty($_POST['email'])) { _e(htmlentities($_POST['email'])); } ?> " size="37" ></td> </tr> <tr><td colspan="2"> </td></tr><tr> <tr> <td><?php _e('Confirm Email Address', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="confirm_email" id="confirm_email" value="<?php if (!empty($_POST['confirm_email'])) { _e(htmlentities($_POST['confirm_email'])); } ?> " size="37" ></td> </tr> <tr><td colspan="2"> </td></tr> <?php if (is_plugin_active('mlm-paypal-mass-pay/load-data.php')) { ?> <tr> <td><?php _e('Paypal ID', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="paypal_id" id="paypal_id" value="<?php if (!empty($_POST['paypal_id'])) { _e(htmlentities($_POST['paypal_id'])); } ?> " size="37" ></td> </tr> <tr><td colspan="2"> </td></tr> <?php } ?> <tr> <td><?php _e('First Name', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="firstname" id="firstname" value="<?php if (!empty($_POST['firstname'])) { _e(htmlentities($_POST['firstname'])); } ?> " maxlength="20" size="37" onBlur="return checkname(this.value, 'firstname');" ></td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Last Name', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="lastname" id="lastname" value="<?php if (!empty($_POST['lastname'])) { _e(htmlentities($_POST['lastname'])); } ?> " maxlength="20" size="37" onBlur="return checkname(this.value, 'lastname');"></td> </tr> <tr><td colspan="2"> </td></tr> <tr> <?php if (isset($sponsor_name) && $sponsor_name != '') { $spon = $sponsor_name; } else { if (isset($_POST['sponsor'])) { $spon = htmlentities($_POST['sponsor']); } } ?> <td><?php _e('Sponsor Name', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td> <input type="text" name="sponsor" id="sponsor" value="<?php if (!empty($spon)) { _e($spon); } ?> " maxlength="20" size="37" onBlur="checkReferrerAvailability(this.value);" <?php echo $readonly_sponsor; ?> > <br /><div id="check_referrer"></div> </td> </tr> <tr> <td colspan="2"> <input type="submit" name="submit" id="submit" value="<?php _e('Submit', 'unilevel-mlm-pro'); ?> " /></td> </tr> </form> </table> <?php } else { _e($msg); } }
if (checkInputField($address1)) { $error .= "\n Please enter your address."; } if (checkInputField($city)) { $error .= "\n Please enter your city."; } if (checkInputField($state)) { $error .= "\n Please enter your state."; } if (checkInputField($postalcode)) { $error .= "\n Please enter your postal code."; } if (checkInputField($telephone)) { $error .= "\n Please enter your contact number."; } if (checkInputField($dob)) { $error .= "\n Please enter your date of birth."; } //Do e-mail address validation if (!is_email($email)) { $error .= "\n E-mail address is invalid."; } if (email_exists($email)) { $error .= "\n E-mail address is already in use."; } if (confirmEmail($email, $confirm_email)) { $error .= "\n Please confirm your email address."; } if (isset($_GET['l']) && $_GET['l'] != '') { $leg = $_GET['l']; } else {
function mlmEligibility() { //get database table prefix $table_prefix = mlm_core_get_table_prefix(); $error = ''; $chk = 'error'; //most outer if condition if (isset($_POST['mlm_eligibility_settings'])) { $personal_referrer = sanitize_text_field($_POST['personal_referrer']); if (checkInputField($personal_referrer)) { $error .= "\n Please specify your personal active referrers."; } //if any error occoured if (!empty($error)) { $error = nl2br($error); } else { $chk = ''; update_option('wp_mlm_eligibility_settings', $_POST); $url = get_bloginfo('url') . "/wp-admin/admin.php?page=admin-settings&tab=payout"; _e("<script>window.location='{$url}'</script>"); $msg = "<span style='color:green;'>Your eligibility settings has been successfully updated.</span>"; } } // end outer if condition if ($chk != '') { $mlm_settings = get_option('wp_mlm_eligibility_settings'); ?> <div class='wrap1'> <h2><?php _e('Eligibility Settings', 'unilevel-mlm-pro'); ?> </h2> <div class="notibar msginfo"> <a class="close"></a> <p><?php _e('These settings define the criteria for a member to start earning regular commissions and bonuses from his downline.', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('No. of Personal Referrers', 'unilevel-mlm-pro'); ?> -</strong> <?php _e('The minimum number of people a member needs to sponsor into the network before he becomes entitled to earn commissions from his network.', 'unilevel-mlm-pro'); ?> </p> </div> <?php if ($error) { ?> <div class="notibar msgerror"> <a class="close"></a> <p> <strong><?php _e('Please Correct the following Error', 'unilevel-mlm-pro'); ?> :</strong> <?php _e($error); ?> </p> </div> <?php } ?> <?php if (empty($mlm_settings)) { ?> <form name="admin_eligibility_settings" method="post" action=""> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="form-table"> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;"title="Click for Help!" onclick="toggleVisibility('mlm_personal_referrer');"> <?php _e('No. of Personal Referrer(s)', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <input type="text" name="personal_referrer" id="personal_referrer" size="10" value="<?php if (!empty($_POST['personal_referrer'])) { _e(htmlentities($_POST['personal_referrer'])); } ?> "> <div class="toggle-visibility" id="mlm_personal_referrer"><?php _e('Please specify personal referrer by you.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> </table> <p class="submit"> <input type="submit" name="mlm_eligibility_settings" id="mlm_eligibility_settings" value="<?php _e('Update Options', 'unilevel-mlm-pro'); ?> »" class='button-primary' onclick="needToConfirm = false;"> </p> </form> <?php } else { if (!empty($mlm_settings)) { ?> <form name="admin_eligibility_settings" method="post" action=""> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="form-table"> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;"title="Click for Help!" onclick="toggleVisibility('mlm_personal_referrer');"> <?php _e('No. of Personal Referrer(s)', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <input type="text" name="personal_referrer" id="personal_referrer" size="10" value="<?php if ($mlm_settings['personal_referrer'] != '') { _e($mlm_settings['personal_referrer']); } ?> "> <div class="toggle-visibility" id="mlm_personal_referrer"><?php _e('Please specify personal referrer by you.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> </table> <p class="submit"> <input type="submit" name="mlm_eligibility_settings" id="mlm_eligibility_settings" value="<?php _e('Update Options', 'unilevel-mlm-pro'); ?> »" class='button-primary' onclick="needToConfirm = false;" > </p> </form> <script language="JavaScript"> populateArrays(); </script> <?php } } ?> </div> <?php } else { _e($msg); } }
function mlm_change_password() { $error = ''; global $current_user; get_currentuserinfo(); $sponsor_name = $current_user->user_login; //most outer if condition if (isset($_POST['submit'])) { $password = sanitize_text_field($_POST['password']); $confirm_pass = sanitize_text_field($_POST['confirm_password']); if (checkInputField($password)) { $error .= "\n Please enter your new password."; } if (confirmPassword($password, $confirm_pass)) { $error .= "\n Your confirm password does not match."; } // inner if condition if (empty($error)) { $user = array('ID' => $current_user->ID, 'user_pass' => $password); // return the wp_users table inserted user's ID $user_id = wp_update_user($user); $msg = "<span style='color:green;'>Congratulations! Your password has been successfully updated.</span>"; } //end inner if condition } //end most outer if condition //if any error occoured if (!empty($error)) { $error = nl2br($error); } if (!empty($msg)) { _e($msg); } include 'js-validation-file.html'; ?> <!--<script type="text/javascript" src="<?php //echo plugins_url().'/'.MLM_PLUGIN_NAME.'/js/form-validation.js' ?> "></script>--> <span style='color:red;'><?php echo $error; ?> </span> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <form name="frm" method="post" action="" onSubmit="return updatePassword();"> <tr> <td><?php _e('New Password', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td> <input type="password" name="password" id="password" maxlength="20" size="37" > <br /><span style="font-size:12px; font-style:italic; color:#006633"><?php _e('Password length atleast 6 character', 'binary-mlm-pro'); ?> </span> </td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Type Again', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td> <input type="password" name="confirm_password" id="confirm_password" maxlength="20" size="37" > </td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td colspan="2"><input type="submit" name="submit" id="submit" value="<?php _e('Submit', 'binary-mlm-pro'); ?> " /></td> </tr> </form> </table> <?php }
function register_first_user() { global $wpdb; //get database table prefix $table_prefix = mlm_core_get_table_prefix(); $error = ''; $chk = 'error'; //most outer if condition if (isset($_POST['submit'])) { $username = sanitize_text_field($_POST['username']); $password = sanitize_text_field($_POST['password']); $confirm_pass = sanitize_text_field($_POST['confirm_password']); $email = sanitize_text_field($_POST['email']); $confirm_email = sanitize_text_field($_POST['confirm_email']); $firstname = sanitize_text_field($_POST['first_name']); $lastname = sanitize_text_field($_POST['last_name']); //Add usernames we don't want used $invalid_usernames = array('admin'); //Do username validation $username = sanitize_user($username); if (!validate_username($username) || in_array($username, $invalid_usernames)) { $error .= "\n Username is invalid."; } if (username_exists($username)) { $error .= "\n Username already exists."; } if (checkInputField($username)) { $error .= "\n Please enter your username."; } if (checkInputField($password)) { $error .= "\n Please enter your password."; } if (confirmPassword($password, $confirm_pass)) { $error .= "\n Please confirm your password."; } //Do e-mail address validation if (!is_email($email)) { $error .= "\n E-mail address is invalid."; } if (email_exists($email)) { $error .= "\n E-mail address is already in use."; } if (confirmEmail($email, $confirm_email)) { $error .= "\n Please confirm your email address."; } //generate random numeric key for new user registration $user_key = generateKey(); // outer if condition if (empty($error)) { $user = array('user_login' => $username, 'user_pass' => $password, 'user_email' => $email, 'first_name' => $firstname, 'last_name' => $lastname, 'role' => 'mlm_user'); // return the wp_users table inserted user's ID $user_id = wp_insert_user($user); /* Send e-mail to admin and new user - You could create your own e-mail instead of using this function */ wp_new_user_notification($user_id, $password); //insert the data into fa_user table $insert = "INSERT INTO {$table_prefix}mlm_users\n\t\t\t\t\t\t \t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tuser_id, username, user_key, parent_key, sponsor_key, leg, payment_status\n\t\t\t\t\t\t\t\t\t\t\t\t\t) \n\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $user_id . "','" . $username . "', '" . $user_key . "', '0', '0', '0','1'\n\t\t\t\t\t\t\t\t\t\t\t\t\t)"; // if all data successfully inserted if ($wpdb->query($insert)) { $chk = ''; //$msg = "<span style='color:green;'>Congratulations! You have successfully registered in the system.</span>"; } } //end outer if condition } //end most outer if condition //if any error occoured if (!empty($error)) { $error = nl2br($error); } if ($chk != '') { include 'js-validation-file.html'; ?> <div class='wrap'> <h2><?php _e('Create First User in Network', 'binary-mlm-pro'); ?> </h2> <div class="notibar msginfo"> <a class="close"></a> <p><?php _e('In order to begin building your network you would need to register the First User of the network. All other users would be registered under this First User.', 'binary-mlm-pro'); ?> </p> </div> <?php if ($error) { ?> <div class="notibar msgerror"> <a class="close"></a> <p> <strong><?php _e('Please Correct the following Error(s)', 'binary-mlm-pro'); ?> :</strong> <?php _e($error); ?> </p> </div> <?php } ?> <p> </p> <form name="frm" method="post" action="" onSubmit="return adminFormValidation();"> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="form-table"> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('create-first-user');"> <?php _e('Create Username', 'binary-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <input type="text" name="username" id="username" value="<?php if (!empty($_POST['username'])) { _e(htmlentities($_POST['username'])); } ?> " maxlength="20" size="37"> <div class="toggle-visibility" id="create-first-user"><?php _e('Please create the first user of the your network.', 'binary-mlm-pro'); ?> </div> </td> </tr> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('create-password');"></a> <?php _e('Create Password', 'binary-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td><input type="password" name="password" id="password" maxlength="20" size="37" > <div class="toggle-visibility" id="create-password"><?php _e('Password length is atleast 6 char.', 'binary-mlm-pro'); ?> </div> </td> </tr> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('confirm-password');"> <?php _e('Confirm Password', 'binary-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <input type="password" name="confirm_password" id="confirm_password" maxlength="20" size="37" > <div class="toggle-visibility" id="confirm-password"><?php _e('Please confirm your password.', 'binary-mlm-pro'); ?> </div> </td> </tr> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('email-address');"> <?php _e('Email Address', 'binary-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <input type="text" name="email" id="email" value="<?php if (!empty($_POST['email'])) { _e(htmlentities($_POST['email'])); } ?> " size="37" > <div class="toggle-visibility" id="email-address"><?php _e('Please specify your email address.', 'binary-mlm-pro'); ?> </div> </td> </tr> <tr> <th> <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('confirm-address');"> <?php _e('Confirm Email Address', 'binary-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <input type="text" name="confirm_email" id="confirm_email" value="<?php if (!empty($_POST['confirm_email'])) { _e(htmlentities($_POST['confirm_email'])); } ?> " size="37" > <div class="toggle-visibility" id="confirm-address"><?php _e('Please confirm your email address.', 'binary-mlm-pro'); ?> </div> </td> </tr> <tr> <th> <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('first-name');"> <?php _e('First Name', 'binary-mlm-pro'); ?> </th> <td> <input type="text" name="first_name" id="first_name" value="<?php if (!empty($_POST['first_name'])) { _e(htmlentities($_POST['first_name'])); } ?> " size="37" > <div class="toggle-visibility" id="first-name"><?php _e('Please enter your first name.', 'binary-mlm-pro'); ?> </div> </td> </tr> <tr> <th> <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('last-name');"> <?php _e('Last Name', 'binary-mlm-pro'); ?> </a> </th> <td> <input type="text" name="last_name" id="last_name" value="<?php if (!empty($_POST['last_name'])) { _e(htmlentities($_POST['last_name'])); } ?> " size="37" > <div class="toggle-visibility" id="last-name"><?php _e('Please confirm your last name.', 'binary-mlm-pro'); ?> </div> </td> </tr> </table> <p class="submit"> <input type="submit" name="submit" id="submit" value="<?php _e('Submit', 'binary-mlm-pro'); ?> " class='button-primary' onclick="needToConfirm = false;"/> </p> </form> </div> <script language="JavaScript"> populateArrays(); </script> <?php } else { _e("<script>window.location='admin.php?page=admin-settings&tab=general&msg=s'</script>"); } }
function mlmRoyaltyBonus() { //get database table prefix $table_prefix = mlm_core_get_table_prefix(); $error = ''; $chk = 'error'; //get no. of level $mlm_general_settings = get_option('wp_mlm_general_settings'); $mlm_no_of_level = $mlm_general_settings['mlm-level']; //most outer if condition if (isset($_POST['mlm_royalty_bonus_settings'])) { $per_ref = count(array_filter($_POST['per_ref'])); $pay_value = count(array_filter($_POST['pay_value'])); $level = $_POST['level']; if ($per_ref == 0) { $error .= "\n Please Specify No. of Personal Referral."; } if ($pay_value == 0) { $error .= "\n Please Specify Payout Value."; } if (checkInputField($level)) { $error .= "\n Please Select Level."; } //if any error occoured if (!empty($error)) { $error = nl2br($error); } else { $chk = ''; update_option('wp_mlm_royalty_bonus_settings', $_POST); $url = get_bloginfo('url') . "/wp-admin/admin.php?page=admin-settings&tab=deduction"; _e("<script>window.location='{$url}'</script>"); $msg = _e("<span style='color:green;'>Your bonus has been successfully updated.</span>", 'unilevel-mlm-pro'); } } // end outer if condition if ($chk != '') { $mlm_settings = get_option('wp_mlm_royalty_bonus_settings'); ?> <div class='wrap1'> <h2><?php _e('Royalty Bonus Settings', 'unilevel-mlm-pro'); ?> </h2> <div class="notibar msginfo"> <a class="close"></a> <p><?php _e('Royalty Bonus is a % bonus paid to a member on the total commissions earned by a particular level under the member.', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('No. of Personal Referrers', 'unilevel-mlm-pro'); ?> - </strong><?php _e('This is the value of the personal referrers which would trigger a bonus distribution in the network.', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('Payout Value', 'unilevel-mlm-pro'); ?> -</strong> <?php _e('This is the payout value in terms of the percentage amount that would be paid to the member.', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('Level', 'unilevel-mlm-pro'); ?> -</strong> <?php _e(' The system would calculate the total commissions for Level X under the member and distribute a bonus equal to Y% (the payout value above) of the total commissions at Level X.', 'unilevel-mlm-pro'); ?> </p> <p><?php _e('eg. Slab 1 = Personal Referrals = 5, Payout Value = 2 and Level = Level 1, then the system would distribute a bonus equal to 2% of the total commission earned by all the members who are at Level of that member.', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('Option 1', 'unilevel-mlm-pro'); ?> </strong></p> <p><?php _e('If the first bonus slab is as above and the second bonus slab is as follows', 'unilevel-mlm-pro'); ?> </p> <p><?php _e('Slab 2 = Personal Referrals = 10, Payout Value = 4 and Level = Level 1.', 'unilevel-mlm-pro'); ?> </p> </br> <p><?php _e('Then, if this member has already referred 10 or more people, he would stop earning the bonus for Slab 1 as he cannot earn both 2% and 4% bonus for the same level.', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('Option 2', 'unilevel-mlm-pro'); ?> </strong></p> <p><?php _e('The first and second bonus slabs are as above and the third bonus slab is as follows:', 'unilevel-mlm-pro'); ?> </p> <p><?php _e('Slab 3 = Personal Referrals = 20, Payout Value = 1, Level = Level 2.', 'unilevel-mlm-pro'); ?> </p> </br> <p><?php _e('Then, if this member has already reached 20 or more personal referrals, he would earn the bonus for both Slab 2 and Slab 3. As in the above Option 1 he would stop earning the commission for Slab 1 as Slab 2 is a higher version of Slab 1.', 'unilevel-mlm-pro'); ?> </p> </div> <?php if ($error) { ?> <div class="notibar msgerror"> <a class="close"></a> <p> <strong><?php _e('Please Correct the following Error', 'unilevel-mlm-pro'); ?> :</strong> <?php _e($error); ?> </p> </div> <?php } ?> <?php if (!empty($msg)) { ?> <div class="notibar msgerror"> <a class="close"></a> <p><?php _e($msg); ?> </p> </div> <?php } ?> <?php if (empty($mlm_settings)) { ?> <form name="admin_bonus_settings" method="post" action=""> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="form-table"> <tr> <td> <INPUT type="button" value="<?php _e('Add Row', 'unilevel-mlm-pro'); ?> " onclick="addRow('dataTable')" class='button-primary' /> <INPUT type="button" value="<?php _e('Delete Row', 'unilevel-mlm-pro'); ?> " onclick="deleteRow('dataTable')" class='button-primary' /> <div class="toggle-visibility" id="admin-mlm-bonus-slab"><?php _e('Add or remove bonus slab.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <tr><td> </td></tr> </table> <TABLE id="dataTableheading" cellspacing="5" cellpadding="5" border="0" width="450"> <TR> <TD align="left" width="10%"><strong><?php _e('Select', 'unilevel-mlm-pro'); ?> </strong></TD> <TD align="left" width="40%"> <strong><?php _e('No. of Personal Referrals', 'unilevel-mlm-pro'); ?> </strong></TD> <TD align="left" width="25%"> <strong><?php _e('Payout Value (%)', 'unilevel-mlm-pro'); ?> </strong></TD> <TD align="left" width="25%"><strong><?php _e('Level', 'unilevel-mlm-pro'); ?> </strong></TD> </TR> </TABLE> <br\> <TABLE id="dataTable" cellspacing="5" cellpadding="5" border="0" width="450"> <TR> <TD align="left" width="10%"><INPUT type="checkbox" name="chk[]"/></TD> <TD align="left" width="40%"> <INPUT type="text" name="per_ref[]" size="15" /> </TD> <TD align="center" width="25%"> <INPUT type="text" name="pay_value[]" size="10" /> </TD> <TD align="center" width="25%"> <select name="level[]" id="level" > <option value=""><?php _e('Select Level', 'unilevel-mlm-pro'); ?> </option> <?php for ($k = 1; $k <= $mlm_no_of_level; $k++) { ?> <option value="<?php echo $k; ?> " <?php echo isset($_POST['level']) && $_POST['level'] == $k ? 'selected' : ''; ?> ><?php _e('Level ' . $k, 'unilevel-mlm-pro'); ?> </option> <?php } ?> </select> </TD> </TR> </TABLE> <table border="0" width="100%"> <tr> <td> <p class="submit"> <input type="submit" name="mlm_royalty_bonus_settings" id="mlm_royalty_bonus_settings" value="<?php _e('Update Options', 'unilevel-mlm-pro'); ?> »" class='button-primary' onclick="needToConfirm = false;"> </p> </td> <tr> </table> </form> </div> <script language="JavaScript"> populateArrays(); </script> <?php } else { if (!empty($mlm_settings)) { ?> <form name="admin_bouns_settings" method="post" action=""> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="form-table"> <tr> <td> <INPUT type="button" value="<?php _e('Add Row', 'unilevel-mlm-pro'); ?> " onclick="addRow('dataTable')" class='button-primary'/> <INPUT type="button" value="<?php _e('Delete Row', 'unilevel-mlm-pro'); ?> " onclick="deleteRow('dataTable')" class='button-primary'/> <div class="toggle-visibility" id="admin-mlm-bonus-slab"><?php _e('Add or remove bonus slab.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <tr><td> </td></tr> </table> <TABLE id="dataTableheading" cellspacing="5" cellpadding="5" border="0" width="450" > <TR> <TD align="left" width="10%"><strong><?php _e('Select', 'unilevel-mlm-pro'); ?> </strong></TD> <TD align="left" width="40%"> <strong><?php _e('No. of Personal Referrals', 'unilevel-mlm-pro'); ?> </strong></TD> <TD align="left" width="25%"> <strong><?php _e('Payout Value (%)', 'unilevel-mlm-pro'); ?> </strong></TD> <TD align="left" width="25%"><strong><?php _e('Level', 'unilevel-mlm-pro'); ?> </strong></TD> </TR> </TABLE> <br\> <TABLE id="dataTable" cellspacing="5" cellpadding="5" border="0" width="450"> <?php $i = 0; while ($i < count($mlm_settings['per_ref'])) { ?> <TR> <TD align="left" width="10%"><INPUT type="checkbox" name="chk[]"/></TD> <TD align="left" width="40%"> <INPUT type="text" name="per_ref[]" size="15" value="<?php echo $mlm_settings['per_ref'][$i]; ?> "/> </TD> <TD align="left" width="25%"> <INPUT type="text" name="pay_value[]" size="10" value="<?php echo $mlm_settings['pay_value'][$i]; ?> "/> </TD> <TD align="left" width="25%"> <select name="level[]" id="level" > <option value=""><?php _e('Select Level', 'unilevel-mlm-pro'); ?> </option> <?php for ($k = 1; $k <= $mlm_no_of_level; $k++) { ?> <option value="<?php echo $k; ?> " <?php echo $mlm_settings['level'][$i] == $k ? 'selected' : ''; ?> ><?php _e('Level ' . $k, 'unilevel-mlm-pro'); ?> </option> <?php } ?> </select> </TD> </TR> <?php $i++; } ?> </TABLE> <p class="submit"> <input type="submit" name="mlm_royalty_bonus_settings" id="mlm_royalty_bonus_settings" value="<?php _e('Update Options', 'unilevel-mlm-pro'); ?> »" class='button-primary' onclick="needToConfirm = false;"> </p> </form> </div> <script language="JavaScript"> populateArrays(); </script> <?php } } } else { _e($msg); } }
function mlmGeneral() { global $wpdb; //get database table prefix $table_prefix = mlm_core_get_table_prefix(); $error = ''; $chk = 'error'; //most outer if condition if (isset($_POST['mlm_general_settings'])) { $currency = sanitize_text_field($_POST['currency']); if (checkInputField($currency)) { $error .= "\n Please Select your currency type."; } $reg_url = sanitize_text_field($_POST['reg_url']); if (isset($_POST['wp_reg'])) { $error .= "\n Please Fill The URL."; } //if any error occoured if (!empty($error)) { $error = nl2br($error); } else { $chk = ''; update_option('wp_mlm_general_settings', $_POST); /* * ********code to save the product price that have payment status 1 and product price 0 ********* */ $mlm_general_settings = get_option('wp_mlm_general_settings'); if (!empty($mlm_general_settings['product_price'])) { $product_price = $mlm_general_settings['product_price']; $sql = "SELECT id \n\t\t\t\t\t\tFROM {$table_prefix}mlm_users\n\t\t\t\t\t\tWHERE payment_status='1' AND product_price='0'"; $ids = $wpdb->get_results($sql); foreach ($ids as $id) { $sql = "update {$table_prefix}mlm_users set product_price='{$product_price}' where id ='{$id->id}' "; $wpdb->query($sql); } } /* * ********code to save the product price that have payment status 1 and product price 0 ********* */ $url = get_bloginfo('url') . "/wp-admin/admin.php?page=admin-settings&tab=eligibility"; _e("<script>window.location='{$url}'</script>"); $msg = "<span style='color:green;'>Your general settings has been successfully updated.</span>"; } } // end outer if condition ?> <script> jQuery(document).ready(function() { jQuery("input[name='ePin_activate']").change(function() { var value = jQuery(this).val(); if (value == '1') jQuery("#sole_id").show(); else if (value == '0') jQuery("#sole_id").hide(); }); jQuery("#rp1").click(function() { var value = jQuery('#rp1').val(); if (value == 'yes') jQuery("#frequency").removeAttr("disabled"); }); jQuery("#rp2").click(function() { var value = jQuery('#rp2').val(); if (value == 'no') jQuery("#frequency").attr("disabled", "disabled"); }); }); function isNumberKey(evt) { var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 46 || charCode > 57 || charCode == 47)) return false; return true; } </script> <script language="javascript"> jQuery(document).ready(function() { jQuery("#reg_url").click(function() { jQuery("#reg_url").removeAttr("readonly"); }); }); function CheckBoxChanged(checkbox) { if (checkbox.checked == true) { //document.getElementById('reg_url').disabled = false; jQuery("#reg_url").removeAttr("readonly"); } else { jQuery("#reg_url").attr("readonly", "readonly"); //document.getElementById('reg_url').focus(); } } function show1() { if (document.getElementById('reg_url').value == '') { alert('Please Fill The URL'); document.getElementById('reg_url').focus(); return false; } } </script> <?php if ($chk != '') { $mlm_settings = get_option('wp_mlm_general_settings'); $URL = empty($mlm_settings['affiliate_url']) ? '' : $mlm_settings['affiliate_url'] . '/'; include 'js-validation-file.html'; ?> <div class='wrap1'> <h2><?php _e('Currency Setting', 'binary-mlm-pro'); ?> </h2> <div class="updated fade"> <p><?php _e("In order to enable SEO Friendly Affiliate URLs please add the following line of code in your .htaccess file at the top of the file BEFORE the #Begin Wordpress line of code<br/><br/> <strong> RedirectMatch 301 u/(.*) " . site_url() . "/" . $URL . "?sp_name=\$1 </strong> <br/><br/>Please note that your Permalink setting in WordPress should be anything other than Default setting.", 'binary-mlm-pro'); ?> </p> </div> <br/> <div class="notibar msginfo"> <a class="close"></a> <p><?php _e('Please select the base currency of your MLM Network. This option is very important as all calculations will be performed in this base currency. Once this currency is chosen and saved, it CANNOT be changed later. The entire network will need to be reset if you decide to change the currency at a later date.', 'binary-mlm-pro'); ?> </p> <p><strong><?php _e('Use WP registration page', 'binary-mlm-pro'); ?> - </strong><?php _e('In case you would like to Check this functionality on your website, you need to put redirect link of registration page.', 'binary-mlm-pro'); ?> </p> <p><strong><?php _e('URL of registration page', 'binary-mlm-pro'); ?> - </strong><?php _e('Registration page url for redirect your website to specefic location .', 'binary-mlm-pro'); ?> </p> <p><strong><?php _e('Redirect Affiliate URL', 'unilevel-mlm-pro'); ?> - </strong> <?php _e(' By default the affiliate URL for your members is setup to redirect to the registration page included in our plugin. In case you would like the affiliate URL to redirect to a different page, please specify the desired URL in this field. ', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('Activate ePin', 'binary-mlm-pro'); ?> - </strong><?php _e('In case you would like to Activate ePin functionality on your website, set this value to Yes.', 'binary-mlm-pro'); ?> </p> <p><strong><?php _e('Sole Payment Method', 'binary-mlm-pro'); ?> - </strong><?php _e('In case members can only register on your site via ePin, set this to Yes. This would make the ePin field mandatory on the user registration form and a visitor would need a valid unused ePin to complete his registration. If this value is set to No, a visitor will be able to register on the site even without specifying a valid ePin. In this case you would need to manually mark the member as Paid / Unpaid under Users -> All Users.', 'binary-mlm-pro'); ?> </p> <p><strong><?php _e('ePin Length', 'binary-mlm-pro'); ?> - </strong><?php _e('The length of the generated ePins.', 'binary-mlm-pro'); ?> </p> <p><strong><?php _e('Process Withdrawals', 'binary-mlm-pro'); ?> - </strong><?php _e('In case you would like to Check this functionality on your website than withdrawal amount by specific process. defaul process is manually', 'binary-mlm-pro'); ?> </p> </div> <?php if ($error) { ?> <div class="notibar msgerror"> <a class="close"></a> <p> <strong><?php _e('Please Correct the following Error', 'binary-mlm-pro'); ?> :</strong> <?php _e($error); ?> </p> </div> <?php } ?> <?php $currency = isset($_POST['currency']) ? $_POST['currency'] : (isset($mlm_settings['currency']) ? $mlm_settings['currency'] : ''); $wp_reg = isset($_POST['wp_reg']) ? $_POST['wp_reg'] : (isset($mlm_settings['wp_reg']) ? $mlm_settings['wp_reg'] : ''); $reg_url = isset($_POST['reg_url']) ? $_POST['reg_url'] : (isset($mlm_settings['reg_url']) ? $mlm_settings['reg_url'] : ''); $affiliate_url = isset($_POST['affiliate_url']) ? $_POST['affiliate_url'] : (isset($mlm_settings['affiliate_url']) ? $mlm_settings['affiliate_url'] : ''); $product_price = isset($_POST['product_price']) ? $_POST['product_price'] : (isset($mlm_settings['product_price']) ? $mlm_settings['product_price'] : ''); $process_withdrawal = isset($_POST['process_withdrawal']) ? $_POST['process_withdrawal'] : (isset($mlm_settings['process_withdrawal']) ? $mlm_settings['process_withdrawal'] : ''); if (empty($process_withdrawal)) { $_POST['process_withdrawal'] = 'Manually'; } ?> <form name="admin_general_settings" method="post" action="" id="admin_general_settings"> <table border="0" cellpadding="0" cellspacing="0" width="60%" class="form-table"> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;" title="Click for Help!" onclick="toggleVisibility('admin-mlm-currency');"><?php _e('Currency', 'binary-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <?php $sql = "SELECT iso3, currency FROM {$table_prefix}mlm_currency ORDER BY iso3"; $results = $wpdb->get_results($sql); ?> <select name="currency" id="currency" > <option value=""><?php _e('Select Currency', 'binary-mlm-pro'); ?> </option> <?php foreach ($results as $row) { if ($currency == $row->iso3) { $selected = 'selected'; } else { $selected = ''; } ?> <option value="<?php echo $row->iso3; ?> " <?php echo $selected; ?> ><?php echo $row->iso3 . " - " . $row->currency; ?> </option> <?php } ?> </select> <div class="toggle-visibility" id="admin-mlm-currency"><?php _e('Select your currency which will you use.', 'binary-mlm-pro'); ?> </div> </td> </tr> <tr> <th scope="row" class="admin-setting" > <strong><?php _e('Use WP registration page'); ?> </strong> </th> <td> <input type="checkbox" name="wp_reg" id="wp_reg" value="1" <?php echo $wp_reg == 1 ? ' checked="checked"' : ''; ?> onclick="CheckBoxChanged(this);" onblur="show1();" /> </td> </tr> <tr> <th scope="row" class="admin-setting" > <strong><?php _e('URL of registration page', 'binary-mlm-pro'); ?> <span style="color:red;"></span>:</strong> </th> <td> <?php echo site_url() . '/'; ?> <input type="text" name="reg_url" id="reg_url" value="<?php echo $reg_url; ?> " readonly="true"/> </td> </tr> <tr> <th scope="row" class="admin-setting" > <strong><?php _e('Redirect Affiliate URL', 'binary-mlm-pro'); ?> :</strong> </th> <td> <?php echo site_url() . '/'; ?> <input type="text" name="affiliate_url" id="affiliate_url" value="<?php echo $affiliate_url; ?> " /> </td> </tr> <?php general_settings_epin(); ?> <tr> <th scope="row" class="admin-settings"> <strong><?php _e('Process Withdrawals', 'binary-mlm-pro'); ?> <span style="color:red;">*</span>:</strong> </th> <td> <input type="radio" name="process_withdrawal" id="process_withdrawal" value="Automatically" <?php echo $process_withdrawal == 'Automatically' ? ' checked="checked"' : ''; ?> />Automatically <input type="radio" name="process_withdrawal" id="process_withdrawal" value="Manually" <?php echo $process_withdrawal == 'Manually' ? ' checked="checked"' : ''; ?> />Manually </td> </tr> </table> <p class="submit"> <input type="submit" name="mlm_general_settings" id="mlm_general_settings" value="<?php _e('Update Options', 'binary-mlm-pro'); ?> »" class='button-primary' onclick="needToConfirm = false;"> </p> </form> </div> <script language="JavaScript"> populateArrays(); </script> <?php } else { _e($msg); } }
if (isset($_REQUEST['wpmlm_first_user_register'])) { $username = sanitize_text_field($_POST['username']); $password = sanitize_text_field($_POST['password']); $confirm_pass = sanitize_text_field($_POST['confirm_password']); $email = sanitize_text_field($_POST['email']); //User Name that is not to be used. $invalid_usernames = array('admin'); //username validation $username = sanitize_user($username); if (!validate_username($username) || in_array($username, $invalid_usernames)) { $error .= "\n Username is invalid."; } if (username_exists($username)) { $error .= "\n Username already exists."; } if (checkInputField($password)) { $error .= "\n Please enter your password."; } if (confirmPassword($password, $confirm_pass)) { $error .= "\n Please confirm your password."; } //Do e-mail address validation if (!is_email($email)) { $error .= "\n E-mail address is invalid."; } if (email_exists($email)) { $error .= "\n E-mail address is already in use."; } $user_key = generateKey(); if (empty($error)) { $user = array('user_login' => $username, 'user_pass' => $password, 'user_email' => $email);
function register_user_html_page() { global $wpdb, $current_user; $user_id = $current_user->ID; $table_prefix = mlm_core_get_table_prefix(); $error = ''; $chk = 'error'; include_once ABSPATH . '/wp-admin/includes/plugin.php'; if (!empty($_GET['sp_name'])) { $sp_name = $wpdb->get_var("select username from {$table_prefix}mlm_users where username='******'sp_name'] . "'"); if ($sp_name) { ?> <script type='text/javascript'> $.cookie('sp_name', '<?php echo $sp_name; ?> ', {path: '/'}); </script> <?php } } else { if (!empty($_REQUEST['sp'])) { $sp_name = getusernamebykey($_REQUEST['sp']); if ($sp_name) { ?> <script type='text/javascript'> $.cookie('sp_name', '<?php echo $sp_name; ?> ', {path: '/'}); </script> <?php } } else { $sp_name = empty($_COOKIE["sp_name"]) ? '' : $_COOKIE["sp_name"]; } } get_currentuserinfo(); $mlm_general_settings = get_option('wp_mlm_general_settings'); if (is_user_logged_in()) { $sponsor_name = $current_user->user_login; $readonly_sponsor = 'readonly'; } else { if (isset($_REQUEST['sp']) && $_REQUEST['sp'] != '') { $sponsorName = getusernamebykey($_REQUEST['sp']); if (isset($sponsorName) && $sponsorName != '') { $readonly_sponsor = 'readonly'; $sponsor_name = $sponsorName; } else { redirectPage(home_url(), array()); exit; } } else { if (!empty($_REQUEST['sp_name'])) { $sponsorName = $_REQUEST['sp_name']; if (!empty($sponsorName)) { $readonly_sponsor = 'readonly'; $sponsor_name = $sponsorName; } else { redirectPage(home_url(), array()); exit; } } else { $readonly_sponsor = ''; } } } /* script for auto insert users================================================ */ if ($_SERVER['HTTP_HOST'] == '192.168.100.100') { echo '<form name="form1"action="" method="post"> <input type="number" min="0" max="99" name="id"/> <input type="number" min="0" max="1" name="epin"/> <input type="number" min="0" max="1" name="leg"/> <input type="submit"/></form>'; $epinstatus = isset($_POST['epin']) ? $_POST['epin'] : ''; if ($epinstatus != '') { $epin_no = $wpdb->get_var("select epin_no from {$table_prefix}mlm_epins where point_status='{$epinstatus}' AND status=0 limit 1 "); } if (isset($_POST['id'])) { $z = $_POST['id']; $_POST = array('firstname' => 'binary' . $z, 'lastname' => 'binary' . $z, 'username' => 'binary' . $z, 'password' => 'binary' . $z, 'confirm_password' => 'binary' . $z, 'email' => 'binary' . $z . '@gmail.com', 'confirm_email' => 'binary' . $z . '@gmail.com', 'sponsor' => !empty($sponsor_name) ? $sponsor_name : '', 'submit' => 'submit', 'leg' => $_POST['leg'], 'epin' => $epin_no, 'paypal_id' => 'binary' . $z . '@gmail.com'); } //'epin'=>!empty($epin_no)?$epin_no:'', //echo "<pre>"; print_r($_SERVER); echo "</pre>"; } /* ===========================================================Close Auto Insert. */ //most outer if condition if (isset($_POST['submit'])) { $firstname = sanitize_text_field($_POST['firstname']); $lastname = sanitize_text_field($_POST['lastname']); $username = sanitize_text_field($_POST['username']); $epin = sanitize_text_field(isset($_POST['epin']) ? $_POST['epin'] : ''); $sponsor = sanitize_text_field($_POST['sponsor']); $password = sanitize_text_field($_POST['password']); $confirm_pass = sanitize_text_field($_POST['confirm_password']); $email = sanitize_text_field($_POST['email']); $confirm_email = sanitize_text_field($_POST['confirm_email']); $invalid_usernames = array('admin'); $username = sanitize_user($username); if (!validate_username($username) || in_array($username, $invalid_usernames)) { $error .= "\n Username is invalid."; } if (username_exists($username)) { $error .= "\n Username already exists."; } if (empty($sponsor)) { $sponsor = $wpdb->get_var("select `username` FROM {$table_prefix}mlm_users order by id asc limit 1"); } if (!empty($epin) && epin_exists($epin)) { $error .= "\n ePin already issued or wrong ePin."; } if (!empty($mlm_general_settings['sol_payment']) && empty($epin)) { $error .= "\n Please enter your ePin."; } else { if (empty($_POST['epin_value']) && empty($epin)) { $error .= "\n Please either enter the ePin or select the Product."; } } if (checkInputField($password)) { $error .= "\n Please enter your password."; } if (confirmPassword($password, $confirm_pass)) { $error .= "\n Please confirm your password."; } if (checkInputField($sponsor)) { $error .= "\n Please enter your sponsor name."; } if (checkInputField($firstname)) { $error .= "\n Please enter your first name."; } if (checkInputField($lastname)) { $error .= "\n Please enter your last name."; } if (!is_email($email)) { $error .= "\n E-mail address is invalid."; } if (email_exists($email)) { $error .= "\n E-mail address is already in use."; } if (confirmEmail($email, $confirm_email)) { $error .= "\n Please confirm your email address."; } include_once ABSPATH . '/wp-admin/includes/plugin.php'; if (is_plugin_active('mlm-paypal-mass-pay/load-data.php')) { $paypalId = sanitize_text_field($_POST['paypal_id']); if (checkInputField($paypalId)) { $error .= "\n Please enter your Paypal id."; } } $sql = "SELECT COUNT(*) num, `user_key` FROM {$table_prefix}mlm_users WHERE `username` = '" . $sponsor . "'"; $intro = $wpdb->get_row($sql); if (isset($_GET['l']) && $_GET['l'] != '') { $leg = $_GET['l']; } else { @($leg = $_POST['leg']); } if (isset($leg) && $leg != '0') { if ($leg != '1') { $error .= "\n You have enter a wrong placement."; } } //generate random numeric key for new user registration $user_key = generateKey(); //if generated key is already exist in the DB then again re-generate key do { $check = $wpdb->get_var("SELECT COUNT(*) ck FROM {$table_prefix}mlm_users WHERE `user_key` = '" . $user_key . "'"); $flag = 1; if ($check == 1) { $user_key = generateKey(); $flag = 0; } } while ($flag == 0); //check parent key exist or not if (isset($_GET['k']) && $_GET['k'] != '') { if (!checkKey($_GET['k'])) { $error .= "\n Parent key does't exist."; } // check if the user can be added at the current position $checkallow = checkallowed($_GET['k'], $leg); if ($checkallow >= 1) { $error .= "\n You have enter a wrong placement."; } } if (!isset($leg)) { $key = $wpdb->get_var("SELECT user_key FROM {$table_prefix}mlm_users WHERE user_id = '{$user_id}'"); $l = totalLeftLegUsers($key); $r = totalRightLegUsers($key); if ($l < $r) { $leg = '0'; } else { $leg = '1'; } } // outer if condition if (empty($error)) { // inner if condition if ($intro->num == 1) { $sponsor = $intro->user_key; $sponsor1 = $sponsor; //find parent key if (isset($_GET['k']) && $_GET['k'] != '') { $parent_key = $_GET['k']; } else { $readonly_sponsor = ''; do { $sql = "SELECT `user_key` FROM {$table_prefix}mlm_users WHERE parent_key = '" . $sponsor1 . "' AND \n\t\t\t\tleg = '" . $leg . "' AND banned = '0'"; $spon = $wpdb->get_var($sql); $num = $wpdb->num_rows; if ($num) { $sponsor1 = $spon; } } while ($num == 1); $parent_key = $sponsor1; } $user = array('user_login' => $username, 'user_pass' => $password, 'first_name' => $firstname, 'last_name' => $lastname, 'user_email' => $email, 'user_registered' => current_time('mysql'), 'role' => 'mlm_user'); // return the wp_users table inserted user's ID $user_id = wp_insert_user($user); /* Send e-mail to admin and new user */ wp_new_user_notification($user_id, $password); $pc = isset($mlm_general_settings['product_price']) ? $mlm_general_settings['product_price'] : '0'; //insert the data into fa_user table if (!empty($epin)) { $pointResult = $wpdb->get_row("select p_id,point_status from {$table_prefix}mlm_epins where epin_no = '{$epin}'"); $pointStatus = $pointResult->point_status; $productPrice = $wpdb->get_var("SELECT product_price FROM {$table_prefix}mlm_product_price WHERE p_id = '" . $pointResult->p_id . "'"); // to epin point status 1 if ($pointStatus[0] == '1') { $paymentStatus = '1'; $payment_date = current_time('mysql'); } else { if ($pointStatus[0] == '0') { $paymentStatus = '2'; $payment_date = current_time('mysql'); } } } else { if (!empty($_POST['epin_value'])) { $productPrice = $wpdb->get_var("SELECT product_price FROM {$table_prefix}mlm_product_price WHERE p_id = '" . $_POST['epin_value'] . "'"); $paymentStatus = '0'; $payment_date = '0000-00-00 00:00:00'; } else { // to non epin $paymentStatus = '0'; $payment_date = '0000-00-00 00:00:00'; } } $insert = "INSERT INTO {$table_prefix}mlm_users\n\t\t\t\t\t\t (\n\t\t\t\t\t\t\t\tuser_id, username, user_key, parent_key, sponsor_key, leg,payment_date,payment_status,product_price\n\t\t\t\t\t\t\t) \n\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t'" . $user_id . "','" . $username . "', '" . $user_key . "', '" . $parent_key . "', '" . $sponsor . "', '" . $leg . "','" . $payment_date . "','" . $paymentStatus . "','" . $productPrice . "'\n\t\t\t\t\t\t\t)"; // if all data successfully inserted if ($wpdb->query($insert)) { //begin most inner if condition //entry on Left and Right Leg tables if ($leg == 0) { $insert = "INSERT INTO {$table_prefix}mlm_leftleg set pkey='" . $parent_key . "',ukey='" . $user_key . "'"; $insert = $wpdb->query($insert); if ($u = get_option('network_mail', true) == 1) { } } else { if ($leg == 1) { $insert = "INSERT INTO {$table_prefix}mlm_rightleg set pkey='" . $parent_key . "',ukey='" . $user_key . "'"; $insert = $wpdb->query($insert); if ($u = get_option('network_mail', true) == 1) { } } } SendMailToAll($user_key, $parent_key, $sponsor); //begin while loop while ($parent_key != '0') { $query = "SELECT COUNT(*) num, parent_key, leg \n\t\t\t\t\t\t\t\t FROM {$table_prefix}mlm_users \n\t\t\t\t\t\t\t\t WHERE user_key = '" . $parent_key . "'\n\t\t\t\t\t\t\t\t AND banned = '0'"; $result = $wpdb->get_row($query); if ($result->num == 1) { if ($result->parent_key != '0') { if ($result->leg == 1) { $tbright = "INSERT INTO {$table_prefix}mlm_rightleg set pkey='" . $result->parent_key . "',ukey='" . $user_key . "' "; $tbright = $wpdb->query($tbright); if ($u = get_option('network_mail', true) == 1) { } } else { $tbleft = "INSERT INTO {$table_prefix}mlm_leftleg set pkey='" . $result->parent_key . "',ukey='" . $user_key . "' "; $tbleft = $wpdb->query($tbleft); if ($u = get_option('network_mail', true) == 1) { } } } $parent_key = $result->parent_key; } else { $parent_key = '0'; } } //end while loop if (isset($epin) && !empty($epin)) { $sql = "update {$table_prefix}mlm_epins set user_key='{$user_key}', date_used='" . current_time('mysql') . "', status=1 where epin_no ='{$epin}' "; $wpdb->query($sql); } if ($paymentStatus == 1) { insert_refferal_commision($user_id); } if (is_plugin_active('mlm-paypal-mass-pay/load-data.php')) { update_user_meta($user_id, 'mlm_user_paypalid', $paypalId, FALSE); } $chk = ''; $msg = "<span style='color:green;'>Congratulations! You have successfully registered in the system.</span>"; } //end most inner if condition } else { $error = "\n Sponsor does not exist in the system."; } } //end outer if condition } //end most outer if condition //if any error occoured if (!empty($error)) { $error = nl2br($error); } if ($chk != '') { include 'js-validation-file.html'; ?> <?php $user_roles = $current_user->roles; $user_role = array_shift($user_roles); $general_setting = get_option('wp_mlm_general_settings'); if (is_user_logged_in()) { if (!empty($general_setting['wp_reg']) && !empty($general_setting['reg_url']) && $user_role != 'mlm_user') { echo "<script>window.location ='" . site_url() . '/' . $general_setting['reg_url'] . "'</script>"; } } else { if (!empty($general_setting['wp_reg']) && !empty($general_setting['reg_url'])) { echo "<script>window.location ='" . site_url() . '/' . $general_setting['reg_url'] . "'</script>"; } } ?> <span style='color:red;'><?php echo $error; ?> </span> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <form name="frm" method="post" action="" onSubmit="return formValidation();"> <tr> <td><?php _e('Create Username', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="username" id="username" value="<?php if (!empty($_POST['username'])) { _e(htmlentities($_POST['username'])); } ?> " maxlength="20" size="37" onBlur="checkUserNameAvailability(this.value);"><br /><div id="check_user"></div></td> </tr> <?php $mlm_general_settings = get_option('wp_mlm_general_settings'); if (!empty($mlm_general_settings['ePin_activate']) && !empty($mlm_general_settings['sol_payment'])) { ?> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Enter ePin', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="epin" id="epin" value="<?php if (!empty($_POST['epin'])) { _e(htmlentities($_POST['epin'])); } ?> " maxlength="20" size="37" onBlur="checkePinAvailability(this.value);"><br /><div id="check_epin"></div></td> </tr> <?php } else { if (!empty($mlm_general_settings['ePin_activate'])) { ?> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Enter ePin', 'binary-mlm-pro'); ?> :</td> <td><input type="text" name="epin" id="epin" value="<?php if (!empty($_POST['epin'])) { _e(htmlentities($_POST['epin'])); } ?> " maxlength="20" size="37" onBlur="checkePinAvailability(this.value);"><br /><div id="check_epin"></div></td> </tr> <?php } } if (empty($mlm_general_settings['sol_payment'])) { ?> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Product', 'binary-mlm-pro'); ?> :</td> <td> <?php $pro_price_settings = $wpdb->get_results("select * from {$table_prefix}mlm_product_price where p_id!='1'"); ?> <select name="epin_value" id="epin_value" > <option value="">Select Product</option> <?php foreach ($pro_price_settings as $pricedetail) { ?> <option value="<?php echo $pricedetail->p_id; ?> " <?php echo $epin_value == $pricedetail->p_id ? 'selected="selected"' : ''; ?> ><?php echo $pricedetail->product_name; ?> </option> <?php } ?> </select></td> </tr> <?php } ?> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Create Password', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td> <input type="password" name="password" id="password" maxlength="20" size="37" > <br /><span style="font-size:12px; font-style:italic; color:#006633"><?php _e('Password length atleast 6 character', 'binary-mlm-pro'); ?> </span> </td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Confirm Password', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="password" name="confirm_password" id="confirm_password" maxlength="20" size="37" ></td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Email Address', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="email" id="email" value="<?php if (!empty($_POST['email'])) { _e(htmlentities($_POST['email'])); } ?> " size="37" ></td> </tr> <tr><td colspan="2"> </td></tr><tr> <tr> <td><?php _e('Confirm Email Address', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="confirm_email" id="confirm_email" value="<?php if (!empty($_POST['confirm_email'])) { _e(htmlentities($_POST['confirm_email'])); } ?> " size="37" ></td> </tr> <tr><td colspan="2"> </td></tr> <?php if (is_plugin_active('mlm-paypal-mass-pay/load-data.php')) { ?> <tr> <td><?php _e('Paypal ID', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="paypal_id" id="paypal_id" value="<?php if (!empty($_POST['paypal_id'])) { _e(htmlentities($_POST['paypal_id'])); } ?> " size="37" ></td> </tr> <tr><td colspan="2"> </td></tr> <?php } ?> <tr> <td><?php _e('First Name', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="firstname" id="firstname" value="<?php if (!empty($_POST['firstname'])) { _e(htmlentities($_POST['firstname'])); } ?> " maxlength="20" size="37" onBlur="return checkname(this.value, 'firstname');" ></td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Last Name', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="lastname" id="lastname" value="<?php if (!empty($_POST['lastname'])) { _e(htmlentities($_POST['lastname'])); } ?> " maxlength="20" size="37" onBlur="return checkname(this.value, 'lastname');"></td> </tr> <tr><td colspan="2"> </td></tr> <tr> <?php if (isset($sponsor_name) && $sponsor_name != '') { $spon = $sponsor_name; } else { if (isset($sp_name)) { $spon = $sp_name; } else { if (isset($_POST['sponsor'])) { $spon = htmlentities($_POST['sponsor']); } } } ?> <td><?php _e('Sponsor Name', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td> <input type="text" name="sponsor" id="sponsor" value="<?php if (!empty($spon)) { _e($spon); } ?> " maxlength="20" size="37" onBlur="checkReferrerAvailability(this.value);" <?php echo $readonly_sponsor; ?> > <br /><div id="check_referrer"></div> </td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Placement', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <?php if (isset($_POST['leg']) && $_POST['leg'] == '0') { $checked = 'checked'; } else { if (isset($_GET['l']) && $_GET['l'] == '0') { $checked = 'checked'; $disable_leg = 'disabled'; } else { $checked = ''; } } if (isset($_POST['leg']) && $_POST['leg'] == '1') { $checked1 = 'checked'; } else { if (isset($_GET['l']) && $_GET['l'] == '1') { $checked1 = 'checked'; $disable_leg = 'disabled'; } else { $checked1 = ''; } } ?> <td><?php echo __('Left', 'binary-mlm-pro'); ?> <input id="left" type="radio" name="leg" value="0" <?php echo $checked; ?> <?php if (!empty($disable_leg)) { _e($disable_leg); } ?> /> <?php echo __('Right', 'binary-mlm-pro'); ?> <input id="right" type="radio" name="leg" value="1" <?php echo $checked1; ?> <?php if (!empty($disable_leg)) { _e($disable_leg); } ?> /> </td> </tr> <tr> <td colspan="2"><input type="submit" name="submit" id="submit" value="<?php _e('Submit', 'binary-mlm-pro'); ?> " /></td> </tr> </form> </table> <?php } else { _e($msg); } }
function mlm_my_financial_dashboard_page($id = '') { global $table_prefix; global $wpdb; global $date_format; global $current_user; $mlm_payouts = get_option('wp_mlm_payout_settings'); $url = plugins_url(); $userKey = get_current_user_key(); $user_id = getuseridbykey($userKey); $user_name = getusernamebykey($userKey); $mlm_currency = get_option('wp_mlm_general_settings'); $currency = $mlm_currency['currency']; $balance = $wpdb->get_var("SELECT closing_bal FROM {$table_prefix}mlm_transaction WHERE id = (select max(id) from {$table_prefix}mlm_transaction where user_id='" . $user_id . "')"); $withdrwl_bal = $wpdb->get_var("SELECT SUM(round(amount+withdrawal_fee+witholding_tax)) as total FROM {$table_prefix}mlm_withdrawal where payment_processed=0 AND user_id='" . $user_id . "'"); $Left_balance = $balance - $withdrwl_bal; $Left_balance = number_format($Left_balance, 2, '.', ''); if (isset($_POST['submit'])) { //Check if already request for withdrawal $wamount = empty($_POST['wamount']) ? '' : $_POST['wamount']; $wcomment = empty($_POST['wcomment']) ? '' : $_POST['wcomment']; $withdrawalMode = empty($_POST['withdrawalMode']) ? '' : $_POST['withdrawalMode']; $waddress = empty($_POST['address']) ? '' : " - \n" . $_POST['address']; $other = empty($_POST['other']) ? '' : $_POST['other']; // Settings for Minimum Amount can withdraw By User $minAmt = unserialize(stripcslashes($_POST['withdrawalMode'])); if ($minAmt[3] != '') { $min_amount = $minAmt[3]; } $error = ''; if (checkInputField($wamount)) { $error .= "</br> Please enter your Amount."; } if (checkInputField($withdrawalMode)) { $error .= "</br> Please Select Any Payment mode."; } if ($wamount > $balance) { $error .= "</br> Amount should be less or equal your Balance Amount."; } if ($wamount > $balance - $withdrwl_bal && isset($withdrwl_bal)) { $error .= "</br> Your Withdrawal Request for Amount " . $withdrwl_bal . " is Pending.You have not sufficient Amount for this Withdrawal Request."; } if ($wamount < $min_amount && isset($min_amount)) { $error .= "</br> Withdrawal Amount should be Minimum " . $currency . " " . $min_amount; } if (empty($error)) { $other_deduc = get_option('wp_mlm_other_method_settings'); if (!empty($other_deduc)) { for ($i = 0; $i <= count($other_deduc['othr_mthd']) - 1; $i++) { // $other_deduc['othr_mthd'][$i],$other_deduc['othr_amt'][$i],$other_deduc['othr_type'][$i]; if ($other_deduc['othr_type'][$i] == 'percent') { $othr_mthd[] = $other_deduc['othr_mthd'][$i]; $deduct_amount[] = $wamount * $other_deduc['othr_amt'][$i] / 100; $deduct_type[] = $other_deduc['othr_type'][$i]; $wamount = $wamount - $deduct_amount[$i]; } if ($other_deduc['othr_type'][$i] == 'fixed') { $othr_mthd[] = $other_deduc['othr_mthd'][$i]; $deduct_amount[] = $other_deduc['othr_amt'][$i]; $deduct_type[] = $other_deduc['othr_type'][$i]; $wamount = $wamount - $deduct_amount[$i]; } } $other_method_serialize = array($othr_mthd, $deduct_amount, $deduct_type); //print_r(//$other_method_serialize); die; $otherDeduct = array_sum($deduct_amount); } else { $other_method_serialize = 0; $otherDeduct = 0; } $wdrAmount = $wamount; $deduct = unserialize(stripcslashes($_POST['withdrawalMode'])); if ($deduct[2] == 'percent') { $deduct_amount = $wdrAmount * $deduct[1] / 100; } if ($deduct[2] == 'fixed') { $deduct_amount = $deduct[1]; } $wdr_amount = $wdrAmount - $deduct_amount; $sql = "INSERT {$table_prefix}mlm_withdrawal SET \n `withdrawal_initiated`=1, \n `withdrawal_initiated_comment` = '" . $wcomment . "', \n `withdrawal_initiated_date` = NOW() , \n `withdrawal_mode` = '" . $deduct[0] . $waddress . "',\n\t\t\t`other_method` = '" . serialize($other_method_serialize) . "',\n `user_id` = '" . $user_id . "' ,\n `amount`='" . $wdr_amount . "',\n `withdrawal_fee`='" . $deduct_amount . "',\n `witholding_tax`='" . $otherDeduct . "'"; $wpdb->query($sql); if ($u = get_option('process_withdrawal_mail', true) == 1) { //Generate Mail to Admin Regarding With-drawal Amount WithDrawalProcessMail($user_id, $_POST); } $sucsess = 'Your Withdrawal Request Initiated'; $sucsess .= '</br>Thanks for Patience'; unset($wamount, $wcomment, $withdrawalMode, $waddress, $_POST['radio']); } } ?> <script> $(function() { $('#delivery').hide(); $('#other').hide(); $('#withdrawalMode').change(function(){ $('#delivery').hide(); $('#other').hide(); $('#' + $(this).val()).show(); }); }); </script> <style>.payout-summary tr { margin:10px 0px; }</style> <!--<script src="initiate.js" type="text/javascript"></script>--> <span style='color:red;'><?php echo !empty($error) ? $error : ''; ?> </span> <span style='color:green;'><?php echo !empty($sucsess) ? $sucsess : ''; ?> </span> <form name="form" action="" method="post" > <table width="100%" border="0" cellspacing="10" cellpadding="1" class="payout-summary"> <tr><td><strong>User Name:</strong> <strong><?php echo $user_name; ?> </strong></td> <td><strong>Account Balance:</strong> <strong><?php echo $currency; echo empty($balance) ? '0.00' : $balance; ?> </strong></td></tr> <tr><td> </td> <td><strong>Withdrawable Balance:</strong> <strong><?php echo $currency; echo empty($Left_balance) ? '0.00' : $Left_balance; ?> </strong></td></tr> <tr> <td><strong>Withdrawal Amount</strong></td> <td width="50%"><input type="text" name="wamount" id="wamount" onblur="return numeric(this.value,'wamount');" value="<?php echo empty($wamount) ? '' : $wamount; ?> " size="21" /></td> </tr> <td><strong>Comment </strong></td> <td width="50%" ><textarea name="wcomment" id="wcomment"><?php echo empty($wcomment) ? '' : $wcomment; ?> </textarea></td> </tr> <tr> <td><strong>Withdrawal Mode </strong></td> <td width="50%" ><select name="withdrawalMode" id="withdrawalMode" onblur="" > <option value="">Select Option</option> <?php $deduction = get_option('wp_mlm_withdrawal_method_settings'); for ($i = 0; $i <= count($deduction['withdwl_mthd']) - 1; $i++) { $value = array($deduction['withdwl_mthd'][$i], $deduction['withdwl_amt'][$i], $deduction['withdwl_type'][$i], $deduction['min_amount'][$i]); $values = serialize($value); ?> <option value='<?php echo $values; ?> ' <?php if (isset($_POST['withdrawalMode'])) { if ($deduction['withdwl_mthd'][$i] == $minAmt[0]) { echo 'selected'; } } ?> ><?php echo $deduction['withdwl_mthd'][$i]; ?> </option> <?php } ?> </select></td></tr> <tr><td> </td><td><textarea name="address" onblur="return allowspace(this.value,'delivery');" id="delivery" placeholder="Enter your Address" ></textarea></td></tr> <tr><td> </td><td><input type="text" name="other" onblur="return allowspace(this.value,'delivery');" id="other" /></td></tr> <tr><td> </td><td><input type="submit"name="submit" id="submit" value="Submit" /></td></tr> </table></form> <form method="post" action="" > <table><tr><td><input type="submit" name="view" value="View Transaction history"></td><td></td></tr></table> </form> <?php if (isset($_POST['view']) && $_POST['view'] === 'View Transaction history') { $result = $wpdb->get_results("select * from {$table_prefix}mlm_transaction where user_id={$user_id} order by transaction_date ASC"); $records = array_reverse($result); $totalrecords = count($records); //$othr_method = $wpdb->get_var("select other_method from {$table_prefix}mlm_withdrawal where user_id ='1' AND id=21"); // print_r(unserialize($othr_method)); $rowcount = 0; ?> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load('visualization', '1', {packages: ['table']}); </script> <script type="text/javascript"> var visualization; var data; var options = {'showRowNumber': false}; function drawVisualization() { // Create and populate the data table. var dataAsJson = {cols:[ {id:'A',label:'<?php echo _e("Date", "unilevel-mlm-pro"); ?> ',type:'string'}, {id:'B',label:'<?php echo _e("Opening Bal", "unilevel-mlm-pro"); ?> ',type:'string'}, {id:'C',label:'<?php echo _e("Dr. Amount", "unilevel-mlm-pro"); ?> ',type:'string'}, {id:'C',label:'<?php echo _e("Cr.Amount", "unilevel-mlm-pro"); ?> ',type:'string'}, {id:'C',label:'<?php echo _e("Closing Bal", "unilevel-mlm-pro"); ?> ',type:'string'}, {id:'D',label:'<?php echo _e("Comment", "unilevel-mlm-pro"); ?> ',type:'string'}], rows:[ <?php foreach ($records as $row) { if ($row->transaction_type == 1) { $type = 'deposit'; } if ($row->transaction_type == 2) { $type = 'Withdrawal'; } if ($row->dr_id != '0') { $withdrawal_fee = $wpdb->get_var("select withdrawal_fee from {$table_prefix}mlm_withdrawal where user_id ='{$row->user_id}' AND id='{$row->dr_id}'"); $witholding_tax = $wpdb->get_var("select witholding_tax from {$table_prefix}mlm_withdrawal where user_id ='{$row->user_id}' AND id='{$row->dr_id}'"); $othrs_method = ''; $othrs_method = $wpdb->get_var("select other_method from {$table_prefix}mlm_withdrawal where user_id ='{$row->user_id}' AND id='{$row->dr_id}'"); $othr_method = unserialize($othrs_method); } //print_r($othr_method);exit; $wf = empty($withdrawal_fee) ? '0.0' : $withdrawal_fee; $wt = empty($witholding_tax) ? '0.0' : $witholding_tax; $type = !empty($type) ? '0.0' : $type; $wf_comment = empty($withdrawal_fee) ? '' : 'Withdrawal Processing Fee'; $wt_comment = empty($witholding_tax) ? '' : 'Other Deductions:'; ?> <?php if (!empty($wt) && $wt != '0.0') { $amt = 0; for ($i = 0; $i < count($othr_method[1]); $i++) { if ($i == 0) { $wt_opening = $row->closing_bal + $othr_method[1][$i]; $closing = $row->closing_bal; } if ($i > 0) { $amt = $amt + $othr_method[1][$i - 1]; $wt_opening = $row->closing_bal + $othr_method[1][$i] + $amt; $closing = $row->closing_bal + $amt; } $rowcount++; ?> {c:[{v:'<?php echo DefaultDateFormat($row->transaction_date); ?> '}, {v:'<?php echo number_format($wt_opening, 2, '.', ''); ?> '}, {v:'<?php echo number_format($othr_method[1][$i], 2, '.', ''); ?> '}, {v:'<?php echo number_format($row->cr_amount, 2, '.', ''); ?> '}, {v:'<?php echo number_format($closing, 2, '.', ''); ?> '}, {v:'<?php echo 'Other Deductions: ' . $othr_method[0][$i]; ?> '}]}, <?php } } ?> <?php if (!empty($wf) && $wf != '0.0') { $rowcount++; ?> {c:[{v:'<?php echo DefaultDateFormat($row->transaction_date); ?> '}, {v:'<?php echo number_format($row->closing_bal + $wf + $wt, 2, '.', ''); ?> '}, {v:'<?php echo number_format($wf, 2, '.', ''); ?> '}, {v:'<?php echo number_format($row->cr_amount, 2, '.', ''); ?> '}, {v:'<?php echo number_format($row->closing_bal + $wt, 2, '.', ''); ?> '}, {v:'<?php echo $wf_comment; ?> '}]}, <?php } ?> {c:[{v:'<?php echo DefaultDateFormat($row->transaction_date); ?> '}, {v:'<?php echo number_format($row->opening_bal, 2, '.', ''); ?> '}, {v:'<?php echo number_format($row->dr_amount - $wf - $wt, 2, '.', ''); ?> '}, {v:'<?php echo number_format($row->cr_amount, 2, '.', ''); ?> '}, {v:'<?php echo number_format($row->closing_bal + $wf + $wt, 2, '.', ''); ?> '}, {v:'<?php echo $row->comment; ?> '}]}, <?php $rowcount++; unset($withdrawal_fee, $witholding_tax, $fundTransDeduct); } ?> ]}; data = new google.visualization.DataTable(dataAsJson); // Set paging configuration options // Note: these options are changed by the UI controls in the example. options['page'] = 'enable'; options['pageSize'] = 10; options['pagingSymbols'] = {prev: 'prev', next: 'next'}; options['pagingButtonsConfiguration'] = 'auto'; //options['allowHtml'] = true; //data.sort({column:1, desc: false}); // Create and draw the visualization. visualization = new google.visualization.Table(document.getElementById('table')); draw(); } function draw() { visualization.draw(data, options); } google.setOnLoadCallback(drawVisualization); // sets the number of pages according to the user selection. function setNumberOfPages(value) { if (value) { options['pageSize'] = parseInt(value, 10); options['page'] = 'enable'; } else { options['pageSize'] = null; options['page'] = null; } draw(); } // Sets custom paging symbols "Prev"/"Next" function setCustomPagingButtons(toSet) { options['pagingSymbols'] = toSet ? {next: 'next', prev: 'prev'} : null; draw(); } function setPagingButtonsConfiguration(value) { options['pagingButtonsConfiguration'] = value; draw(); } </script> <!--va-matter--> <div class="va-matter"> <!--va-matterbox--> <div class="va-matterbox"> <!--va-headname--> <div class="va-headname"><?php _e('My Transaction History (All figures below are in ' . $currency . ')', 'unilevel-mlm-pro'); ?> </div> <!--/va-headname--> <div class="va-admin-leg-details"> <!--va-admin-mid--> <div class="paging"> <form action=""> <div class="left-side"> <?php _e('Display Number of Rows', 'unilevel-mlm-pro'); ?> : </div> <div class="right-side"> <select style="font-size: 12px" onchange="setNumberOfPages(this.value)"> <option value="5">5</option> <option selected="selected" value="10">10</option> <option value="20">20</option> <option value="50">50</option> <option value="100">100</option> <option value="500">500</option> <option value="">All</option> </select> </div> </form> <div class="right-members"> <?php _e('Total Records', 'unilevel-mlm-pro'); ?> : <strong><?php echo $rowcount; ?> </strong> </div> <div class="va-clear"></div> </div> <div id="table"></div> <div class="va-clear"></div> </div> </div> </div> <?php } }
function join_network() { global $wpdb, $current_user; $user_id = $current_user->ID; $table_prefix = mlm_core_get_table_prefix(); $error = ''; $chk = 'error'; if (!empty($_GET['sp_name'])) { $sp_name = $wpdb->get_var("select username from {$table_prefix}mlm_users where username='******'sp_name'] . "'"); if ($sp_name) { ?> <script type='text/javascript'> $.cookie('sp_name', '<?php echo $sp_name; ?> ', {path: '/'}); </script> <?php } } else { if (!empty($_REQUEST['sp'])) { $sp_name = $wpdb->get_var("select username from {$table_prefix}mlm_users where user_key='" . $_REQUEST['sp'] . "'"); if ($sp_name) { ?> <script type='text/javascript'> $.cookie('sp_name', '<?php echo $sp_name; ?> ', {path: '/'}); </script> <?php } } else { $sp_name = empty($_COOKIE["sp_name"]) ? '' : $_COOKIE["sp_name"]; } } /* * ****date format ***** */ $date_format = get_option('date_format'); $time_format = get_option('time_format'); /* * ****** end******* */ global $current_user; get_currentuserinfo(); $mlm_general_settings = get_option('wp_mlm_general_settings'); if (isset($_REQUEST['sp']) && $_REQUEST['sp'] != '') { $sponsorName = getusernamebykey($_REQUEST['sp']); if (isset($sponsorName) && $sponsorName != '') { $readonly_sponsor = 'readonly'; $sponsor_name = $sponsorName; } else { redirectPage(home_url(), array()); exit; } } else { if (!empty($_REQUEST['sp_name'])) { $sponsorName = $_REQUEST['sp_name']; if (!empty($sponsorName)) { $readonly_sponsor = 'readonly'; $sponsor_name = $sponsorName; } else { redirectPage(home_url(), array()); exit; } } else { $readonly_sponsor = ''; } } //most outer if condition if (isset($_POST['submit'])) { $firstname = sanitize_text_field($_POST['firstname']); $lastname = sanitize_text_field($_POST['lastname']); $email = sanitize_text_field($_POST['email']); $sponsor = sanitize_text_field($_POST['sponsor']); if (empty($sponsor)) { $sponsor = $wpdb->get_var("select `username` FROM {$table_prefix}mlm_users order by id asc limit 1"); } if (checkInputField($firstname)) { $error .= "\n Please enter your first name."; } if (checkInputField($lastname)) { $error .= "\n Please enter your last name."; } if (!is_email($email)) { $error .= "\n E-mail address is invalid."; } //Add usernames we don't want used $invalid_usernames = array('admin'); //Do username validation $sql = "SELECT COUNT(*) num, `user_key` \n\t\t\t\tFROM {$table_prefix}mlm_users \n\t\t\t\tWHERE `username` = '" . $sponsor . "'"; $intro = $wpdb->get_row($sql); if (isset($_GET['l']) && $_GET['l'] != '') { $leg = $_GET['l']; } else { $leg = $_POST['leg']; } if (isset($leg) && $leg != '0') { if ($leg != '1') { $error .= "\n You have enter a wrong placement."; } } if (!isset($leg)) { $key = $wpdb->get_var("SELECT user_key FROM {$table_prefix}mlm_users WHERE user_id = '{$user_id}'"); $l = totalLeftLegUsers($key); $r = totalRightLegUsers($key); if ($l < $r) { $leg = '0'; } else { $leg = '1'; } } //generate random numeric key for new user registration $user_key = generateKey(); //if generated key is already exist in the DB then again re-generate key do { $check = $wpdb->get_var("SELECT COUNT(*) ck FROM {$table_prefix}mlm_users \n WHERE `user_key` = '" . $user_key . "'"); $flag = 1; if ($check == 1) { $user_key = generateKey(); $flag = 0; } } while ($flag == 0); //check parent key exist or not if (isset($_GET['k']) && $_GET['k'] != '') { if (!checkKey($_GET['k'])) { $error .= "\n Parent key does't exist."; } // check if the user can be added at the current position $checkallow = checkallowed($_GET['k'], $leg); if ($checkallow >= 1) { $error .= "\n You have enter a wrong placement."; } } // outer if condition if (empty($error)) { // inner if condition if ($intro->num == 1) { $sponsor = $intro->user_key; $sponsor1 = $sponsor; //find parent key if (isset($_GET['k']) && $_GET['k'] != '') { $parent_key = $_GET['k']; } else { $readonly_sponsor = ''; do { $sql = "SELECT `user_key` FROM {$table_prefix}mlm_users \n WHERE parent_key = '" . $sponsor1 . "' AND \n leg = '" . $leg . "' AND banned = '0'"; $spon = $wpdb->get_var($sql); $num = $wpdb->num_rows; if ($num) { $sponsor1 = $spon; } } while ($num == 1); $parent_key = $sponsor1; } // return the wp_users table inserted user's ID $user = array('ID' => $user_id, 'first_name' => $firstname, 'last_name' => $lastname, 'user_email' => $email, 'role' => 'mlm_user'); // return the wp_users table inserted user's ID $user_id = wp_update_user($user); $username = $current_user->user_login; //get the selected country name from the country table /* Send e-mail to admin and new user - You could create your own e-mail instead of using this function */ /** * ****** product Price set *************** */ if (!empty($mlm_general_settings['product_price'])) { $pc = $mlm_general_settings['product_price']; } else { $pc = '0'; } //insert the data into fa_user table if (!empty($epin)) { $pointStatus = $wpdb->get_row("select point_status from {$table_prefix}mlm_epins where epin_no = '{$epin}'", ARRAY_N); // to epin point status 1 if ($pointStatus[0] == '1') { $paymentStatus = '1'; $product_price = $pc; } else { if ($pointStatus[0] == '0') { $paymentStatus = '2'; $product_price = '0'; } } } else { // to non epin $paymentStatus = '0'; $product_price = '0'; } $insert = "INSERT INTO {$table_prefix}mlm_users(\n\t\t\tuser_id, username, user_key, parent_key, sponsor_key, leg,payment_status,product_price) \n\t\t\tVALUES(\n\t\t\t'" . $user_id . "','" . $username . "', '" . $user_key . "', '" . $parent_key . "', '" . $sponsor . "', '" . $leg . "','" . $paymentStatus . "','" . $product_price . "')"; // if all data successfully inserted if ($wpdb->query($insert)) { //begin most inner if condition //entry on Left and Right Leg tables if ($leg == 0) { $insert = "INSERT INTO {$table_prefix}mlm_leftleg (pkey, ukey) \n\t\t\t\tVALUES ('" . $parent_key . "','" . $user_key . "')"; $insert = $wpdb->query($insert); } else { if ($leg == 1) { $insert = "INSERT INTO {$table_prefix}mlm_rightleg(pkey, ukey) \n\t\t\t\tVALUES('" . $parent_key . "','" . $user_key . "')"; $insert = $wpdb->query($insert); } } //begin while loop while ($parent_key != '0') { $query = "SELECT COUNT(*) num, parent_key, leg \n FROM {$table_prefix}mlm_users \n WHERE user_key = '" . $parent_key . "'\n AND banned = '0'"; $result = $wpdb->get_row($query); if ($result->num == 1) { if ($result->parent_key != '0') { if ($result->leg == 1) { $tbright = "INSERT INTO {$table_prefix}mlm_rightleg (pkey,ukey) \n\t\t\t\t\t\tVALUES('" . $result->parent_key . "','" . $user_key . "')"; $tbright = $wpdb->query($tbright); } else { $tbleft = "INSERT INTO {$table_prefix}mlm_leftleg (pkey, ukey) \n\t\t\t\t\t\tVALUES('" . $result->parent_key . "','" . $user_key . "')"; $tbleft = $wpdb->query($tbleft); } } $parent_key = $result->parent_key; } else { $parent_key = '0'; } } //end while loop if (isset($epin) && !empty($epin)) { $sql = "update {$table_prefix}mlm_epins set user_key='{$user_key}', date_used=now(), status=1 where epin_no ='{$epin}' "; // Update epin according user_key (19-07-2013) $wpdb->query($sql); if ($paymentStatus == 1) { insert_refferal_commision($user_id, $sponsor, $user_key); } } $chk = ''; $msg = "<span style='color:green;'>Congratulations! You have successfully Join MLM</span>"; } //end most inner if condition } else { $error = "\n Sponsor does not exist in the system."; } } //end outer if condition } //end most outer if condition //if any error occoured if (!empty($error)) { $error = nl2br($error); } if ($chk != '') { include 'js-validation-file.html'; ?> <?php if ($current_user->roles[0] == 'mlm_user') { echo "Your are MLM user"; } else { $_POST['firstname'] = get_user_meta($user_id, 'first_name', true); $_POST['lastname'] = get_user_meta($user_id, 'last_name', true); $_POST['email'] = $current_user->user_email; ?> <script> function checkspname() { var spname = document.getElementById('sponsor').value; if (spname == '') { if (!confirm('Are you sure you do not know your Sponsor\'s username? Proceed without a Sponsor?')) { return false; } } } </script> <span style='color:red;'><?php echo $error; ?> </span> <?php if (isset($msg) && $msg != "") { echo $msg; } ?> <form name="frm" method="post" action="" onSubmit="checkspname()"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('First Name', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="firstname" id="firstname" value="<?php if (!empty($_POST['firstname'])) { _e(htmlentities($_POST['firstname'])); } ?> " maxlength="20" size="37" onBlur="return checkname(this.value, 'firstname');" ></td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Last Name', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="lastname" id="lastname" value="<?php if (!empty($_POST['lastname'])) { _e(htmlentities($_POST['lastname'])); } ?> " maxlength="20" size="37" onBlur="return checkname(this.value, 'lastname');"></td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Email Address', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="email" id="email" value="<?php if (!empty($_POST['email'])) { _e(htmlentities($_POST['email'])); } ?> " size="37" ></td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Sponsor Name', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td> <input type="text" name="sponsor" id="sponsor" value="<?php if (!empty($_POST['sponsor'])) { _e(htmlentities($_POST['sponsor'])); } ?> " maxlength="20" size="37" onkeyup="checkReferrerAvailability12(this.value);"> <br /><div id="check_referrer"></div> </td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Placement', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><?php echo __('Left', 'binary-mlm-pro'); ?> <input id="left" type="radio" name="leg" value="0" <?php echo isset($led) && $leg == '0' ? 'checked="checked"' : ''; ?> /> <?php echo __('Right', 'binary-mlm-pro'); ?> <input id="right" type="radio" name="leg" value="1" <?php echo isset($led) && $leg == '0' ? 'checked="checked"' : ''; ?> /> </td> <tr><td colspan="2"> </td></tr> <tr> <td colspan="2"><input type="submit" name="submit" id="submit" value="<?php _e('Submit', 'binary-mlm-pro'); ?> " /></td> </tr> </table> </form> <?php } ?> <?php } else { _e($msg); } }
function mlmDeduction() { //get database table prefix $table_prefix = mlm_core_get_table_prefix(); $error = ''; $chk = 'error'; //most outer if condition if (isset($_POST['mlm_withdrawal_settings'])) { $withdwl_mthd = count(array_filter($_POST['withdwl_mthd'])); $withdwl_type = $_POST['withdwl_type']; $withdwl_amt = count(array_filter($_POST['withdwl_amt'])); if ($withdwl_mthd == 0) { $error .= "\n Please Specify Name of Withdrawal Method."; } if ($withdwl_amt == 0) { $error .= "\n Please Specify Amount."; } if (checkInputField($withdwl_type)) { $error .= "\n Please Specify Type."; } //if any error occoured if (!empty($error)) { $error = nl2br($error); } else { $chk = ''; update_option('wp_mlm_withdrawal_method_settings', $_POST); $url = get_bloginfo('url') . "/wp-admin/admin.php?page=admin-settings&tab=deduction"; _e("<script>window.location='{$url}'</script>"); $msg = _e("<span style='color:green;'>Your Withdrawal Settings has been successfully updated.</span>", 'unilevel-mlm-pro'); } } else { if (isset($_POST['mlm_other_method_settings'])) { $othr_mthd = count(array_filter($_POST['othr_mthd'])); $othr_type = $_POST['othr_type']; $othr_amt = count(array_filter($_POST['othr_amt'])); if ($othr_mthd == 0) { $error .= "\n Please Specify Name of Other Method."; } if ($othr_amt == 0) { $error .= "\n Please Specify Amount."; } if (checkInputField($othr_type)) { $error .= "\n Please Specify Type."; } //if any error occoured if (!empty($error)) { $error = nl2br($error); } else { $chk = ''; update_option('wp_mlm_other_method_settings', $_POST); $url = get_bloginfo('url') . "/wp-admin/admin.php?page=admin-settings&tab=deduction"; _e("<script>window.location='{$url}'</script>"); $msg = _e("<span style='color:green;'>Your Other Method Settings has been successfully updated.</span>", 'unilevel-mlm-pro'); } } } // end outer if condition if ($chk != '') { $mlm_withdrawal_settings = get_option('wp_mlm_withdrawal_method_settings'); $mlm_other_settings = get_option('wp_mlm_other_method_settings'); ?> <div class='wrap1'> <h2><?php _e('Deductions Settings', 'unilevel-mlm-pro'); ?> </h2> <div class="notibar msginfo"> <a class="close"></a> <p><?php _e('These settings will define the amounts that would be deducted from the withdrawals made by members in their Member\'s Area.', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('Withdrawal Methods', 'unilevel-mlm-pro'); ?> - </strong></p> <p><?php _e('You can configure the various withdrawal methods and the amount (fixed or percentage) that would be deductible if the member opts for a particular method of withdrawal.', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('Other deductions', 'unilevel-mlm-pro'); ?> -</strong> </p> <p><?php _e('You can configure other deductions that would be deducted from a withdrawal. Typical examples could include a general service charge, withholding tax or any other amount that you like to deduct from the withdrawal amount.', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('Note ', 'unilevel-mlm-pro'); ?> : </strong> <?php _e('All % amounts would always apply the specified % to the actual amount withdrawn.', 'unilevel-mlm-pro'); ?> </p> </div> <?php if ($error) { ?> <div class="notibar msgerror"> <a class="close"></a> <p> <strong><?php _e('Please Correct the following Error', 'unilevel-mlm-pro'); ?> :</strong> <?php _e($error); ?> </p> </div> <?php } ?> <?php if (!empty($msg)) { ?> <div class="notibar msgerror"> <a class="close"></a> <p><?php _e($msg); ?> </p> </div> <?php } ?> <?php if (empty($mlm_withdrawal_settings)) { ?> <form name="admin_withdrawalsettings" method="post" action=""> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="form-table"> <tr><td><h3><?php _e('Withdrawal Method', 'unilevel-mlm-pro'); ?> </h3></td></tr> <tr> <td> <INPUT type="button" value="<?php _e('Add Row', 'unilevel-mlm-pro'); ?> " onclick="addRow('dataTable')" class='button-primary' /> <INPUT type="button" value="<?php _e('Delete Row', 'unilevel-mlm-pro'); ?> " onclick="deleteRow('dataTable')" class='button-primary' /> <div class="toggle-visibility" id="admin-mlm-bonus-slab"><?php _e('Add or remove bonus slab.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <tr><td> </td></tr> </table> <TABLE id="dataTableheading" cellspacing="5" cellpadding="5" border="0" width="450"> <TR> <TD align="left" width="10%"><strong><?php _e('Select', 'unilevel-mlm-pro'); ?> </strong></TD> <TD align="left" width="35%"> <strong><?php _e('Withdrawal Method', 'unilevel-mlm-pro'); ?> </strong></TD> <TD align="left" width="20%"> <strong><?php _e('Amount', 'unilevel-mlm-pro'); ?> </strong></TD> <TD align="left" width="20%"> <strong><?php _e('Min. </br>Amount', 'unilevel-mlm-pro'); ?> </strong></TD> <TD align="left" width="20%"><strong><?php _e('Type', 'unilevel-mlm-pro'); ?> </strong></TD> </TR> </TABLE> <br\> <TABLE id="dataTable" cellspacing="5" cellpadding="5" border="0" width="450"> <TR> <TD align="left" width="10%"><INPUT type="checkbox" name="chk[]"/></TD> <TD align="left" width="40%"> <INPUT type="text" name="withdwl_mthd[]" size="15" /> </TD> <TD align="left" width="20%"> <INPUT type="text" name="withdwl_amt[]" size="5" /> </TD> <TD align="left" width="20%"> <INPUT type="text" name="min_amount[]" size="5" /> </TD> <TD align="left" width="20%"> <select name="withdwl_type[]" id="withdwl_type"> <option value=""><?php _e('Select Type', 'unilevel-mlm-pro'); ?> </option> <option value="fixed" <?php echo isset($_POST['withdwl_type']) && $_POST['withdwl_type'] == 'fixed' ? 'selected' : ''; ?> ><?php _e('Fixed', 'unilevel-mlm-pro'); ?> </option> <option value="percent" <?php echo isset($_POST['withdwl_type']) && $_POST['withdwl_type'] == 'percent' ? 'selected' : ''; ?> ><?php _e('Percentage', 'unilevel-mlm-pro'); ?> </option> </select> </TD> </TR> </TABLE> <table border="0" width="100%"> <tr> <td> <p class="submit"> <input type="submit" name="mlm_withdrawal_settings" id="mlm_withdrawal_settings" value="<?php _e('Update Options', 'unilevel-mlm-pro'); ?> »" class='button-primary' onclick="needToConfirm = false;"> </p> </td> <tr> </table> </form> <script language="JavaScript"> populateArrays(); </script> <?php } else { if (!empty($mlm_withdrawal_settings)) { ?> <form name="admin_withdrawal_settings" method="post" action=""> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="form-table"> <tr><td><h3><?php _e('Withdrawal Method', 'unilevel-mlm-pro'); ?> </h3></td></tr> <tr> <tr> <td> <INPUT type="button" value="<?php _e('Add Row', 'unilevel-mlm-pro'); ?> " onclick="addRow('dataTable')" class='button-primary'/> <INPUT type="button" value="<?php _e('Delete Row', 'unilevel-mlm-pro'); ?> " onclick="deleteRow('dataTable')" class='button-primary'/> <div class="toggle-visibility" id="admin-mlm-bonus-slab"><?php _e('Add or remove bonus slab.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <tr><td> </td></tr> </table> <TABLE id="dataTableheading" cellspacing="5" cellpadding="5" border="0" width="450" > <TR> <TD align="left" width="10%"><strong><?php _e('Select', 'unilevel-mlm-pro'); ?> </strong></TD> <TD align="left" width="35%"> <strong><?php _e('Withdrawal Method', 'unilevel-mlm-pro'); ?> </strong></TD> <TD align="left" width="20%"> <strong><?php _e('Amount', 'unilevel-mlm-pro'); ?> </strong></TD> <TD align="left" width="20%"> <strong><?php _e('Min. </br> Amount', 'unilevel-mlm-pro'); ?> </strong></TD> <TD align="left" width="20%"><strong><?php _e('Type', 'unilevel-mlm-pro'); ?> </strong></TD> </TR> </TABLE> <br\> <TABLE id="dataTable" cellspacing="5" cellpadding="5" border="0" width="450"> <?php $i = 0; while ($i < count($mlm_withdrawal_settings['withdwl_mthd'])) { ?> <TR> <TD align="left" width="10%"><INPUT type="checkbox" name="chk[]"/></TD> <TD align="left" width="40%"> <INPUT type="text" name="withdwl_mthd[]" size="15" value="<?php echo $mlm_withdrawal_settings['withdwl_mthd'][$i]; ?> "/> </TD> <TD> <INPUT type="text" name="withdwl_amt[]" size="5" value="<?php echo $mlm_withdrawal_settings['withdwl_amt'][$i]; ?> "/> </TD> <TD> <INPUT type="text" name="min_amount[]" size="5" value="<?php echo $mlm_withdrawal_settings['min_amount'][$i]; ?> "/> </TD> <TD align="center" width="25%"> <select name="withdwl_type[]" id="withdwl_type"> <option value=""><?php _e('Select Type', 'unilevel-mlm-pro'); ?> </option> <option value="fixed" <?php echo $mlm_withdrawal_settings['withdwl_type'][$i] == 'fixed' ? 'selected' : ''; ?> ><?php _e('Fixed', 'unilevel-mlm-pro'); ?> </option> <option value="percent" <?php echo $mlm_withdrawal_settings['withdwl_type'][$i] == 'percent' ? 'selected' : ''; ?> ><?php _e('Percentage', 'unilevel-mlm-pro'); ?> </option> </select> </TD> </TR> <?php $i++; } ?> </TABLE> <p class="submit"> <input type="submit" name="mlm_withdrawal_settings" id="mlm_withdrawal_settings" value="<?php _e('Update Options', 'unilevel-mlm-pro'); ?> »" class='button-primary' onclick="needToConfirm = false;"> </p> </form> <script language="JavaScript"> populateArrays(); </script> <?php } } if (empty($mlm_other_settings)) { ?> <form name="admin_other_settings" method="post" action=""> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="form-table"> <tr><td><h3><?php _e('Other Deductions', 'unilevel-mlm-pro'); ?> </h3></td></tr> <tr> <td> <INPUT type="button" value="<?php _e('Add Row', 'unilevel-mlm-pro'); ?> " onclick="addRow('dataWithDrawalTable')" class='button-primary' /> <INPUT type="button" value="<?php _e('Delete Row', 'unilevel-mlm-pro'); ?> " onclick="deleteRow('dataWithDrawalTable')" class='button-primary' /> <div class="toggle-visibility" id="admin-mlm-bonus-slab"><?php _e('Add or remove bonus slab.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <tr><td> </td></tr> </table> <TABLE id="dataTableheading" cellspacing="5" cellpadding="5" border="0" width="450"> <TR> <TD align="left" width="10%"><strong><?php _e('Select', 'unilevel-mlm-pro'); ?> </strong></TD> <TD align="left" width="40%"> <strong><?php _e('Name of Deduction', 'unilevel-mlm-pro'); ?> </strong></TD> <TD align="left" width="25%"> <strong><?php _e('Amount', 'unilevel-mlm-pro'); ?> </strong></TD> <TD align="left" width="25%"><strong><?php _e('Type', 'unilevel-mlm-pro'); ?> </strong></TD> </TR> </TABLE> <br\> <TABLE id="dataWithDrawalTable" cellspacing="5" cellpadding="5" border="0" width="450"> <TR> <TD align="left" width="10%"><INPUT type="checkbox" name="chk[]"/></TD> <TD align="left" width="40%"> <INPUT type="text" name="othr_mthd[]" size="15" /> </TD> <TD align="center" width="25%"> <INPUT type="text" name="othr_amt[]" size="10" /> </TD> <TD align="center" width="25%"> <select name="othr_type[]" id="othr_type"> <option value=""><?php _e('Select Type', 'unilevel-mlm-pro'); ?> </option> <option value="fixed" <?php echo isset($_POST['othr_type']) && $_POST['othr_type'] == 'fixed' ? 'selected' : ''; ?> ><?php _e('Fixed', 'unilevel-mlm-pro'); ?> </option> <option value="percent" <?php echo isset($_POST['othr_type']) && $_POST['othr_type'] == 'fixed' ? 'selected' : ''; ?> ><?php _e('Percentage', 'unilevel-mlm-pro'); ?> </option> </select> </TD> </TR> </TABLE> <table border="0" width="100%"> <tr> <td> <p class="submit"> <input type="submit" name="mlm_other_method_settings" id="mlm_other_method_settings" value="<?php _e('Update Options', 'unilevel-mlm-pro'); ?> »" class='button-primary' onclick="needToConfirm = false;"> </p> </td> <tr> </table> </form> </div> <script language="JavaScript"> populateArrays(); </script> <?php } else { if (!empty($mlm_other_settings)) { ?> <form name="admin_other_settings" method="post" action=""> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="form-table"> <tr><td><h3><?php _e('Other Deductions', 'unilevel-mlm-pro'); ?> </h3></td></tr> <tr> <td> <INPUT type="button" value="<?php _e('Add Row', 'unilevel-mlm-pro'); ?> " onclick="addRow('dataWithDrawalTable')" class='button-primary'/> <INPUT type="button" value="<?php _e('Delete Row', 'unilevel-mlm-pro'); ?> " onclick="deleteRow('dataWithDrawalTable')" class='button-primary'/> <div class="toggle-visibility" id="admin-mlm-bonus-slab"><?php _e('Add or remove bonus slab.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <tr><td> </td></tr> </table> <TABLE id="dataTableheading" cellspacing="5" cellpadding="5" border="0" width="450" > <TR> <TD align="left" width="10%"><strong><?php _e('Select', 'unilevel-mlm-pro'); ?> </strong></TD> <TD align="left" width="40%"> <strong><?php _e('Name of Deduction', 'unilevel-mlm-pro'); ?> </strong></TD> <TD align="left" width="25%"> <strong><?php _e('Amount', 'unilevel-mlm-pro'); ?> </strong></TD> <TD align="left" width="25%"><strong><?php _e('Type', 'unilevel-mlm-pro'); ?> </strong></TD> </TR> </TABLE> <br\> <TABLE id="dataWithDrawalTable" cellspacing="5" cellpadding="5" border="0" width="450"> <?php $i = 0; while ($i < count($mlm_other_settings['othr_mthd'])) { ?> <TR> <TD align="left" width="10%"><INPUT type="checkbox" name="chk[]"/></TD> <TD align="left" width="40%"> <INPUT type="text" name="othr_mthd[]" size="15" value="<?php echo $mlm_other_settings['othr_mthd'][$i]; ?> "/> </TD> <TD align="left" width="25%"> <INPUT type="text" name="othr_amt[]" size="10" value="<?php echo $mlm_other_settings['othr_amt'][$i]; ?> "/> </TD> <TD align="center" width="25%"> <select name="othr_type[]" id="othr_type"> <option value=""><?php _e('Select Type', 'unilevel-mlm-pro'); ?> </option> <option value="fixed" <?php echo $mlm_other_settings['othr_type'][$i] == 'fixed' ? 'selected' : ''; ?> ><?php _e('Fixed', 'unilevel-mlm-pro'); ?> </option> <option value="percent" <?php echo $mlm_other_settings['othr_type'][$i] == 'percent' ? 'selected' : ''; ?> ><?php _e('Percentage', 'unilevel-mlm-pro'); ?> </option> </select> </TD> </TR> <?php $i++; } ?> </TABLE> <p class="submit"> <input type="submit" name="mlm_other_method_settings" id="mlm_other_method_settings" value="<?php _e('Update Options', 'unilevel-mlm-pro'); ?> »" class='button-primary' onclick="needToConfirm = false;"> </p> </form> </div> <script language="JavaScript"> populateArrays(); </script> <?php } } } else { _e($msg); } }
function join_network_page() { global $wpdb, $current_user; $user_id = $current_user->ID; $table_prefix = mlm_core_get_table_prefix(); $error = ''; $chk = 'error'; global $current_user; get_currentuserinfo(); if (!empty($_GET['sp_name'])) { $sp_name = $_GET['sp_name']; ?> <script>$.cookie('s_name', '<?php echo $sp_name; ?> ', {path: '/'});</script> <?php //setcookie("s_name", $sp_name); } else { if (!empty($_GET['sp'])) { $sp_name = getusernamebykey($_GET['sp']); ?> <script>$.cookie('s_name', '<?php echo $sp_name; ?> ', {path: '/'});</script> <?php } else { $sp_name = $_COOKIE["s_name"]; } } /* * ****date format ***** */ $date_format = get_option('date_format'); $time_format = get_option('time_format'); /* * ****** end******* */ $mlm_general_settings = get_option('wp_mlm_general_settings'); $mlm_no_of_level = $mlm_general_settings['mlm-level']; $mlm_pay_settings = get_option('wp_mlm_payment_settings'); $mlm_method = get_option('wp_mlm_payment_method'); if (isset($_REQUEST['sp_name']) && $_REQUEST['sp_name'] != '') { //$sponsorName = getusernamebykey($_REQUEST['sp']); $sponsorName = $_REQUEST['sp_name']; if (isset($sponsorName) && $sponsorName != '') { $readonly_sponsor = 'readonly'; $sponsor_name = $sponsorName; } } else { if (isset($_COOKIE["s_name"]) && $_COOKIE["s_name"] != '') { $readonly_sponsor = 'readonly'; $sponsor_name = $_COOKIE["s_name"]; } else { if (isset($_REQUEST['sp']) && $_REQUEST['sp'] != '') { //$sponsorName = getusernamebykey($_REQUEST['sp']); $sponsorName = getusernamebykey($_REQUEST['sp']); if (isset($sponsorName) && $sponsorName != '') { $readonly_sponsor = 'readonly'; $sponsor_name = $sponsorName; } } else { $readonly_sponsor = ''; } } } //most outer if condition if (isset($_POST['submit'])) { $sponsor = sanitize_text_field($_POST['sponsor']); if (empty($sponsor)) { $sponsor = $wpdb->get_var("select `username` FROM {$table_prefix}mlm_users order by id asc limit 1"); } $firstname = sanitize_text_field($_POST['firstname']); $lastname = sanitize_text_field($_POST['lastname']); $email = sanitize_text_field($_POST['email']); /* * ***** check for the epin field ***** */ if (isset($_POST['epin']) && !empty($_POST['epin'])) { $epin = sanitize_text_field($_POST['epin']); } else { if (isset($_POST['epin']) && empty($_POST['epin'])) { $epin = ''; } } /* * ***** check for the epin field ***** */ /* $address1 = sanitize_text_field( $_POST['address1'] ); $address2 = sanitize_text_field( $_POST['address2'] ); $city = sanitize_text_field( $_POST['city'] ); $state = sanitize_text_field( $_POST['state'] ); $postalcode = sanitize_text_field( $_POST['postalcode'] ); $telephone = sanitize_text_field( $_POST['telephone'] ); $dob = sanitize_text_field( $_POST['dob'] ); */ //Add usernames we don't want used $invalid_usernames = array('admin'); //Do username validation $sql = "SELECT COUNT(*) num, `user_key` \n\t\t\t\tFROM {$table_prefix}mlm_users \n\t\t\t\tWHERE `username` = '" . $sponsor . "'"; //Case If User is not fill the Sponser field $intro = $wpdb->get_row($sql); if (checkInputField($firstname)) { $error .= "\n Please enter your first name."; } if (checkInputField($lastname)) { $error .= "\n Please enter your last name."; } if (checkInputField($email)) { $error .= "\n Please enter your email address."; } /* * ***** check for the epin field ***** */ if (isset($epin) && !empty($epin)) { if (epin_exists($epin)) { $error .= "\n ePin already issued or wrong ePin."; } } if ($mlm_general_settings['sol_payment'] == 1) { if (isset($_POST['epin']) && empty($_POST['epin'])) { $error .= "\n Please enter your ePin."; } } /* * ***** check for the epin field ***** */ /* if ( checkInputField($address1) ) $error .= "\n Please enter your address."; if ( checkInputField($city) ) $error .= "\n Please enter your city."; if ( checkInputField($state) ) $error .= "\n Please enter your state."; if ( checkInputField($postalcode) ) $error .= "\n Please enter your postal code."; if ( checkInputField($telephone) ) $error .= "\n Please enter your contact number."; if ( checkInputField($dob) ) $error .= "\n Please enter your date of birth."; */ //generate random numeric key for new user registration $user_key = generateKey(); //if generated key is already exist in the DB then again re-generate key do { $check = $wpdb->get_var("SELECT COUNT(*) ck \n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM {$table_prefix}mlm_users \n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `user_key` = '" . $user_key . "'"); $flag = 1; if ($check == 1) { $user_key = generateKey(); $flag = 0; } } while ($flag == 0); // outer if condition if (empty($error)) { // inner if condition if ($intro->num == 1) { $sponsor = $intro->user_key; $parent_key = $sponsor; // return the wp_users table inserted user's ID wp_update_user(array('ID' => $user_id, 'role' => 'mlm_user')); $username = $current_user->user_login; //get the selected country name from the country table $country = $_POST['country']; $sql = "SELECT name \n\t\t\t\t\t\tFROM {$table_prefix}mlm_country\n\t\t\t\t\t\tWHERE id = '" . $country . "'"; $country1 = $wpdb->get_var($sql); //insert the registration form data into user_meta table $user = array('ID' => $user_id, 'first_name' => $firstname, 'last_name' => $lastname, 'user_email' => $email, 'role' => 'mlm_user'); // return the wp_users table inserted user's ID $user_id = wp_update_user($user); /* add_user_meta( $user_id, 'user_address1', $address1, FALSE ); add_user_meta( $user_id, 'user_address2', $address2, FALSE ); add_user_meta( $user_id, 'user_city', $city, FALSE ); add_user_meta( $user_id, 'user_state', $state, FALSE ); add_user_meta( $user_id, 'user_country', $country1, FALSE ); add_user_meta( $user_id, 'user_postalcode', $postalcode, FALSE ); add_user_meta( $user_id, 'user_telephone', $telephone, FALSE ); add_user_meta( $user_id, 'user_dob', $dob, FALSE); */ //get the selected country name from the country table if (!empty($epin)) { $pointResult = mysql_query("select point_status from {$table_prefix}mlm_epins where epin_no = '{$epin}'"); $pointStatus = mysql_fetch_row($pointResult); // to epin point status 1 if ($pointStatus[0] == '1') { $paymentStatus = '1'; } else { if ($pointStatus[0] == '0') { $paymentStatus = '2'; } } } else { // to non epin $paymentStatus = '0'; } //insert the data into fa_user table $insert = "INSERT INTO {$table_prefix}mlm_users\n\t\t\t\t\t\t (\n\t\t\t\t\t\t\t\tuser_id, username, user_key, parent_key, sponsor_key, payment_status\n\t\t\t\t\t\t\t) \n\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t'" . $user_id . "','" . $username . "', '" . $user_key . "', '" . $parent_key . "', '" . $sponsor . "','" . $paymentStatus . "'\n\t\t\t\t\t\t\t)"; $wpdb->query($insert); //hierarchy code for genology InsertHierarchy($user_key, $sponsor); if (isset($epin) && !empty($epin)) { $sql = "update {$table_prefix}mlm_epins set user_key='{$user_key}', date_used=now(), status=1 where epin_no ='{$epin}' "; // Update epin according user_key (19-07-2013) mysql_query($sql); if ($paymentStatus == 1) { UserStatusUpdate($user_id); } } $chk = ''; $msg = "<span style='color:green;'>Congratulations! You have successfully Join MLM</span>"; $check_paid = $wpdb->get_var("SELECT payment_status FROM {$table_prefix}mlm_users WHERE user_id = '" . $user_id . "'"); if ($check_paid == '0') { PayNowOptions($user_id, 'join_net'); } } else { $error = "\n Sponsor does not exist in the system."; } } //end inner if condition } //end outer if condition // } //if any error occoured if (!empty($error)) { $error = nl2br($error); } if ($chk != '') { //include 'js-validation-file.html'; ?> <script type="text/javascript"> var popup1, popup2, splofferpopup1; var bas_cal, dp_cal1, dp_cal2, ms_cal; // declare the calendars as global variables window.onload = function() { dp_cal1 = new Epoch('dp_cal1', 'popup', document.getElementById('dob')); }; function checkReferrerAvailability(str) { if (isSpclChar(str, 'sponsor') == false) { document.getElementById('sponsor').focus(); return false; } var xmlhttp; if (str != "") { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function() { if (xmlhttp.status == 200 && xmlhttp.readyState == 4) { document.getElementById("check_referrer").innerHTML = xmlhttp.responseText; } } xmlhttp.open("GET", "<?php echo MLM_PLUGIN_URL . 'ajax/check_username.php'; ?> " + "?action=sponsor&q=" + str, true); xmlhttp.send(); } } </script> <?php if ($current_user->roles[0] == 'mlm_user') { echo "Your are already a MLM user"; } else { $fname = get_user_meta($user_id, 'first_name', true); $lname = get_user_meta($user_id, 'last_name', true); $u_email = $current_user->user_email; ?> <span style='color:red;'><?php echo $error; ?> </span> <?php if (isset($msg) && $msg != "") { echo $msg; } ?> <form name="frm" method="post" action="" onSubmit="return JoinNetworkformValidation();"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('First Name', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="firstname" id="firstname" value="<?php if (!empty($fname)) { _e(htmlentities($fname)); } elseif (!empty($_POST['firstname'])) { _e(htmlentities($_POST['firstname'])); } ?> " maxlength="20" size="37" onBlur="return checkname(this.value, 'firstname');" ></td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Last Name', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="lastname" id="lastname" value="<?php if (!empty($lname)) { _e(htmlentities($lname)); } elseif (!empty($_POST['lastname'])) { _e(htmlentities($_POST['lastname'])); } ?> " maxlength="20" size="37" onBlur="return checkname(this.value, 'lastname');"></td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Email', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="email" id="email" value="<?php if (!empty($u_email)) { _e(htmlentities($u_email)); } elseif (!empty($_POST['email'])) { _e(htmlentities($_POST['email'])); } ?> " size="37" ></td> </tr> <tr><td colspan="2"> </td></tr> <tr> <?php if (isset($sponsor_name) && $sponsor_name != '') { $spon = $sponsor_name; } else { if (isset($_POST['sponsor'])) { $spon = htmlentities($_POST['sponsor']); } } ?> <td><?php _e('Sponsor Name', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td> <input type="text" name="sponsor" id="sponsor" value="<?php if (!empty($spon)) { _e($spon); } ?> " maxlength="20" size="37" onBlur="checkReferrerAvailability(this.value);" <?php echo $readonly_sponsor; ?> > <br /><div id="check_referrer"></div> </td> </tr> <?php if (isset($mlm_general_settings['ePin_activate']) && $mlm_general_settings['ePin_activate'] == '1' && isset($mlm_general_settings['sol_payment']) && $mlm_general_settings['sol_payment'] == '1') { ?> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Enter ePin', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="epin" id="epin" value="<?php if (!empty($_POST['epin'])) { _e(htmlentities($_POST['epin'])); } ?> " maxlength="20" size="37" onBlur="checkePinAvailability(this.value);"><br /><div id="check_epin"></div></td> </tr> <?php } else { if (isset($mlm_general_settings['ePin_activate']) && $mlm_general_settings['ePin_activate'] == '1') { ?> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Enter ePin', 'unilevel-mlm-pro'); ?> :</td> <td><input type="text" name="epin" id="epin" value="<?php if (!empty($_POST['epin'])) { _e(htmlentities($_POST['epin'])); } ?> " maxlength="20" size="37" onBlur="checkePinAvailability1(this.value);"><br /><div id="check_epin"></div></td> </tr> <?php } } ?> <tr><td colspan="2"> </td></tr> <tr> <td colspan="2"><input type="submit" name="submit" id="submit" value="<?php _e('Submit', 'unilevel-mlm-pro'); ?> " /></td> </tr> </table> </form> <?php } } else { _e($msg); } }
function mlmPayout() { //get database table prefix $table_prefix = mlm_core_get_table_prefix(); $error = ''; $chk = 'error'; //get no. of level $mlm_general_settings = get_option('wp_mlm_general_settings'); $mlm_no_of_level = $mlm_general_settings['mlm-level']; $mlm_product_value = $mlm_general_settings['single-sale']; //most outer if condition if (isset($_POST['mlm_payout_settings'])) { //echo "<pre>"; print_r($_POST); $company_commission = sanitize_text_field($_POST['company_commission_amount']); $referral_commission = sanitize_text_field($_POST['referral_commission_amount']); if (checkInputField($company_commission)) { $error .= "\n Please specify your company commission."; } if (checkInputField($referral_commission)) { $error .= "\n Please specify your referral commission."; } for ($k = 1; $k <= $mlm_no_of_level; $k++) { if (checkInputField(sanitize_text_field($_POST['level' . $k . '_commission']))) { $error .= "\n Please specify your Level {$k} Commission."; } } //if any error occoured if (!empty($error)) { $error = nl2br($error); } else { $chk = ''; update_option('wp_mlm_payout_settings', $_POST); $url = get_bloginfo('url') . "/wp-admin/admin.php?page=admin-settings&tab=regular_bonus"; _e("<script>window.location='{$url}'</script>"); $msg = "<span style='color:green;'>Your payout settings has been successfully updated.</span>"; } } // end outer if condition if ($chk != '') { $mlm_settings = get_option('wp_mlm_payout_settings'); ?> <div class='wrap1'> <h2><?php _e('Payout Settings', 'unilevel-mlm-pro'); ?> </h2> <div class="notibar msginfo"> <a class="close"></a> <p><?php _e('These settings define the commissions that would be distributed in the network for a single sale in the network.', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('Commission Type', 'unilevel-mlm-pro'); ?> - </strong><?php _e('Select whether the commission amounts specified are absolute numbers or percentage figures.', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('Company Share', 'unilevel-mlm-pro'); ?> - </strong><?php _e('This is a fixed amount that is payable to the company (First User in the network) for every sale in the network.', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('Referral Commission', 'unilevel-mlm-pro'); ?> </strong> - <?php _e('This is a referral commission that is paid to the sponsor for sponsoring a new member to the network. This is over and above his regular Level based commissions. You can set this to zero in case you do not want to distribute any referral commission as typically this would be covered under Level 1 Commissions.', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('Level Commissions', 'unilevel-mlm-pro'); ?> - </strong><?php _e('These are the amounts payable at various levels in the upline depending on the No. of Levels setting defined under the General Tab.', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('Note :', 'unilevel-mlm-pro'); ?> </strong><?php _e('The sum of all the commissions mentioned above should always be less than or equal to the Product Value as defined in the General Tab.', 'unilevel-mlm-pro'); ?> </p> </div> <?php if ($error) { ?> <div class="notibar msgerror"> <a class="close"></a> <p> <strong><?php _e('Please Correct the following Error', 'unilevel-mlm-pro'); ?> :</strong> <?php _e($error); ?> </p> </div> <?php } ?> <script> function check_total_amount(num) { var commission_type = document.getElementById('commission_type').value; var direct_cpy=parseFloat(document.getElementById('company_commission_amount').value); var direct_reff=parseFloat(document.getElementById('referral_commission_amount').value); if(commission_type=='percent') { var level_comm=0; var total=100; for(var i=1;i<=num;i++) { var x='level'+i+'_commission'; level_comm += parseFloat(document.getElementById(x).value); } var result=direct_cpy+direct_reff+level_comm; if(result!=total) { alert('Commissions in percent should always be equal to 100.Please Correct this.'); document.getElementById('company_commission_amount').focus() return false; } } } </script> <?php if (empty($mlm_settings)) { ?> <form name="admin_payout_settings" method="post" action="" onsubmit="return check_total_amount('<?php echo $mlm_no_of_level; ?> ');"> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="form-table"> <tr> <th scope="row" class="admin-settings"><?php _e('Commission Type', 'unilevel-mlm-pro'); ?> :</th> <td> <select name="commission_type" id="commission_type" > <option value="fixed" <?php if ($_POST['commission_type'] == 'fixed') { echo 'selected'; } ?> >Fixed </option> <option value="percent" <?php if ($_POST['commission_type'] == 'percent') { echo 'selected'; } ?> >Percent </option> </select> </td></tr> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;"title="Click for Help!" onclick="toggleVisibility('admin-mlm-company_commission_amount');"> <?php _e('Company Share', 'unilevel-mlm-pro'); ?> :</a> </th> <td> <input type="text" name="company_commission_amount" id="company_commission_amount" size="10" value="<?php if (isset($_POST['company_commission_amount'])) { _e(htmlentities($_POST['company_commission_amount'])); } ?> "><?php if ($_POST['commission_type'] == 'percent') { echo '%'; } ?> <div class="toggle-visibility" id="admin-mlm-company_commission_amount"><?php _e('Please specify Company commission.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;"title="Click for Help!" onclick="toggleVisibility('admin-mlm-referral_commission_amount');"> <?php _e('Referral Commission', 'unilevel-mlm-pro'); ?> :</a> </th> <td> <input type="text" name="referral_commission_amount" id="referral_commission_amount" size="10" value="<?php if (isset($_POST['referral_commission_amount'])) { _e(htmlentities($_POST['referral_commission_amount'])); } ?> "><?php if ($_POST['commission_type'] == 'percent') { echo '%'; } ?> <div class="toggle-visibility" id="admin-mlm-referral_commission_amount"><?php _e('Please specify referral commission.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <?php for ($j = 1; $j <= $mlm_no_of_level; $j++) { ?> <th scope="row" class="admin-settings"> <a style="cursor:pointer;"title="Click for Help!" onclick="toggleVisibility('admin-mlm-level<?php echo $j; ?> -commission');"> <?php _e('Level ' . $j . ' Commission', 'unilevel-mlm-pro'); ?> :</a> </th> <td> <input type="text" name="level<?php echo $j; ?> _commission" id="level<?php echo $j; ?> _commission" size="10" value="<?php if (isset($_POST['level' . $j . '_commission'])) { _e(htmlentities($_POST['level' . $j . '_commission'])); } ?> "><?php if ($_POST['commission_type'] == 'percent') { echo '%'; } ?> <div class="toggle-visibility" id="admin-mlm-level<?php echo $j; ?> -commission"><?php _e('Please specify Level ' . $j . ' Commission.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <?php } ?> </table> <p class="submit"> <input type="submit" name="mlm_payout_settings" id="mlm_payout_settings" value="<?php _e('Update Options', 'unilevel-mlm-pro'); ?> »" class='button-primary' onclick="needToConfirm = false;"> </p> </form> <?php } else { if (!empty($mlm_settings)) { ?> <form name="admin_payout_settings" method="post" action="" onsubmit="return check_total_amount('<?php echo $mlm_no_of_level; ?> ');"> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="form-table"> <tr> <th scope="row" class="admin-settings"><?php _e('Commission Type', 'unilevel-mlm-pro'); ?> :</th> <td> <select name="commission_type" id="commission_type" > <option value="fixed" <?php if ($mlm_settings['commission_type'] == 'fixed') { echo 'selected'; } ?> >Fixed </option> <option value="percent" <?php if ($mlm_settings['commission_type'] == 'percent') { echo 'selected'; } ?> >Percent </option> </select> </td></tr> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;"title="Click for Help!" onclick="toggleVisibility('admin-mlm-company_commission_amount');"> <?php _e('Company Share', 'unilevel-mlm-pro'); ?> :</a> </th> <td> <input type="text" name="company_commission_amount" id="company_commission_amount" size="10" value="<?php if (isset($mlm_settings['company_commission_amount'])) { _e($mlm_settings['company_commission_amount'], 'unilevel-mlm-pro'); } ?> "><?php if ($mlm_settings['commission_type'] == 'percent') { echo '%'; } ?> <div class="toggle-visibility" id="admin-mlm-company_commission_amount"><?php _e('Please specify Company commission.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;"title="Click for Help!" onclick="toggleVisibility('admin-mlm-referral_commission_amount');"> <?php _e('Referral Commission', 'unilevel-mlm-pro'); ?> :</a> </th> <td> <input type="text" name="referral_commission_amount" id="referral_commission_amount" size="10" value="<?php if (isset($mlm_settings['referral_commission_amount'])) { _e($mlm_settings['referral_commission_amount'], 'unilevel-mlm-pro'); } ?> "><?php if ($mlm_settings['commission_type'] == 'percent') { echo '%'; } ?> <div class="toggle-visibility" id="admin-mlm-referral_commission_amount"><?php _e('Please specify referral commission.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <?php for ($j = 1; $j <= $mlm_no_of_level; $j++) { ?> <th scope="row" class="admin-settings"> <a style="cursor:pointer;"title="Click for Help!" onclick="toggleVisibility('admin-mlm-level<?php echo $j; ?> -commission');"> <?php _e('Level ' . $j . ' Commission', 'unilevel-mlm-pro'); ?> :</a> </th> <td> <input type="text" name="level<?php echo $j; ?> _commission" id="level<?php echo $j; ?> _commission" size="10" value="<?php if (isset($mlm_settings['level' . $j . '_commission'])) { _e($mlm_settings['level' . $j . '_commission']); } ?> "><?php if ($mlm_settings['commission_type'] == 'percent') { echo '%'; } ?> <div class="toggle-visibility" id="admin-mlm-level<?php echo $j; ?> -commission"><?php _e('Please specify Level ' . $j . ' Commission.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <?php } ?> </table> <p class="submit"> <input type="submit" name="mlm_payout_settings" id="mlm_payout_settings" value="<?php _e('Update Options', 'unilevel-mlm-pro'); ?> »" class='button-primary' onclick="needToConfirm = false;"> </p> </form> <script language="JavaScript"> populateArrays(); </script> <?php } } } else { _e($msg); } }
function mlmGeneral() { global $wpdb; //get database table prefix $table_prefix = mlm_core_get_table_prefix(); $error = ''; $chk = 'error'; //most outer if condition if (isset($_POST['mlm_general_settings'])) { $currency = sanitize_text_field($_POST['currency']); $levels = sanitize_text_field($_POST['mlm-level']); //$single_sale = sanitize_text_field( $_POST['single-sale'] ); if (checkInputField($currency)) { $error .= "\n Please Select your currency type."; } if (checkInputField($levels)) { $error .= "\n Please specify No. of Levels."; } //if ( checkInputField($single_sale) ) // $error .= "\n Please specify value of single sale."; $wp_check = $_POST['wp_reg']; $reg_url = sanitize_text_field($_POST['reg_url']); if ($wp_check == '1') { if (checkInputField($reg_url)) { $error .= "\n Please Fill The URL."; } } //if any error occoured if (!empty($error)) { $error = nl2br($error); } else { $chk = ''; update_option('wp_mlm_general_settings', $_POST); $url = get_bloginfo('url') . "/wp-admin/admin.php?page=admin-settings&tab=eligibility"; _e("<script>window.location='{$url}'</script>"); $msg = "<span style='color:green;'>Your general settings has been successfully updated.</span>"; } } // end outer if condition ?> <script type="text/javascript"> jQuery(document).ready(function () { jQuery("input[name='ePin_activate']").change(function () { var value = jQuery(this).val(); if (value == '1') { jQuery(".sole_id").show(); } else if (value == '0') { jQuery(".sole_id").hide(); } }); }); </script> <script language="javascript"> jQuery(document).ready(function(){ jQuery("#reg_url").click(function(){ jQuery("#reg_url").removeAttr("readonly"); }); }); function CheckBoxChanged(checkbox) { if (checkbox.checked == true) { //document.getElementById('reg_url').disabled = false; jQuery("#reg_url").removeAttr("readonly"); } else { jQuery("#reg_url").attr("readonly","readonly"); //document.getElementById('reg_url').focus(); } } function show1() { if (document.getElementById('reg_url').value == '') { alert('Please Fill The URL'); document.getElementById('reg_url').focus(); return true; } } </script> <?php if ($chk != '') { $mlm_settings = get_option('wp_mlm_general_settings'); $URL = empty($mlm_settings['affiliate_url']) ? '' : $mlm_settings['affiliate_url'] . '/'; ?> <div class='wrap1'> <h2><?php _e('Currency Setting', 'unilevel-mlm-pro'); ?> </h2> <div class="updated fade"> <p><?php _e("In order to enable SEO Friendly Affiliate URLs please add the following line of code in your .htaccess file at the top of the file BEFORE the #Begin Wordpress line of code<br/><br/> <strong> RedirectMatch 301 u/(.*) " . site_url() . "/" . $URL . "?sp_name=\$1 </strong> <br/><br/>Please note that your Permalink setting in WordPress should be anything other than Default setting.", 'unilevel-mlm-pro'); ?> </p> </div> <br/> <div class="notibar msginfo"> <a class="close"></a> <p><strong><?php _e('Currency', 'unilevel-mlm-pro'); ?> -</strong> <?php _e('Please select the base currency of your MLM Network. This option is very important as all calculations will be performed in this base currency. Once this currency is chosen and saved, it CANNOT be changed later. The entire network will need to be reset if you decide to change the currency at a later date.', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('No. of Levels', 'unilevel-mlm-pro'); ?> -</strong> <?php _e('This defines the levels upto which the payment will be distributed for a successful sale in the network. As with currency, once defined, this value cannot be changed.', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('Use WP registration page', 'unilevel-mlm-pro'); ?> - </strong> <?php _e(' Select this option in case you want to use the default WP registration page or a custom registration page on your site. ', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('URL of registration page', 'unilevel-mlm-pro'); ?> - </strong> <?php _e(' In case you selected the Use WP registration page option specify the URL of your registration page. This would enable us to setup the correct redirect for the registration page included in our plugin. ', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('Redirect Affiliate URL', 'unilevel-mlm-pro'); ?> - </strong> <?php _e(' By default the affiliate URL for your members is setup to redirect to the registration page included in our plugin. In case you would like the affiliate URL to redirect to a different page, please specify the desired URL in this field. ', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('Activate ePin', 'unilevel-mlm-pro'); ?> -</strong> <?php _e('In case you would like to Activate ePin functionality on your website, set this value to Yes.', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('Sole Payment Method', 'unilevel-mlm-pro'); ?> -</strong> <?php _e('In case members can only register on your site via ePin, set this to Yes. This would make the ePin field mandatory on the user registration form and a visitor would need a valid unused ePin to complete his registration. If this value is set to No, a visitor will be able to register on the site even without specifying a valid ePin. In this case you would need to manually mark the member as Paid / Unpaid under Users -> All Users. ', 'unilevel-mlm-pro'); ?> </p> <p><strong><?php _e('ePin Length', 'unilevel-mlm-pro'); ?> -</strong> <?php _e('The length of the generated ePins.', 'unilevel-mlm-pro'); ?> </p> </div> <?php if ($error) { ?> <div class="notibar msgerror"> <a class="close"></a> <p> <strong><?php _e('Please Correct the following Error', 'unilevel-mlm-pro'); ?> :</strong> <?php _e($error); ?> </p> </div> <?php } ?> <?php if (empty($mlm_settings)) { ?> <form name="admin_general_settings" method="post" action=""> <table border="0" cellpadding="0" cellspacing="0" width="60%" class="form-table"> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;" title="Click for Help!" onClick="toggleVisibility('admin-mlm-currency');"><?php _e('Currency', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <?php $sql = "SELECT iso3, currency \n\t\t\t\t\t\t\t\t\t\t\tFROM {$table_prefix}mlm_currency \n\t\t\t\t\t\t\t\t\t\t\tORDER BY iso3"; $results = $wpdb->get_results($sql); ?> <select name="currency" id="currency" > <option value=""><?php _e('Select Currency', 'unilevel-mlm-pro'); ?> </option> <?php foreach ($results as $row) { if ($_POST['currency'] == $row->iso3) { $selected = 'selected'; } else { $selected = ''; } ?> <option value="<?php echo $row->iso3; ?> " <?php echo $selected; ?> ><?php echo $row->iso3 . " - " . $row->currency; ?> </option> <?php } ?> </select> <div class="toggle-visibility" id="admin-mlm-currency"><?php _e('Select your currency which will you use.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;" title="Click for Help!" onClick="toggleVisibility('admin-mlm-level');"><?php _e('No. of Levels', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <input type="text" name="mlm-level" id="mlm-level" size="10" value="<?php if (!empty($_POST['mlm-level'])) { _e(htmlentities($_POST['mlm-level'])); } ?> "> <div class="toggle-visibility" id="admin-mlm-level"><?php _e('Please specify no. of level.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <!--<tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;" title="Click for Help!" onClick="toggleVisibility('admin-mlm-single-sale');"><?php _e('Value of Single Sale', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <input type="text" name="single-sale" id="single-sale" size="10" value="<?php //if(!empty($_POST['single-sale'])) _e(htmlentities($_POST['single-sale'])); ?> "> <div class="toggle-visibility" id="admin-mlm-single-sale"><?php //_e('Please specify value of single sale.','unilevel-mlm-pro'); ?> </div> </td> </tr>--> <tr> <th scope="row" class="admin-setting" > <strong><?php _e('Use WP registration page', 'unilevel-mlm-pro'); ?> </strong> </th> <td> <input type="checkbox" name="wp_reg" id="wp_reg" value="1" <?php echo $_POST['wp_reg'] == 1 ? ' checked="checked"' : ''; ?> onclick="CheckBoxChanged(this);" onblur="show1();" /> </td> </tr> <tr> <th scope="row" class="admin-setting" > <strong><?php _e('URL of registration page', 'unilevel-mlm-pro'); ?> :<span style="color:red;"></span>:</strong> </th> <td> <?php echo site_url() . '/'; ?> <input type="text" name="reg_url" id="reg_url" value="<?php echo empty($_POST['reg_url']) ? '' : $_POST['reg_url']; ?> " readonly="true"/> </td> </tr> <tr> <th scope="row" class="admin-setting" > <strong><?php _e('Redirect Affiliate URL', 'unilevel-mlm-pro'); ?> :</strong> </th> <td> <?php echo site_url() . '/'; ?> <input type="text" name="affiliate_url" id="affiliate_url" value="<?php echo empty($_POST['affiliate_url']) ? '' : $_POST['affiliate_url']; ?> " /> </td> </tr> <tr><td colspan="2" style="padding: 0px;"> <table> <tr> <th scope="row" class="admin-settings"> <strong><?php _e('Activate ePin', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span>:</strong> </th> <td> <?php if ($mlm_settings['ePin_activate'] == '0') { ?> <script> jQuery(document).ready(function () { jQuery(".sole_id").hide(); });</script> <?php } ?> <input class="radio" type="radio" name="ePin_activate" value="1" <?php if (isset($_POST['ePin_activate']) && $_POST['ePin_activate'] == '1') { echo 'checked'; } ?> /> <?php _e('Yes', 'unilevel-mlm-pro'); ?> <?php $sql = "SELECT COUNT( * ) AS ps FROM {$table_prefix}mlm_users WHERE `payment_status` = '2'"; $ps = $wpdb->get_var($sql); $sql1 = "SELECT COUNT( * ) AS es FROM {$table_prefix}mlm_epins WHERE `status` = '1'"; $es = $wpdb->get_var($sql1); if ($ps > 0 || $es > 0) { echo "<br>" . __('Cannot be disabled as 1 or more ePins have been used for registration.', 'unilevel-mlm-pro'); } else { ?> <input class="radio" type="radio" name="ePin_activate" value="0" <?php if (isset($_POST['ePin_activate']) && $_POST['ePin_activate'] != '1') { echo 'checked'; } else { echo 'checked'; } ?> /> <?php _e('No', 'unilevel-mlm-pro'); ?> <?php } ?> </td> </tr> <tr class="sole_id" > <th scope="row" class="admin-settings"> <strong><?php _e('Sole Payment Method', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span>:</strong> </th> <td> <input class="radio" type="radio" name="sol_payment" value="1" <?php if (isset($_POST['sol_payment']) && $_POST['sol_payment'] == '1') { echo 'checked'; } ?> /> <?php _e('Yes', 'unilevel-mlm-pro'); ?> <input class="radio" type="radio" name="sol_payment" value="0" <?php if (isset($_POST['sol_payment']) && $_POST['sol_payment'] != '1') { echo 'checked'; } else { echo 'checked'; } ?> /> <?php _e('No', 'unilevel-mlm-pro'); ?> </td> </tr> <tr class="sole_id"> <th><strong><?php _e('ePin Length', 'unilevel-mlm-pro'); ?> :</strong></th> <td> <?php $epin_length = $_POST['epin_length']; ?> <select name="epin_length" id="epin_length"> <?php // or whatever you want $epin_array = array(8 => '8', 9 => '9', 10 => '10', 11 => '11', 12 => '12', 13 => '13', 14 => '14', 15 => '15'); foreach ($epin_array as $key => $val) { ?> <option value="<?php echo $key; ?> "<?php if ($key == $epin_length) { echo ' selected="selected"'; } ?> > <?php echo $val; ?> </option> <?php } ?> </select> </td> </tr></table> </td></tr> </table> <p class="submit"> <input type="submit" name="mlm_general_settings" id="mlm_general_settings" value="<?php _e('Update Options', 'unilevel-mlm-pro'); ?> »" class='button-primary' onClick="needToConfirm = false;"> </p> </form> </div> <script language="JavaScript"> populateArrays(); </script> <?php } else { if (!empty($mlm_settings)) { ?> <?php if (isset($mlm_settings['recur_payment']) && $mlm_settings['recur_payment'] == '0') { ?> <script> jQuery(document).ready(function () { jQuery(".recur_id").hide(); });</script> <?php } ?> <form name="admin_general_settings" method="post" action=""> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="form-table"> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;" title="Click for Help!" onClick="toggleVisibility('admin-mlm-currency');"><?php _e('Currency', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <?php $sql = "SELECT iso3, currency \n\t\t\t\t\t\tFROM {$table_prefix}mlm_currency\n\t\t\t\t\t\tWHERE iso3 = '" . $mlm_settings['currency'] . "'\n\t\t\t\t\t\tORDER BY iso3"; //$sql = mysql_fetch_array(mysql_query($sql)); ?> <input type="text" name="currency" id="currency" value="<?php echo $mlm_settings['currency']; ?> " readonly /> <div class="toggle-visibility" id="admin-mlm-currency"><?php _e('You can not change the currency.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;" title="Click for Help!" onClick="toggleVisibility('admin-mlm-level');"><?php _e('No. of Levels', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <input type="text" name="mlm-level" id="mlm-level" size="10" value="<?php if (!empty($mlm_settings['mlm-level'])) { _e($mlm_settings['mlm-level']); } ?> " readonly> <div class="toggle-visibility" id="admin-mlm-level"><?php _e('You can not change the level.', 'unilevel-mlm-pro'); ?> </div> </td> </tr> <!--<tr> <th scope="row" class="admin-settings"> <a style="cursor:pointer;" title="Click for Help!" onClick="toggleVisibility('admin-mlm-single-sale');"><?php _e('Value of Single Sale', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span>: </a> </th> <td> <input type="text" name="single-sale" id="single-sale" size="10" value="<?php //if(!empty($mlm_settings['single-sale'])) _e($mlm_settings['single-sale']); ?> "> <div class="toggle-visibility" id="admin-mlm-single-sale"><?php //_e('Please specify value of single sale.','unilevel-mlm-pro'); ?> </div> </td> </tr>--> <tr> <th scope="row" class="admin-setting" > <strong><?php _e('Use WP registration page', 'unilevel-mlm-pro'); ?> </strong> </th> <td> <input type="checkbox" name="wp_reg" id="wp_reg" value="1" <?php echo $mlm_settings['wp_reg'] == 1 ? ' checked="checked"' : ''; ?> onclick="CheckBoxChanged(this);"/> </td> </tr> <tr> <th scope="row" class="admin-setting" > <strong><?php _e('URL of registration page', 'unilevel-mlm-pro'); ?> <span style="color:red;"></span>:</strong> </th> <td> <?php echo site_url() . '/'; ?> <input type="text" name="reg_url" id="reg_url" value="<?php echo empty($mlm_settings['reg_url']) ? '' : $mlm_settings['reg_url']; ?> " onblur="show1()" readonly="true" /> </td> </tr> <tr> <th scope="row" class="admin-setting" > <strong><?php _e('Redirect Affiliate URL', 'unilevel-mlm-pro'); ?> :</strong> </th> <td> <?php echo site_url() . '/'; ?> <input type="text" name="affiliate_url" id="affiliate_url" value="<?php echo empty($mlm_settings['affiliate_url']) ? '' : $mlm_settings['affiliate_url']; ?> " /> </td> </tr> <tr><td colspan="2" style="padding: 0px;"> <table> <tr> <th scope="row" class="admin-settings"> <strong><?php _e('Activate ePin', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span>:</strong> </th> <td> <?php if ($mlm_settings['ePin_activate'] == '0') { ?> <script> jQuery(document).ready(function () { jQuery(".sole_id").hide(); });</script> <?php } ?> <input class="radio" type="radio" name="ePin_activate" value="1" <?php if (isset($mlm_settings['ePin_activate']) && $mlm_settings['ePin_activate'] == '1') { echo 'checked'; } ?> /> <?php _e('Yes', 'unilevel-mlm-pro'); ?> <?php $sql = "SELECT COUNT( * ) AS ps FROM {$table_prefix}mlm_users WHERE `payment_status` = '2'"; $ps = $wpdb->get_var($sql); $sql1 = "SELECT COUNT( * ) AS es FROM {$table_prefix}mlm_epins WHERE `status` = '1'"; $es = $wpdb->get_var($sql1); if ($ps > 0 || $es > 0) { echo "<br>" . __('Cannot be disabled as 1 or more ePins have been used for registration.', 'unilevel-mlm-pro'); } else { ?> <input class="radio" type="radio" name="ePin_activate" value="0" <?php if (isset($mlm_settings['ePin_activate']) && $mlm_settings['ePin_activate'] == '0') { echo 'checked'; } ?> /> <?php _e('No', 'unilevel-mlm-pro'); ?> <?php } ?> </td> </tr> <tr class="sole_id" > <th scope="row" class="admin-settings"> <strong><?php _e('Sole Payment Method', 'unilevel-mlm-pro'); ?> <span style="color:red;">*</span>:</strong> </th> <td> <input class="radio" type="radio" name="sol_payment" value="1" <?php if (isset($mlm_settings['sol_payment']) && $mlm_settings['sol_payment'] == '1') { echo 'checked'; } ?> /> <?php _e('Yes', 'unilevel-mlm-pro'); ?> <input class="radio" type="radio" name="sol_payment" value="0" <?php if (isset($mlm_settings['sol_payment']) && $mlm_settings['sol_payment'] == '0') { echo 'checked'; } ?> /> <?php _e('No', 'unilevel-mlm-pro'); ?> </td> </tr> <tr class="sole_id"> <th><strong><?php _e('ePin Length', 'unilevel-mlm-pro'); ?> </strong></th> <td> <?php $epin_length = $mlm_settings['epin_length']; ?> <select name="epin_length" id="epin_length"> <?php // or whatever you want $epin_array = array(8 => '8', 9 => '9', 10 => '10', 11 => '11', 12 => '12', 13 => '13', 14 => '14', 15 => '15'); foreach ($epin_array as $key => $val) { ?> <option value="<?php echo $key; ?> "<?php if ($key == $epin_length) { echo ' selected="selected"'; } ?> > <?php echo $val; ?> </option> <?php } ?> </select> </td> </tr></table> </td></tr> </table> <p class="submit"> <input type="submit" name="mlm_general_settings" id="mlm_general_settings" value="<?php _e('Update Options', 'unilevel-mlm-pro'); ?> »" class='button-primary' onClick="needToConfirm = false;"> </p> </form> </div> <?php } } } else { _e($msg); } }
function mlm_update_profile($id = '') { echo "<script>window.location='" . site_url() . "'</script>"; // Echo count of items in menu global $wpdb; $table_prefix = mlm_core_get_table_prefix(); $error = ''; global $current_user; get_currentuserinfo(); if ($id == '') { //$sponsor_name = $current_user->user_login; $userId = $current_user->ID; $class = ''; } else { $userId = $id; $class = "class='button-primary'"; } //most outer if condition if (isset($_POST['submit'])) { $firstname = sanitize_text_field($_POST['firstname']); $lastname = sanitize_text_field($_POST['lastname']); $address1 = sanitize_text_field($_POST['address1']); $address2 = sanitize_text_field($_POST['address2']); $city = sanitize_text_field($_POST['city']); $state = sanitize_text_field($_POST['state']); $postalcode = sanitize_text_field($_POST['postalcode']); $telephone = sanitize_text_field($_POST['telephone']); $dob = sanitize_text_field($_POST['dob']); if (checkInputField($firstname)) { $error .= "\n Please enter your first name."; } if (checkInputField($lastname)) { $error .= "\n Please enter your last name."; } if (checkInputField($address1)) { $error .= "\n Please enter your address."; } if (checkInputField($city)) { $error .= "\n Please enter your city."; } if (checkInputField($state)) { $error .= "\n Please enter your state."; } if (checkInputField($postalcode)) { $error .= "\n Please enter your postal code."; } if (checkInputField($telephone)) { $error .= "\n Please enter your contact number."; } if (checkInputField($dob)) { $error .= "\n Please enter your date of birth."; } // inner if condition if (empty($error)) { $user = array('ID' => $userId, 'first_name' => $firstname, 'last_name' => $lastname); // return the wp_users table inserted user's ID $user_id = wp_update_user($user); //get the selected country name from the country table $country = $_POST['country']; $sql = "SELECT name \n\t\t\t\t\t\tFROM {$table_prefix}mlm_country\n\t\t\t\t\t\tWHERE id = '" . $country . "'"; $country1 = $wpdb->get_var($sql); //insert the registration form data into user_meta table update_user_meta($user_id, 'user_address1', $address1, FALSE); // I have replace FALSE to $unique update_user_meta($user_id, 'user_address2', $address2, FALSE); update_user_meta($user_id, 'user_city', $city, FALSE); update_user_meta($user_id, 'user_state', $state, FALSE); update_user_meta($user_id, 'user_country', $country1, FALSE); update_user_meta($user_id, 'user_postalcode', $postalcode, FALSE); update_user_meta($user_id, 'user_telephone', $telephone, FALSE); update_user_meta($user_id, 'user_dob', $dob, FALSE); $msg = "<span style='color:green;'>Congratulations! Profile has been successfully updated.</span>"; } //end inner if condition } //end most outer if condition //if any error occoured if (!empty($error)) { $error = nl2br($error); } $user_info = get_userdata($userId); if (!empty($msg)) { _e($msg); } include 'js-validation-file.html'; ?> <script type="text/javascript"> var popup1, popup2, splofferpopup1; var bas_cal, dp_cal1, dp_cal2, ms_cal; // declare the calendars as global variables window.onload = function() { dp_cal1 = new Epoch('dp_cal1', 'popup', document.getElementById('dob')); }; </script> <span style='color:red;'><?php echo $error; ?> </span> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <form name="frm" method="post" action="" onSubmit="return updateFormValidation();"> <tr> <td><?php _e('First Name', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="firstname" id="firstname" value="<?php echo $user_info->first_name; ?> " maxlength="20" size="37" onBlur="return checkname(this.value, 'firstname');" ></td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Last Name', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="lastname" id="lastname" value="<?php echo $user_info->last_name; ?> " maxlength="20" size="37" onBlur="return checkname(this.value, 'lastname');"></td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Address Line 1', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="address1" id="address1" value="<?php echo $user_info->user_address1; ?> " size="37" onBlur="return allowspace(this.value, 'address1');"></td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Address Line 2', 'binary-mlm-pro'); ?> :</td> <td><input type="text" name="address2" id="address2" value="<?php echo $user_info->user_address2; ?> " size="37" onBlur="return allowspace(this.value, 'address2');"></td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('City', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="city" id="city" value="<?php echo $user_info->user_city; ?> " maxlength="30" size="37" onBlur="return allowspace(this.value, 'city');"></td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('State', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="state" id="state" value="<?php echo $user_info->user_state; ?> " maxlength="30" size="37" onBlur="return allowspace(this.value, 'state');"></td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Postal Code', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="postalcode" id="postalcode" value="<?php echo $user_info->user_postalcode; ?> " maxlength="20" size="37" onBlur="return numeric(this.value, 'postalcode');"></td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Country', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td> <?php $sql = "SELECT id, name\n\t\t\t\t\t\t\tFROM {$table_prefix}mlm_country\n\t\t\t\t\t\t\tORDER BY name"; $rows = $wpdb->get_results($sql); ?> <select name="country" id="country" > <option value="">Select Country</option> <?php foreach ($rows as $row) { if ($user_info->user_country == $row->name) { $selected = 'selected'; } else { $selected = ''; } ?> <option value="<?php echo $row->id; ?> " <?php echo $selected; ?> ><?php echo $row->name; ?> </option> <?php } ?> </select> </td> </tr> <tr><td colspan="2"> </td></tr><tr> <tr> <td><?php _e('Contact No', 'binary-mlm-pro'); ?> . <span style="color:red;">*</span> :</td> <td><input type="text" name="telephone" id="telephone" value="<?php echo $user_info->user_telephone; ?> " maxlength="20" size="37" onBlur="return numeric(this.value, 'telephone');" ></td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td><?php _e('Date of Birth', 'binary-mlm-pro'); ?> <span style="color:red;">*</span> :</td> <td><input type="text" name="dob" id="dob" value="<?php echo $user_info->user_dob; ?> " maxlength="20" size="22" ></td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td colspan="2"><input type="submit" name="submit" id="submit" value="Update" <?php echo $class; ?> /></td> </tr> </form> </table> <?php }
checkInputField('cfax', $f_cfax, getConfigItem(CONFIG_reg_cfax) == CONFIG_CONST_show_require); checkInputField('cmobile', $f_cmobile, getConfigItem(CONFIG_reg_cmobile) == CONFIG_CONST_show_require); checkInputField('cpager', $f_cpager, getConfigItem(CONFIG_reg_cpager) == CONFIG_CONST_show_require); checkInputField('cipphone', $f_cipphone, getConfigItem(CONFIG_reg_cipphone) == CONFIG_CONST_show_require); checkInputField('cwebpage', $f_cwebpage, getConfigItem(CONFIG_reg_cwebpage) == CONFIG_CONST_show_require); checkInputField('cphoto', $f_cphoto, getConfigItem(CONFIG_reg_cphoto) == CONFIG_CONST_show_require); checkInputField('userfield1', $f_userfield1, getConfigItem(CONFIG_reg_userfield1) == CONFIG_CONST_show_require); checkInputField('userfield2', $f_userfield2, getConfigItem(CONFIG_reg_userfield2) == CONFIG_CONST_show_require); checkInputField('userfield3', $f_userfield3, getConfigItem(CONFIG_reg_userfield3) == CONFIG_CONST_show_require); checkInputField('userfield4', $f_userfield4, getConfigItem(CONFIG_reg_userfield4) == CONFIG_CONST_show_require); checkInputField('userfield5', $f_userfield5, getConfigItem(CONFIG_reg_userfield5) == CONFIG_CONST_show_require); checkInputField('userfield6', $f_userfield6, getConfigItem(CONFIG_reg_userfield6) == CONFIG_CONST_show_require); checkInputField('userfield7', $f_userfield7, getConfigItem(CONFIG_reg_userfield7) == CONFIG_CONST_show_require); checkInputField('userfield8', $f_userfield8, getConfigItem(CONFIG_reg_userfield8) == CONFIG_CONST_show_require); checkInputField('userfield9', $f_userfield9, getConfigItem(CONFIG_reg_userfield9) == CONFIG_CONST_show_require); checkInputField('userfield10', $f_userfield10, getConfigItem(CONFIG_reg_userfield10) == CONFIG_CONST_show_require); function checkInputField($i_name, $i_value, $i_required) { global $g_vars, $srv_settings, $lngstr; if ($i_required && !$i_value) { $g_vars['page']['errors'] .= $lngstr['page_register']['no_' . $i_name]; } } if ($g_vars['page']['errors']) { include_once $DOCUMENT_PAGES . "register-1.inc.php"; } else { $i_id = api_addNewUser($f_username, $f_password, array('email' => $f_email, 'title' => $f_title, 'firstname' => $f_firstname, 'lastname' => $f_lastname, 'middlename' => $f_middlename, 'address' => $f_address, 'city' => $f_city, 'state' => $f_state, 'zip' => $f_zip, 'country' => $f_country, 'phone' => $f_phone, 'fax' => $f_fax, 'mobile' => $f_mobile, 'pager' => $f_pager, 'ipphone' => $f_ipphone, 'webpage' => $f_webpage, 'icq' => $f_icq, 'msn' => $f_msn, 'aol' => $f_aol, 'gender' => $f_gender, 'birthday' => $f_birthday, 'husbandwife' => $f_husbandwife, 'children' => $f_children, 'trainer' => $f_trainer, 'photo' => $f_photo, 'company' => $f_company, 'cposition' => $f_cposition, 'department' => $f_department, 'coffice' => $f_coffice, 'caddress' => $f_caddress, 'ccity' => $f_ccity, 'cstate' => $f_cstate, 'czip' => $f_czip, 'ccountry' => $f_ccountry, 'cphone' => $f_cphone, 'cfax' => $f_cfax, 'cmobile' => $f_cmobile, 'cpager' => $f_cpager, 'cipphone' => $f_cipphone, 'cwebpage' => $f_cwebpage, 'cphoto' => $f_cphoto, 'ufield1' => $f_userfield1, 'ufield2' => $f_userfield2, 'ufield3' => $f_userfield3, 'ufield4' => $f_userfield4, 'ufield5' => $f_userfield5, 'ufield6' => $f_userfield6, 'ufield7' => $f_userfield7, 'ufield8' => $f_userfield8, 'ufield9' => $f_userfield9, 'ufield10' => $f_userfield10, 'checkword' => $i_checkword, 'active' => false), array($f_groupid)); if ($i_id == false) { $g_vars['page']['errors'] .= $lngstr['err_username_duplicate']; unset($f_username); include_once $DOCUMENT_PAGES . "register-1.inc.php";