Jump to content

what command do I use to create a mySQL login?


Recommended Posts

Posted

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?

Posted

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

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

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

Posted
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

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

Posted

lol u and luke_ferra are same persons i think O_o

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

Posted

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!

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...