a couple of points:
always calculate any values you need in a query before putting them into your sql:
ie
$lastlogin = mktime() - 1500; (etc or whatever you want)
then:
$sql = "SELECT * FROM dt_profile WHERE lastlogin > $lastlogin"
etc - your query was hard to understand due to functions and a lack or comparisons (ie = or > signs)
similarly, if you need to access an array, then break out of the echo:
"DELETE FROM dt_members, dt_profile WHERE id='".$f_user[id]."'";
That should help you some