Jump to content
UBot Underground

[HELP PLS] How to query a database to see if a record exists?


Recommended Posts

Hi! I want to store my users and their license codes in a database and then make the bot check the database to see if that user exists and save the result in a variable (or a table). I have made the bot that will let me input data in the database but I have problems making the client bot read the database to see if that record exists. If I use MySQL Workbench to send that query it works as it should so the sintax is correct , the problem is when I run it in ubot, I get an error: "Fatal error encountered during command execution" and of course the command does not return any value. here is the script:

ui text box("id", #hdid)
clear table(&keyword)
plugin command("DatabaseCommands.dll", "connect to database", "server=*******;uid=*******; pwd=******; database=******; port=3306; pooling=false") {
plugin command("DatabaseCommands.dll", "query with results", "SELECT * FROM user_data WHERE user_HDID=@{#hdid}", &keyword)
if($comparison($table total rows(&keyword), ">", 0)) {
 then {
	 alert("License valid")
 }
 else {
	 alert("License invalid")
 }
}
}

 

 

(database credentials are "******" here for obvious reasons :)) )

 

 

 

Can anyone tell me what is wrong with this code or show me how to do that in another way?

Thank You

Link to post
Share on other sites

ok, I solved it :D ... the variable in the query should be inserted in a different way:

ui text box("id", #hdid)
clear table(&keyword)
plugin command("DatabaseCommands.dll", "connect to database", "server=******;uid=*******; pwd=*******; database=*******; port=3306; pooling=false") {
   plugin command("DatabaseCommands.dll", "query with results", "SELECT * FROM user_data WHERE user_HDID=\"{#hdid}\"", &keyword)
   if($comparison($table total rows(&keyword), ">", 0)) {
    then {
	    alert("License valid")
    }
    else {
	    alert("License invalid")
    }
   }
}

Link to post
Share on other sites

tipp!

as more fields u request as more secure is the licencething if ya script only check for id it is mutch easyer to crack it

do something like....

select pla from plupp where id = #id AND email =#email AND some_other_data = #some_other_date

...is a bit more secure

  • Like 1
Link to post
Share on other sites
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...