Cacti Beginner's Guide(Second Edition)
上QQ阅读APP看书,第一时间看更新

Checking the existence of the template user

The next code section checks the Cacti database to see whether the template user exists. If it does not exist, the program immediately stops with an error message:

/* Check that user exists */ 
$user_auth = db_fetch_row("SELECT * FROM user_auth WHERE username = '" . $template_user . "' AND realm = 0"); 
if (! isset($user_auth)) { 
        die("Error: Template user does not exist!\n\n"); 
}