adapt login code to older version of php