My feeling is that in the UN, each country should get a number of votes based on the proportion of free people in the population that has real say in said country's government (based on some standard set of checks, but mostly based on whether they can vote in honest elections). In a government like China, that would mean they would only get a tiny fraction of a vote, based on the small minority of high ranking government officials who get to choose how China actually operates. The same would be true in countries like Iran that hold mostly fraudulent elections.
Well established verifiable democracies would have a lot more influence in the UN than dictatorships.
The best part is that countries like China can't realistically complain about not having a voice proportional to their people when they can't truly say they represent those people. If they want a democratic say in how the planet is run, then they have to offer that same right to the people in their country.