What is a good algorithm to use for a UK based Lottery System?
===

I'm programming a lottery system (similar to that used in the UK) using both JS and PHP for use on a forum. This is how the system should work:

Admin creates a lottery
There are unlimited tickets in the lottery
Members can buy a limited number of tickets
Each ticket should have x numbers where you choose y numbers. 

    I.e x = 40, y = 6 -----> There are numbers 1-40, and one possible ticket could be 1,6,14,29,31,40.

I will make x and y dynamic such that the number of combinations is proportional to the number of members registered on the forum.

That bit's not too hard to do.

Hard part:

Each ticket costs $z. When the lottery is drawn, the total pot = $az where a = number of tickets bought. 

Prize breakdown:

    Match y numbers = Max prize
    Match y-1 numbers = Smaller prize
    etc etc until Match 0 numbers = $0

Now I need to make the prizes dynamic so that matching y numbers is much better than matching y-1 numbers, i.e not a linear scale. I was thinking maybe using an exponential scale.

Not only this, but all the prizes added up together should be equal to $baz, i.e the total pot multiplied by some constant, say 0.9 (therefore leaving 10% of the pot to go to some sort of 'charity' or whatever). 

I hope this is specific enough! I don't want any help on the programming side, but more on the algorithm. I had to add the code indents otherwise it wouldn't post :( .