$add_client_data_addr = isset($_POST["add_client_form_address"]) ? encode_html($_POST["add_client_form_address"]) : ''; $add_client_data_phone = isset($_POST["add_client_form_phone"]) ? encode_html($_POST["add_client_form_phone"]) : ''; $add_client_data_intcont = isset($_POST["add_client_form_intcont"]) ? encode_html($_POST["add_client_form_intcont"]) : ''; $add_client_data_notity = isset($_POST["add_client_form_notify"]) ? 1 : 0; /** Arguments used on validation and client creation. */ $new_arguments = array('id' => '', 'username' => $add_client_data_user, 'password' => $_POST['add_client_form_pass'], 'name' => $add_client_data_name, 'email' => $add_client_data_email, 'address' => $add_client_data_addr, 'phone' => $add_client_data_phone, 'contact' => $add_client_data_intcont, 'notify' => $add_client_data_notity, 'type' => 'new_client'); if (CLIENTS_AUTO_APPROVE == 0) { $new_arguments['active'] = 0; } else { $new_arguments['active'] = 1; } /** Validate the information from the posted form. */ $new_validate = $new_client->validate_client($new_arguments); /** Create the client if validation is correct. */ if ($new_validate == 1) { $new_response = $new_client->create_client($new_arguments); /** * Check if the option to auto-add to a group * is active. */ if (CLIENTS_AUTO_GROUP != '0') { $admin_name = 'SELFREGISTERED'; $client_id = $new_response['new_id']; $group_id = CLIENTS_AUTO_GROUP; $add_to_group = $dbh->prepare("INSERT INTO " . TABLE_MEMBERS . " (added_by,client_id,group_id)" . " VALUES (:admin, :id, :group)"); $add_to_group->bindParam(':admin', $admin_name); $add_to_group->bindParam(':id', $client_id, PDO::PARAM_INT); $add_to_group->bindParam(':group', $group_id); $add_to_group->execute(); } $notify_admin = new PSend_Email();