How to echo text in browser instead of download junk file?

This change is untested:

if( $file === '' || ! isset( $file ) || ! file_exists( $file ) ) {

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