Lordi Uusipaavalniemi

Learn the sweetness of my mercy

Using your own counter at Opera Community

If you'd like to know a bit more than just the hitcount you can use your own counter at O.C. It's a hack, but not a really dirty one. The trick is to run a server side counter script at your own host, disguised as a CSS file... To get the counter running you import to that in your custom style sheet:

@import url(http://example/count.php);

For the counter you can either roll your own or use something readymade. A no-no for JavaScript-based counters, naturally. BBClone, for example, is rather simple PHP-based counter. It is easy to install and does not require a database. With it you could use something like this to hunt 'em down:

<?php

// be nice, send header
header("Content-type: text/css;");

// check for referer
if(!$_SERVER['HTTP_REFERER']){
        $referer = 'unknown';
} else {
        $referer = $_SERVER['HTTP_REFERER'];
}

// hit that counter
define("_BBC_PAGE_NAME", 'my opera: '.$referer);
define("_BBCLONE_DIR", "/path/to/bbclone/");
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if (is_readable(COUNTER)) { include_once(COUNTER); };

?>

/* counter hack, you could place css here */

Proof of concept:



You could use the same hack to run random styles - day and night scheme, maybe - too. It's really up to what you want to do on the server :)

Server admins could render this hack useless by parsing all http:// -strings from the custom style sheet when saving, for example.

Written by Unknown on Saturday April 15, 2006

Permalink -

« Hiphoppy easter! - The best football team ever! »