PDA

View Full Version : php include for traffic - HOW?


Shackbase
04-12-2005, 10:46 PM
Hi there,

I am using Tracewatch which is a Real Time Web Stats and Traffic Analysis program; if you don't know what it is, check it out over at www.tracewatch.com - it is 100% free with no tags or images required and you host it yourself.

Anyways, there's two ways of tracking traffic, one is via php include and one is via java, I have been forced to use java because I don't know how to add php include in vb... how could I add a php include to all pages on my forum?

sample:

<?php $GLOBALS['adl_count_params']=true; @include_once $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT'].'/twatch_include/logger.php'; ?>

Thank you,

--Tone

Jolten
04-13-2005, 12:46 AM
Add it to the php_include_start template.

Shackbase
04-13-2005, 01:38 AM
thats odd - i tried that before and it gave me an error like unexpected < or something so i assumed that didn't work...

but I did it again but the traffic does not update with that in and the java out so something is still amiss.. hmm.. :(

--Tone

there's something peculiar you need to do with that isn't there.. i just added the above to the bottom (under the comments) of the php_include_start template... what should I have done?

--Tone

Link14716
04-14-2005, 03:23 AM
Remove the <?php at the begining and the ?> at the end and put the code in the phpinclude_start template.

Shackbase
04-14-2005, 03:27 AM
$GLOBALS['adl_count_params']=true; @include_once $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT'].'/twatch_include/logger.php'; ?

i would put that inside the sample call in the phpinclude_start template or just like that? do I need to call it on the html template too or anything and if so, how?

Thank you so much for your help,

--Tone

Guy G
04-14-2005, 06:59 PM
Jוust put it on the phpinclude_start template and thats it.

VHLinks
04-28-2005, 06:15 PM
Just curious if anyone got this to work, just throwing that code in there doesn't do anything.

Shackbase
04-28-2005, 06:32 PM
yeah - i gave up... :(

--Tone

VHLinks
04-28-2005, 06:46 PM
I'm not giving up that easily. Here's the code I have up now in phpinclude_start, maybe someone will have an idea.

ob_start();
@include_once $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT'].'/twatch_include/logger.php';
$logger = ob_get_contents();
ob_end_clean();

And of course calling $logger in the footer.

Shackbase
04-28-2005, 06:49 PM
if you get it working - please share!

Thanks :)

--Tone

VHLinks
04-28-2005, 06:50 PM
Will do, hopefully someone will point me in the right direction.

sere
04-29-2005, 10:44 AM
I'm trying to deal with one myself. Whenever I include it in _start it works but when somebody logs in it sends the person to homepage/Array for some reason. very annoying. I've included it now in _end and it appears to be working.

also, you probably need to


@include_once ($GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT'].'/twatch_include/logger.php');


or better of


include_once('/absolute/path/to/file');

VHLinks
04-29-2005, 06:48 PM
Nope tried just sticking this line in the include end, it didn't work:

@include_once ($GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT'].'/twatch_include/logger.php');

The I tried just putting this in the end include:

include_once('/home/jamtothis/twatch_include/logger.php');

Nada.

ericgtr
04-29-2005, 07:31 PM
Wouldn't that be this?
'home/jamtothis/public_html/twatch_include/logger.php'

Let me know if you get this working, I would like to use it too :)

VHLinks
04-29-2005, 07:33 PM
Eric who? :) No man, I don't have a public_html directory. Yes the old site did, I don't on the new server.

I've tried so many freaking variations it's ridiculous.

ericgtr
04-29-2005, 09:28 PM
I should have known you wouldn't miss something small like that ;) You guys have me screwing around with this thing now and I have tried several variations, all with no luck :mad:

VHLinks
04-29-2005, 10:05 PM
I know it's very frustrating. I even tried hardcoding it into index.php just to see if would work and it didn't.

ericgtr
04-29-2005, 10:37 PM
I tried adding it to the global.php and it was ugly man. I don't think a call needs to be made to a variable for this one (I have tried both ways) we should be able to pop it in and go, maybe worth looking at the file it's grabbing from too.

ZED28
01-01-2006, 11:53 PM
I came across this post looking for an addon for some kind of webstats for my new VB site and was a little dejected to find that nobody had gotten it working considering how good the TraceWatch app looked. I'm nothing more than a noob but using some clues in this thread, some on VB's official site and one I just stumbled across that wasn't related to the stats app, I managed to get it to parse VB. That said, mine is version 3.5.2 and not the older version that was used in this discussion, I also realise how old this topic is.

Just incase anyone's interested, here's what I did... (Note that the Plugin/Hook System has to be enabled first, it's disabled by default)
From your AdminCD, go to vBulletin Options, Plugin/Hook System
Make sure the Plugin/Hook System is enabled.
Again from your AdminCD, go to Plugin System, Plugin Manager
Select Add New Plugin
For the Product, make sure VBulletin is selected
For Hook Location, select global_start
For the Title, call it something like Trace Watch Monitoring Plugin
For the Plugin PHP Code, enter the following:-
@include_once $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT'].'/twatch_include/logger.php';
Save it and make sure it's active and you're done.

The TraceWatch application should be installed following the instructions from the author's website.

MikQuattro
02-19-2006, 08:39 AM
ZED28, nice one mate. Like you, I was in the middle of piecing this together when I came across your post. There is one thing I wanted to add to you post tho, and maybe get some help from the resident PHP gurus.....

Tracewatch doesn't count individual parameters to each page. For instance, you can click on as many threads around your forum as you want to, Tracewatch will see each of these as a a visit to showthread.php. There is, however, a way to get around this, by adding:
$GLOBALS['adl_count_params']=true;
before the include statement in your plugin. REFERENCE (http://www.tracewatch.com/doc/advanced.php#countparams)

My question is, would this be the correct code?
@include_once $GLOBALS['adl_count_params']=true;
$GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT'].'/twatch_include/logger.php';
Thanks again, and any help from anyone would be appreciated.

***EDIT***

I sort of just answered my Q.....

Found this at the TraceWatch site:

<?php
$GLOBALS['adl_count_params']=true;
@include_once $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT'].'/twatch_include/logger.php';
?>

HTH!!! :)

nicedreams
03-27-2006, 04:15 PM
These last 2 posts do not work for me. I'm on 3.5.4. Putting the code in a plugin under global_start was a disaster. Froze everything up real fast. When I put it in global_shutdown, that at least didn't do anything to my server load and actually ran the logger file, but the logger did not do anything.

Jim

jaybolt
05-02-2006, 06:28 PM
OK - I have tried all of the above in by 3.5.4 board and nothing worked so heres what I am doing:

In your .htaccess file in your root directory, add

php_value auto_append_file /path/to/your/twatch_include/logger.php

This will apend the php logger code to the end of each php page called (I think!). Works fine for me.

Also, the above will throw up an error when you try to log onto twatch (it will still let you log on and it will work). To get rid of the error, create a file called empty.php in your twatch folder with nothing in it.

Then create a .htaccess file in your twatch directory and add this:

php_value auto_append_file /path/to/your/twatch/empty.php

You can add the same .htaccess code to any folders you wish to exclude from twatch.

Simple but effective :)