Hit Counter for AXS

 

Introduction

I love using AXS for collecting information on my website visitors. It is easy to install, has a clean web interface, and is free. The only drawback is that development has ceased. I have long wanted to display a counter on my pages using AXS's data.

Requirements

  • AXS installed
  • PHP on your server
  • Files saved as .php
  • Manual edits for each page for the counter
  • Just a few minutes

 

The instructions

1. Go to your admin panel for axs.
2. Check "hits to local documents" only.
3. Enter a filter string.
4. Click on "view in graphical format". You need to make certain only one bar is displayed, if not revise your filter string and repeat.
5. Copy and paste that url into the code below where it says "YOUR_URL".
6. Edit the ALL CAPS text below to have some words before or after the counter.
7. Paste the full code into your page where you want the counter to appear.
8. Save your page as a .php file, publish, and enjoy.

<?php
$url = 'YOUR_URL';
$html = file_get_contents($url);
$regexp = '/<td align="right"><tt.*?>(.*?)<\/tt>/s';
if (preg_match_all($regexp, $html, $hit) && count($hit[1]) == 1) {
print 'INSERT TEXT BEFORE COUNTER HERE'.($hit[1][0]).'INSERT TEXT AFTER COUNTER HERE';
} else {
print 'Error! Retrieved '.count($hit[1]).' matches!';
}
?>

It will look something like this...

Error! Retrieved 0 matches!

I know this is a little sloppy to you true coders. I'm really just a copy and paster that fiddles with things a bit until they work for me. Please feel free to suggest improvements.

Navigation

Main page
Zieak's scripts

Featured on

No Where!


About this page

AXS tracking pixel Valid XHTML 1.0 Transitional Valid CSS! Creative Commons License Haloscan comments and trackbacks Gravatar avatars in commentsWhat websites are close to me in the real world?Check Pagerank

Rate this


Comments