Do not use mysql escaping (`), use dibi one ([])

Signed-off-by: Etienne CHAMPETIER <etienne.champetier@fiducial.net>
Use COUNT(*) instead of counting the returned number of login

Signed-off-by: Etienne CHAMPETIER <etienne.champetier@fiducial.net>
Do no reinvent dibi (use %in)

Signed-off-by: Etienne CHAMPETIER <etienne.champetier@fiducial.net>