-
Online Highscores Help
Hey everyone.
I'm making a game and trying to have online highscores for it.
i'v been following this tutorial http://www.clickteam.com/eng/resources/online_score/onlinescoreboards.html#setu
I just uploaded a notepad file but instead of saying this
pos name score date submitted
1 tom sweeney 172 2008-2-11 12:31:40
I get this
\n"); $loopindex++; } ?>
pos name score date submitted
$thispos $thisname $thisscore $thisdate
I don't really have any idea what i'm doing and dunno what has gone wrong. I'v checked the coding and it all seems fine, the only difference is i changed buttonscore to highscores.
Help very much appreciated
Dylan
-
Re: Online Highscores Help
sounds like PHP isn't supported on your server, you could try the VCade remote (on the right)
-
Re: Online Highscores Help
What do you mean?(sorry not experienced with this html stuff)
It was suggested to use this site in the tutorial, and i have not done any coding in my game that even connects to the highscores yet.
Thanks very much for the reply though neat kliker.
If DavidN could reply i would be very grateful.
-
Re: Online Highscores Help
PHP www.php.net is not HTML, it is a server side coding program and most free hosts do not support it
-
Re: Online Highscores Help
Hi dylan,
It sounds like NK2 is right here - your webspace doesn't support PHP and is trying to interpret the file as HTML instead. Which host are you using?
Although having said that, I'm surprised that a host would have support for SQL and not PHP to go with it - perhaps the reading of the file type is causing a problem? You say you uploaded a "Notepad file", but that could mean anything - it should end with the extension ".php" to be interpreted correctly.
-
Re: Online Highscores Help
Quote:
Originally Posted by DavidN
it should end with the extension ".php" to be interpreted correctly.
Enable file extensions using the Tools > Folder Options > View list, else your not actually seeing file extensions at all
-
Re: Online Highscores Help
Thanks for the replies!
The host i am using is bytehost.com
I put .php at the end of it. Neat kilker ill try this (Tools > Folder Options > View list) in about 7 hours, goto go to school now = )
Thanks again for the replies and i hope to give more info soon.
-
Re: Online Highscores Help
Ok back.
Quote:
Originally Posted by neat_Kliker2
Quote:
Originally Posted by DavidN
it should end with the extension ".php" to be interpreted correctly.
Enable file extensions using the Tools > Folder Options > View list, else your not actually seeing file extensions at all
Are you talking about on bytehost to change the folder options? I can't find it on the site and it's not in notepad.
I know this is asking allot but here is my code, are there any easy to spot errors?
<html>
<head>
<title>Online Scoreboard Tutorial - Scores</title>
</head>
<body>
<?
$service = "sql112.byethost13.com";
$username = "b13_1564643";
$password = "*******";
$database = "highscores";
mysql_connect($service, $username, $password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "SELECT * FROM highscores";
$result = mysql_query($query);
$num = mysql_numrows($result);
?>
<table>
<tr class="header"><td>Pos</td><td>Name</td><td>Score</td><td>Date Submitted</td></tr>
<?
$loopindex = 0;
while ($loopindex < $num) {
$thisname = mysql_result($result, $loopindex, "name");
$thisscore = mysql_result($result, $loopindex, "combatexperience");
$thisdate = mysql_result($result, $loopindex, "datesubmitted");
$thispos = $loopindex+1;
echo ("<tr><td align=left><p>$thispos</p></td>
<td align=center><p>$thisname</p></td>
<td align=center><p>$thisscore</p></td>
<td align=center><p>$thisdate</p></td></tr>\n");
$loopindex++;
}
?>
</table>
</body>
</html>
Also in my ftp client in the htupload(think it's called that) folder, it says "COM SHOULD BE UPLOADED HERE! file" not sure if this is a problem...
Again i very much appreciate this as it will give my game a new dimension of fun = )
-
Re: Online Highscores Help
i think i have found a problem. In the FTP client it says that the notepad file i uploaded is:
Dislpayscores.php.txt
Again im really not sure..
-
Re: Online Highscores Help
that would probably be the problem, it needs to just be displayscores.php
-
Re: Online Highscores Help
hmm... Any idea how to change it?
Do i need to use microsoft word? because another computer in our house has it.
-
Re: Online Highscores Help
open it up in notepad again and do save as and change the extension to .php instead of .txt
-
Re: Online Highscores Help
It dosent make adifference when i put .php at the end, but while saving there are there 3 options in encoding: ANSI, UNICODE, UNICODEbidedia and UTF-8. By default it's on ANSI so im not sure if it makes a difference.
BTW thanks for help so far ketchip : )
-
Re: Online Highscores Help
no he means just change it.
you may need to disable hide known file types in the folder view menu.
Best of luck
-
Re: Online Highscores Help
The filename is displayscores.php but it is still a text file.
ooo i see that you mean, there is no .php extension. It isn't on microsoft word either =(
Is it even neccesary to complete the tutorial to upload a word document with the coding?
Thanks for the luck, think i need it ; )
Also thanks to everyone contributing there time to my problem, very (very) much appreciated.
-
Re: Online Highscores Help
try this:
turn off hide file extensions for known file types like this:
- select Start | Settings | Control Panels | Folder Options
- select the View tab
- UNcheck "hide file extensions for known file types"
- Click OK to finish
then try to rename the file to .php within windows
-
Re: Online Highscores Help
alrighty i try that in a sec...
-
Re: Online Highscores Help
Alright, when i try to press save it just does nothing.. Dosen't work on microsoft word either.
-
Re: Online Highscores Help
This is the problem a lot of people have with file extensions. Here is what you do:
1. Open a blank notepad.
2. Copy and paste the php text from the other failed one or just start over with a new one.
3. Go to File>Save As
4. Under "Save As Type" select All Files
5. Make the file name "whatever.php" without quotations.
5. Hit Save
And your done, this makes it an absolute php file, the encoding shouldn't matter, but to stay on the safe side, leave it as ANSI. I just tested this and I know it works, because instead of a text icon on the file, I have a Dreamweaver icon, which I have defaulted for php.
---EDIT---
Quote:
Originally Posted by dylan99379
<html>
<head>
<title>Online Scoreboard Tutorial - Scores</title>
</head>
<body>
<?
$service = "sql112.byethost13.com";
$username = "b13_1564643";
$password = "*******";
$database = "highscores";
mysql_connect($service, $username, $password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "SELECT * FROM highscores";
$result = mysql_query($query);
$num = mysql_numrows($result);
?>
<table>
<tr class="header"><td>Pos</td><td>Name</td><td>Score</td><td>Date Submitted</td></tr>
<?
$loopindex = 0;
while ($loopindex < $num) {
$thisname = mysql_result($result, $loopindex, "name");
$thisscore = mysql_result($result, $loopindex, "combatexperience");
$thisdate = mysql_result($result, $loopindex, "datesubmitted");
$thispos = $loopindex+1;
echo ("<tr><td align=left><p>$thispos</p></td>
<td align=center><p>$thisname</p></td>
<td align=center><p>$thisscore</p></td>
<td align=center><p>$thisdate</p></td></tr>\n");
$loopindex++;
}
?>
</table>
</body>
</html>
There is a problem in the php code right here at "$database = "highscores";" That is the table name, and the database should be something longer probably like bytehost12_highscore, you will find it in the phpMyAdmin. This line is correct
"$query = "SELECT * FROM highscores" because it uses the table name. If you fix the database thing you should be alright.
-
Re: Online Highscores Help
Quote:
Originally Posted by Brandon
This is the problem a lot of people have with file extensions. Here is what you do:
1. Open a blank notepad.
2. Copy and paste the php text from the other failed one or just start over with a new one.
3. Go to File>Save As
4. Under "Save As Type" select All Files
5. Make the file name "whatever.php" without quotations.
5. Hit Save
And your done, this makes it an absolute php file, the encoding shouldn't matter, but to stay on the safe side, leave it as ANSI. I just tested this and I know it works, because instead of a text icon on the file, I have a Dreamweaver icon, which I have defaulted for php.
---EDIT---
Quote:
Originally Posted by dylan99379
<html>
<head>
<title>Online Scoreboard Tutorial - Scores</title>
</head>
<body>
<?
$service = "sql112.byethost13.com";
$username = "b13_1564643";
$password = "*******";
$database = "highscores";
mysql_connect($service, $username, $password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "SELECT * FROM highscores";
$result = mysql_query($query);
$num = mysql_numrows($result);
?>
<table>
<tr class="header"><td>Pos</td><td>Name</td><td>Score</td><td>Date Submitted</td></tr>
<?
$loopindex = 0;
while ($loopindex < $num) {
$thisname = mysql_result($result, $loopindex, "name");
$thisscore = mysql_result($result, $loopindex, "combatexperience");
$thisdate = mysql_result($result, $loopindex, "datesubmitted");
$thispos = $loopindex+1;
echo ("<tr><td align=left><p>$thispos</p></td>
<td align=center><p>$thisname</p></td>
<td align=center><p>$thisscore</p></td>
<td align=center><p>$thisdate</p></td></tr>\n");
$loopindex++;
}
?>
</table>
</body>
</html>
There is a problem in the php code right here at "$database = "highscores";" That is the table name, and the database should be something longer probably like bytehost12_highscore, you will find it in the phpMyAdmin. This line is correct
"$query = "SELECT * FROM highscores" because it uses the table name. If you fix the database thing you should be alright.
Thanks for the very helpful reply!
I tried saving the file as php again, but it would just refresh my icons and not do anything, so i used the file editor on bytehost. I renamed that to displayhighscores(*.PHP) and it worked!
With the code problem, my database is also called highscores, so should i rename the code to b13_1564643_highscores or using the host name sql112.byethost13.com_highscores
I'll be able to reply in about 6-6.5 hours.
Again thanks everyone for there replies and help. Few names going in the credits of my game = )
-
Re: Online Highscores Help
Quote:
Originally Posted by dylan99379
With the code problem, my database is also called highscores, so should i rename the code to b13_1564643_highscores or using the host name sql112.byethost13.com_highscores
I use the paid version of bytehost hosting (I own www.clickalize.com), and when I make MySQL databases, they start with clickali_******. I'm pretty sure it will be yourusername_highscores, or as you said b13_1564643_highscores.
-
Re: Online Highscores Help
Ummm... can't you just right click on the file and click rename? Or click, wait a second or two, and click again to rename? I always do that... works like a charm.
-
Re: Online Highscores Help
Quote:
Originally Posted by _LB
Ummm... can't you just right click on the file and click rename? Or click, wait a second or two, and click again to rename? I always do that... works like a charm.
No, there must be a technical problem with my computer because that wasn't working.
Alrighty, i got a few hours to continue tinkering with this. I'm pretty sure it will work well now, but i'll post if i got anymore problems.
Thanks for all the help brandon = )
-
Re: Online Highscores Help
Ok, new problem(s).
I'm still not sure baout my coding in the files uploaded to bytenet.. but i would like to get the coding in the game done first to see what happens when i submit a score.
All is going well on the tutorial untill i came upto this part
+ MooSock object: On Connect
-> Status string: Set alterable string to "Submitting score"
-> MooSock object: Send text line "GET http://[youraddresshere]/submitscore.php?name="+Edittext$( "Edit Box" )+"&score="+Str$(value( "Counter" ))
-> MooSock object: Send text line "From: clicktutorial@nowhere.com"
-> MooSock object: Send text line "User-Agent: HTTP-Tool/1.0"
-> MooSock object: Send text line "" (i.e. an empty string)
-> MooSock object: Listen on port 80
I got upto line two(where have to send text line) and i did this
"GET ftp://ftp.byethost13.com/htdocs/displayscores2(.PHP)name="Global String A"+"&score="+Str$( "value( "Combat Experience" ))"
I know it must be annoying but can someone experienced with moosock please tell me whats going wrong.
It could also be that the web address i'm adding in is wrong.
So basicly i need a very kind person to check the coding im using to send to the server(and if anyone is experienced with byte_host or other hosting sites please tell me the best way the find my URL)
thanks
Dylan (confused and scared atm)
-
Re: Online Highscores Help
I think you have some extra quotes and missing some +'s in there...it should be like this:
"GET ftp://ftp.byethost13.com/htdocs/displayscores2(.PHP)name="+Global String A+"&score"+Str$(value( "Combat Experience" )
Also, I think you need an http address not an ftp one
-
Re: Online Highscores Help
Quote:
Originally Posted by KetchupMaster
I think you have some extra quotes and missing some +'s in there...it should be like this:
"GET ftp://ftp.byethost13.com/htdocs/displayscores2(.PHP)name="+Global String A+"&score"+Str$(value( "Combat Experience" )
Also, I think you need an http address not an ftp one
I copied and pasted your code in and it looked correct(everything was either purple or blue) but still said syntac error.
Your probaly right about needing a http adress, as it asks for a password when trying to open the webpage, but i can't seem to find it anyone on bytehost.
-
Re: Online Highscores Help
"GET http://www.clickalize.com/submitscore.php?name="+string$( "String" )+"&score="+Str$(Points)+"&mdfive="+mdFive$( "String Parser" ) Here is a line I ripped straight out of one of my online games. And yes Ketchup Master is right about the http thing. Ftp is for uploading the files to the server.
-
Re: Online Highscores Help
Quote:
Originally Posted by dylan99379
+ MooSock object: On Connect
-> Status string: Set alterable string to "Submitting score"
-> MooSock object: Send text line "GET http://[youraddresshere]/submitscore.php?name="+Edittext$( "Edit Box" )+"&score="+Str$(value( "Counter" ))
-> MooSock object: Send text line "From: clicktutorial@nowhere.com"
-> MooSock object: Send text line "User-Agent: HTTP-Tool/1.0"
-> MooSock object: Send text line "" (i.e. an empty string)
-> MooSock object: Listen on port 80
I got upto line two(where have to send text line) and i did this
"GET ftp://ftp.byethost13.com/htdocs/displayscores2(.PHP)name="Global String A"+"&score="+Str$( "value( "Combat Experience" ))"
It should be this:
On submit score:
Connect to www.byethost13.com (or whatever the first bit of your web address is, between http:// and the next /) on port 80
MooSock object: On Connect
-> Status string: Set alterable string to "Submitting score"
-> MooSock object: Send text line "GET /submitscore.php?name="+Edittext$( "Edit Box" )+"&score="+Str$(value( "Counter" ))+" HTTP/1.1" (this is "GET ", then the second half of the address (after the .com), then "?" then the data you want to send, then " HTTP/1.1". Also make sure there is no spaces in the data you're sending (change them to "%20" or remove them).)
-> MooSock object: Send text line "Server: www.byethost13.com" (same as you connected to)
-> MooSock object: Send text line "User-Agent: HTTP-Tool/1.0" (you should change this to the name and version of your game)
-> MooSock object: Send text line "" (i.e. an empty string)
No need to listen on port 80, you'll receive a reply anyway. Add the reply to an edit box or string or something to have a look.
-
Re: Online Highscores Help
Yes, I'd been meaning to remove the "Listen" line for a while - it was a mistake that I picked up when I learned from a different tutorial, and mistakenly propagated it to everyone else.
However (and this is a big 'however'), I'd actually now recommend ditching MooSock entirely and using Jam's Live Receiver object instead. I know that the method I used in the tutorial has problems with certain servers, and Jam's extension is quite successful at getting around them.
It's also quicker - all you need is the address and the GET string to send - the "GET /submitscore.php?name="+Edittext$( "Edit Box" )+"&score="+Str$(value( "Counter" ))" bit.
-
Re: Online Highscores Help
Ok everyone thanks again for the help.
I have changed the code to this:
"GET/http://dylan99379.bytehost13.com/submitscore.php?name="Global String A+"&score="value( "Combat Experience" ))+" HTTP/1.1"
Also tried this one
"GET http://dylan99379.byethost13.com/htdocs/displayscores2(.PHP)name="+Global String A+"&score"+Str$(value( "Combat Experience"
(combat experience is the counter i want to use for the score and global string A contains the players name which is submited at the start of the game.)
But it is still saying syntax error (how do you get the GET at the start? i can't find it anywhere on the moosock object.)
(Also please note that i have not used moosock before, tried to but could'nt work it out.)
Also i found the right right adress(instead of ftp one) but when i go there it's some wierd google site lol. (http://dylan99379.byethost13.com)
(if it's against forum rules to post links to sites please tell me and i'll edit.)
So yer, Getting there = )
Found right address, code's getting better.
Timezones make it so that i can't work on this while your all online(im at school at that time). On saturday i should be on allot mroe frequently.
So yer i can code for the next 6 and a half hours.
Found right address, code's getting better.
Thanks for the help so far, your all my god's (i have shrines to each person who has replied and i worship them daily.)
Dylan
-
Re: Online Highscores Help
Bump
This is my line of code atm for the send text line command
"GET http://dylan99379.byethost13.com/htdocs/displayscores2(.PHP)name="+Global String A+"&score"+Str$(value( "Combat Experience"
I was wondering how you manuely get the GET at the start (Like to get a counter value you right click on that counter).
Thanks, Dylan.
-
Re: Online Highscores Help
I think your going about this a lil wrong but basically you send GET + (what ever) then wait for a response and base your counter on that.
-
Re: Online Highscores Help
kk i understand that, but i keep getting syntax error from my line of code, so was thinking it may be because im typing GET in instead of finding it.
If someone else can quickly open up a new mmf2 and try and put that line of code in under send text line and see if it works, i would greatly appreciate it.
-
Re: Online Highscores Help
okay, I've been testing this out too. I've got it working. The only problem is if the player puts spaces in their name has do I tell it to replace those spaces with + so it submits correctly, otherwise I'll be waiting forever.
-
Re: Online Highscores Help
Quote:
Originally Posted by damee
okay, I've been testing this out too. I've got it working. The only problem is if the player puts spaces in their name has do I tell it to replace those spaces with + so it submits correctly, otherwise I'll be waiting forever.
kk ill keep that in mind.
You couldnt put in the get text line code you did without the web adress could you?
Be back in 8 hours.
-
Re: Online Highscores Help
ump
This is my line of code atm for the send text line command
"GET http://dylan99379.byethost13.com/htdocs/displayscores2(.PHP)name="+Global String A+"&score"+Str$(value( "Combat Experience"
I was wondering how you manuely get the GET at the start (Like to get a counter value you right click on that counter) because i think that is the reason it is saying syntax error.
The whole line of code is purple before i try to put it in, but it still says syntax error. = (
Thanks, Dylan.
-
Re: Online Highscores Help
You're clearly missing your closing brackets at the end... and I'm not sure where the brackets around your ".php" came from, either. You need to remove those.
Edit 1: And you're missing the equals sign after "&score".
Edit 2: And the question mark after ".php".
Actually, given this I'd go back to the original line in the tutorial and check to see where you're going wrong with it.
-
Re: Online Highscores Help
Okay I've got mine working except i keep getting at the start of the names column. On the first name only. Everything else is working fine now.
-
Re: Online Highscores Help
Quote:
Originally Posted by DavidN
You're clearly missing your closing brackets at the end... and I'm not sure where the brackets around your ".php" came from, either. You need to remove those.
Edit 1: And you're missing the equals sign after "&score".
Edit 2: And the question mark after ".php".
Actually, given this I'd go back to the original line in the tutorial and check to see where you're going wrong with it.
Alrigthy thanks for that mate this is how the code line loks atm (still getting syntax error =[)
"GET http://dylan99379.byethost13.com/htdocs/displayscores2.PHP?""name="+Global String A+"&score="+"Str$(value( "Combat Experience)"
Theres probaly to many "'s but im nto sure, i had to add more in for the whole lot to be purple.
"Actually, given this I'd go back to the original line in the tutorial and check to see where you're going wrong with it. "
good idea, i think i'll go do that now. I'll be on for a few hours now.
Just checked back to your original code and i'v now changed my code to this:
"GET http://dylan99379.bytehost13.com/htdocs/displayscores2.php?name="+"(Global Value A" )+"&score="+Str$(value( "Combat Experience" ))
(still syntax error)
This is the original code from the tutorial
"GET http://[youraddresshere]/submitscore.php?name="+Edittext$( "Edit Box" )+"&score="+Str$(value( "Counter" ))
Even if i just copy your code straight in i get syntax error, is that normal?
What i changed was:
Put in my adress
Changed it to get instead of edit box string to global string A
Changed it from instead of getting value off counder, gets off combat experience (also a counter).
Hope that helps.
Thanks again david, really appreciate your help, and everyone else who has contributed.
-
Re: Online Highscores Help
bump, b back for awhile in 8 and a half hours.