Io credo che sarebbe opportuno farlo in php o cmq linguaggio lato server.