filling a online DB using php. how?

Previous topic - Next topic

ampos

I would like to fill a database with app/device info within my app (when a user run my app for the first sent info about date, device,...) so i can have a few statistics.

How do i do it? I have no idea of php...

matchy

Quote from: ampos on 2012-Feb-28
I would like to fill a database with app/device info within my app (when a user run my app for the first sent info about date, device,...) so i can have a few statistics.

How do i do it? I have no idea of php...

http://www.w3schools.com/php/php_post.asp

Send the parameters in a form or query and just save it to a delimited text file for now.


MrTAToad

You would use NETWEBGET$ to send the data to the PHP web file.

Moru

There are some examples in the samples (as usual :-)

Can't remember the name but try searching on .php, there should be sources for the server around there too.

Leginus

This is some code for a highscore table that I used that you could easily adapt

Code (glbasic) Select
NETWEBGET$("websitehome.co.uk", "/poststats.php?n=" + YourName$ + "&s=" + Distance, 80, 4096)


And the php saved as poststats.php and placed in your server location @ websitehome.co.uk

Code (glbasic) Select

<?php

  $nam 
$_GET["n"];
  
$sco $_GET["s"];

 
$con mysql_connect("YourDB.co.uk","YourDBname","YourPassword");
 if (!
$con)
  {
  die(
'Could not connect: ' mysql_error());
  }
 
 
mysql_select_db("YourDBname"$con); 
$result mysql_query"INSERT INTO HIGHSCORE (Name, Score)
 VALUES ( '" 
$nam "', '" $sco "' ) " );

 
mysql_close($con);
?>



Obviously this could be adapted to use blowfish for encryption but thats up to you....this is old code and never did.

MrTAToad

Included is the PHP code I use to process uploaded scores :

And the GLBasic code to send to it :

Code (glbasic) Select
/hs/new_score.php?send="+URLENCODE$(ENCRYPT$(PLATFORMINFO$("HOSTID")+"acode",setup.ReturnProgName$()+","+name$+","+score%+","+setup.ReturnCountryCode$()+","+setup.ReturnPlatform$()+","+gameMode%+",anothercode"))

[attachment deleted by admin]