User Account System
by Skylar Kelty · 11/13/2006 (4:37 pm) · 170 comments
---------------------------------------------------------------------------------------------------
Version 3
---------------------------------------------------------------------------------------------------
Version 3.3 - Updated!
download v3.3
Version 3.3 uses Web-Server Interaction and features awards, stats and member panel.
This version requires PHP, MYSQL and TorqueScript Knowledge.
If you have downloaded this before, make sure you clear your browser's cache!
Version 3.2
download v3.2
Version 3.2 uses SQLLite and features awards, stats and member panel.
Version 3.1 - Untested!
download v3.1
Version 3.1 uses xml and features awards, stats and member panel.
---------------------------------------------------------------------------------------------------
Old Versions
---------------------------------------------------------------------------------------------------
Version 2 - No longer supported!
download v2
Version 2 uses SQLite, which is more secure. Some of you may not want to use SQLite, if you dont, use v1.2
Version 1.2 - No longer supported!
download v1.2
Version 1.2 uses the fileobject
---------------------------------------------------------------------------------------------------
ChangeLog
---------------------------------------------------------------------------------------------------
UPDATES:
v1.1 - bug fixes
v1.2 - now uses c++
v2 - now uses SQLite
v3 - Fixes, Updates and 3.3 uses web-server interaction
v3.3 - Updated to.. actually work.. see comments
Version 3
---------------------------------------------------------------------------------------------------
Version 3.3 - Updated!
download v3.3
Version 3.3 uses Web-Server Interaction and features awards, stats and member panel.
This version requires PHP, MYSQL and TorqueScript Knowledge.
If you have downloaded this before, make sure you clear your browser's cache!
Version 3.2
download v3.2
Version 3.2 uses SQLLite and features awards, stats and member panel.
Version 3.1 - Untested!
download v3.1
Version 3.1 uses xml and features awards, stats and member panel.
---------------------------------------------------------------------------------------------------
Old Versions
---------------------------------------------------------------------------------------------------
Version 2 - No longer supported!
download v2
Version 2 uses SQLite, which is more secure. Some of you may not want to use SQLite, if you dont, use v1.2
Version 1.2 - No longer supported!
download v1.2
Version 1.2 uses the fileobject
---------------------------------------------------------------------------------------------------
ChangeLog
---------------------------------------------------------------------------------------------------
UPDATES:
v1.1 - bug fixes
v1.2 - now uses c++
v2 - now uses SQLite
v3 - Fixes, Updates and 3.3 uses web-server interaction
v3.3 - Updated to.. actually work.. see comments
About the author
Recent Blogs
• AFXSpellCooldowns• TGEA material.cs Generator
• Check for update
• Save/Load game system
• DOM, SG and future resources
#122
I had never noticed that fuction in the int.cs file before.
I am hoping to get a working user accout system going and I think this will be great for it if I can get it setup like I would need.
I am trying to fix a type of game like Call Of Duty 4 and Combat Arms.
Thank you so much.
09/06/2009 (9:19 pm)
Sweet thanks man,I had never noticed that fuction in the int.cs file before.
I am hoping to get a working user accout system going and I think this will be great for it if I can get it setup like I would need.
I am trying to fix a type of game like Call Of Duty 4 and Combat Arms.
Thank you so much.
#123
What all does it have and any more progress with it?
Also is there a download link for that version if done?
Thanks
09/06/2009 (11:03 pm)
I noticed you sayed a few things about version 4.What all does it have and any more progress with it?
Also is there a download link for that version if done?
Thanks
#124
09/07/2009 (2:49 pm)
Err i stopped working on this ages ago :(
#125
I started over 3 times now and I still get these errors.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/uac.cs (39): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/uac.cs (43): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/uac.cs (48): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/uac.cs (52): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/uac.cs (63): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/uac.cs (68): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/uac.cs (86): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/score.cs (19): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/score.cs (23): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/score.cs (42): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/awards.cs (21): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/awards.cs (25): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/awards.cs (42): break outside of loop... ignoring.
And
Warning! You have a duplicate datablock name of UACOnline. This can cause problems. You should rename one of them.
Not sure what I am missing now. I did at the function for the int.cs tho.
09/08/2009 (5:33 pm)
The strange thing about all this is I must have gotten lucky the first time but. I had to start over from scratch becouse I tryed to add more to it like insted of name its First Name, Last Name, E-mail address so forth and it quit working and started giving me the same errors as before.I started over 3 times now and I still get these errors.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/uac.cs (39): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/uac.cs (43): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/uac.cs (48): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/uac.cs (52): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/uac.cs (63): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/uac.cs (68): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/uac.cs (86): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/score.cs (19): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/score.cs (23): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/score.cs (42): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/awards.cs (21): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/awards.cs (25): break outside of loop... ignoring.
C:/Torque/TGEA_1_8_1/GameExamples/Stronghold/game/scriptsAndAssets/client/scripts/awards.cs (42): break outside of loop... ignoring.
And
Warning! You have a duplicate datablock name of UACOnline. This can cause problems. You should rename one of them.
Not sure what I am missing now. I did at the function for the int.cs tho.
#126
09/08/2009 (5:42 pm)
Blah, I think I know what my trouble is. I am using vs2005 and it does not seem to be cleaning and compiling correctly.
#127
The thing is after getting it to compile and you go in game and create an account , you then got to close the game, clean dso's and reload in order to login.
I may leave registration as website only.
Thanks agian James
09/08/2009 (6:27 pm)
ok, got it to compile and work. I do still get those break outside of loop errors tho. The thing is after getting it to compile and you go in game and create an account , you then got to close the game, clean dso's and reload in order to login.
I may leave registration as website only.
Thanks agian James
#128
All your gui's have an letter befor the string like.
%username has %rusername for register and %lusername for login.
My question is , where and how do you translate the rusername to username and lusername to username?
Normley I see something like in the php
$username = mysql_real_escape_string($_GET['rusername']);
Sorry for all the questions and bringing up an old resource lol.
Im just trying to get a working account system for my game.
Thanks
Also, I added more things like first name, last name so forth but I get a mysql error when trying to register.
Was this correct way to add to register.php?
<?
include("database.php");
$username = mysql_real_escape_string($_GET['username']);
$password = sha1($_GET['password']);
$firstname = mysql_real_escape_string($_GET['firstname']);
$lastname = mysql_real_escape_string($_GET['lastname']);
$email = mysql_real_escape_string($_GET['email']);
$q = mysql_query("SELECT * FROM users WHERE Username='$username'");
if(mysql_num_rows($q) > 0)
die("UserTaken\n<!--end-->");
if(!mysql_query("INSERT INTO users VALUES ('0', '$username', '$password', '$firstname', '$lastname', '$email')"))
die("MYSQLError\n<!--end-->");
print "SUCCESS\n<!--end-->";
?>
Thanks
09/08/2009 (7:38 pm)
Something else that I notice and puzzles me.All your gui's have an letter befor the string like.
%username has %rusername for register and %lusername for login.
My question is , where and how do you translate the rusername to username and lusername to username?
Normley I see something like in the php
$username = mysql_real_escape_string($_GET['rusername']);
Sorry for all the questions and bringing up an old resource lol.
Im just trying to get a working account system for my game.
Thanks
Also, I added more things like first name, last name so forth but I get a mysql error when trying to register.
Was this correct way to add to register.php?
<?
include("database.php");
$username = mysql_real_escape_string($_GET['username']);
$password = sha1($_GET['password']);
$firstname = mysql_real_escape_string($_GET['firstname']);
$lastname = mysql_real_escape_string($_GET['lastname']);
$email = mysql_real_escape_string($_GET['email']);
$q = mysql_query("SELECT * FROM users WHERE Username='$username'");
if(mysql_num_rows($q) > 0)
die("UserTaken\n<!--end-->");
if(!mysql_query("INSERT INTO users VALUES ('0', '$username', '$password', '$firstname', '$lastname', '$email')"))
die("MYSQLError\n<!--end-->");
print "SUCCESS\n<!--end-->";
?>
Thanks
#129
just remove the breaks from the switch then.
At work atm so cant answer your first question, the query string looks fine. Did you update the database?
Try using: die(mysql_error()); and viewing the page with get vars in a webbrowser.
09/09/2009 (10:48 am)
break outside of loop *warnings*just remove the breaks from the switch then.
At work atm so cant answer your first question, the query string looks fine. Did you update the database?
Try using: die(mysql_error()); and viewing the page with get vars in a webbrowser.
#130
I have gotten it to work kinda.
I setup the c++ code with my added info lik
First Name, Last Name, Email.
I can register and get an success button and I can also login with my username and password now.
I have also updated the database to match and also updated the scripts and gui files but.
If I look at my database the First Name is blank, the email is in the last name table and the email table is blank but yet everything seems to be in the same format order now.
Strange.
Great resource James.
Thank you very much.
Sooner or latter I will rap my brain around this and get myself a good client side account system going. :)
09/09/2009 (8:08 pm)
Im not sure why I can not rap my brain around this but.I have gotten it to work kinda.
I setup the c++ code with my added info lik
First Name, Last Name, Email.
I can register and get an success button and I can also login with my username and password now.
I have also updated the database to match and also updated the scripts and gui files but.
If I look at my database the First Name is blank, the email is in the last name table and the email table is blank but yet everything seems to be in the same format order now.
Strange.
Great resource James.
Thank you very much.
Sooner or latter I will rap my brain around this and get myself a good client side account system going. :)
#131
Thank you very much.
09/10/2009 (11:13 am)
Well, it took a bit but I finely got it all working.Thank you very much.
#132
09/10/2009 (5:47 pm)
Good too hear :) good luck with the project!
#133
login.php
There's nothing wrong with the MySQL query in this file, as it works just fine when I run it directly on my server (and in the PHP when logging into the website), but here things go weird.
When trying to log in, the following happens in my console.
I've tried multiple variations on the login.php, as it seems to vary quite a bit from the one I use for my website, but I can't see why this one shouldn't work...
10/13/2009 (10:13 am)
I'm having some issues trying to link my T3D game up with the usersystem of my website. It connects nicely to my MySQL server, but it has problems finding the users, it seems.login.php
<?
include("database.php");
$username= htmlspecialchars(addslashes($_POST[username]));
$password = sha1(md5(md5(sha1(md5(sha1(sha1(md5($_POST[password]))))))));
$q = mysql_query("SELECT * FROM `members` WHERE `username` = '$username'") or die(mysql_error());
$checkuser = mysql_num_rows($q);
if($checkuser == '0')
{
print "Empty SQL Query\n<!--end-->";
}
else
{
$result = mysql_fetch_array($q);
print( $result['ID'] . "~" . $result['Name'] . "\n<!--end-->" );
}
?>There's nothing wrong with the MySQL query in this file, as it works just fine when I run it directly on my server (and in the PHP when logging into the website), but here things go weird.
When trying to log in, the following happens in my console.
(myusername) username=(myusername) password=(mypassword) HTTP/1.0 200 OK Date: Tue, 13 Oct 2009 13:13:27 GMT Content-Type: text/html Server: Apache X-Powered-By: PHP/5.2.1 Content-Length: 26 X-Cache: MISS from charon.uninett.no X-Cache-Lookup: MISS from charon.uninett.no:3128 Via: 1.1 charon.uninett.no:3128 (squid/2.7.STABLE3) Connection: close Empty SQL Query <!--end--> HTTP/1.0 200 OK Date: Tue, 13 Oct 2009 13:13:27 GMT Content-Type: text/html Server: Apache X-Powered-By: PHP/5.2.1 Content-Length: 26 X-Cache: MISS from charon.uninett.no X-Cache-Lookup: MISS from charon.uninett.no:3128 Via: 1.1 charon.uninett.no:3128 (squid/2.7.STABLE3) Connection: close Empty SQL Query Empty SQL Query
I've tried multiple variations on the login.php, as it seems to vary quite a bit from the one I use for my website, but I can't see why this one shouldn't work...
#134
I'm wondering how long of a string I can send/fetch from the server. If I have a database with say, a thousand records, each having 100 characters, can I fetch the entire database with one call and one string (100,000 characters long)?
I guess I could test this, but it would be nice to know of known limitations.
11/23/2009 (12:41 pm)
This resource is working well for me, thanks a lot.I'm wondering how long of a string I can send/fetch from the server. If I have a database with say, a thousand records, each having 100 characters, can I fetch the entire database with one call and one string (100,000 characters long)?
I guess I could test this, but it would be nice to know of known limitations.
#135
Id say its a bad way because... TCP ensures the sent data matches the received data and if you get one missed packet in a string that long, the whole lot would have to be resent. Which sucks.
However! I may be completely wrong! Research time :P
11/23/2009 (2:05 pm)
I have limited knowledge of TCP, but Afaik it would work but just send it in many packets that would be pieced together at the other end.Id say its a bad way because... TCP ensures the sent data matches the received data and if you get one missed packet in a string that long, the whole lot would have to be resent. Which sucks.
However! I may be completely wrong! Research time :P
#136
I may have to limit the length of the string and do multiple queries, although I was trying to avoid doing so.
11/24/2009 (12:42 am)
Successfully sending a string seems to depend on two things, from my simple tests: the length and the speed of the internet connection. I have had known length string fail on one computer/network but go through successfully on another. On the slower connection, a shorter string is uploaded successfully.I may have to limit the length of the string and do multiple queries, although I was trying to avoid doing so.
#137
12/07/2009 (11:23 am)
I just wanted to say that this has to be one of the few resources that the author actually keeps support up with. You don't get that on a lot of the paid resources.
#138
I am in the point of my game where I need to start tweaking and adding more features so I have a question on this one again.
I copied and changed register.php and .cs .gui files and made register avatar for charter names. My problem is now that after you register your account I can not get it to take the user to the register avatar screen.
I have also tryed creating a
but can not seem to get that working.
Any way you can tell me what I am overlooking?
Thanks
Edit:: I forgot to say I was using version 3.3
02/06/2010 (10:04 am)
Hello again. Loving this resource btw :)I am in the point of my game where I need to start tweaking and adding more features so I have a question on this one again.
I copied and changed register.php and .cs .gui files and made register avatar for charter names. My problem is now that after you register your account I can not get it to take the user to the register avatar screen.
case "SUCCESS":
MessageBoxOK("Sucess!", "Thankyou for registering.");
canvas.popdialog(registerdlg);
canvas.popdialog(registeravatardlg);I have also tryed creating a
case "REGISTERAVATAR":
//MessageBoxOK("OK!", "Going to create avatar menu.");
canvas.popdialog(registeravatardlg);but can not seem to get that working.
Any way you can tell me what I am overlooking?
Thanks
Edit:: I forgot to say I was using version 3.3
#139
02/06/2010 (10:42 am)
Im guessing you want to push, not pop?canvas.pushdialog(registeravatardlg);
#140
Thank you very much.
This is the resource that got my game started after trying since 2002 :)
02/06/2010 (10:59 am)
OMG lol I cant believe I missed that.Thank you very much.
This is the resource that got my game started after trying since 2002 :)

Torque Owner Skylar Kelty
SkylarK
Can be fixed by using the strSplit i provided in the init.cs file (hacky place to put it though).
Edit: make sure its defined before the UAC file is loaded.
That should also get rid of the rest of your errors... try it.
The "scriptsAndAssets/client/scripts/uac.cs (67): Unknown command logout."
Is beacuse i used "%this.logout();" umm thats bad :(
Make logout a standalone function and call it without "%this". Give it a nice unique name though.