use this:
PHP Code:
$adminbutton='<a href="admin/index.phps=$session[sessionhash]"><img src="https://vborg.vbsupport.ru/images/top_admin.gif" border=0></a>';
also just a tip, you're first version couldn't work, you have used $loggedinadmin in your headertemplate before this variable has been created ^^
look, it was defined afterwards...
nevertheless, for such things a template conditional hack would help you
look for logician's