get_posts works in the page template but not in a shortcode

You might be missing global $post before the foreach loop in your shortcode function. Please refer to the setup_postdata codex entry.

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