Example #1
0
 $add_client_data_user = encode_html($_POST['add_client_form_user']);
 $add_client_data_email = encode_html($_POST['add_client_form_email']);
 /** Optional fields: Address, Phone, Internal Contact, Notify */
 $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);
Example #2
0
    $add_client_data_phone = isset($_POST["add_client_form_phone"]) ? $_POST["add_client_form_phone"] : '';
    $add_client_data_intcont = isset($_POST["add_client_form_intcont"]) ? $_POST["add_client_form_intcont"] : '';
    $add_client_data_notity = isset($_POST["add_client_form_notify"]) ? 1 : 0;
    if ($global_level != 0) {
        $add_client_data_active = isset($_POST["add_client_form_active"]) ? 1 : 0;
    }
    /** Arguments used on validation and client creation. */
    $edit_arguments = array('id' => $client_id, 'username' => $add_client_data_user, '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, 'active' => $add_client_data_active, 'type' => 'edit_client');
    /**
     * If the password field, or the verification are not completed,
     * send an empty value to prevent notices.
     */
    $edit_arguments['password'] = isset($_POST['add_client_form_pass']) ? $_POST['add_client_form_pass'] : '';
    //$edit_arguments['password_repeat'] = (isset($_POST['add_client_form_pass2'])) ? $_POST['add_client_form_pass2'] : '';
    /** Validate the information from the posted form. */
    $edit_validate = $edit_client->validate_client($edit_arguments);
    /** Create the client if validation is correct. */
    if ($edit_validate == 1) {
        $edit_response = $edit_client->edit_client($edit_arguments);
    }
}
$page_title = __('Edit client', 'cftp_admin');
if (isset($add_client_data_user) && $global_user == $add_client_data_user) {
    $page_title = __('My account', 'cftp_admin');
}
include 'header.php';
?>

<div id="main">
	<h2><?php 
echo $page_title;