上QQ阅读APP看书,第一时间看更新
Input validation
As a quick run of the script without any parameters reveals, the CLI takes three input parameters:
Syntax: php import_user.php <import file> <template user> <realm id>
The import file is the text file with the user IDs you created earlier. The template user will be your _CustomerA_user. The realm id references the ID of the Authentication Realm and can be a number between 0 and 2:
- Realm id 0 - Local Authentication
- Realm id 1 - LDAP Authentication
- Realm id 2 - Web Authentication
The following code checks the entered realm id for its valid range and sets it to Local Authentication (0) if it has not been set correctly:
// Realm Id can be: 0 - Local, 1 - LDAP, 2 - Web Auth if ( ( $realm_id < 0 ) || ( $realm_id > 2 ) ) { // The realm id will be local unless a valid id was given $realm_id = 0; }