Bug fix

if(data) was done twice, but not correctly
Factorize lastuser into dbtable
Fix errors