Blame Automation/Php/Webenv/admin/p_users_add.php
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
/***
|
|
Alain Reguera Delgado |
8f60cb |
* Useradd page.
|
|
Alain Reguera Delgado |
8f60cb |
*
|
|
Alain Reguera Delgado |
8f60cb |
* This page sumarize the actions needed to add users into LDAP
|
|
Alain Reguera Delgado |
8f60cb |
* directory server's database.
|
|
Alain Reguera Delgado |
8f60cb |
*
|
|
Alain Reguera Delgado |
8f60cb |
* --
|
|
Alain Reguera Delgado |
8f60cb |
* 2009 (c) Alain Reguera Delgado <al@ciget.cienfuegos.cu>
|
|
Alain Reguera Delgado |
8f60cb |
* Released under GPL lisence (http://www.fsf.org/licensing/licenses/gpl.txt)
|
|
Alain Reguera Delgado |
8f60cb |
*/
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
//------------/* Show error if this page is called directly.
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
if ( basename($_SERVER['PHP_SELF']) <> 'index.php')
|
|
Alain Reguera Delgado |
8f60cb |
{
|
|
Alain Reguera Delgado |
8f60cb |
echo 'Sorry, this page can\'t be served directly. ';
|
|
Alain Reguera Delgado |
8f60cb |
echo 'Try this instead.';
|
|
Alain Reguera Delgado |
8f60cb |
exit;
|
|
Alain Reguera Delgado |
8f60cb |
}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
//------------/* Initialize entry values.
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
$fields = array('uid', 'userpassword', 'cn', 'employeetype', 'preferredlanguage', 'displayname');
|
|
Alain Reguera Delgado |
8f60cb |
$entry = $ldap->init_useradd_values( $fields );
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
//------------/* Do Action if POST
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
if ( isset( $_POST['useradd'] ) )
|
|
Alain Reguera Delgado |
8f60cb |
{
|
|
Alain Reguera Delgado |
8f60cb |
$message = $ldap->do_action( $entry, 'add' );
|
|
Alain Reguera Delgado |
8f60cb |
}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
//------------/* Display useradd action results
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
if ( isset($message) )
|
|
Alain Reguera Delgado |
8f60cb |
{
|
|
Alain Reguera Delgado |
8f60cb |
echo $message;
|
|
Alain Reguera Delgado |
8f60cb |
}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
//------------/* Display useradd title
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
echo '' . ucfirst(translate('add')) . ' ' . translate('user') . '';
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
//------------/* Display useradd form
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
echo show_useradd_form( $entry );
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
?>
|