Saivaneri Web Tutor
So, now we know some basics about improving the show on the web site. But, to be frank, what we learned in the Chapter 4 is just Tip of the Iceberg. Graphics is ocean, and new things arrive every day on the net. So just we will catch up faster in this HYPER LINKED world, we will learn what is hot today, and how FAST we can do it.
That is how a Java script starts and ends. Source file is put in the root folder, as a *.js file, which can be created/edited in a Notepad/Wordpad. You can write the source at the *.html page itself, but incase if it is lengthy, then you need to use a separate file.
ü It is important to upload the *.js file as ASCII method not BINARY method. In binary mode, the carriage returns are not interpreted properly, so you will not get desired results.
ü It is always good practice to put the scripts within <head> …….</head> or outside the <html> …. </html> tags.. especially in IE it tend to misbehave if it is inside body.
ü Any Java Applet/servlet needs Java Virtual Machine to run. In IE 4 and above, it is included with the browser. In IE 6 you have to download it as a separate software.
ü Some Java codes and Active X documents can even destroy a host system, so it is a security hazard to enable Java and Active X on all sites. IE custom security level can be used to change this settings.
ü While Java is a OOPS Language and thus has lot of abilities, Java script is a limited scope web page script. Think this difference as a difference between Visual Basic and VB script.
ü VB script can not run on certain browsers/machines. So use it if you want your web pages to be shown in windows clients only.
ü Refer HTML basic Book (Chapter 1) and Thinking in Java on CD1 for in depth understanding of Java/Java script
ü Refer Java script samples in CD1 for FAST java learning.
There are so much of Java scripts available for FREE download on the Internet. Sample page with a Java script is coming with this email. Try them on your site. If you face trouble, mail me.
Create a Java script based Password checking page. The page should load if password is correct. Not loads if password wrong.
Common Gateway Interface is a method of getting Form results from the visiting public on your web. Okay, you need to have interaction with the visitoes. Isn’t it?. So how websites interact with people?
ü Login/Password screen
ü Guest Book
ü Form Mailer
ü Form Results Submission
ü Ad rotator
ü Advertising popups
ü Cookie handler and more..
So the first thing any web master needs is to create a guest book, so that visitors can sign in their comments at the site. It is a very common script.
There are three things that go hand in glove in any Form.
1. The user Form
2. The intermediary processing
3. The resulting Form
The user form and the resulting form is what the user gets to see. The intermediate processing is not shown to the user. It is executed on the web server. That’s why FREE web companies doesn’t allow you to put CGI scripts on their server, because it has a potential to break down the server. A PAID web server also will monitor each users’ CGI-BIN directory so that they don’t run dangerous codes.
CGI scripts can be wriiten in any language like C,C++,Java etc. But most prefer PERL, because of its simplicity and customization for CGI.
What you will write in User Form?
<FORM METHOD="POST" ACTION="/cgi-sys/FormMail.cgi">
<input type=hidden name="subject" value="Auto Register">
<!-- HTML Template used for the page after successful submission -->
<input type=hidden name="redirect" value="http://saivaneri.org/Regn_thank-you.html">
<!-- HTML Template used in case an error occurs -->
<input type=hidden name="missing_fields_redirect" value="http://saivaneri.org/error.html">
<input type=hidden name="required" value="gender,full_name,qualfn,star,dob,job,height,father,email,address,via,caste,mark">
<input type=hidden name="env_report" value="REMOTE_HOST,HTTP_USER_AGENT,HTTP_REFERER">
<input type=hidden name="sort" value="order:gender,full_name,qualfn,star,dob,job,height,father,email,address,via,caste,mark">
<input type=hidden name="print_config" value="email">
The <FORM> tag starts a form.
The fields in a form can be of
1 Text Field
2 Radio Button
3 Option Box (Tick mark)
4 Drop Down Box
5 List Box
6 Submit Button
7 Password Field etc…
So when user fills all these info, then presses SUBMIT, the script mentioned in here <FORM METHOD="POST" ACTION="/cgi-sys/FormMail.cgi"> takes the “action”. You can name it as
FormMail or FormMail.cgi or FormMail.pl
You should set this files’ attributes as Read, Execute for others or simply 755.
You need to know UNIX basics to understand this.
*.cgi = CGI file *.pl = PERL file. Refer to your web server admin for file naming tactics.
You can edit a CGI/PERL file in a Word Pad/Note Pad and FTP it to your server as ASCII not BINARY.
This sample FormMail.cgi script now runs on the server to “PARSE” (distil) the data filled in by the user.
scripts are extra arguments given to the parser so that a mailer
<input type=hidden name="subject" value="Auto Register">
These hidden fields are used in the FormMailer.cgi script so that the Form reaches the man intended by email.
Other hidden fields like required fields, redirect, missing field redirect , sort, are self explanatory, just go thru it to understand. If you can’t get it, please mail me, I will explain.
A sample script and a sample form is attached with this mail. Please go through them and mail me if you face any difficulty. Also use the CGI/PERL tutor found in Chapter 1.
Create a Guest Book or Form Mailer at your Freeservers web site.
Logon to you account, go to Enhance My Site, Click Guest Book or Form Mailer to create one. No need to write any CGI scripts. The site has some in built customized scripts for you. Just go thru the help page there, and use it on your site and tell me to visit it. I give 2 days to do this. It is really that easy!