Cookies in template

Why do you think you can only hook into init via Plugin, rather than via the Theme?

The setup_theme hook, which fires when the Theme is setup, fires before the init hook. Thus, a Theme is perfectly capable of hooking into init.

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