function eStore_register_link_in_db($creation_time = '', $download_key = '', $download_item = '', $download_limit_count, $download_limit_time, $download_limit_ip = '', $access_count = 0, $txn_id = '')
{
    if (empty($creation_time)) {
        $creation_time = date("Y-m-d H:i:s");
        //current_time('mysql');
    }
    if (empty($download_key)) {
        //Download key cannot be empty
        return false;
    }
    if (empty($download_limit_count)) {
        $download_limit_count = get_option('eStore_download_url_limit_count');
        if (empty($download_limit_count)) {
            $download_limit_count = 999;
        }
    }
    if (empty($download_limit_time)) {
        $download_limit_time = get_option('eStore_download_url_life');
    }
    if (empty($download_limit_ip)) {
        $download_limit_ip = $_SERVER['REMOTE_ADDR'];
    }
    //Add to the download link to the database
    global $wpdb;
    $download_key = rawurldecode($download_key);
    //str_replace('%2B','+', $download_key );
    $fields = array();
    $fields['creation_time'] = $creation_time;
    $fields['download_key'] = $download_key;
    $fields['download_item'] = esc_sql($download_item);
    $fields['download_limit_count'] = $download_limit_count;
    $fields['download_limit_time'] = $download_limit_time;
    $fields['download_limit_ip'] = $download_limit_ip;
    $fields['access_count'] = $access_count;
    $fields['txn_id'] = $txn_id;
    $updated = WP_eStore_Db_Access::insert(WP_ESTORE_DOWNLOAD_LINKS_TABLE_NAME, $fields);
    return true;
}
function eStore_save_membership_signup_rego_url($email, $rego_url, $ipn_data)
{
    debug_log_subsc("Saving membership signup rego URL data for: " . $email, true);
    $fields = array();
    $fields['date_time'] = date("Y-m-d H:i:s");
    //current_time('mysql');
    $fields['meta_key1'] = "member_email";
    //Email address key
    $fields['meta_value1'] = $email;
    //Email address value
    $fields['meta_key2'] = "txn_id";
    //Txn ID key
    $fields['meta_value2'] = $ipn_data['txn_id'];
    //Txn ID value
    $fields['meta_key3'] = "rego_url";
    //Rego url key
    $fields['meta_value3'] = $rego_url;
    //Rego url value
    //Save ip address too maybe
    $updated = WP_eStore_Db_Access::insert(WP_ESTORE_GLOBAL_META_TABLE_NAME, $fields);
    debug_log_subsc("Membership signup rego URL data saved.", true);
}