Gmsql 1.0
#41
Posted 17 April 2004 - 06:46 PM
#42
Guest_Mafiaboy69_*
Posted 18 April 2004 - 09:18 AM
ooohh your not registerd
last year december i got registerd and i'm still enjoying GM Full version 5.3 so get registerd you wont feel sorry
#43
Posted 18 April 2004 - 10:05 AM
i just kept leaving notes every where asking them to register gamemaker.if your parents ask you what you want to eat just say Game Maker registerd, if they ask you are you all right just say if i get Game Maker registerd they i will etc... just keep on talking about it. i worked for me and i got it for kristmas
lets see now, ah yes i used:
post it notes
microsoft agent at the start up of windows
e-mails
texts
phone calls
#44
Posted 18 April 2004 - 10:46 AM
I've created an MySQL server and here are the stats:
www.freesql.org
username : gunhappy
password : online
I have an firewall built in to my router so i cant shut it off to test it. do you have any problems like that or can anyone test it for me?
EDIT : thanx PromaneX
Edited by stupidegames, 18 April 2004 - 12:02 PM.
#45
Posted 18 April 2004 - 11:56 AM
#46
Posted 18 April 2004 - 11:58 AM
edit get mysql from the official site (large file for some reson) http://dev.mysql.com...om/pick#mirrors
i still recomend phpdev4
Edited by PromaneX, 18 April 2004 - 01:05 PM.
#47
Posted 18 April 2004 - 12:20 PM
sweet program smarty, only one thing: my PC hangs when I try to connect
I've created an MySQL server and here are the stats:
www.freesql.org
username : gunhappy
password : online
I have an firewall built in to my router so i cant shut it off to test it. do you have any problems like that or can anyone test it for me?
I have been able to log on.
The problem is the initial connection (gmsql_connect). For some reason I can't figure out, this takes several seconds to complete, about 10-15 here. Your system may seem to hang, but it's actually busy building the connection. After that, queries run comparatively fast.
I don't know what causes the initial slow connection. I think it has to do something with server-side settings, but as I am no MySQL crack I don't know how to fine-tune these. AFAIK in the DLL code there is nothing I can do about it, I'm just using the required functions for it.
If anyone knows why this may happen, I'd be interested to know (and will put it in the documentation). I have the idea that the MySQL server is busy finding the right communication platform (MySQL server may run on a completely different platform) with the currently connected machine. On a local PC it takes no significant time at all.
Smarty
#48
Posted 21 April 2004 - 03:17 AM
#49
Posted 21 April 2004 - 04:23 AM
#50
Guest_Paulbreeuwsma_*
Posted 04 May 2004 - 10:59 AM
I can't use the function mplay_ipaddress() to read the ip, because if you have a LAN network that function returns the LAN ip(in my case 192.168.1.2) and not the WAN ip.
#51
Posted 04 May 2004 - 12:06 PM
Smarty
#52
Posted 04 May 2004 - 12:42 PM
#53
Posted 04 May 2004 - 02:06 PM
Ok, can smart or anybody else, please make an example or explan with code how to just send some info to the database and retrieve it?
I think the manual I wrote explains that pretty well... Either that, or you may want to read the MySQL manual first.
Smarty
#54
Guest_Paulbreeuwsma_*
Posted 04 May 2004 - 02:37 PM
I can't find a variable!I'm not sure, maybe the MySQL server has a variable that contains the IP address of the connected client within the session. Haven't found anything on that yet, though.
Smarty
#55
Guest_Trixer_*
Posted 15 May 2004 - 03:42 PM
global.logon=false;
username=wgmGetText(global.username);
password=wgmGetText(global.password);
if !gmsql_connect('www.blacknova.servegame.com','username','password','trixer_darkfusion'){
show_message('Failed to connect to database server.');
exit;
}
gmsql_selectdb("trixer_darkfusion");
if gmsql_query('select * from players where user="username" and pass="password"') {
show_message("Logged in");
show_message(username);
global.logon=true;
}
else {
show_message("failed to login check username or password");
}
if !gmsql_storeresult()
{
show_message("failed to get player data");
}This script should scan the database for a place where the username and password match and then save it. if not it should give them a message saying there stuff wasnt right.. though for some reason it works all the time (even when tested for users that dont exist or what ever else) and when Im not to sure the gmsql_stroreresults is running because all I pull is blank strings out of it...
#56
Guest_Trixer_*
Posted 15 May 2004 - 04:27 PM
I'm not sure, maybe the MySQL server has a variable that contains the IP address of the connected client within the session. Haven't found anything on that yet, though.
Smarty
I can't find a variable!
There is a mplay function that gets the users IP save it as a varable then insert it......
Edited by Trixer, 15 May 2004 - 04:30 PM.
#57
Posted 16 May 2004 - 01:53 PM
This script should scan the database for a place where the username and password match and then save it. if not it should give them a message saying there stuff wasnt right.. though for some reason it works all the time (even when tested for users that dont exist or what ever else) and when Im not to sure the gmsql_stroreresults is running because all I pull is blank strings out of it...
Since you do not get a warning at the database logon, I assume that the username and password used are correct. However, this part is incorrect for two reasons:
if gmsql_query('select * from players where user="username" and pass="password"') {
show_message("Logged in");
show_message(username);
global.logon=true;
}1)
As Erik said in your topic in Advaced, it will look for "username" and "password" in the table "players", but it does not actually fill in the values of those variables into the query.
It's easier to think what would be your original query. Let's say that username contains "Trixer", and password contains "beer". The query that the MySQL server needs to receive is this:
select * from players where user="Trixer" and pass="beer"
As you can see you need quotes around Trixer and beer, because they are text strings. But a string in GML also contains quotes. This means you have to place quotes INSIDE the quoted strings in GML. For the GML language you use single quotes, and for the query you use double quotes. Then you carefully add the whole piece together:
gmsql_query('select * from players where user="'+username+'" and pass="'+password+'"');This of course works only if the table contains fields called "user" and "pass". You should notice that the last characters are a single quote, a double quote, and a single quote again after one another. Difficult to read, isn't it?
2)
Using if gmsql_query... et cetera, checks whether the query succeeded. The query however can succeed without having any results. You assume it only succeeds when it finds the record, but it succeeds usually only because the query syntax is OK - and it indeed was OK when you entered it, although it didn't contain a username and password that were in your table.
So to see whether the player exists in the database, you need to check how many records where found that contain this username and password. You need to load the record first, otherwise you will never know what is returned.
Your correct syntax would be this:
if !gmsql_query('select * from players where user="'+username+'" and pass="'+password+'"')
{
show_message('Query failed');
exit;
}
if !gmsql_storeresult()
{
show_message('failed to get result data');
exit;
}
if gmsql_numrows()<>1
{
show_message('Failed to log on due to incorrect username and/or password.');
exit;
}
global.logon=true;I have a likewise example in my manual that just tries to load the record immediately and then checks the password for itself instead of querying it from the database. This way you can also check whether either the password is wrong, or the username.
There is a mplay function that gets the users IP save it as a varable then insert it......
The function mplay_ipaddress() returns the local IP, but in some cases where you have both a LAN IP and an Internet IP, it usually only returns the LAN IP, which is of no use. The MySQL server should always know the correct IP, but I haven't found a method yet to get that information from the server.
Anyway, since dynamic IPs are still around, I don't see much use to store IP addresses other than for logging purposes.
Smarty
#58
Posted 06 June 2004 - 10:48 PM
{
if (!gmsql_init()) {
show_message(gmsql_errormessage());
exit;
}
if(!gmsql_connect("localhost","root","","rpg")) {
show_message(gmsql_errormessage());
exit;
}
if(!gmsql_query("SELECT * FROM settings WHERE name='up'")) {
show_message(gmsql_errormessage());
exit;
}
if(!gmsql_useresult()) {
show_message(gmsql_errormessage());
exit;
}
up = gmsql_getvalue(2);
}And here is my enter key release event:
{
var user, pass;
if(up == "true") {
user = get_string("What do you wish your username to be?","");
pass = get_string("What do you wish your password to be?","");
if(user == "" || pass == "") {
show_message("Please enter a valid username and password.");
exit;
}
if(!gmsql_query("SELECT * FROM users WHERE username='"+user+"')) {
scr_displayerror("Getting user error");
exit;
}
if(!gmsql_storeresult()) {
scr_displayerror("Storing result error");
exit;
}
if(gmsql_numrows() > 0) {
show_message("That username is already taken. Please choose a different username.");
exit;
}
gmsql_query("INSERT INTO users VALUES('','"+user+"',password("+pass+"))");
show_message("You should now be registered.");
}
}I keep getting: "Getting user error: 'Commands out of sync; You can't run this command now' Error code: 2014"
I have looked it up and it says it could come from using mysql_store_result or mysql_get_result and not using mysql_free_result to free the space up. I don't believe there is a gmsql_freeresult function.
Edited by Avalanche, 06 June 2004 - 10:51 PM.
#59
Posted 06 June 2004 - 11:30 PM
I have looked it up and it says it could come from using mysql_store_result or mysql_get_result and not using mysql_free_result to free the space up. I don't believe there is a gmsql_freeresult function.
That is correct. I am taking care of that in my DLL, since I only allow for one result table to be stored anyway and to make it easier for the users.
I am not sure how this error can occur though. Could you find out at which command the error occurs exactly?
To find this out properly, try displaying the error message after just about any GMSQL command.
Smarty
#60
Posted 07 June 2004 - 12:26 AM
{
gmsql_dataseek(0);
gmsql_fetchrow(0);
}
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users



This topic is locked





