So I want my website to add GM status for anyone who joins my server. The only problem I have is trying to find out how set them in the DB as GM (3). Would love the help thanks!
-3.3.5a Trinity Core V2
-Navicat
So I want my website to add GM status for anyone who joins my server. The only problem I have is trying to find out how set them in the DB as GM (3). Would love the help thanks!
-3.3.5a Trinity Core V2
-Navicat
Join PVP GM Server!
knif3r2.blogdns.org
php to sql. just like how the script would input the user into the database on account creation, have it alter the field for permissions. want indepth spoonfeed? sorry i dont dabble anymore thus dont have the databases for the exact spots to have it alter.
Think before you post. You can only get smarter by playing a smarter opponent.
Link the PHP file that handles the creation (insert.php or something similar usually). You just need to modify the query, as Remus said.
Put them into a rar file
Heres the link:
Filebeam - Beam up that File Scottie!
PW: 123
Join PVP GM Server!
knif3r2.blogdns.org
In index.php:
So you need to change that query so that it inserts the GM level as well (I don't know the SQL table structure) but if say, 'level' was after the expansion column:Code:mysqli_query($mysql_connect, "INSERT INTO account (username, sha_pass_hash, email, last_ip, expansion) VALUES ('".$post_accountname."', '".$post_password_final."', '".$post_email."', '".$_SERVER["REMOTE_ADDR"]."', '".$post_expansion."')") or die(mysqli_error($mysql_connect));
Code:mysqli_query($mysql_connect, "INSERT INTO account (username, sha_pass_hash, email, last_ip, expansion, level) VALUES ('".$post_accountname."', '".$post_password_final."', '".$post_email."', '".$_SERVER["REMOTE_ADDR"]."', '".$post_expansion."', '3')") or die(mysqli_error($mysql_connect));
Heres the setup:
Goes auth > account_access > gmlevel
Then
Wanting to set that "gmlevel" field to 3
It would be easy but its in a different table so I don't really know web and sql entry enough to edit it that far.
Im guessing its close but what values would it be entering into the DB (if im even close lol)
Code:mysqli_query($mysql_connect, "INSERT INTO account_access (id, gmlevel, RealmID) VALUES ('".$post_id."', '".$post_3"', '"RealmID_-1"')") or die(mysqli_error($mysql_connect));
Last edited by knif3r2; 10-20-2011 at 06:49 AM.
Join PVP GM Server!
knif3r2.blogdns.org
Aye you can basically do that, just a second query.
The .$post_id. stuff represents a variable, so if those variables exist then it should work. Else just give it plain values, like .$post_3 can just be '3'.
Test it, post any errors you get.
Error using phpDesigner 7
Syntax Error: CONSTANT_ENCAPSED_STRINGCode:if(!is_array($errors)){ mysqli_query($mysql_connect, "INSERT INTO account (username, sha_pass_hash, email, last_ip, expansion) VALUES ('".$post_accountname."', '".$post_password_final."', '".$post_email."', '".$_SERVER["REMOTE_ADDR"]."', '".$post_expansion."')") or die(mysqli_error($mysql_connect)); mysqli_query($mysql_connect, "INSERT INTO account_access (id, gmlevel, RealmID) VALUES ('".$post_id"', '"3"', '"-1"')") or die(mysqli_error($mysql_connect)); $errors[] = 'You have successfully created the account: <font color="yellow">'.$post_accountname.'</font>.'; }
Join PVP GM Server!
knif3r2.blogdns.org
You don't need the "" between the 3 and -1, the " marks the end of a string, then the .variable. comes in, then they start the string again with ". As your inserting the values directly, you only need the ' and not the ".
Edited:
So more like this since, both 3 & -1 are values.
The one thing I dont understand is where the id value is coming from and I think is giving me the error. There's no user input for the ID, its just created numerically in the DB. So that shouldn't be a string should it?Code:if(!is_array($errors)){ mysqli_query($mysql_connect, "INSERT INTO account (username, sha_pass_hash, email, last_ip, expansion) VALUES ('".$post_accountname."', '".$post_password_final."', '".$post_email."', '".$_SERVER["REMOTE_ADDR"]."', '".$post_expansion."')") or die(mysqli_error($mysql_connect)); mysqli_query($mysql_connect, "INSERT INTO account_access (id, gmlevel, RealmID) VALUES ('".$post_id"', '3', '-1')") or die(mysqli_error($mysql_connect)); $errors[] = 'You have successfully created the account: <font color="yellow">'.$post_accountname.'</font>.'; }
Plus still the same error as before. Maybe placement?
I really want to work this out so I can apply it to my server, I appreciate the feed btw +rep
Last edited by knif3r2; 10-20-2011 at 11:26 AM.
Join PVP GM Server!
knif3r2.blogdns.org
It must be because .$post_id is not defined?
You will need to write a query to:
post_id = SELECT id FROM accounts WHERE username = 'usernamejustcreated'; ('".$post_accountname."');
INSERT.... postid...
As pseudo code. However, I'm really a novice at PHP, and while editing SQL statements is simple I do not have the knowledge on how to do what I just said. You can probably find out by asking google and reading a tutorial, or wait for somebody with more expertise in php to help.
Couldn't you just set the default value in the accounts -> gm table to 3? Then he could skip the whole php process.
I don't know how the Trinity accounts system is handled, but by looking it appears to me that you have the main accounts table, then if you want to give them permissions you insert into this second table the account ID, account level and realm ID and it will give them the permissions. If it's automatically inserted for normal players, then yes it would be a simple edit like that (unless the emulator inserts 0 directly, then you would need to edit the SQL query in there).
Nevermind, I fixed my issue editng the "Worldserver" config. There's a line in there that lets you to let players use level "0" commands
After that just set the commands in the "commands table" in the db to 0 so everyone could use themCode:# AllowPlayerCommands # Description: Allow players to use commands. # Default: 1 - (Enabled) # 0 - (Disabled) AllowPlayerCommands = 1 //Changed to 1
Join PVP GM Server!
knif3r2.blogdns.org