How can I restrict access to a widget to admins only?

Simply add the following on top of your code:

if ( ! current_user_can( 'manage_options' ) );
    return;

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