Security - This PHP script takes some precautions to make sure things like SQL injection aren't somehow added to your database (giving remote users access to your data). But with any prevention, there is no absolute guarantee. It also checks to make sure that the two variables PV and N are in the POST command. If either or both are absent, it does nothing. So, even if someone randomly stumbles onto your .php file, they'll have to know how to send a POST command, and know exactly which two variables to send in order to 'spoof' your data. Anyone who has a copy of your game and is determined to find this out, can. My advice is check your data often.
Data Storage - Once you learn a bit more about PHP and MySQL you can create a database and php script that, instead of logging each individual connection, keeps track of how many times a specific IP address has connected and update that record. If you have thousands of connections per day, that would be a better solution as logging each connection would fill up your database quickly.
Advanced ideas - By using Ajax, php and a MySQL database, you can easily track high scores, user names, passwords, registration information, any data your app/game can create, you can stuff it into a 'cloud' database by using Ajax, php and MySQL.
Getting data back - You can even use this method to check a database for information and then, send data back to your game/app. Using the php 'echo' command (which prints things to the browser), the Ajax.LastData will contain the contents of that echo. For that, you'll need to add a Tag to your post command and do an Ajax.onCompleted with the same tag.
How I'll be using this - I sell shareware where users pay via PayPal. PayPal has a feature called Instant Payment Notification (IPN). When someone sends me money, PayPal contacts one of my .php scripts with the payment information. My php script then adds that data to a MySQL database, generates a registration key based on the IPN number and then sends out an automated e-mail to the purchaser thanking them and giving them the registration information and it sends me an e-mail letting me know someone purchased my product.
This is my first tutorial so try not to laugh too hard. Hope you enjoyed it.