Am I do it right?

I want to ask because I don't have any knowledge about sql and php.
1. Are you create this table (log_faucets) in your database?
2. Are you connect to database in your script? Do not post connection string to forum coz you can lose your money.
3. Move "{" up to string with "$ra = getIP();" - it's border of IF statement (must be "{$ra = getIP();")
1, 2 you can google how to using DB, or i can help