|
|
Tips for Web Programmers
- CGI / Perl Programming
- #!/usr/bin/perl
#!/usr/bin/perl should be the first line of your perl cgi scripts indicating
what program to use to interpret the code. For mailing scripts, try /usr/lib/sendmail
or /usr/sbin/sendmail. Also, if you are outputting back to the screen, your first line should be:
print "Content-type: text/html\n\n";
This is the third biggest mistake that gets made.
- Upload in ASCII Mode
Always upload Cgi / Perl files in Ascii Mode. Unless it's an .exe .jpg .png .bmp or .gif file, upload in ascii or text mode.
This includes .cgi .pl .txt .log .htaccess .htpasswd .htgroup .php .php3 .htm .html .js and the like.
- Set the right permissions.
Files that get run like .cgi need to be set to 755 or rwxr-xr-x and files that get written to must be 666 or rw-rw-rw.
These can be set using most ftp programs like CuteFTP and WsFTP by right clicking the file and selecting 'chmod'.
This is the second biggest mistake that gets made.
- JavaScript Programming
- Try not put all scripts on the <HEAD> tag
If write a huge JavaScript program, dont write all your script on the <HEAD> tag.
If you do that, your page may take a longer time to display by visitor's browser. You
should only place "global" JavaScript function on the <HEAD> tag.
Place your "local" JavaScript function near on location where you use it.
- Use <NOSCRIPT> and </NOSCRIPT> tag
To give information for your visitors that doesn't use a JavaScript capable browser, write
some notification inside <NOSCRIPT> and </NOSCRIPT> tags. That notes will only displayed by a non JavaScript capable bowser.
|