ASP, CGI and PHP Scripts and Record-Locking: What Every Webmaster Needs To Know

Written by Sunil Tanna


Many of us install server-side (ASP, CGI or PHP) scripts on our web sites, and many of this scripts store data onrepparttar server. However, poorly designed scripts can experience performance problems and sometimes even data corruption on busy (and not so busy) web sites.

If you're not a programmer, why should this matter to you?

Answer: Even if you're just installing and using server-side scripts, you'll want to make sure thatrepparttar 143660 scripts that you choose don't randomly break or corrupt your data.

First, some examples ofrepparttar 143661 types of scripts which store data on web servers include:

(Of course, many scripts in each of these (and other) categories are well-designed, and run perfectly well even on very busy web sites).

1. Follow-up autoresponders typically storerepparttar 143662 list of subscribers torepparttar 143663 autoresponder, as well where inrepparttar 143664 sequence of messages, each subscriber is. Examples of autoresponder scripts: http://www.scriptcavern.com/scr_email_auto.php

2. Classified ad scripts store (at least) a list of allrepparttar 143665 classified ads placed by visitors. Examples of this type of script: http://www.scriptcavern.com/scr_classified.php

3. Free for all links scripts store a list of all links posted by visitors. See some example scripts listed at: http://www.scriptcavern.com/scr_ffa.php

4. Top site scripts usually store a list ofrepparttar 143666 members ofrepparttar 143667 top site as well as information aboutrepparttar 143668 number of "votes" that each has received. For examples of this type of script, see http://www.scriptcavern.com/scr_topsite.php

So what kind of scripts have problems? And what sort of problems am I talking about?

Wellrepparttar 143669 principle problems all relate to what happens when bits of data from multiple users needs to be stored on updated atrepparttar 143670 same time. Some scripts handle these situations well, but others don't...

DATA CORRUPTION

Here's a common data corruption problem that can occur with many scripts:

1. When some bit of data needs to be updated, a copy ofrepparttar 143671 server-side script starts running, and then starts updating it.

2. If another user comes along and does an update beforerepparttar 143672 first copy ofrepparttar 143673 script has finished, a second copy ofrepparttar 143674 script starts running atrepparttar 143675 same time.

3. There are a number of ways things can now go wrong, for example:

(a) What ifrepparttar 143676 first copy ofrepparttar 143677 script reads inrepparttar 143678 data, thenrepparttar 143679 second copy readsrepparttar 143680 same data, thenrepparttar 143681 first copy updatesrepparttar 143682 data, thenrepparttar 143683 second copy updatesrepparttar 143684 data? Answer: any changes made byrepparttar 143685 first copy ofrepparttar 143686 script can get lost.

(b) What ifrepparttar 143687 first and second copy of scripts are both adding multiple bits of new data torepparttar 143688 store atrepparttar 143689 same time? For example, imagine each needs to storerepparttar 143690 headline, description andrepparttar 143691 name ofrepparttar 143692 person posting a classified ad. Well, what can happen (with some scripts) isrepparttar 143693 two classified ads can get intermingled, so you might get (for example) HEADLINE-1, DESCRIPTION-1, HEADLINE-2, PERSON-1, DESCRIPTION-2, PERSON-2. Or worse yet, you might get bits of each part of each classified ad, mixed withrepparttar 143694 bits ofrepparttar 143695 other. This type of thing is usually really bad news, as your data may consequently becoming unusable from that point on.

Does this sound too unlikely a problem to worry about? Don't bank on it... even if it happens only 1 time in 1,000, or 1 in 10,000, eventually it will happen: You need a solution.

Sorepparttar 143696 real question is: is it possible for programmers to create scripts without these kinds of problems? Fortunatelyrepparttar 143697 answer is yes, and there are a number of ways that programmers can address it:

1. They can store each bit of data in a separate file. This isn't necessarily a total solution by itself (in particular, a script which just does this could still have problems if multiple copies of a script updaterepparttar 143698 same file atrepparttar 143699 same time), but it does make data corruption less likely, and if corruption does occur, at least it won't corruptrepparttar 143700 entire data store in one go.

2. They can use file-locking. This means that if one copy of a script is working with a file, another copy ofrepparttar 143701 script is prevented from working on that file, untilrepparttar 143702 first copy has finished. File-locking works if done correctly, but programming it into a script needs to be done very carefully and precisely, for every single possible case... even a tiny bug or omission can allowrepparttar 143703 possibility of data-corruption in throughrepparttar 143704 backdoor!

3. They can use a database (such as MySQL) to storerepparttar 143705 data. Providedrepparttar 143706 data is properly structured inrepparttar 143707 database,repparttar 143708 database handlesrepparttar 143709 locking automatically. And, asrepparttar 143710 programmer doesn't have to write their own special locking routines,repparttar 143711 possibility of bugs and omissions are much reduced.

5 CGI Scripts You Must Use to Turn Your Site Into a Powerhouse

Written by Marc Goldman


HTML is great. But what really makes your site super powerful? The Backend orrepparttar processes running inrepparttar 107137 background that make everything on your website really click. And what powers repparttar 107138 backend? CGI Scripts. Some of you may know what CGI scripts are and others may not. CGI scripts arerepparttar 107139 key to creating interactive websites that automate your online business. Instead of getting too technical about scripts, lets talk about 5 powerful CGI scripts that every website should have if they have any desire to conduct E-commerce. Number 1: First off, you must have forms on your website. You should be utilizing forms for everything including retrieving demographic information from your visitors to processing credit card orders. You can also use forms to send contact information so that your visitors do not have to use email to contact you. The beauty of forms is that not only can you retrieverepparttar 107140 information you request, you can also include hidden fields to be submitted with each form so that you know certain information like what websiterepparttar 107141 visitor came from, their IP address (useful for fraud protection) and much more. Some form scripts even let you send autoresponses torepparttar 107142 submitter. So, for example if someone fills in a form to sign up for a newsletter, you can send them an automated reply thanking them for their submission and including basically anything you want without having to lift a finger. Number 2: The next script every site should be using is a "recommend it" script. This is a script that allows your site visitors to recommend your site to their friends and contacts. Do not underestimaterepparttar 107143 power of this little tool. The recommend it script on our site at http://www.goldbar.net/recomm.html brings in tons of traffic and prospects that we may never have gotten on our own. The power of referrals should never, ever be underestimated. It is far more effective to have someone recommend your site to their contacts then it is to advertise. I userepparttar 107144 Master Recommend script from William Bontrager, available for free at: http://www.willmaster.com Number 3: Affiliate Software. Without a doubt, one ofrepparttar 107145 best investments you can ever make if you have your own product or service is in affiliate software. While usually not cheap it is by far one ofrepparttar 107146 best methods of growing traffic to your site and exploding your sales. Many people advocate using a 3rd party affiliate company such as Commission Junction to manage their affilate programs. This is fine if you are a big company with a huge budget to WASTE on administrative fees and obscure technical charges. But, if you are a small to midsized company and you want to utilizerepparttar 107147 awesome power of a strictly commissioned salesforce sending you traffic and sales, you would be crazy to not consider purchasing affiliate software and installing it on your own site (or having it installed for you). Some affiliate scripts are so advanced that you can click one button onrepparttar 107148 administrative interface and send allrepparttar 107149 months commissions to a check writing program and haverepparttar 107150 checks printed out and all you will have to do is sign them. Number 4: Follow Up Autoresponders: Without a doubt, everyone

Cont'd on page 2 ==>
 
ImproveHomeLife.com © 2005
Terms of Use