XAMPP cannot work that way, as it is a suite that is unaware of the user context.
What you are describing is called server provisioning/ webhosting management and there are both Open Source and commercial solutions for that. XAMPP can't help you (nor can IIS really).
BTW, If you want 'write your own' the most likely candidate language is Perl.
Good Luck