Game Development Community

Login php/mysql script

by CIMO · in Torque Game Engine · 01/27/2008 (6:21 am) · 5 replies

Hi..I use this resource www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=13468
And i would modify "tgeLoginDlg.gui" and i need help
I try this simply (very very very simply =P) code and function...
$pref::Player::Name = "";
$pref::Player::Password = "";

function GuiLoginDlg::onWake(%this)
{
   loginId.setCursorPos(0);
}

function requestAuth()
{
	echo("User = " @ $pref::Player::Name);
	echo("Password = " @ $pref::Player::Password);

	if($pref::Player::Password $= "entra")
	{
		showMainMenuBttnControls(true);
		Canvas.popDialog(GuiLoginDlg);
	}
	else
		Canvas.pushDialog(GuiLoginDlg);
}
Now i would use a my MySql DB and my .php login on my site

- This is my DB
[code]
CREATE TABLE utenti (
userid int(25) NOT NULL auto_increment,
nome varchar(255) NOT NULL default '',
cognome varchar(255) NOT NULL default '',
email varchar(255) NOT NULL default '',
username varchar(255) NOT NULL default '',
password varchar(255) NOT NULL default '',
password_decriptata varchar(255) NOT NULL default '',
livello_utenti enum('0','1','2','3') NOT NULL default '0',
data_registrazione datetime NOT NULL default '0000-00-00 00:00:00',
ultimo_login datetime NOT NULL default '0000-00-00 00:00:00',
attivazione enum('0','1') NOT NULL default '0',
PRIMARY KEY (userid)
) TYPE=MyISAM COMMENT='Informazioni Utenti';
[code]
And i would use a "userid" and "password_decriptata" in "tgeLoginDlg.gui"

How i do for read my db in "tgeLoginDlg.gui"?
Please help me with modify my code =) tnx

#1
01/28/2008 (12:59 am)
I would not even think about that idea or touch it with a 10 feet pole.

MySQL must only be accessed by a secure script ie something on your server, never by a client.

We have a meta server php for this purpose which sues the HTTP protocol and game/net/tcpobject to communicate to the TCP object and request data or login players ... login as well as download characters etc works without any problem and without any security problems by allowing remote database access which you try there.
#2
01/29/2008 (7:48 am)
Sorrybut not understood...
I use this resource
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=13468 and start withmygamebut when click on login the game not start and see only my backgroundimage...why i have this error??
i would learn a code to use on "tgeLoginDlg.gui"
i try to use this for simply test
$pref::Player::Name = "";$pref::Player::Password = "";function GuiLoginDlg::onWake(%this){   loginId.setCursorPos(0);}function requestAuth(){	echo("User = " @ $pref::Player::Name);	echo("Password = " @ $pref::Player::Password);	if($pref::Player::Password $= "entra")	{		showMainMenuBttnControls(true);		Canvas.popDialog(GuiLoginDlg);	}	else		Canvas.pushDialog(GuiLoginDlg);}
and function now iwouldacode for use a my sql db an my login.php on my server
help me please =(
#3
09/19/2009 (5:16 am)
"MySQL must only be accessed by a secure script ie something on your server, never by a client"

@marc, what are you talking about. That makes no sense to me.
#4
09/19/2009 (6:24 am)
You can not access a MySQL-DB-Server from outside because of security reasons. The best way is to execute some php-scripts from the server. After that the php-parser will communicate with the MySQL-DB.
#5
09/19/2009 (7:16 am)
Best way is to leave the game client communicating with the server side scripts of the game. The server side scripts then communicate with the php, which then reads/writes to the mysql database.