function process_signup_2($POST)
{
    global $seo_tag, $consts;
    #/ encrypt password
    include_once '../includes/func_enc.php';
    $new_pass = @$POST['pass_w'];
    $pass_w = @md5_encrypt($new_pass);
    $joined_on = date('Y-m-d H:i:s');
    #/save users
    $sql_users = "INSERT INTO users (package_id, email_add, pass_w, first_name, middle_name, last_name, company_name, joined_on)\n    VALUES ('{$POST['package_id']}', '{$POST['email_add']}', '{$pass_w}', '{$POST['first_name']}', '{$POST['middle_name']}', '{$POST['last_name']}', '{$POST['company_name']}', '{$joined_on}')";
    @mysql_exec($sql_users, 'save');
    $user_id = @mysql_insert_id();
    //var_dump($user_id); die();
    if ($user_id > 0) {
        $POST['secret_question_id'] = (int) @$POST['secret_question_id'];
        #/save user_info
        $sql_user_info = "INSERT INTO user_info (user_id, secret_question_id, secret_answer)\n        VALUES ('{$user_id}', '{$POST['secret_question_id']}', '{$POST['secret_answer']}')";
        @mysql_exec($sql_user_info, 'save');
        #/save acc_verifications
        $verification_str = mt_rand() . md5(uniqid(rand())) . mt_rand();
        $sql_veri = "INSERT INTO acc_verifications (user_id, verification_str)\n        VALUES ('{$user_id}', '{$verification_str}')";
        @mysql_exec($sql_veri, 'save');
        include_once '../includes/email_templates.php';
        include_once '../includes/send_mail.php';
        #/ Send Emails to User
        $heading = $subject = "Account Confirmation from collaborateUSA.com";
        $body_in = signup_success($POST['first_name'], $user_id, $verification_str);
        send_mail($POST['email_add'], $subject, $heading, $body_in);
        #/ Send Emails to Admin
        $subject = "New Member Signup Notification from collaborateUSA.com";
        $heading = "New Member Joined Us at collaborateUSA.com";
        $body_in_admin = signup_notice_to_admin($POST, $joined_on);
        send_mail($consts['support_em'], $subject, $heading, $body_in_admin);
        //die('x');
        #/ Lock & Redirect
        $_SESSION['signup_success'] = '1';
        $_SESSION['signup_stage'] = 'signup-details';
        reset_attempt_counts();
        redirect_me('signup-details');
    } else {
        $_SESSION["CUSA_MSG_GLOBAL"] = array(false, 'Unable to process your request at this moment! Please try again later.');
        redirect_me($seo_tag);
    }
}
         $sql_veri = "INSERT INTO acc_verifications (user_id, verification_str)\n                VALUES ('{$u_id}', '{$verification_str}')";
         @mysql_exec($sql_veri, 'save');
         #/save user_permissions //private fields only
         $fields_perm = 'email_add,state,city,address_ln_1,address_ln_2,zip,phone_number';
         $sql_fields_perm = "INSERT INTO user_permissions (user_id, fields_perm)\n                VALUES ('{$u_id}', '{$fields_perm}')";
         @mysql_exec($sql_fields_perm, 'save');
         #/ Send Account Creation Email
         include_once '../../includes/email_templates.php';
         include_once '../../includes/send_mail.php';
         $chk_pkg = mysql_exec("SELECT * FROM membership_packages WHERE id='{$_POST['package_id']}'", 'single');
         $heading = $subject = "Account Setup Confirmation from collaborateUSA.com";
         $insert_msg = "Please find below your Temporary Password:<br /><br />";
         $insert_msg .= "<b>Email Address</b>: {$_POST['email_add']}<br />";
         $insert_msg .= "<b>Password</b>: {$new_pass}<br /><br />";
         $insert_msg .= "Please note that this is a temporary password and you should update it after your first login.";
         $body_in = signup_success($_POST['first_name'], $u_id, $verification_str, $insert_msg, $chk_pkg, true);
         send_mail($_POST['email_add'], $subject, $heading, $body_in, 'collaborateUSA.com', $consts['mem_support_em']);
         #-
     }
     $_SESSION["CUSA_ADMIN_MSG_GLOBAL"] = array(true, 'The User data has been Added successfully. A Temporary Password has been generated and an Email has been sent to their Email Address.');
     //redirect_me("{$consts['DOC_ROOT_ADMIN']}admin_users_opp.php{$param2}&u_id={$u_id}", true);
 }
 //end Add ..
 ##/ Image processing & savings
 if ($u_id > 0) {
     include_once '../../includes/resize_images.php';
     $up_path = "../user_files/prof/{$u_id}/";
     if (!is_dir($up_path)) {
         mkdir($up_path, 0705, true);
     }
     $sql_upd_prt = $profile_pic = '';
function process_signup_2($POST, $chk_pkg, $redir = true, $joined_on = '')
{
    global $seo_tag, $consts;
    #/ encrypt password
    include_once '../includes/func_enc.php';
    $new_pass = @$POST['pass_w'];
    $pass_w = @md5_encrypt($new_pass);
    if (empty($joined_on)) {
        $joined_on = date('Y-m-d H:i:s');
    }
    #/save users
    $sql_users = "INSERT INTO users (package_id, email_add, pass_w, first_name, middle_name, last_name, company_name, joined_on)\n    VALUES ('{$POST['package_id']}', '{$POST['email_add']}', '{$pass_w}', '{$POST['first_name']}', '{$POST['middle_name']}', '{$POST['last_name']}', '{$POST['company_name']}', '{$joined_on}')";
    @mysql_exec($sql_users, 'save');
    $user_id = @mysql_insert_id();
    //var_dump("<pre>", $sql_users, $user_id); die();
    if ($user_id > 0) {
        $POST['secret_question_id'] = (int) @$POST['secret_question_id'];
        #/save user_info
        $sql_user_info = "INSERT INTO user_info (user_id, secret_question_id, secret_answer)\n        VALUES ('{$user_id}', '{$POST['secret_question_id']}', '{$POST['secret_answer']}')";
        @mysql_exec($sql_user_info, 'save');
        #/save acc_verifications
        $verification_str = mt_rand() . md5(uniqid(rand())) . mt_rand();
        $sql_veri = "INSERT INTO acc_verifications (user_id, verification_str)\n        VALUES ('{$user_id}', '{$verification_str}')";
        @mysql_exec($sql_veri, 'save');
        #/save user_permissions //private fields only
        $fields_perm = 'email_add,state,city,address_ln_1,address_ln_2,zip,phone_number';
        $sql_fields_perm = "INSERT INTO user_permissions (user_id, fields_perm)\n        VALUES ('{$user_id}', '{$fields_perm}')";
        @mysql_exec($sql_fields_perm, 'save');
        include_once '../includes/email_templates.php';
        include_once '../includes/send_mail.php';
        #/ Send Emails to User
        $heading = $subject = "Account Confirmation from collaborateUSA.com";
        $body_in = signup_success($POST['first_name'], $user_id, $verification_str, '', $chk_pkg);
        send_mail($POST['email_add'], $subject, $heading, $body_in, 'collaborateUSA.com', $consts['mem_support_em']);
        #/ Send Emails to Admin
        $subject = "New Member Signup Notification from collaborateUSA.com";
        $heading = "New Member Joined Us at collaborateUSA.com";
        $body_in_admin = signup_notice_to_admin($POST, $joined_on, $chk_pkg['is_basic']);
        send_mail($consts['mem_support_em'], $subject, $heading, $body_in_admin);
        //die('x');
        #/ Generate Welcome Notification
        include_once '../includes/notif_func.php';
        $notif_data = array('template_id' => "5", 'user_id' => "{$user_id}", 'from_user_id' => "0", 'objects' => '', 'object_id' => '0', 'object_location' => '');
        @generate_notification($notif_data);
        if ($redir != false) {
            #/ Lock & Redirect
            $_SESSION['signup_success'] = '1';
            $_SESSION['signup_stage'] = 'signup-details';
            reset_attempt_counts();
            redirect_me('signup-details');
        } else {
            return $user_id;
        }
    } else {
        if ($redir != false) {
            $_SESSION["CUSA_MSG_GLOBAL"] = array(false, 'Unable to process your request at this moment! Please try again later.');
            redirect_me($seo_tag);
        } else {
            return false;
        }
    }
}