File_SMBPasswd::addUser()

File_SMBPasswd::addUser() – add a new user with the given plaintext-password.

Synopsis

mixed File_SMBPasswd::addUser ( string $user , int $userid , string $pass = '' , string $comment = '' )

Description

This method works in the same way as File_SMBPasswd::addAccount() , except the flags are forced representing a user-account.

Parameter

  • string $user - username to be added

  • int $userid - userid of the user

  • string $pass - plaintext-password

  • string $comment - comment

Return value

mixed - Returns TRUE on success, PEAR_Error on failure.

Note

This function can not be called statically.

Note that the user to be added must already exist in the system password file.

Example

Using File_SMBPasswd::addUser()

<?php
require_once 'File/SMBPasswd.php';

// add user mbretter
$fh = new File_SMBPasswd('/usr/local/private/smbpasswd');
$fh->load();
$status $fh->addUser(
    
'mbretter'
    
1004
    
'MyPw',
    
'Michael Bretterklieber');
if (
PEAR::isError($status)) {
    
// handle errors
} else {
    
// continue processing
    
$fh->save();
}

?>