failed to establish a db connectionfailed to establish a db connection

Software error:

Can't call method "prepare" on an undefined value at /home/topfrees/public_html/usersonline.net/pro/onlinehide.cgi line 338.

For help, please send mail to the webmaster (webmaster@usersonline.net.topfreestuff.com), giving this error message and the time and date of the error.

[an error occurred while processing this directive]


Home
Online Count
Users Online
Users Online Elite
Users Online Pro
Search Engine Pro
Currency Converter
Contact
Help
Users Online Help
Users Online Help
cgi html shtml php
First things first...

You've just received your Users Online zip file. The first thing you need to do is unzip it. If you don't have an unzip program, download a free demo of winzip. Once it's unzipped - you will have a folder called 'elite' or 'online', depending on which version you have. You will now need to edit a couple of things before you upload.

The scripts use #!/usr/bin/perl
If your path to perl is different (some use #!/usr/local/bin/perl) then you will need to change it in the following files:

  • online.cgi
  • usersonline.cgi
  • onlineadmin.cgi (for elite and pro versions)

Uploading

You need to work out whether you can run cgi scripts outside of the cgi-bin. Some servers only allow scripts within the bin.

For scripts running outside of the cgi-bin, you can upload the entire folder and it's contents anywhere you like. You can have the folder directly under your domain root. This is the easiest way to go about it.

If your scripts need to run inside the cgi-bin, or if you'd like to run them there - you'll need to upload the folder to the cgi-bin, then create another folder under the domain root. You can call this whatever you like, but for simplicity call it onlinefiles.
Move your onlinestyle.css, burst3.gif and alert.wav into the onlinefiles folder. You will need to open up the 'header' file and change the url to the burst3.gif image so it points to the image in your onlinefiles folder.

Configuring - for Users Online and Users Online Elite

* Users Online Pro users ignore this section - configuration is set with the install script

Open up online.cfg. The three main variables you will need to have changed are:
  • $audio="http://www.domain.com/elite/alert.wav";
  • $domain="http://www.domain.com";
  • $stylesheet="onlinestyle.css";
Change $audio so it points to where your alert.wav is placed
Put your website url in for $domain. Change $stylesheet so it points to where your stylesheet is stored - if it's in the same folder as online.cgi, you can leave it as it is.

The rest of the configuration in this file is optional.

Chmod

* Users Online Pro users chmod installer.cgi - chmod on other files is set with the install script

You will need to set your scripts so they can be executed. All servers allow different setting for this - either 755 or 777. Try 755 first, if that doesn't work - then go with 777. If it's 777, make sure your logs folder is set to 777.

Chmod the following files:

  • online.cgi - 755
  • usersonline.cgi - 755
  • onlineadmin.cgi - 755
  • logfiled.txt - 666
  • countfile.txt - 666
  • uniquefile.txt - 666

Run it...

Once you've done all this, you should be able to open up online.cgi in a browser and see it working. Of course - if you set it not to show on the page, it won't work. Open up usersonline.cgi in a browser to view who's on your site, and onlineadmin.cgi to check your log files. Please note that entries aren't made into the log files until the user leaves the site - thus capturing all of their movements through your site.

 


 

CGI scripts

To incorporate Users Online Elite into a cgi script, we need to grab the page the user is on and the referrer. To do this you need to add some code to your cgi which will grab these variables, and pass them to the Users Online script in a format it can work with. No matter which method you use - I-Frame or Image tag, you will need to add the following code into your cgi script somewhere above where you put the code that calls the online.cgi script:
my $mypage=$ENV{'REQUEST_URI'};
my $ref = $ENV{'HTTP_REFERER'};
$mypage=~s/\?/ddkkdd/g;
$ref=~s/\?/ddkkdd/g;

I-Frame

Using an I-Frame will show the 'There are currently XXX users online' tag in cgi scripts. The down side of this is that not every browser can utilise frames. For those that can't, they will see nothing - and they won't register with the Users Online script. That being said - if you wish to use an I-Frame to display the tag, use the following code in your script noting that you can change the width/height of the iframe so no scrollbar shows up:
<IFRAME frameborder=0 scrolling=0 src="http://www.domain.com/elite/online.cgi?$mypage&ref=$ref" width=300 height=70>
</IFRAME>

This will display the following:

    back to top

Image tag

Using an image tag won't display the 'There are currently XXX users online' tag on your page, but it will record all hits. You're best to place it up near the top of your page so it loads in and records all hits. If you place it down the bottom and the user stops the page from loading, it won't register. Place the following code within a html section of your cgi script:
<img src="http://www.domain.com/online/online.cgi?$mypage&ref=$ref" width=1 height=1>
If you're a little more comfortable with hacking cgi scripts, you can put the image tag into your header/footer file. An example of the full code you need to use is:
open(FILE, "header");
while(<FILE>)
{
$_=~s/\$ref/$ref/;
$_=~s/\$mypage/$mypage/;
print $_;
}
close (FILE);
Incorporate this into the code which reads and prints out your header, which means you will probably only use:
$_=~s/\$ref/$ref/;
$_=~s/\$mypage/$mypage/;

(where $_ is your variable for each line of the header)

    back to top

 

HTML pages

There are two options you can use for html pages. You can either use the image tag, which won't give you referrer information - or you can set htacess to parse SSI on html pages, which allows you to use the <!--#include virtual --> method.

Image tag

Use the following image tag, where 'pagetotrack.html' is the name of the page the code is on. Don't make this a full url - make it from your domain root. For example - if the page you are putting the code on is http://www.mydomain.com/firstpage.html then the 'pagetotrack.html' bit will be 'firstpage.html'. If the page is http://www.mydomain.com/guests/firstpage.html then the 'pagetotrack.html' bit will be 'guests/firstpage.html'
<img src="http://www.domain.com/elite/online.cgi?pagetotrack.html" width=1 height=1>
    back to top

SSI on HTML pages

Servers are set to parse SSI tags in shtml pages. If changing your extension to shtml isn't a viable option for you, then you can add some code to your .htaccess file which will parse SSI in htm or html pages as well. If you already have a .htaccess file, add the code to it (hit enter after the code so there's a new line). Make sure you have your ftp program set to display hidden files, as your .htaccess file begins with a 'dot', which makes it hidden. If you are using Frontpage extensions on your site, you will have a .htaccess file - add this code to that file, DO NOT delete that file!! If you delete it, your Frontpage extensions won't work.

If you don't already have a .htaccess file, create a file called htaccess.txt on your computer, add the following code to it, and upload it to the top folder in your site (ie, where there's no webpages in a folder above it!!). Rename it to .htaccess (with a dot at the start) and it should then parse SSI on your html pages.

HTML extensions:
AddType text/html .html
AddHandler server-parsed .html
HTM extensions:
AddType text/html .htm
AddHandler server-parsed .htm
If you use the .htaccess method, then you can use the <!--#include virtual --> tag as for shtml.

    back to top

 

PHP pages

Use the following code in your php scripts. If you set it so it doesn't show the 'xxx users online' tag on the pages, you may need to open up online.cgi and comment out (#) the content header:
<?php virtual('/path/to/elite/online.cgi');?>
To comment out the header (if you need to) change the following line in online.cgi:
print "Content-type: text/html ";
to:
#print "Content-type: text/html ";
    back to top

 

SHTML pages

This one's real easy - all you need to do is put the following code on your shtml pages where you want the Users Online tag to show:
<!--#include virtual="/path/to/elite/online.cgi" -->
    back to top





Our online help section isn't completed yet.
Please submit any problems you are having and we will get back to you as soon as possible.

 

Name:
Email:
Problem: