What you must change
First of all, ask your Internet Service Provider where is "Perl". Perl is a computer language and LazyLinksLimited is written in Perl. If your provider doesn't have Perl or not let you use it, you cannot use LazyLinksLimited. Sorry about that but I cannot help you. Also ask where you can upload cgi script, .htaccess and other files. While some provider let you put cgi anywhere within your directory, others are specific. Ask also if the server supports "sendmail" and its path so that you can receive a mail notice when a guest adds an URL.
Once you get the answers from the provider, open link.cgi which is nothing but a text document. Use NotePad, a text editor or a word processor. The location of Perl or "Path" must be the first line of the cgi. For example:
| #!/usr/local/bin/perl |
If your provider does not use an UNIX based server but a PC server, you may delete the first line altogether. Extension ".cgi" does the trick. A Mac based server, though small in number, does not need "path" either, instead you save the cgi as a "script". This can be easily done by Perl-installed-Mac. (But the latest MacO/S X is UNIX based.)
Go down to
| ################
# basic set up # ################ #$url = "http://your_url/"; #$dir = "/your_directory/public_html/"; #$smpath = "/usr/sbin/sendmail"; $addrss = 'your@mail.address'; |
You can ignore #$url = ... and #$dir = ... if you can put everything in one directory.
If, however, you can not have cgi scripts (link.cgi) and the link page (link.html) in one directory - for example, a cgi script must be in /cgi-bin/ directory but in which you can not create a new file, you need to have a separate directory for link.html. Then you specify URL and "directory path" of that directory. Then delete # from the head of #$url and #$dir. Replace http://your_url/ of $url by your web site URL where you are going to accommodate the link page (link.html).
While $url (base URL) is the location of your link page relative to the all of internet, $dir (base directory) is the location of the link page in the server's hard-disk. (Don't ask me where. Only the provider knows where is your directory in its hard-disk.)
Suppose URL of your link cgi is http://visitware.com/sobaya/cgi-bin/link.cgi and the same cgi in the server's hard-disk is /home/sobaya/public_html/cgi-bin/link.cgi. Further, the link page URL is http://visitware.com/sobaya/link.html and the same link page is /home/sobaya/public_html/link.html in the hard-disk. Then "basic set up" must be
| ################
# basic set up # ################ $url = "http://visitware.com/sobaya/"; $dir = "/home/sobaya/public_html/"; |
Please note, both $url and $dir have / at the end. / is the UNIX's (and internet's) separator. But an old MacO/S needs : as a separator for $dir instead. For windows, the separator for $dir must be \. Either way, you do not omit the separator at the ends.
Further, to have a cgi file in a separate directory, open add.html by a text editor (or use homepage authoring soft which can handle "FORM") and find
| :
: <FORM NAME="link" ACTION="link.cgi" method="POST"> : : |
| and change the path to link.cgi. If you are not sure the relative path (or do not know what is a relative path), use full URL such as |
| :
: <FORM NAME="link" ACTION="http://your_provider/your_directory/somewhere/link.cgi" method="POST"> : : |
link.cgi can automatically send you an e-mail when a new link is added. To have the CGI send mails, delete # from the head of #$smpath and replace /usr/sbin/sendmail by the server's sendmail path.
More, you changes the value of $addrss to your mail address. Please note the mail address is put in 'single quote'. Perl treats single quote and double quote differently and @ has special meaning within double quote. (To use @ or the likes in double quote, you need to use "\" in front of it.)
If your provider does not have sendmail or not let you use it, however, you can not use automatic mail notice. Then keep # at the head of $smpath. Though my experience tells that the server does not have "sendmail" and you set the CGI to send a mail - no error arises except you can not send a mail. (By the way, LazyLinksLimited has javascript which may pop up a message on occasion. Some messages are useless if "sendmail" is off. You can turn it off if you like.)
The mail notice, however, is also meant to tell you if the CGI can not find a pointed category (most probably because you forgot it or misspelt it on the link page). Since more and more web hosting companies are including "sendmail" in their package, and even some free hosting sites are offering such deals, you may able to find a web space where you can park the script in a whole skin.
You want to change your password in link.cgi
| ################
# basic set up # ################ : : $tool = "admin"; $pswd = "your_password"; |
Modify HTML documents
To make the cgi fits for you, at least you want to modify the categories of homepage a guest may submit. Open add.html
| <HTML>
<HEAD> <TITLE>LazyLinksLimited</TITLE> <script language="JavaScript">
function check(){ msg="Oops! "; if (document.link.group.options[0].selected) {msg+="Pick the type of
your homepage. "};
if (msg == "Oops! ") {document.link.submit.click()}
} <!---->
</HEAD>
<CENTER>
<FORM NAME="link" ACTION="link.cgi" method="POST">
<TABLE><TD>
Description<BR>
<INPUT TYPE="button" NAME="ok" VALUE="OK / SEND" onClick="check()">
<P ALIGN=RIGHT>
|
As you can see, this Add-URL-Form is a HTML document. When you modify add.html, do not change the NAMEs of FORM fields such as "group", "title", "url" or "descript". But you can change "OPTION VALUE" such as "group 1", "group 2" and "group 3" in <SELECT> field NAMEd "group" which is the first field of the form. Or you can add a few more OPTIONs here. This is where the guest picks the type of homepage his homepage fits. You decide the type of homepage you accept into your link. If you like a dog, for example, you may have your link page dedicated for doggy such as
| :
: <FORM NAME="link" ACTION="link.cgi" method="POST"> Choose <SELECT NAME="group"> <OPTION VALUE="dog" SELECTED>the type of homepage <OPTION VALUE="dog">dog lover's homepage in general <OPTION VALUE="akita">Akita-dog's special page <OPTION VALUE="toilet">toilet education <OPTION VALUE="food">dog food homepage </SELECT><BR> : : |
<- This is a part of add.html <BODY> <FORM>. |
If you change or add "OPTION VALUE" in add.html, you need to change link.html, too.
| <HTML>
<HEAD> <TITLE>LazyLinksLimited</TITLE> </HEAD> <BODY BGCOLOR="lightyellow"> <CENTER> <FONT SIZE=6>LazyLinksLimited</FONT><BR> <FONT SIZE=5>(Link Page)</FONT><BR> <FONT SIZE=4><A HREF="add.html">Add URL</A></FONT> </CENTER> <HR>
<!--group 1--> <HR>
<!--group 2--> <HR>
<!--group 3--> <HR>
|
HTML tag <!--group 1-->, etc. in the link page are where a new URL is added. Now you need <!--dog-->, <!--akita-->, etc. Replace <!--(group name)--> in link.html by the categories you decided. You can have many categories you like. Please note, the value of "OPTION VALUE" in add.html and what comes between "<!--" and "-->" in link.html must exactly agree. And the first option <OPTION SELECTED> in add.html is not really an option. Rather, it is a heading. (You want to give it a value fit for "the others" in case someone does not choose a real option.)
Now your link page must have
| :
: <HR> <B><FONT SIZE=4>all the dog lovers</FONT></B><P> <!--dog--> <HR>
<!--akita-->
|
<- This is a part of link.html <BODY>. |
Before file upload
You can make other optional changes on the cgi. Otherwise save the texts. Change carriage return and/or line feed. Mac, Windows and UNIX employ different symbols to tell where a line end (or the return key is pressed). Convert them (a lot of text editors can do this) before you upload link.cgi and other files so that your server can understand where the line end. The easiest way of doing this is, however, just forget about the difference and upload files as text (or ASCII) files. They are, indeed, nothing but text files (except MacPerl for old Mac).
You may already have .htaccess in your directly. If so, it must have at least
| Options ExecCGI
AddType application/x-httpd-cgi .cgi AddType application/x-httpd-cgi .cgi/ |
If you are a Windows user, you may not able to have a file name .htaccess. Then you have it in other name. Upload it, and then rename it to .htaccess.
Many servers do not show files that begin with a period "." that is .htaccess. If you must have it yet you cannot see it, don't panic. See if the cgi works first. Next, ask your provider.
If your server is not UNIX with certain server program, you may not need .htaccess . Then forget it and follow the direction given by the provider.
If possible, make index.html or HTML document of any other name which works as default page for the directory where link.cgi is placed. The content doesn't matter. Having index.html in the cgi's directory enhances security. (If you can put cgi and data files in the same directory, you may rename add.html to index.html but do not forget to rename all relevant links.)
Permission or file access mask
Since you've already made your homepage, I assume you know how to upload files. You are going to upload link.cgi, add.html and link.html and if necessary .htaccess. Then, you set something called permission or file access mask. Usually it can be done by FTP.
Select link.cgi and set permission 755 (or -rwxr-xr-x) which means the owner can read/write/execute the file while others can read/execute only. The permission of link.html is 666 (or -rw-rw-rw-) which means everybody can read/write the file but no execution. add.html is 644 (or -rw-r--r--) which is the owner can read/write the file but others can read only. The directory in which you place link.html needs 777 ( or drwxrwkrwx) and .htaccess is to be set 644 (or -rwxr--r--). If FTP does not work, ask your provider. You may need to set permission by telnet or you may ask the provider sets permission on behalf of you.
Incidentally you may see the permission a number with four figures instead of three. If so, 755 means 0755, etc.
It's worth to try if any smaller number does the same trick. If you set link.cgi 705 instead of 755 and if it works, you can have more security. But I cannot tell if your server allows the cgi works under the tighter security. It all depends on your server. Ask your provider or try and see.
Test run
Once you set the permissions, run a browser. Type the the location of your cgi into the browser's location window http://your_site/link.cgi. The CGI redirects you to the link page link.html. If you see "no such document" message, check if link.cgi and link.html are in the server and if you didn't misspell the URL. If you see the cgi's source code itself, check if the cgi's permission is right and also check if the perl path is right. No line, no space before #!. Any omission of seemingly trivial marks such as # or { or } or ( or ) or ' or " or ; may cause an error too in that you would see "internal server error" message.
Next, go to add.html and add a URL. Click "OK / send" button and you will see the link page with new URL. If not, click the browser's reload button first. Then check add.html. Does the value of ACTION in FORM
| <FORM NAME="link" ACTION="link.cgi" method="POST"> |
If new URL is add but it is misplaced, check if add.html's group and link.html's group agree.
To use LazyLinksLimited, make it sure that you have the latest script and try it first without modification but change where you need to (especially perl path) according to the provider. Check the sendmail path ($smpath) for the mail error.
method="GET"
The last but not least, the link cgi does not work if the server does not accept "POST" type data input. Though you can rewrite the script to accept "GET" data, relocating the site (at least for the auto-link) is much easier. The most of web hosting companies including many free web hosters with CGI can handle "POST" data.