[Include] cini - simple and fast ini system
#21

Quote:
Originally Posted by Y_Less
View Post
Small bug:

Code:
	cini_FSave("hello.ini", "si",
		"break", "hi\nwoop=11",
		"woop", 42);
Some people could exploit that to get better at something - I don't know what, but it's like the old privilege escalation bug in GF.

I also managed to repeatedly crash the system while testing, but in trying to narrow down why it happened, it stopped happening...
thanks, that was actually something I thought about when creating it, but I figured for example if you saved a password as something like.
pass\nAdminLevel=123

it wouldn't really work unless you save to a file and then load from that file straight away, the cini_Save clears the file when writing and cini_Load will get the last found match I could see it happening if someone had another string to save near the bottom of the file and that's why I included cini_EscapeString.

I'd like to hear more about the crash if you do manage to narrow it down.
Reply
#22

dini, zini, yini, rini and now cini.......
Reply
#23

Quote:
Originally Posted by cessil
View Post
thanks, that was actually something I thought about when creating it, but I figured for example if you saved a password as something like.
pass\nAdminLevel=123

it wouldn't really work unless you save to a file and then load from that file straight away, the cini_Save clears the file when writing and cini_Load will get the last found match I could see it happening if someone had another string to save near the bottom of the file and that's why I included cini_EscapeString.

I'd like to hear more about the crash if you do manage to narrow it down.
If cini_Load gets the last found match you could still use that for strings found after numbers, just change the order. As for the crash, I don't know how I managed it - it seemed to crash on fread, which is an odd place to crash, but I don't know why and now I can't replicate it, so I wouldn't worry about it.
Reply
#24

Cool :d I like it
Reply
#25

Good job!
Reply
#26

updated with version 2.0
Reply
#27

I laughed when I didn't see any benchmark test with this system and y_ini...
Reply
#28

feel free to run and paste your own results
Reply
#29

Nice release, it's nice to see an INI system which conforms to the format common in SA-MP. Dini doesn't compare, Y_Ini conforms to the real INI standard of formatting, and the rest aren't really that good.
Reply
#30

Nice one
Reply
#31

Quote:
Originally Posted by Uberanwar
View Post
Nice one
Reply
#32

Can someone explain me this?

Quote:

public OnPlayerConnect(playerid)
{
if(!cini_CheckAccount(playerid))
{
cini_Register(playerid,"default_pass");
cini_Save(playerid,"ssssdf",
"Props1","Slice",
"Props2","Grim_",
"Props3","Blacklite",
"Props4","Rachael",
"digit1",18,
"float1",1.24
);
cini_Add(playerid,"d","digit2",20);
}

if(!cini_CheckLogin(playerid,"wrong_pass")) print("wrong password");
if(cini_CheckLogin(playerid,"default_pass"))
{
print("correct password!");
new name[cini_string], Float:fl, digit2;
cini_Load(playerid,"sfd",
"Props3",name,
"float1",fl,
"digit2",digit2
);
printf("name = %s, fl = %.02f, digit2 = %d",name,fl,digit2);
cini_Update(playerid,"sf",
"Props3","Potassium",
"float1",floatmul(fl,2.0)
);
cini_Load(playerid,"sf","Props3",name,"float1",fl) ;
printf("name = %s, float = %.02f",name,fl);
}
print(cini_EscapeString("Password=pass\n\rAdminLev el=1337"));
return 1;
}

The one that I bold
Reply
#33

You should't really use this, there are much better systems like y_ini. (No SQL)

The bolded part is obv saving.
ssssdf - string string string string integer float
Slice Grim_ Blacklite Rachael 18 1.24

Props1, Props2... - ini keys.
Reply
#34

Quote:
Originally Posted by QuaTTrO
View Post
Lmfao
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)