egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

gzcompress

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Tue Mar 06, 2012 5:14 pm    Post subject: gzcompress Reply with quote

Is there a way of gzcompress stuff before inserting it to database...?
_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Back to top
View user's profile Send private message MSN Messenger
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Wed Mar 07, 2012 1:24 am    Post subject: Reply with quote

A quote from a user on this topic that is related to gzcompress.

This is a bad idea because:
- theoretically, there might be a sequence of data that, when compressed, leads to a SQL injection or simply breaks the query
- gzcompressed data can't be properly indexed and searched - you'll have a database full of garbled characters
- gzcompression is computationally expensive

Simply always sanitize your data before entering it into a database, using the string escaping method of your library (like mysql(i)_real_escape_string()) or parametrized queries. If you do that reliably, no further protection is necessary.

You will end up getting an error like:
Quote:

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'cUÓyM›û]YûßTS§mÖø_öè|®SÝT?½¥®Ê!y{ëVùÊP†’Â1�'‰;(§�èh$1Cà�b

_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Wed Mar 07, 2012 9:12 am    Post subject: Reply with quote

Okay, thanks for the reply Smile
_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Back to top
View user's profile Send private message MSN Messenger
Ofloo
Owner


Joined: 13 May 2003
Posts: 953
Location: Belguim

PostPosted: Sat Apr 14, 2012 3:14 am    Post subject: Reply with quote

look for a way to do it with images cause images like jpeg is basically just compressed data, .. read about "blob" type unless you're inserting text then you might better find something like drive compression never really looked into it but i know it used to be on ntfs, years ago when i still used windows, .. that there was this feature to compress all your data onto fly when you stored it on disk. I never saw much use for it and never really looked for something like that cause most of my files where jpeg or media files and then it's useless to compress them once more, .. it's only a waste of cpu time. I'm pretty sure you can set up some sort of zip drive, or whatever you want to call it in any os.
_________________
XplaiN but think of me as stupid
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber