papsmurfer Posted June 28, 2010 Share Posted June 28, 2010 I created a registration system where it inserts the accounts user name and password from my gui register screen however how can I apply that so they can log back into their accounts on the mySQL db? Link to comment
dzek (varez) Posted June 29, 2010 Share Posted June 29, 2010 1: are you sure you are not confusing MySQL with SQLite? 2: i dont understand your question.. you dont know how to create table, select data from database, or what? post your code, and tell us what more do you need Link to comment
Luke_Ferrara Posted June 30, 2010 Share Posted June 30, 2010 yes I am not sure about the SELECT part like heres my registration function addPlayer(thePlayer, username, email, password) playerIP = getPlayerIP( thePlayer ) playerSerial = getPlayerSerial( thePlayer ) if ( username ) then addNewUser = mysql_query(connect_mysql, "INSERT INTO `players` (login, class, serial, email, password) VALUES ('"..username.."', '2', '"..playerSerial.."','"..email.."', '"..password.."')") if( addNewUser) then outputChatBox( "#FF0000*USER: #FFFF00Succesfully added: #FF0000"..username.." #FFFF00to the usersystem.", player, 0, 0, 0, true ) --- restartResource(getResourceFromName("usersystem")) triggerClientEvent ( "hideLoginWindow", getRootElement()) triggerClientEvent ( "ShowChar", getRootElement()) setPlayerName(thePlayer, username) else outputDebugString("mysql_query failed" ) end mysql_free_result( addNewUser ) else outputChatBox ("#FF0000*USER: #FFFF00User: #FF0000"..username.." #FFFF00 could not be found.", player, 0,0,0, true) end end addEvent ("addPlayer", true) addEventHandler("addPlayer", getRootElement(), addPlayer) now how can I use the SELECT command and apply this data for users to login Link to comment
papsmurfer Posted June 30, 2010 Author Share Posted June 30, 2010 yes I am not sure about the SELECT part like heres my registrationfunction addPlayer(thePlayer, username, email, password) playerIP = getPlayerIP( thePlayer ) playerSerial = getPlayerSerial( thePlayer ) if ( username ) then addNewUser = mysql_query(connect_mysql, "INSERT INTO `players` (login, class, serial, email, password) VALUES ('"..username.."', '2', '"..playerSerial.."','"..email.."', '"..password.."')") if( addNewUser) then outputChatBox( "#FF0000*USER: #FFFF00Succesfully added: #FF0000"..username.." #FFFF00to the usersystem.", player, 0, 0, 0, true ) --- restartResource(getResourceFromName("usersystem")) triggerClientEvent ( "hideLoginWindow", getRootElement()) triggerClientEvent ( "ShowChar", getRootElement()) setPlayerName(thePlayer, username) else outputDebugString("mysql_query failed" ) end mysql_free_result( addNewUser ) else outputChatBox ("#FF0000*USER: #FFFF00User: #FF0000"..username.." #FFFF00 could not be found.", player, 0,0,0, true) end end addEvent ("addPlayer", true) addEventHandler("addPlayer", getRootElement(), addPlayer) now how can I use the SELECT command and apply this data for users to login yeah I have something similar...is SELECT the command I use? like something along the lines of SELECT 'players' (login, and password) if they match it means login? I have no clue Link to comment
Castillo Posted June 30, 2010 Share Posted June 30, 2010 lol u and luke_ferra are same persons i think O_o Link to comment
papsmurfer Posted June 30, 2010 Author Share Posted June 30, 2010 lol u and luke_ferra are same persons i think O_o actually Luke is my brother we are both working on the same scripts O_o so do you want to help orrrrrrrrrrrrrrrrrrrrrrrrrrr Link to comment
dzek (varez) Posted June 30, 2010 Share Posted June 30, 2010 omg, next guy who dont know the idea, but trying to use random code, right? you are not escaping your queries, its very easy to remove your whole database by random player read: https://wiki.multitheftauto.com/wiki/Modules/MTA- ... ape_string and yes, you are right, SELECT * FROM players WHERE login='' and password='' should do the job. but escape your variables! 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