Game Development Community

dev|Pro Game Development Curriculum

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
#41
09/03/2007 (7:32 pm)
James!!! Thank you! I really love this resource! Whatever I have to alter for the RTS Kit to merge this, I'll be sure to let you know and contribute back to you. So far I haven't had to alter anything, though. :)
#42
09/03/2007 (8:26 pm)
I was told it wasn't necessary but I wanted to apologize to James for taking other frustrations out on him. I also wanted to pass on that I got it to work (v3.2). I think I mixed files because I have actually applied all of these resources and all versions just to see how they work. Ultimately I am wanting v3.3 for web authentication.
#43
09/03/2007 (11:52 pm)
I am glad to see you got it to work for you Andrew. Have fun with it!
#44
09/04/2007 (6:12 am)
Thanks John, I wish you luck, im sure you wont need it though as it probably only needs minor TS changes.
Glad to see you got it all working Andrew!
#45
09/07/2007 (8:15 am)
$web::HTTPHost = "www.mydomain.com"; // Your web address
$web::HTTPPath = ""; // Path to your scripts
$web::HTTPInfoPage = %page; // The page which retrieves data
$web::HTTPTextLines = "";


Can you explain what I am supposed to do here?(above) I have what I think it should be.

HTTPHost should contain your domain name.
HTTPPath should contain the path of the scripts. Now I left this blank because the path of the scripts are in the root folder. Is this correct? I kept it how it looks now. HTTPInfoPage this is really not needed to make this work right? I'm also not sure what to put in for HTTPTextLines. Could you maybe explain in an email or in the forum? Not being pushy or impatient but how is the progress coming on the new version?
#46
09/07/2007 (9:30 am)
$web::HTTPHost = "www.mydomain.com"; // Your web address
$web::HTTPPath = ""; // Path to your scripts

They are all you need to change to make it work.

The new version is coming on slowly beacuse im extreemly busy, but i will look at it over the weekend.
#47
09/07/2007 (10:44 am)
ok, thank you
#48
09/07/2007 (10:33 pm)
I keep getting this error when running torquedemo.exe

Compiling starter.fps/client/scripts/uac.cs...
starter.fps/client/scripts/uac.cs (72): string always evaluates to 0.
starter.fps/client/scripts/uac.cs (79): string always evaluates to 0.
starter.fps/client/scripts/uac.cs (81): break outside of loop... ignoring.
starter.fps/client/scripts/uac.cs (83): string always evaluates to 0.
starter.fps/client/scripts/uac.cs (85): break outside of loop... ignoring.
starter.fps/client/scripts/uac.cs (90): break outside of loop... ignoring.
starter.fps/client/scripts/uac.cs (110): string always evaluates to 0.
starter.fps/client/scripts/uac.cs (117): string always evaluates to 0.
starter.fps/client/scripts/uac.cs (119): break outside of loop... ignoring.
starter.fps/client/scripts/uac.cs (121): string always evaluates to 0.
starter.fps/client/scripts/uac.cs (123): break outside of loop... ignoring.
starter.fps/client/scripts/uac.cs (125): string always evaluates to 0.
starter.fps/client/scripts/uac.cs (127): break outside of loop... ignoring.
starter.fps/client/scripts/uac.cs (132): break outside of loop... ignoring.
Loading compiled script starter.fps/client/scripts/uac.cs.
Compiling starter.fps/client/scripts/score.cs...
starter.fps/client/scripts/score.cs (22): string always evaluates to 0.
starter.fps/client/scripts/score.cs (31): string always evaluates to 0.
starter.fps/client/scripts/score.cs (35): break outside of loop... ignoring.
starter.fps/client/scripts/score.cs (39): break outside of loop... ignoring.
starter.fps/client/scripts/score.cs (53): string always evaluates to 0.
starter.fps/client/scripts/score.cs (61): string always evaluates to 0.
starter.fps/client/scripts/score.cs (64): break outside of loop... ignoring.
starter.fps/client/scripts/score.cs (68): break outside of loop... ignoring.
Loading compiled script starter.fps/client/scripts/score.cs.
Compiling starter.fps/client/scripts/awards.cs...
starter.fps/client/scripts/awards.cs (22): string always evaluates to 0.
starter.fps/client/scripts/awards.cs (30): string always evaluates to 0.
starter.fps/client/scripts/awards.cs (33): break outside of loop... ignoring.
starter.fps/client/scripts/awards.cs (37): break outside of loop... ignoring.
starter.fps/client/scripts/awards.cs (52): string always evaluates to 0.
starter.fps/client/scripts/awards.cs (59): string always evaluates to 0.
starter.fps/client/scripts/awards.cs (61): break outside of loop... ignoring.
starter.fps/client/scripts/awards.cs (65): break outside of loop... ignoring.
Loading compiled script starter.fps/client/scripts/awards.cs.
#49
09/08/2007 (12:38 am)
What version is this?

Could you send me your files?
#50
09/08/2007 (6:37 am)
Version 3.3 and yes I will send you the file. The only one I have changed is the UAC.CS Unless you would like the php files as well. PHP files I know work because I am able to register and login using html front end. Thanks.
#51
09/08/2007 (9:52 am)
oops?

I know why, ill update files now
#52
09/08/2007 (10:00 am)
Ok fixed and updated - sorry bou tha
#53
09/08/2007 (1:52 pm)
I don't get the error anymore that the login failed yet it doesn't return the result. I am still getting these errors in the console log.

Compiling starter.fps/client/scripts/uac.cs...
starter.fps/client/scripts/uac.cs (81): break outside of loop... ignoring.
starter.fps/client/scripts/uac.cs (85): break outside of loop... ignoring.
starter.fps/client/scripts/uac.cs (90): break outside of loop... ignoring.
starter.fps/client/scripts/uac.cs (119): break outside of loop... ignoring.
starter.fps/client/scripts/uac.cs (123): break outside of loop... ignoring.
starter.fps/client/scripts/uac.cs (127): break outside of loop... ignoring.
starter.fps/client/scripts/uac.cs (132): break outside of loop... ignoring.
Loading compiled script starter.fps/client/scripts/uac.cs.
Compiling starter.fps/client/scripts/score.cs...
starter.fps/client/scripts/score.cs (35): break outside of loop... ignoring.
starter.fps/client/scripts/score.cs (39): break outside of loop... ignoring.
starter.fps/client/scripts/score.cs (64): break outside of loop... ignoring.
starter.fps/client/scripts/score.cs (68): break outside of loop... ignoring.
Loading compiled script starter.fps/client/scripts/score.cs.
Compiling starter.fps/client/scripts/awards.cs...
starter.fps/client/scripts/awards.cs (33): break outside of loop... ignoring.
starter.fps/client/scripts/awards.cs (37): break outside of loop... ignoring.
starter.fps/client/scripts/awards.cs (61): break outside of loop... ignoring.
starter.fps/client/scripts/awards.cs (65): break outside of loop... ignoring.
Loading compiled script starter.fps/client/scripts/awards.cs.
#54
10/15/2007 (8:33 pm)
Using TGE 1.5.2 and attempting to add UAC version 3.3a

James I sent you an email containing the php scripts I am using and the edited uac.cs file. Just as an fyi I forgot to delete the e-mail portion of the login script. It is not a option at the moment to enter in the email address. Right now with the script and the way I have evrything set up I am getting this error....

The web server did not send a response, Please try again later.

This is from the login code shown below...

loadHTTP($uac::loginPage @ %querystring);
%result = $uac::result;

if(%result $= "") // Error checking
{
MessageBoxOK("Error", "The web server did not send a response, please try again later");
}

Doesn't this mean that a connection was made to the database but it just didn't send the result? The connection is made earlier in the code right before the UAC register code.
#55
10/16/2007 (7:11 am)
Yer probably should explain this, I assumed people would look through the code.

The last line of every file that the game requests should be:

<!--end-->

Otherwise the game will not save the files data to the variables.

And the webserver MUST send a valid response to the game i.e. USERACCPETED

Hope that helps
#56
10/16/2007 (8:02 am)
I hate to do this to you and I appreciate your response so quickly. If I understand you correctly you want that end tag on each php file that is called on by the game? The webserver must send a valid response to the game........ is that the print function that you have in your php code? I never could get that to print the name of the user it just printed name. HAHAHAHA I feel retarded here. Did you take a look at my code? Did it seem ok?
#57
10/16/2007 (10:03 am)
If I understand you correctly you want that end tag on each php file that is called on by the game?
yup

The webserver must send a valid response to the game........ is that the print function that you have in your php code?
Yes, it can send "CLIENTACCEPTED" for example

Did you take a look at my code? Did it seem ok?
At a brief overview it did, as long as it works properly its fine eh?


Try the things ive said and let me know :D
#58
10/16/2007 (9:10 pm)
Ok, I put everything I know to do. I put CLIENTACCEPTED as the print function on success. This works fine on the php end when I login using the web. As far as

$uac::registerPage = "register.php";
$uac::loginPage = "checklogin.php";
$uac::scorePage = "stats.php";
$uac::awardsPage = "awards.php";
$uac::result = ""; <---------- What does this need to display? I have tried it different ways. I have left it blank. I have entered in CLIENTACCEPTED and I have tried my ip to connect to the dedicated server. My initial thought was this was used to execute the result if the login was successful. but now I am starting to think it is what is returned from the print function. Can you clarify this please?

Also, this piece of code is where I think the actual result is when the user has success logging in.

if(%continue == true){
UAC.Loggedin = "1";
UAC.Username = %username;
UAC.Password = %password;
UAC.Name = %name;
connect("My IP here seems to work just fine!");

The only issue when I put my dedicated server ip here is when I login I get the error message that it cannot connect to the web server please try again. Unfortunately it then goes straight into loading the dedicated server. this also happens with or without me entering a password.


What is this? Do I have to change any data that is print function specific?
function UAC::getcurrentuserdata(%this, %info)
{
switch$(%info){
case "username":
return UAC.Username;
case "password":
return UAC.Password;
case "name":
return UAC.Name;
default:
return UAC.Loggedin;
}
}

I'm sorry again for hitting you with this stuff. You have been really patient with me. I just really need this to work. Thanks.
#59
10/17/2007 (6:11 am)
The results are stored in the UAC class yes,
$uac::result stores the text retrieved from the page, you can just leave it.


What is this? Do I have to change any data that is print function specific?
No, you can leave that
#60
11/17/2007 (4:43 am)
Sorry about that, megaupload links removed..