Jump to content

Recommended Posts

Posted

Hi,

 

bug report.

 

Sample you generate a code : welcome123

them if player get it already, then someone "player"  type : WELCOME123 players can spam it.\

 

or

 

Welcome123 - uppercase W   it will spam code.

 

Did you put these queries?

DROP TABLE IF EXISTS `reward_codes`;
DROP TABLE IF EXISTS `reward_logs`;
CREATE TABLE IF NOT EXISTS `reward_codes` (
	`promo` VARCHAR(26) NOT NULL DEFAULT '',
	`nameid` INT(11) UNSIGNED NOT NULL DEFAULT '0',
	`item_name` VARCHAR(50) NOT NULL DEFAULT '',
	`amount` SMALLINT(6) UNSIGNED NOT NULL DEFAULT '0',
	`time_created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
	`limit` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	`pool` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	PRIMARY KEY (`promo`)
) ENGINE = MYISAM;
CREATE TABLE `reward_logs` (
  `code` VARCHAR( 26 ) NOT NULL DEFAULT '',
	`account_id` int(11) unsigned NOT NULL default '0',
	`last_ip` BINARY( 9 ) NOT NULL DEFAULT '',
  `name` VARCHAR( 26 ) NOT NULL DEFAULT '',
	`redeem_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
	`claim` INT( 10 ) NOT NULL default '0',
	PRIMARY KEY (`code`)
) ENGINE = MYISAM;

 

 

Yes. still player's can spam it. with upper case letter.

Posted (edited)

 

Hi,

 

bug report.

 

Sample you generate a code : welcome123

them if player get it already, then someone "player"  type : WELCOME123 players can spam it.\

 

or

 

Welcome123 - uppercase W   it will spam code.

 

Did you put these queries?

DROP TABLE IF EXISTS `reward_codes`;
DROP TABLE IF EXISTS `reward_logs`;
CREATE TABLE IF NOT EXISTS `reward_codes` (
	`promo` VARCHAR(26) NOT NULL DEFAULT '',
	`nameid` INT(11) UNSIGNED NOT NULL DEFAULT '0',
	`item_name` VARCHAR(50) NOT NULL DEFAULT '',
	`amount` SMALLINT(6) UNSIGNED NOT NULL DEFAULT '0',
	`time_created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
	`limit` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	`pool` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	PRIMARY KEY (`promo`)
) ENGINE = MYISAM;
CREATE TABLE `reward_logs` (
  `code` VARCHAR( 26 ) NOT NULL DEFAULT '',
	`account_id` int(11) unsigned NOT NULL default '0',
	`last_ip` BINARY( 9 ) NOT NULL DEFAULT '',
  `name` VARCHAR( 26 ) NOT NULL DEFAULT '',
	`redeem_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
	`claim` INT( 10 ) NOT NULL default '0',
	PRIMARY KEY (`code`)
) ENGINE = MYISAM;

 

 

Yes. still player's can spam it. with upper case letter.

I upload a quick fix.

Thanks for the report,

shatowolf and uDe

@ude found no close button bug for you, I replaced end with close, in my current svn end is working fine.

from this:

announce "No exisiting codes.",bc_self;
end;

to this:

announce "No exisiting codes.",bc_self;
close;

@shatowolf i add small caps letters, let see if this fix will work, please do reply if you see more of them.

For random code generation,

from this:

setarray .@s$,"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9","0";

to this:

setarray .@s$[0],"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9","0";	

Or if both of you guys referring to promo code pool count? (Maximum claim limit)

Change this:

setarray $@ClaimLimit[0],1,2,3,4,5,6,7,8,9,10;

To:

setarray $@ClaimLimit[0],1; or set $@ClaimLimit,1;

And in-game if you are manually creating a code.

Set the max claim limit to 1(means the pool count of the code will be 1, after 1 player get a code, it turns to 0 and then the code cannot be claimed again.) See pic Below:

WtRKtlv.png

 
Currently i`m working on a big update for this script but i don't yet have spare time to do the project.

 

I added random code generation length detection, from 5-15 supported chars in this fix.

I used hard coded random code generator,  not the one a using now, because some might caught an errors. 

setarray $@length,5,15; // <MIN>,<MAX> LENGTH CHECK    
// 5 Recommended Minimum due to not recognizing 1234 from garbage deletion.
// 15 maximum characters supported in random code generation.
Edited by Lil Troll
Posted

Thanks guys for stating errors,  got to look over it. I think ima re-write the whole sql part. Give me a bit over here. :)

 

 

Sure mate. :)

Updated to 1.2.2 actually guys, I do not know what causing you the bug, but it was working fine on me, I think the bug is because of SQL Administrative issues or using older SVN's.

 

YMSXufC.png

Posted

Hi Lil Troll,

 

Create a code like this sir, welcome123

 

and claim it using this Welcome123 uppercase "W"

 

it will trigger the spam. you can get unlimited item using the code Welcome123 uppercase "W"

 

Thanks,

 

Or can be abuse with WELCOME123. Try it.

Posted (edited)

Hi Lil Troll,

 

Create a code like this sir, welcome123

 

and claim it using this Welcome123 uppercase "W"

 

it will trigger the spam. you can get unlimited item using the code Welcome123 uppercase "W"

 

Thanks,

 

Or can be abuse with WELCOME123. Try it.

Using input string is case sensitive. Sorry guys it took long, because I cant get what you both want to say to me. I`m not really good in English. 

 

Now this is the fix:

input .@pcode$;
set .@pc$,strtoupper(.@pcode$);

All inputted codes will be set to uppercase.

 

Also all random codes is generated in upper case.

 

Updated to new version.

 

Please tell me guys if you found new bugs/errors, so that my next release will be much stable. (Includes mailing of codes and referral system.)

Edited by Lil Troll
  • 1 month later...
  • 1 month later...
Posted
help please

I have problems

I have these errors, any solution?

 

: DB error - Unknown column 'codes' in 'field list'
[Debug]: at script.c:14834 - SELECT `codes`,`redeem_time` FROM `reward_logs` ORDER BY pool ASC LIMIT 25

[Debug]: Source (NPC): LilTrollPCodes (invisible/not on a map)

[Debug]: script debug : 0 110015856 : reward_logs garbage has been deleted.

 

Posted (edited)

http://dba.stackexchange.com/questions/15250/how-to-do-a-case-sensitive-search-in-where-clause

by default, the table creation use charset = latin1;

means it couldn't do a case-sensitive search

if you want to do a case-sensitive in a query, use BINARY

select * from `char` where name = binary('AnnieRuru');
however using BINARY might have performance hit if it is a big table

so its more recommend to convert your sql table to collate with latin1_general_cs

let's say this is a sample table

create table testtest (
id int(11) primary key auto_increment,
name varchar(23)
)engine = innodb;
do an alter table syntax

alter table testtest modify column name varchar(23) collate latin1_general_cs;
or just put it into the table creation

create table testtest (
id int(11) primary key auto_increment,
name varchar(23)
)engine = innodb default charset = latin1 collate latin1_general_cs;

@leondedios

	set .@garbage,query_sql("SELECT `codes`,`redeem_time` FROM `reward_logs` ORDER BY pool ASC LIMIT 25",.@code$);
	for(set .@i,1; .@i <= .@garbage; set .@i,.@i++) {
	query_sql "DELETE FROM `reward_logs` WHERE `codes` = '" + escape_sql(.@code$[0]) + "'";  // Number 1 row will be deleted.
	query_sql "DELETE FROM `reward_logs` WHERE `codes` = '" + escape_sql(.@code$[.@i]) + ""; // Numbers from 2-25 rows will be deleted.
	}
change into

	set .@garbage,query_sql("SELECT `code`,`redeem_time` FROM `reward_logs` ORDER BY pool ASC LIMIT 25",.@code$);
	for(set .@i,1; .@i <= .@garbage; set .@i,.@i++) {
	query_sql "DELETE FROM `reward_logs` WHERE `code` = '" + escape_sql(.@code$[0]) + "'";  // Number 1 row will be deleted.
	query_sql "DELETE FROM `reward_logs` WHERE `code` = '" + escape_sql(.@code$[.@i]) + ""; // Numbers from 2-25 rows will be deleted.
	}
Edited by AnnieRuru
  • 3 years later...
Posted

: DB error - Data too long for column 'last_ip' at row 1
[Debug]: at c:\#\src\map\script.c:16173 - INSERT INTO `reward_logs` (`account_id`,`last_ip`,`code`,`redeem_time`,`claim`) VALUES ('2000001','#','ROOSTER',NOW(),'1')
[Debug]: Source (NPC): LilTrollPCodes (invisible/not on a map)

Gives this error every time i claim an code.
Seems its not getting the last ip data.
Any idea how to solve this.

  • 8 months later...
Posted

Hi sir! I'm using your script and it's awesome! But i want to make a npc for it. But if i input the atcommand "@claim" in the script, it says @claim is unknown command. How do i fix this? Thanks

  • 5 months later...
Posted

although it works. it still has some bugs.

 

1. when you type "test111" and type "test111 " "test111  " with spaces it doesn't recognize the code as already received.

  • 6 months later...
  • 1 month later...
Posted

i think that it is still not updated. I tried and i experienced case sensitive issues with same account can still claim the prize. If i switch to one account and i go for another account with the same IP, it can still claim.

  • 1 year later...
Posted
On 12/10/2018 at 6:34 PM, Dev G Inc said:

i think that it is still not updated. I tried and i experienced case sensitive issues with same account can still claim the prize. If i switch to one account and i go for another account with the same IP, it can still claim.

Experiencing this too. Any update for this wonderful script?

Posted
21 hours ago, xJhay said:

Experiencing this too. Any update for this wonderful script?

Probably there is actually. Just need to refine it really

Posted

If you don't mind, could you help us to improve this script? Like I mean this is really a good script and very useful but somehow, players can abuse it.

  • 4 months later...
Posted
    if(query_sql("SELECT `claim` FROM `reward_logs` WHERE `code` = '" + escape_sql(.@pc$) + "'",.@claim)) { 
        set .@claim,0;
        query_sql("UPDATE `reward_logs` SET `claim` = '"+1+"' WHERE `code` = '" + escape_sql(.@pc$) + "'"); 
    }   
    else {
        query_sql("INSERT INTO `reward_logs` (`account_id`,`last_ip`,`code`,`redeem_time`,`claim`) VALUES ('"+getcharid(3)+"','"+getcharip(strcharinfo(0))+"','"+escape_sql(.@pc$)+"',NOW(),'"+1+"')"); 
    }

 

the problem lies in this line. The reason why everyone can spam it is because it doesn't put any data after the first one so the only that wouldn't be able to spam it is the 1st ip to claim it, if anyone can fix it it would be really great.

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.

  • Recently Browsing   0 members

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