Why does user not logged in when using wp_signon function

First of all move the redirect code in case of success. while there is error then no need to redirect the user.

if you are getting the header information warning, then it means error is actually in redirection everything else is working fine. regarding this error, general-template.php file is writing down some code in DOM before your redirection.
Try using meta or jQuery redirection in this case.

Note : sometimes there is only blank space after PHP closing tag ?> remove the extra spaces at the end from general-template.php

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