Login | Register

The use of PHP and mysql

November 15, 2006, 20:26 by Calle
[loading]
-->
Sometimes is very useful to communicate with your server, to put things online. PHP is one very easy way to do this. There are DLLs to help out with the communication, but we'll use as few DLLs as possible. They just do what we are gonna do, but you better understand what it does and you'll soon come to relise the ture power much better.

The first thing to do is to get a script or DLL to download files from the internet. Commonly people uses DLLs such as 39dll.dll for this task, although it is not needed. I myself often use a VBscript that I have found. Search the GMC for either of them.

Next you need to decide what your PHP file should do, and this require PHP knowledge or course. We could for an example want to write something into a database (such as is done in a online highscore system) - then we'd need to write the basic code, like:
mysql_connect ...
mysql_select...
mysql_query(... and here comes the intresting part. Because we'll want to input custom stuff. How'll we send the custom info to the server?

One, the easiest, way is to just put it in the adress, and then get it with $_GET['var_name'];

This is not very secure though. You might want to encrypt it, or you might want to do this:

For each score you calculate, through a formula, a number that is in relation to the score/value that you want to input with your other variables in the adress. Like: .php?score=5&sn=8

...where sn is the the secure number. You check with the PHP files whether the score and the secure number is good togheter before entering the database. This way, if someone tries to download the file with the wrong score they won't be able to without knowing the formula for the secure number. Smart, eh?

Comments

Loading comments... [loading]
.
Users logged in:

game maker articles, game maker examples, game maker tutorials, gmtutorials, game maker questions and answers, game maker crash course, how to create games