View previous topic :: View next topic |
Author |
Message |
dtbradio -
Joined: 10 Oct 2004 Posts: 10
|
Posted: Thu Feb 25, 2010 10:39 pm Post subject: Display Abyss X2 Global Variable Values |
|
|
I have been researching both this forum, and the 'net in general, to find a simple bit of code to display the Abyss X2 global variable X_ABYSS_STATS_SERVER_TOTAL. So far, I have found the following snippets:
For PHP
Code: | <?php
echo "Total hits: " . $_ENV['X_ABYSS_STATS_SERVER_TOTAL'];
?> | and for SSI
Code: | Total hits: <!-- echo var="X_ABYSS_STATS_SERVER_TOTAL" --> |
Neither of these seems to be working. I've made sure that both PHP and Perl are installed and working (I run both PHP and CGI scripts on my website with no problems).
My test PHP code is Code: | <?php
echo "Total hits : $X_ABYSS_STATS_SERVER_TOTAL";
?> |
My test SSI code is Code: | <html>
<head>
<title>Stat View Test</title>
</head>
<body>
Total server hits:
<!-- #echo var="X_ABYSS_STATS_SERVER_TOTAL" -->
</body>
</html> |
Many of the threads regarding display of server stats suggest AWStats, which I do have installed and working, but I'm looking for something that will show nothing but the global variable I mentioned earlier.
Any ideas as to what I am missing? Before you ask, yes, I have gone through the Abyss docs on SSI, global CGI/SSI variables, etc. |
|
Back to top |
|
|
ale -
Joined: 12 Dec 2007 Posts: 6 Location: Italy
|
Posted: Fri Feb 26, 2010 12:37 pm Post subject: |
|
|
You may try this for PHP
Code: | <?php
echo "Total hits: " . $_SERVER['X_ABYSS_STATS_SERVER_TOTAL'];
?>
|
|
|
Back to top |
|
|
dtbradio -
Joined: 10 Oct 2004 Posts: 10
|
Posted: Fri Feb 26, 2010 1:29 pm Post subject: |
|
|
Thank you! That worked. I figured it had to be some kind of syntax issue or other simple problem. I also stumbled on to this article which suggests an additional bit of code just a little earlier this morning on another forum. It seems to do the same thing, but not quite as simply. |
|
Back to top |
|
|
dtbradio -
Joined: 10 Oct 2004 Posts: 10
|
Posted: Fri Feb 26, 2010 4:45 pm Post subject: |
|
|
Ok, here is the PHP page code for what I finally decided to go with. Hopefully this will give others trying to solve the same problem a basic platform from which to come up with their own stats display page.
Thanks again to Ale for pointing out my syntax error.
Code: |
<html>
<head>
<title>Basic Server Stats</title>
</head>
<body>
<TABLE BORDER="1" CELLSPACING="0" WIDTH="51%">
<TR>
<TD WIDTH="56%">Total Server Uptime in Days</TD>
<TD WIDTH="44%">
<P><?php
$x = $_SERVER['X_ABYSS_STATS_SERVER_UPTIME'] / 60;
$y = $x/60;
$z = $y/24;
printf ("%01.1f", $z);
?>
</TD>
</TR>
<TR>
<TD WIDTH="56%">Total Server Hits</TD>
<TD WIDTH="44%">
<?php
echo $_SERVER['X_ABYSS_STATS_SERVER_TOTAL'];
?>
</TD>
</TR>
<TR>
<TD WIDTH="56%">Total HTML Hits</TD>
<TD WIDTH="44%">
<?php
echo $_SERVER['X_ABYSS_STATS_SERVER_HTML'];
?>
</TD>
</TR>
<TR>
<TD WIDTH="56%">Total Bytes Served in GB</TD>
<TD WIDTH="44%">
<?php
$a = $_SERVER['X_ABYSS_STATS_SERVER_OUTPUT'];
$a = $a/(1024*1024*1024);
printf ("%01.2f", $a);
?>
</TD>
</TR>
</TABLE>
</body>
</html> |
|
|
Back to top |
|
|
|