One more question. With the SQL database Ive got a table called premium and its a boolean. If they purchase the game it will go to a 1. How will I get it so there account has to be premium in the code? Basically if the SQL table premium is true they can play the game and continue however if its false they have to pay.
Instead of a table Premium you could also add a field "premium" to your users table. After executing the select for username/password you can read out the field "premium" and use it for premium content of the game. (You would also need to add "registration date" and maybe "premium date" and anything else you can think of.)
In your GetValidUsername you could add the following lines (replace everything from Query.Open to Query.Close with these lines):
Query.Open;
Result := Query.RecordCount > 0;
Premium := Result and (Query.Fieldbyname('premium').AsInteger = 1);
Query.Close;
And put a global variable "Premium: Boolean;" below the "User: String;" definition.
In the PHP version you could echo "Premium" back.
So:
Premium (for premium users)
Normal (for normal users who still need to buy the premium content)
Invalid (for unknown users)
Please note that if money is involved I would choose the more secure PHP-option over the insecure direct MySQL-calls from the game itself.
(Unless you are expecting not more than 100 users or so)
B.T.W. Upside of the PHP-solution is you don't need the MySQL-dll anymore. Also... the game might also work on college because the calls go over port 80 which probably isn't blocked.