It's even worse: An open source license would allow anyone to not just make that change for their own use but in fact release the premium version for free on their own website.
And that check you are considering could be dummied out just as easily.
The pay-per-install business model simply doesn't work for open source software. For alternative business models which might work for you, check out the question "How can large open source projects be monetized?".
You could also make only the free version open source and the premium version proprietary. The free version would then simply lack the sourcecode of the premium features. But that's of course only possible when every part of the software is either your own intellectual property or used under non-copyleft open source licenses. In the context of web applications you can implement crucial parts of the premium-exclusive features as webservices on the server and only allow paying users to access them.