Help with a script

Hi,
I need to create a script that automatically creates a static dns entry for each hotspot user, I need to set the host name to the users login/username. I’ve got a radius backend. Any chance someone can help me out here? I’ve tried modifying the static dns entries script but am not making any headway.

Thanks in advance.