Insert function insde body tag

The answer is “it depends” as usual 🙂

You can do it with hooks and I would recommand action-hook in this case or you can do it on your own.

In both cases : define your function in a plugin, functions.php could be fine but be sure your function is not critical and can be dropped when you change theme.

If you do not want to use action-hooks be sure to test if function exists before using it in a template :

if( function_exists('Ciusan_NBar') ){
    Ciusan_NBar();
}

Regarding the function declaration I would recommand you some coding standards, for example :

if( 'yes' === $options['CNB_Showing'] )

It’s better to put variable to the right in case you omit an equal sign.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)