change
$query = mysql_query("SELECT url FROM allowed") or die(mysql_error());
to
$query = mysql_query("SELECT url FROM allowed LIMIT 0,1") or die(mysql_error());
from the sounds of it you are probably looking for the same domain from the result as the current domain
so you would want something like this
$query = mysql_query("SELECT url FROM allowed WHERE url='".$domain."' LIMIT 0,1") or die(mysql_error());