Jump to content
xisto Community
KansukeKojima

Flat Files! Good Or Bad? Whats Your Opinion!

Flat files!  

15 members have voted

You do not have permission to vote in this poll, or see the poll results. Please sign in or register to vote in this poll.

Recommended Posts

I am not sure, but databases are good because you can export them to different cpanels. Then flat files are not so popular, and so you have to invent by yourself lots of things, You need to be a good coder.

Share this post


Link to post
Share on other sites

Hi!My concern with flat files is write-concurrency. They offer good performance while reading though and if your file is your actual end markup, the web server can serve the file without any processing! WP-SuperCache does something similar for WordPress blogs.Regards,Nitin Reddy"Flat flies good. Flat files bad." (kidding!)

Edited by k_nitin_r (see edit history)

Share this post


Link to post
Share on other sites

I use a mixture of both flat files (in the form of static includes, for page formatting) and database (for, of all things, my error page, which uses detailed database info for reporting specifically on every error), depending on the criteria required. In my opinion, it's like comparing a pair of pliers to a wrench. You can use pliers (flat files) as a wrench (database), but it's clunky, and not the best tool for the job, most times. conversely, you can also use a wrench to do the same job that pliers do, at times, but it can be unwieldy to do. My main criteria is how static the data is, and if it's page structure (presentation) or data of some sort (content). It also depends on how hard it would be to code which way, and how lazy I'm feeling at the time. :lol:

Share this post


Link to post
Share on other sites

Hi!I like the way Dave Morton puts it - you need to use what's best for the scenario at hand. If you've got heavy traffic on your website, using a database call several dozen times on a single page isn't really a good idea.For data that rarely changes, if you can put together the data you need and write it to an HTML file on disk, you can use the static HTMLpages for the header and footer (with frames) - that would save you quite a bit of processing. Or you could just call a PHP script via AJAX on a static HTML page for the dynamic content while the less-frequently changing content is already written to the page.For images, instead of storing the actual binary data in the database, you can store the file on disk and keep just the file name in the database. It saves you a lot of processing too.Regards,Nitin Reddy

Share this post


Link to post
Share on other sites

This kind of files are really good way to store lots of data,but if they are not important.Because if you store passwords in files,hackers will find out the file and only a half step is separating them from hacking your website or stealing someones password.The half step is decrypting which is possible if you only use md5 to encrypt passwords.You should always use more complicated way to encrypt passwords if you use flat files.Flat files for example are very good for logs.I have a little script which is storing everyone's IP and time he visited my website,and all that data is stored in one file which i can see.If you use flat files for passwords i cannot give you the principe i use this principe to encrypt passwords:

function enc($string){$second=sha1($string);$third=str_replace("a","z",$second);return md5($third);}
So this code first encrypts string in sha1,then it replaces a with z,to make hash not decryptable,then it is encrypting the sha1 hash with md5 method.So this will always return the same result,and that is why this function will work...If you do not believe me,try to add this code in php page and refresh and you will always see the same vode.So you need to use this to check is the password correct:

if(enc(the password user specified)==enc(the password which should be){

the code should be executed

}

 

Remember that you need to replace bold things with real variables or code.Flat files are better if you need to do some operation fast,without any complicate code and without errors.Remember,FLAT FILES SHOULD NOT BE USED FOR THINGS LIKE PASSWORDS IF THEY ARE NOT SECURED

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.