A safe login script with less code