The first error message means the mysql query you are trying to run is errorneous, change it from:
PHP Code:
$result = mysql_query("SELECT password FROM ".$prefix."_admin WHERE admin_name='$cookie[1]'");
to:
PHP Code:
$result = mysql_query("SELECT password FROM ".$prefix."_admin WHERE admin_name='$cookie[1]'")
or die( mysql_error() );
This should give you a better error message telling you exactly what is wrong with the query. Could be anything, but its bugged
the latter is regarding setting your cookies and headers, because when creating a cookie or setting a location header to move to a different place, NO output should be produced before these functions are called, including a space at the top of your document so watch out for these