Variable scope in functions

I think you need a global user_counter inside your function.