First and foremost, like any CGI-based application the prerequisite is that you do have access to a /cgi-bin/ directory of some sort... you do, don't you? If not, the rest of this page is pretty much a moot point. :)
If you're not sure whether or not you have the ability to use Server Side Includes, try this test. Copy/paste the following five lines into a new page, name it 'test.shtml' and upload it to your server.
I uploaded this page on <!--#echo var="LAST_MODIFIED"-->.
Check it out with a browser (errr.. Navigator.. whatever...), if you get back a date (in place of the funky #echo stuff), you've got SSI capability, if not, skip to the 'What to do if you don't have SSI' section. Assuming you're still here (first, fold your hands and say a prayer of thanks to the Deity of your choice) now, rename the file to 'test.html' and bring up the page again. If you *still* get a date a) I'm darned impressed and b) you're server's probably not running as fast as it could (not my problem, but.. well.. hey, that's the breaks). Now that we're done amusing ourselves.. let's get on with it.
$SSI = 1;
This tells the script that we're running it from a Server Side Include.
$logfile = "/absolute/path/to/dan_o.dat";
Replace the path statement with the absolute machine path to where you want your logfile kept. As a gross generalization, keeping it in the /cgi-bin/ will tend to keep the log fairly private and allow you to fetch it via FTP while keeping it within the HTML document path will allow it to be found/read by you, your Uncle Fred, and just about any Bot that hits your pages. Again, a gross generalization, but you get the gist...
$exclude = 0;
This part is only for those of you who have static IP addresses as either a dialup user or as part of a corporate network. Since most providers use dynamic addressing, leave this as '0' unless you're positive you have a static IP, in which case change this to...
$exclude = 1;
(unless you purposefully want to log yourself too! ;)
If you've changed $exclude to '1', then use $my_addr to hold your dialup IP address (or machine name, if you're provider has given you one and your server has reverse DNS turned on). Don't confuse this address with the IP of your host, $my_addr is only for your dialup/Ethernet IP address, nothing more, nothing less. Assuming that $exclude = 1;, then $my_addr should look like...
$my_addr = "126.96.36.199";
$my_addr = "yacko.animainiacs.com"; (unless you're of the fairer gender, in which case it'd probably be "dot.animainiacs.com" .. alas, I digress... ;)
Note: these addresses are examples only, use your personal address in place of these!
If you're calling the script from a SSI, skip to Finishing the Install now.
The biggest drawback to not having Server Side Includes is that you will not have the ability to tell where the user hit you from .. but you'll still get the rest of the information. With that out of the way, here's the configuration for Non-SSI use.
$SSI = 0;
See the exclude portion of the setup for getting $exclude and $my_addr correct.
See the logfile portion of the setup for setting the path to the log.
$HomeDirURL = "http://www.yourdomain.com/your/path/";
This is the base URL (and any subdirectories as needed) for the next page to be brought up when the script is run. The implimentation of this will be explained later.. just trust me for now. ;) If your URL looks like http://www.joeblow.com/~user/, then $HomeDirURL = "http://www.joeblow.com/~user/";
$nextfile = "file.html";
The name of the next file you want the user transported to at the end of the script if you want the user to go to 'page2.html', then $nextfile = "page2.html";
First off, change the permission of dan_o.pl (or .cgi if it's so named..) with this..
chmod 755 dan_o.pl
Which sets the script as executable, otherwise you're going to get server errors all day long.
Keeping in mind that the HTML document has to have the .shtml extension (unless you saw otherwise as explored at the top of this page), there are two SSI tags we can use...
The first one assumes that you have a Virtual (or Real) Hosting and that /cgi-bin/ is found at the root of that host. The second one means that you enter the entire path (usually found at the top of your FTP client) from the root of the host to the dan_o script. Some servers will take either, some don't like #exec cgi= but will take #exec cmd=, so if you get this lovely message...
play with the tags to see which one will work for you. If you're still getting the error message, triple check your path information or drop your SysAdmin a nice note.
The easiest way to run Dan-O without SSI's is to create a <FORM> area like this...
<FORM METHOD=POST ACTION="/cgi-bin/dan_o.pl">
<INPUT TYPE=SUBMIT VALUE="Click to Continue">
This runs the script and since we properly set $HomeDirURL and $nextfile (you did, didn't you?), the user is *magically* transported to the page we wanted them to go to! It's not as elegant or transparent as using SSI's but if it's all you've got, then it's better than nothing, right?!
The last step is simply to create an empty file named 'dan_o.dat', upload it to the *exact* place you specified in the $logfile = area and change the permission to...
chmod 666 dan_o.dat
..or if you're Telnet happy and only want to FTP the logfile back to you..
chmod o+w dan_o.dat
Ignore the 'chown' stuff in the README docs .. unless you have SU permission on the server, in which case you *probably* aren't reading this anyway. ;)
Notes to Spider.