Jump to content
  • 0

Name Changer NPC


WhatFT

Question


  • Group:  Members
  • Topic Count:  142
  • Topics Per Day:  0.03
  • Content Count:  511
  • Reputation:   7
  • Joined:  02/15/12
  • Last Seen:  

How it works :

 

  • Requires 1 Item like Name Changer Ticket & 50,000,000z
  • If player has ticket, it will change the name permanently
  • After changing the name, the previous name & new name will be saved sql log

 

I can't find a script like this so can you help me? thank you in advance!

Link to comment
Share on other sites

13 answers to this question

Recommended Posts

  • 0

  • Group:  Developer
  • Topic Count:  36
  • Topics Per Day:  0.01
  • Content Count:  587
  • Reputation:   431
  • Joined:  01/26/16
  • Last Seen:  

Answers that are vulnerable to SQL injection have been hidden.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  311
  • Reputation:   46
  • Joined:  11/06/11
  • Last Seen:  

1 hour ago, Secrets said:

Answers that are vulnerable to SQL injection have been hidden.

What do you mean by this?

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

16 hours ago, vBrenth said:

What do you mean by this?

They forgot to use escape_sql() command when allowing the user to type things in when querying the sql server... So someone could end the statement early by adding ; then type their own stuff. :) Like ; DROP TABLE `accounts`; Or something much worse hahaha

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   4
  • Joined:  07/29/17
  • Last Seen:  

On 9/13/2017 at 10:59 AM, Skorm said:

They forgot to use escape_sql() command when allowing the user to type things in when querying the sql server... So someone could end the statement early by adding ; then type their own stuff. :) Like ; DROP TABLE `accounts`; Or something much worse hahaha

i don't get it....

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  477
  • Reputation:   269
  • Joined:  06/13/17
  • Last Seen:  

It's possible for users to DROP or edit something on your database using a script like you want(though it depends on the script).. =)

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   4
  • Joined:  07/29/17
  • Last Seen:  

1 hour ago, Haruka Mayumi said:

It's possible for users to DROP or edit something on your database using a script like you want(though it depends on the script).. =)

Do i need to use the escape_sql() inside the query_sql " ";

Cause sometimes i use like this:

query_sql "select `id` from `table` where `id` = " + .@name;

Do i need to use escape_sql() on the .@name or just leave it like that because it is outside of the ""(double qoute)?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  626
  • Reputation:   188
  • Joined:  11/19/11
  • Last Seen:  

Escape_sql() is only required for text inputs, like WHERE `char_name` = '"+escape_sql(.@name$)+"'";

In the ( ) comes the text/variable/array.

Regards,

Chris

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   4
  • Joined:  07/29/17
  • Last Seen:  

1 hour ago, llchrisll said:

Escape_sql() is only required for text inputs, like WHERE `char_name` = '"+escape_sql(.@name$)+"'";

In the ( ) comes the text/variable/array.

Regards,

Chris

Thanks for the answer.

back to my question.. how about outside of double qoute("") on query sql just like my sample is it necessary?

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

7 hours ago, Nerks said:

Thanks for the answer.

back to my question.. how about outside of double qoute("") on query sql just like my sample is it necessary?

'"+@NewName$+"'

It's not double quotes like you have. It's quotes ( " ) then single quotes ( ' ). The single quotes are for SQL to be like OK this is a string. Normal Quotes are there to break the string server side.

So what it's doing

"String '(Start SQL String) (Break NPC Compiler String)"+(.@npc_string_variable$)+"(Enter NPC String) (End SQL String)' (End NPC String)"

 

Edited by Skorm
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   4
  • Joined:  07/29/17
  • Last Seen:  

4 hours ago, Skorm said:

'"[email protected]$+"'

It's not double quotes like you have. It's quotes ( " ) then single quotes ( ' ). The single quotes are for SQL to be like OK this is a string. Normal Quotes are there to break the string server side.

So what it's doing


"String '(Start SQL String) (Break NPC Compiler String)"+(.@npc_string_variable$)+"(Enter NPC String) (End SQL String)' (End NPC String)"

 

Sorry for the confusion on my question.

im about to ask is the difference of this two(2).

EXAMPLE 1:

query_sql "select `field` from `table` where `field` = " + .@id, holder;

Question on EXAMPLE 1, do i need to put escape_sql() on the .@id even its outside of double qoute (")

 

CORRECT USAGE:

EXAMPLE 2:

query_sql "select `field` from `table` where `field` = '" + escape_sql(.@id) + "'";

This EXAMPLE 2 is commonly use each one of us..

 

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

3 hours ago, Nerks said:

Sorry for the confusion on my question.

im about to ask is the difference of this two(2).

You only need escape_sql when dealing with string variables.

.@id is a integer variable so nobody can put an escape character like "; or something to cause harm to your database.

if the variable was .@id$ and a user put text for that .@id$ variable like '; DROP TABLE `accounts`;

MySQL would read

select `field` from `table` where `field` = ''; DROP TABLE `accounts`;

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   4
  • Joined:  07/29/17
  • Last Seen:  

1 hour ago, Skorm said:

You only need escape_sql when dealing with string variables.

[email protected] is a integer variable so nobody can put an escape character like "; or something to cause harm to your database.

if the variable was [email protected]$ and a user put text for that [email protected]$ variable like '; DROP TABLE `accounts`;

MySQL would read


select `field` from `table` where `field` = ''; DROP TABLE `accounts`;

 

Now i get it. even on my EXAMPLE 1 i need to put escape_sql.

It's more safer to you use escape_sql on every variable.

little code MAXIMUM Effects /no1

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  626
  • Reputation:   188
  • Joined:  11/19/11
  • Last Seen:  

Not really, since escape_sql converts "John's" into "John\'s", like described in the script_commands.txt, so it's only necessary for string input.

Edited by llchrisll
Link to comment
Share on other sites

Join the conversation

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

Guest
Answer this question...

×   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.

×
×
  • Create New...