Guest Posted October 18, 2008 Share Posted October 18, 2008 Hi...i tried to make an Login/Registration script, but i need help, in this script i want to save your name and password ! I dont know yet what i can make this script...! Please help me with an example. Thanks ! Sorry for my bad english... Link to comment
Gamesnert Posted October 18, 2008 Share Posted October 18, 2008 Ehm... Aren't the included /login and /register commands good enough? Or you want a GUI or something? Can you please give us some more info on what you exactly want? Link to comment
Lordy Posted October 18, 2008 Share Posted October 18, 2008 in this script i want to save your name and password ! I'm using a cookie system for this.. It's done via xml saved to client side, maybe I should put it to community resources... Link to comment
Gamesnert Posted October 18, 2008 Share Posted October 18, 2008 It's just how you want it. You can use XML, SQL and MySQL. You can do it any way you prefer. In case of an account system it's usually recommended to use SQL or, if you have an external website, MySQL. XML is the easiest way, but "not the best optimised"... ("" because I don't know, but the difference isn't THAT big. Atleast, XML is fast enough with the right usage) You can do some VERY basic XML by learning how XML works. More about that here: http://development.mtasa.com/index.php?title=Xmlnode Might you really want to make it good, and I even think SQL is simpler at SOME points, then check here: http://development.mtasa.com/index.php? ... reateTable -- You might also need basic SQL tutorials to use this though. You can choose to do things any way you want, as long as it works. (and is safe) Link to comment
Lordy Posted October 19, 2008 Share Posted October 19, 2008 @Gamesnert If it's server side SQLite then how do you identify a player.. by ip? The best way to store it to client is actually creating a file I think. I'll upload the resource to community site now.. Now uploaded. https://community.multitheftauto.com/index.php?p= ... ils&id=210 boolean setCookie (string cookiename, string cookievalue, string resource) string getCookie(string cookiename, string resource) The functions have to be called from clientside. Link to comment
Gamesnert Posted October 19, 2008 Share Posted October 19, 2008 @LordAzamth Simple. You don't login for nothing! ^^ Because if you click on the login button, it'll look if the username exists and the password is correct. If it is, you're identified as the owner of that account. Now, you can use cookies, but it can become a mess sometimes... The beauty of SQL is that it's stored in tables! So like... Username: Password: Money: Someone hello 15 Someoneelse someotherpass 15000000 And it's just a lot better to see everything! The only problem... Well... You need an SQL browser to look in the database... EDIT: Argh... Stupid spacebardeletion... These tabs will hopefully do it... Link to comment
Guest Posted October 19, 2008 Share Posted October 19, 2008 Thx for help !! (ALL) , i will try to make ... Link to comment
Twig Posted October 19, 2008 Share Posted October 19, 2008 And it's just a lot better to see everything! The only problem... Well... You need an SQL browser to look in the database... http://sqlitebrowser.sourceforge.net/ http://sourceforge.net/projects/sqlitecc Link to comment
Guest Posted October 19, 2008 Share Posted October 19, 2008 Ehm... Aren't the included /login and /register commands good enough? Or you want a GUI or something? Can you please give us some more info on what you exactly want? I want /login and /register , too. This is a list with what i want : 1.Login GUI - Username : ........ - Password : ........ 2. /login ; /register 3. ...and the script , i want to save the dates... Link to comment
Gamesnert Posted October 19, 2008 Share Posted October 19, 2008 Ehm... Aren't the included /login and /register commands good enough? Or you want a GUI or something? Can you please give us some more info on what you exactly want? I want /login and /register , too. This is a list with what i want : 1.Login GUI - Username : ........ - Password : ........ 2. /login ; /register 3. ...and the script , i want to save the dates... Yes but what I meant is that /login and /register are ALREADY IN MTA... So anyway, you want an example for XML, SQL or MySQL? And note that they will be examples, not we-give-you-the-script-you-need... Link to comment
Lordy Posted October 19, 2008 Share Posted October 19, 2008 @LordAzamthSimple. You don't login for nothing! ^^ Because if you click on the login button, it'll look if the username exists and the password is correct. If it is, you're identified as the owner of that account. I think we are missing eachother talk a bit The cookies sys just stores the pw and username locally in client's computer, so he doesn't have to type it all the time.. He still has to push the login button.. So it likle autofills the edit boxes.. It's not some auto login or something, just making logging in easier.. EDIT: I just found out there was a typo on line 30 of my uploaded resource.. now fixed Link to comment
Guest Posted October 19, 2008 Share Posted October 19, 2008 Ehm... Aren't the included /login and /register commands good enough? Or you want a GUI or something? Can you please give us some more info on what you exactly want? I want /login and /register , too. This is a list with what i want : 1.Login GUI - Username : ........ - Password : ........ 2. /login ; /register 3. ...and the script , i want to save the dates... Yes but what I meant is that /login and /register are ALREADY IN MTA... So anyway, you want an example for XML, SQL or MySQL? And note that they will be examples, not we-give-you-the-script-you-need... yeah...an example for XML, SQL , MySQL... Link to comment
Gamesnert Posted October 19, 2008 Share Posted October 19, 2008 That was to answer this question: @Gamesnert If it's server side SQLite then how do you identify a player.. by ip? So still that cookie system HELPS logging in, but isn't an login/register script or an example... So anyway, do you want an XML OR SQL OR MySQL OR that we just pick our favorite? Making 3 examples is a bit stupid you know... =/ Link to comment
lil Toady Posted October 20, 2008 Share Posted October 20, 2008 It's just how you want it. You can use XML, SQL and MySQL. You can do it any way you prefer. In case of an account system it's usually recommended to use SQL or, if you have an external website, MySQL. In MTA's case it's recommended to use the in-built accounts system. Everything relies on it in MTA. Link to comment
Gamesnert Posted October 20, 2008 Share Posted October 20, 2008 It's just how you want it. You can use XML, SQL and MySQL. You can do it any way you prefer. In case of an account system it's usually recommended to use SQL or, if you have an external website, MySQL. In MTA's case it's recommended to use the in-built accounts system. Everything relies on it in MTA. Then you'd need setAccountData to save anything, right? But didn't that delete accounts.xml? I know this should be fixed in DP3 in whatever function this was the problem, but I just wanted to give some advice for DP2 for now. Link to comment
lil Toady Posted October 20, 2008 Share Posted October 20, 2008 It's just how you want it. You can use XML, SQL and MySQL. You can do it any way you prefer. In case of an account system it's usually recommended to use SQL or, if you have an external website, MySQL. In MTA's case it's recommended to use the in-built accounts system. Everything relies on it in MTA. Then you'd need setAccountData to save anything, right? But didn't that delete accounts.xml? I know this should be fixed in DP3 in whatever function this was the problem, but I just wanted to give some advice for DP2 for now. You can save your stuff anywhere you want, still using mta accounts. And it does not delete accounts.xml if you check for guest account before setting account data. Link to comment
Gamesnert Posted October 20, 2008 Share Posted October 20, 2008 Ah ok that clears things up a bit! Thanks for the info. So that means that it brings the amouns of methods to 4. And it seems that method #4 doesn't delete things with the correct usage, so why don't we use that one eh? ^^ You might find THIS page useful, it's the accounts functions page, it contains some examples too. Just always keep in mind to use isGuestAccount to make sure you don't call setAccountData it if that's true... It would be disastrous... ^^ Link to comment
50p Posted October 20, 2008 Share Posted October 20, 2008 In MTA's case it's recommended to use the in-built accounts system. Everything relies on it in MTA. Then you'd need setAccountData to save anything, right? But didn't that delete accounts.xml? I know this should be fixed in DP3 in whatever function this was the problem, but I just wanted to give some advice for DP2 for now. You can save your stuff anywhere you want, still using mta accounts. And it does not delete accounts.xml if you check for guest account before setting account data. Hmm, I wonder why I always had problems with wiping out accounts from accounts.xml. It doesn't metter if I check if the account is guest or not, it just wipes them out. My bank resource was first written with these functions but people were complaining about this problem, why? I did check for guest account, why did they say this deletes their accounts? "Use properly", hmm... if you like, download one of the first versions of bank resource and try to tell me what was wrong in the code. I still check if the account is guest-account with SQL solution because only logged in users should be able to save their money. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now