*READ CAREFULLY THERE IS ONLY TEXT AS I'M TOO LAZY FOR PICTURES WITH WHAT TIME I HAVE*
oh and feel free to ask questions. ill do my best to make sure i didn't make any mistakes typing this
Make a free account here http://freehostingphpmysql.com/ with a free hosting plan and click on website manager in the top horizontal bar
from there you will see a side bar, click on My SQL Manager create a database name and password and remember it/write it down.
**Make sure you remember the full database number, not just the part you pick**
Click on the hyperlink that is your database number you just created and login using the database and password you just created
Once again, you will see your database number on the left hand side and click on it from here name your table "highscores" or something simple to remember and make the "number of fields" 3
**Picture shows this better than text, see it below**
in the first field put "Name" make it a "char" type "64" length "latin1-bin" collation
in the second put "Score" "BIGINT" type
in the third put "Id" "INT" type "UNSIGNED" attribute "auto_increment" for extras and pick the first radio button on the fire right
now return to the page where you signed up first and clicked on "website manage" and choose "subdomain manager" from the sidebar
simply create a subdomain and choose one of the dropdown options and remember this once again
now on the side bar go to file manager and click that folder that has your subdomain name
minimize your internet explorer and create a new text document
inside here put this code and we will change some lines
- Code: Select all
<?
echo "<h5>High Scores</h5>";
$con = mysql_connect("fdb3.runhosting.com","databse","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database", $con);
$result = mysql_query("SELECT * FROM highscores ORDER BY Score DESC LIMIT 10");
while($row = mysql_fetch_array($result))
{
echo $row['Name'] . " | " . $row['Score'];
echo "<h5> </h5>";
}
mysql_close($con);
?>
now find this line:
- Code: Select all
$con = mysql_connect("fdb3.runhosting.com","database","password");
and input your database number (the FULL one) and password. Also make sure the "fdb3" in the first quotes should be a 3 and not a 2 based on what it says next to your database in the "my SQL manager"
now find these lines:
- Code: Select all
mysql_select_db("database", $con);
$result = mysql_query("SELECT * FROM highscores ORDER BY Score DESC LIMIT 10");
change the database to your FULL number and change where you see highscores to the name of your table
if you would like to have more than the top 10 change "LIMIT 10" to "LIMIT whatever number you want"
save this as a .php by using the drop down menu and choosing "all file types", and remember the name of it
open now another text document inside here put this code and we will change some lines again
- Code: Select all
<?php
$nam = $_GET["n"];
$sco = $_GET["s"];
$con = mysql_connect("fdb3.runhosting.com","database","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database", $con);
$result = mysql_query( "INSERT INTO highscores (Name, Score)
VALUES ( '" . $nam . "', '" . $sco . "' ) " );
mysql_close($con);
header( 'Location: http://yoursubdomain/1st_textdocument.php' ) ;
?>
now find this line:
- Code: Select all
$con = mysql_connect("fdb3.runhosting.com","database","password");
and input your database number (the FULL one) and password. Also make sure the "fdb3" in the first quotes should be a 3 and not a 2 based on what it says next to your database in the "my SQL manager"
next find these lines:
- Code: Select all
mysql_select_db("database", $con);
$result = mysql_query( "INSERT INTO highscores (Name, Score)
and change the "database" to yours and where you see "highscores" put whatever you named your table
finally find this line:
- Code: Select all
header( 'Location: http://yoursubdomain/1st_textdocument.php' ) ;
insert your subdomain and the name of the 1st php text document you created accordingly
save this as a .php by choosing "all file types" when saving named whatever you would like
now return to your untouched internet explorer and upload both of the files
we can now test this to make sure it works before entering GE
http://highscore.mygamesonline.org/dbpost.php?n=Jimmynewguy&s=15000000
change the red to your subdomain and the blue to the name of the second text file and open this webpage, after a little bit of loading I should be on your highscore table with 15000000 points if not retrace this tutorial *carefully* until it does work
now open a .ged file
simply make a way to make score by acquired and a text actor that allows user input (i assume doing this is common knowledge? really shouldn't but this is a lot of typing....)
make a global inter "score" also that will hold the user score and a global string variable "texts"
now, where you want the player to be able to submit their score (mousedown for example)
put this code
- Code: Select all
sprintf(texts, "your_subdomain/the_2nd_text_document.php?n=%s&s=%i", texts.text, score);
openUrl(texts);
Enter your subdomain and the name of the 2nd text document we created accordingly again
and test it out/have fun with it, maybe someone better with mySQL and php can throw out other ideas from this??
Anyways, if you get stuck post here and ill do my best to help out. view the example .ged too since i didnt explain well some things there...sorry about that and the fact this only being text will make it quite confusing.
Cheers!