Files
librenms-librenms/adduser.php
T

37 lines
750 B
PHP
Raw Normal View History

2010-09-03 18:26:59 +00:00
#!/usr/bin/env php
<?php
include("includes/defaults.inc.php");
include("config.php");
include("includes/functions.php");
if (file_exists('html/includes/authentication/' . $config['auth_mechanism'] . '.inc.php'))
{
include('html/includes/authentication/' . $config['auth_mechanism'] . '.inc.php');
}
else
{
2010-11-22 22:06:37 +00:00
echo("ERROR: no valid auth_mechanism defined.\n");
exit();
2011-03-17 11:12:32 +00:00
}
if (auth_usermanagement())
{
2011-03-16 09:29:46 +00:00
if ($argv[1] && $argv[2] && $argv[3])
{
2011-03-14 18:53:48 +00:00
if (adduser($argv[1],$argv[2],$argv[3],$argv[4]))
{
echo("User ".$argv[1]." added successfully\n");
}
2011-03-16 09:29:46 +00:00
}
else
{
echo("Add User Tool\nUsage: ./adduser.php <username> <password> <level 1-10> [email]\n");
2011-03-16 09:29:46 +00:00
}
}
else
{
echo("Auth module does not allow adding users!\n");
}
2011-03-17 11:12:32 +00:00
?>