plugins/conversions/docs/plugins/conversions/conversion_report conversions.php,NONE,1.1 conversions.tpl.html,NONE,1.1 conversions_summary.php,NONE,1.1 conversions_summary.tpl.html,NONE,1.1 current_activity.php,NONE,1.1 current_activity.tpl.html,NONE,1.1 current_activity_all.php,NONE,1.1 current_clicks.php,NONE,1.1 current_clicks.tpl.html,NONE,1.1 current_clicks_all.php,NONE,1.1 day.php,NONE,1.1 day.tpl.html,NONE,1.1 footer.tpl.html,NONE,1.1 graph.php,NONE,1.1 header.tpl.html,NONE,1.1 index.php,NONE,1.1 index.tpl.html,NONE,1.1 index_do.php,NONE,1.1 login.php,NONE,1.1 login.tpl.html,NONE,1.1 month.php,NONE,1.1 month.tpl.html,NONE,1.1 rss_current_activity.php,NONE,1.1 style.css,NONE,1.1 total.php,NONE,1.1 total.tpl.html,NONE,1.1

Sebastian Bergmann <[email protected]> Sun, 11 Apr 2004 09:45:17 +0000
Newsgroups gmane.comp.web.phpopentracker.cvs
Message-ID <[email protected]>
Update of /cvsroot/phpopencounter/plugins/conversions/docs/plugins/conversions/conversion_report
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2596/conversions/docs/plugins/conversions/conversion_report

Added Files:
	conversions.php conversions.tpl.html conversions_summary.php 
	conversions_summary.tpl.html current_activity.php 
	current_activity.tpl.html current_activity_all.php 
	current_clicks.php current_clicks.tpl.html 
	current_clicks_all.php day.php day.tpl.html footer.tpl.html 
	graph.php header.tpl.html index.php index.tpl.html 
	index_do.php login.php login.tpl.html month.php month.tpl.html 
	rss_current_activity.php style.css total.php total.tpl.html 
Log Message:
Initial import of Conversions plugin by Daniel Kehoe and Adrian Lanning.

--- NEW FILE: conversions.php ---
<?php
//
// phpOpenTracker - The Website Traffic and Visitor Analysis Solution
//
// Copyright 2000 - 2004 Sebastian Bergmann. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// $Id: conversions.php,v 1.1 2004/04/11 09:45:14 bergmann Exp $
//

require_once('includes/prepend.php');

$visitors = array();

foreach ($clients as $clientID => $client) {

  $resultSet = phpOpenTracker::get(
    array(
      'client_id' => $clientID,
      'api_call'  => 'conversions',
      // see sessions since when? in minutes:
	  'session_lifetime' => '1440' // past 24 hrs
	  //'session_lifetime' => '10080' // past 7 days
    )
  );

  if ($resultSet) {
    foreach ($resultSet as $resultItem) {
      $index = sizeof($visitors);
      $visitors[$index]['last_access']  = $resultItem['last_access'];
      $visitors[$index]['site']         = $client;
      $visitors[$index]['document']     = implode(" -> ", $resultItem['clickpath']->documents);
      $visitors[$index]['host']         = $resultItem['host'];
      $visitors[$index]['sale']         = $resultItem['sale'];
      $visitors[$index]['inquiry']    = ($resultItem['inquiry'] > 0)    ? 'x' : '';
      $visitors[$index]['signup']    = ($resultItem['signup'] > 0)    ? 'x' : '';
      $visitors[$index]['email']         = $resultItem['email'];
      $visitors[$index]['zip']         = $resultItem['zip'];
      $visitors[$index]['country']         = $resultItem['country'];
      $visitors[$index]['name']         = $resultItem['name'];
      $visitors[$index]['num_visits']         = $resultItem['num_visits'];
      $visitors[$index]['source']         = $resultItem['source'];
    }
  } 
}

$table = array();

if (!empty($visitors)) {
  foreach($visitors as $visitor) $tmp[] = $visitor['last_access'];
  array_multisort($tmp, SORT_DESC, $visitors);
  foreach ($visitors as $visitor) {
      $table[] = array(
        'last_access' => date('H:i:s', $visitor['last_access']),
        'site' => $visitor['site'],
        'document' => $visitor['document'],
        'host' => $visitor['host'],
        'sale' => $visitor['sale'],
        'inquiry' => $visitor['inquiry'],
        'signup' => $visitor['signup'],
        'email' => $visitor['email'],
        'zip' => $visitor['zip'],
        'country' => $visitor['country'],
        'name' => $visitor['name'],
        'num_visits' => $visitor['num_visits'],
        'source' => $visitor['source'],
    );
  }
}

$smarty->assign('table', $table);
$smarty->assign('pot_version', PHPOPENTRACKER_VERSION);
$smarty->assign('user', $user);
$smarty->assign('page', 'clickpaths');         
$smarty->display('conversions.tpl.html'); 

?>
--- NEW FILE: footer.tpl.html ---
{* footer.tpl.html for use with Smarty and phpOpenTracker Example Report *}
<!-- InstanceEndEditable -->

                      <br />
                      <br />
                    </td>
                  </tr>

                  <tr>
                    <td align="center">
                      <br />
                      <br />
                      <small>Powered by <a href="http://www.phpOpenTracker.de/">phpOpenTracker</a> {$pot_version}.</small>
                      <br />
                      <br />
                      <a href="http://www.phpopentracker.de/"><img alt="phpOpenTracker" border="0" src="images/88x31.jpg" width="88" height="31" /></a>
                      <br />
                      <br />                    </td>
                  </tr>
                </table>
              </td>
            </tr>
          </table>
        </td>
      </tr>

      <tr>
        <td height="1" background="images/line_top.jpg"><img alt="" src="images/line_top.jpg" width="3" height="1" /></td>
      </tr>

      <tr>
        <td height="34" background="images/bg_top.jpg">
          <table width="100%" border="0" cellspacing="0" cellpadding="0" height="34">
            <tr>
              <td align="left" valign="middle" nowrap="nowrap" width="33%">
                <small>&nbsp;Copyright &copy; 2000-2003 Sebastian Bergmann</small>
                <br />
                <small>&nbsp;All Rights Reserved.</small>
                <br />
              </td>

              <td align="right" valign="top" width="33%"><a href="#top"><img alt="" src="images/top_btn.jpg" width="8" height="8" border="0" /></a> <small>Top</small>
              </td>
            </tr>
          </table>
        </td>
      </tr>

      <tr>
        <td height="1" background="images/line_top.jpg"><img alt="" src="images/line_top.jpg" width="3" height="1" /></td>
      </tr>
    </table>

<script language="JavaScript" type="text/javascript" src="/tracker.js"></script> 
<noscript>
<img alt="" src="http://www.site.com/track/tracker.php?client_id=1&show=img"></img>
</noscript>
</body>
<!-- InstanceEnd --></html>

--- NEW FILE: current_activity.tpl.html ---
{* current_activity.tpl.html for use with Smarty and phpOpenTracker Example Report *}
{include file="header.tpl.html" title="phpOpenTracker Sample Report"}
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="90%">
  <tr valign="baseline" bgcolor="#a9bbcf">
    <td align="left">
      Last Access
    </td>
    <td align="left">
      Site
    </td>
    <td align="left">
      Host
    </td>
    <td align="left">
      Document Title
    </td>
    <td align="left">
      Referer
    </td>
    <td align="left">
      Document URL
    </td>
  </tr>
{section name=mysec loop=$table}
{strip}
   <tr bgcolor="#bdd0e1">
  <td align="left">
    {$table[mysec].last_access}
  </td>
  <td align="left">
    {$table[mysec].site}
  </td>
  <td align="left">
    {$table[mysec].host}
  </td>
  <td align="left">
    {$table[mysec].document}
  </td>
  <td align="left">
    {$table[mysec].referer}
  </td>
    <td align="left">
    {$table[mysec].document_url}
  </td>
   </tr>
{/strip}
{/section}
</table>
{include file="footer.tpl.html"}
--- NEW FILE: month.tpl.html ---
{* month.tpl.html for use with Smarty and phpOpenTracker Example Report *}
{include file="header.tpl.html" title="phpOpenTracker Sample Report"}
<small>
  <a href="#monthly_statistics">
    Monthly Statistics
  </a>

  |

  <a href="#pages">
    Top Pages
  </a>

  |

  <a href="#referers">
    Top Referers
  </a>

  |

  <a href="#entry_pages">
    Top Entry Pages
  </a>

  |

  <a href="#exit_pages">
    Top Exit Pages
  </a>

  |

  <a href="#exit_targets">
    Top Exit Targets
  </a>

  |

  <a href="#hosts">
    Top Hosts
  </a>

  <br />

  <a href="#operating_systems">
    Top Operating Systems
  </a>

  |

  <a href="#user_agents">
    Top User Agents
  </a>

  |

  <a href="#search_engines">
    Top Search Engines
  </a>

  |

  <a href="#search_keywords">
    Top Search Keywords
  </a>
</small>

<br />
<br />

<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="2">
      Monthly Statistics for {$month} {$year} for Site '{$client}'
    </th>
  </tr>
  <tr valign="baseline" bgcolor="#bdd0e1">
    <td align="left" bgcolor="#a9bbcf" width="75%">
      Total Page Impressions
    </td>
    <td align="right" width="25%">
      {$total_pi}
    </td>
  </tr>
  <tr valign="baseline" bgcolor="#bdd0e1">
    <td align="left" bgcolor="#a9bbcf">
      Total Visits
    </td>
    <td align="right">
      {$total_visits}
    </td>
  </tr>
</table>

<br />

<a id="daily_statistics" name="daily_statistics"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" bgcolor="#ffffff" colspan="5">
      Daily Statistics for {$month} {$year}

      <br />

      <img alt="" src="graph.php?client_id={$client_id}&amp;what=access_statistics&amp;start={$start}&amp;end={$end}&amp;interval=day&amp;width=700&amp;height=260" />
    </th>
  </tr>
  <tr valign="baseline" bgcolor="#bdd0e1">
    <td bgcolor="#79a0c7" width="10%">
      &nbsp;
    </td>
    <td align="center" bgcolor="#79a0c7" colspan="2" width="45%">
      Page Impressions
    </td>
    <td align="center" bgcolor="#79a0c7" colspan="2" width="45%">
      Visits
    </td>
  </tr>
{section name=days loop=$days}
{strip}
  <tr valign="baseline" bgcolor="#bdd0e1">
   <td align="left" bgcolor="#a9bbcf">
	{$days[days].day}
   </td>
   <td align="left" width="22%">
    {$days[days].pi_number}
   </td>
   <td align="left" width="22%">
    {$days[days].pi_percent}%
   </td>
   <td align="left" width="22%">
    {$days[days].visits_number}
   </td>
   <td align="left" width="22%">
    {$days[days].visits_percent}%
  </td>
  </tr>
{/strip}
{/section}
</table>

<br />

<a id="pages" name="pages"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_pages} Total Pages
    </th>
  </tr>
  <tr valign="baseline" bgcolor="#bdd0e1">
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Page Impressions
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Page
    </td>
  </tr>
{section name=pages loop=$pages}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$pages[pages].rank}
  </td>
  <td align="left" width="10%">
    {$pages[pages].count}
  </td>
  <td align="left" width="10%">
    {$pages[pages].percent}%
  </td>
  <td align="left">
    {$pages[pages].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="referers" name="referers"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_referers} Total Referers
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors refered here
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Referer
    </td>
  </tr>
{section name=referers loop=$referers}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$referers[referers].rank}
  </td>
  <td align="left" width="10%">
    {$referers[referers].count}
  </td>
  <td align="left" width="10%">
    {$referers[referers].percent}%
  </td>
  <td align="left">
    {$referers[referers].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="entry_pages" name="entry_pages"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_entry_pages} Total Entry Pages
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors entered here
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Page
    </td>
  </tr>
{section name=entry_pages loop=$entry_pages}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$entry_pages[entry_pages].rank}
  </td>
  <td align="left" width="10%">
    {$entry_pages[entry_pages].count}
  </td>
  <td align="left" width="10%">
    {$entry_pages[entry_pages].percent}%
  </td>
  <td align="left">
    {$entry_pages[entry_pages].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="exit_pages" name="exit_pages"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_exit_pages} Total Exit Pages
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors exited here
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Page
    </td>
  </tr>
{section name=exit_pages loop=$exit_pages}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$exit_pages[exit_pages].rank}
  </td>
  <td align="left" width="10%">
    {$exit_pages[exit_pages].count}
  </td>
  <td align="left" width="10%">
    {$exit_pages[exit_pages].percent}%
  </td>
  <td align="left">
    {$exit_pages[exit_pages].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="exit_targets" name="exit_targets"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_exit_targets} Total Exit Targets
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Clicks
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Target URL
    </td>
  </tr>
{section name=exit_targets loop=$exit_targets}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$exit_targets[exit_targets].rank}
  </td>
  <td align="left" width="10%">
    {$exit_targets[exit_targets].count}
  </td>
  <td align="left" width="10%">
    {$exit_targets[exit_targets].percent}%
  </td>
  <td align="left">
    {$exit_targets[exit_targets].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="hosts" name="hosts"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_hosts} Total Hosts
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors from there
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Host
    </td>
  </tr>
{section name=hosts loop=$hosts}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$hosts[hosts].rank}
  </td>
  <td align="left" width="10%">
    {$hosts[hosts].count}
  </td>
  <td align="left" width="10%">
    {$hosts[hosts].percent}%
  </td>
  <td align="left">
    {$hosts[hosts].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="operating_systems" name="operating_systems"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_operating_systems} Total Operating Systems
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors used this
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Operating System
    </td>
  </tr>
{section name=operating_systems loop=$operating_systems}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$operating_systems[operating_systems].rank}
  </td>
  <td align="left" width="10%">
    {$operating_systems[operating_systems].count}
  </td>
  <td align="left" width="10%">
    {$operating_systems[operating_systems].percent}%
  </td>
  <td align="left">
    {$operating_systems[operating_systems].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="user_agents" name="user_agents"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_user_agents} Total User Agents
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors used this
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      User Agent
    </td>
  </tr>
{section name=user_agents loop=$user_agents}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$user_agents[user_agents].rank}
  </td>
  <td align="left" width="10%">
    {$user_agents[user_agents].count}
  </td>
  <td align="left" width="10%">
    {$user_agents[user_agents].percent}%
  </td>
  <td align="left">
    {$user_agents[user_agents].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="search_engines" name="search_engines"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_search_engines} Total Search Engines
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors used this
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Search Engine
    </td>
  </tr>
{section name=search_engines loop=$search_engines}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$search_engines[search_engines].rank}
  </td>
  <td align="left" width="10%">
    {$search_engines[search_engines].count}
  </td>
  <td align="left" width="10%">
    {$search_engines[search_engines].percent}%
  </td>
  <td align="left">
    {$search_engines[search_engines].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="search_keywords" name="search_keywords"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_search_keywords} Total Search Keywords
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors searched for this
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Search Keyword(s)
    </td>
  </tr>
{section name=search_keywords loop=$search_keywords}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$search_keywords[search_keywords].rank}
  </td>
  <td align="left" width="10%">
    {$search_keywords[search_keywords].count}
  </td>
  <td align="left" width="10%">
    {$search_keywords[search_keywords].percent}%
  </td>
  <td align="left">
    {$search_keywords[search_keywords].string}
  </td>
</tr>
{/strip}
{/section}
</table>
{include file="footer.tpl.html"}
--- NEW FILE: header.tpl.html ---
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
{* header.tpl.html for use with Smarty and phpOpenTracker Example Report *}
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/template-main.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>traffic ({$page}) for {$user}</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<meta name="generator" content="phpOpenTracker, see www.phpOpenTracker.de" />
<link type="text/css" href="style.css" rel="stylesheet" />
</head>

<body bgcolor="#ffffff" text="#000000" link="#000000" vlink="#000000" alink="#000000">
    <table border="0" cellspacing="0" cellpadding="0" width="100%">
      <tr>
        <td height="63" background="images/bg_top.jpg">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="438" valign="bottom" align="left"><a id="top" name="top"></a><img alt="" src="images/logo_left_top.jpg" width="146" height="63" /><img alt="" src="images/logo_right_top.jpg" width="292" height="63" /></td>
              <td width="5"><img alt="" src="images/space.gif" width="5" height="1" /></td>

              <td align="right" valign="middle">
              </td>
            </tr>
          </table>
        </td>
      </tr>

      <tr>
        <td height="1" background="images/line_top.jpg"><img alt="" src="images/line_top.jpg" width="3" height="1" /></td>
      </tr>

      <tr>
        <td>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="100%" align="left" valign="top">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">

                  <tr>
                    <td>
                      &nbsp;
                      &nbsp;
                      <a href="index.php">
                        <small>All Sites Totals</small>
                      </a>
                      &nbsp;
                      &nbsp;
                      <a href="current_clicks.php">
                        <small>Visitors (last 24 hrs - low traffic sites)</small>
                      </a>
                      &nbsp;
                      &nbsp;
                      <a href="current_clicks_all.php">
                        <small>Visitors (last 24 hrs - all)</small>
                      </a>
                      &nbsp;
                      &nbsp;
                      <a href="conversions.php">
                        <small>Conversions (last 24 hrs)</small>
                      </a>
                                            &nbsp;
                      &nbsp;
                      <a href="conversions_summary.php">
                        <small>Conversions By Source</small>
                      </a>
                    </td>
                  </tr>
                  <tr>
                    <td align="center" valign="top" height="400" width="90%">
<!-- InstanceBeginEditable name="table" -->

--- NEW FILE: current_activity.php ---
<?php
//
// phpOpenTracker - The Website Traffic and Visitor Analysis Solution
//
// Copyright 2000 - 2004 Sebastian Bergmann. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// $Id: current_activity.php,v 1.1 2004/04/11 09:45:14 bergmann Exp $
//

require_once('includes/prepend.php');

$visitors = array();

foreach ($clientSet2 as $clientID => $client) {

  $resultSet = phpOpenTracker::get(
    array(
      'client_id' => $clientID,
      'api_call'  => 'visitors_online',
      // see sessions since when? in minutes:
	  'session_lifetime' => '1440' 
    )
  );

  if ($resultSet) {
    foreach ($resultSet as $resultItem) {
      $index = sizeof($visitors);
      $visitors[$index]['last_access']  = $resultItem['last_access'];
      $visitors[$index]['site']         = $client;
      $visitors[$index]['document']     = $resultItem['clickpath']->documents[sizeof($resultItem['clickpath']->documents)-1];
      $visitors[$index]['document_url'] = $resultItem['clickpath']->document_urls[sizeof($resultItem['clickpath']->document_urls)-1];
      $visitors[$index]['host']         = $resultItem['host'];
      $visitors[$index]['referer']      = $resultItem['referer'];
    }
  } 
}

$table = array();

if (!empty($visitors)) {
  foreach($visitors as $visitor) $tmp[] = $visitor['last_access'];
  array_multisort($tmp, SORT_DESC, $visitors);
  foreach ($visitors as $visitor) {
      $table[] = array(
        'last_access' => date('H:i:s', $visitor['last_access']),
        'site' => $visitor['site'],
        'document' => $visitor['document'] != $visitor['document_url'] ? $visitor['document'] : 'n/a',
        'document_url' => substr(($visitor['document_url']), 0, 50),
        'host' => $visitor['host'],
        'referer' => substr(($visitor['referer'] != '' ? $visitor['referer'] : 'n/a'), 0, 50)
    );
  }
}

$smarty->assign('table', $table);
$smarty->assign('pot_version', PHPOPENTRACKER_VERSION);
$smarty->assign('user', $user);
$smarty->assign('page', 'activity');         
$smarty->display('current_activity.tpl.html'); 

?>
--- NEW FILE: style.css ---
a:link {
  color: #2564c4;
}

a:visited {
  color: #2564c4;
}

a:hover {
  color: #1d4c93;
  text-decoration: underline;
}

a:active {
  color: #2564c4;
}

body {
  background-color: #ffffff;
  color: #000000;
  margin-left: 0px;
  margin-right: 0px;
  margin-top: 0px;
  margin-bottom: 0px;
}

body, td {
  font-family: "Bitstream Vera Sans Serif", Verdana, Arial, Helvetica, Geneva, SunSans-Regular, sans-serif;
  font-size: 90%;
}

--- NEW FILE: conversions_summary.php ---
<?php
//
// phpOpenTracker - The Website Traffic and Visitor Analysis Solution
//
// Copyright 2000 - 2004 Sebastian Bergmann. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// $Id: conversions_summary.php,v 1.1 2004/04/11 09:45:14 bergmann Exp $
//

require_once('includes/prepend.php');

$table = array();

$start = false;
$end   = false;
    
foreach ($clients as $clientID => $client) {

  $resultSet = phpOpenTracker::get(
    array(
      'client_id' => $clientID,
      'api_call'  => 'conversions_by_source',
      'start'     => $start,
      'end'       => $end
    )
  );

if ($resultSet) {
	foreach($resultSet as $result) $tmp[] = $result['sale'];
	array_multisort($tmp, SORT_DESC, $resultSet);
	foreach ($resultSet as $result) {
      $table[] = array(
          'source' => $result['source'],
          'sale' => $result['sale'],
          'inquiry' => $result['inquiry'],
          'signup' => $result['signup'],
        );
    }
  }
}

$smarty->assign('table', $table);
$smarty->assign('pot_version', PHPOPENTRACKER_VERSION);
$smarty->assign('user', $user);
$smarty->assign('page', 'conversions sumamry');         
$smarty->display('conversions_summary.tpl.html'); 

?>
--- NEW FILE: login.tpl.html ---
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
	<title>Login</title>
	<script type="text/javascript"></script> 
	<style type="text/css" media="all">
		@import url(/stylesheet/style.css);
	</style> 
</head>
<body onload="document.loginForm.name.focus();">
<div id="container">
	<div id="identity">
		<div id="pageHeader">
			<h1><span>Client Login</span></h1> 
		</div>
	</div>
<div id="content">

<table align="center" width="300">
      <tr>
       <td align="center" colspan="2" bgcolor="#DEDEDE">
        Please log in for access to reports
       </td>
      </tr>
      <tr>
       <form name="loginForm" method="post" action="index_do.php">
       <td align="right" class="light"><b>Username</b></td>
       <td align="left"><input type="text" tabindex="1" name="name" value="" /></td>
      </tr>
      <tr>
       <td align="right" class="light"><b>Password</b></td>
       <td align="left"><input type="password" tabindex="2" name="password" /></td>
      </tr>
      <tr>
       <td>&nbsp;</td>
       <td align="left">
        <input type="submit" name="Login" value="Login"/>
        </form>
       </td>
      </tr>
</table>

</div> <!-- id="content" -->
</div> <!-- id="container" -->
<script language="JavaScript" type="text/javascript" src="/tracker.js"></script> 
<noscript>
<img alt="" src="http://www.fortuity.us/track/tracker.php?client_id=1&show=img"></img>
</noscript>
</body>
</html>

--- NEW FILE: current_activity_all.php ---
<?php
//
// phpOpenTracker - The Website Traffic and Visitor Analysis Solution
//
// Copyright 2000 - 2004 Sebastian Bergmann. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// $Id: current_activity_all.php,v 1.1 2004/04/11 09:45:14 bergmann Exp $
//

require_once('includes/prepend.php');

$visitors = array();

foreach ($clients as $clientID => $client) {

  $resultSet = phpOpenTracker::get(
    array(
      'client_id' => $clientID,
      'api_call'  => 'visitors_online',
      // see sessions since when? in minutes:
	  'session_lifetime' => '60' 
    )
  );

  if ($resultSet) {
    foreach ($resultSet as $resultItem) {
      $index = sizeof($visitors);
      $visitors[$index]['last_access']  = $resultItem['last_access'];
      $visitors[$index]['site']         = $client;
      $visitors[$index]['document']     = $resultItem['clickpath']->documents[sizeof($resultItem['clickpath']->documents)-1];
      $visitors[$index]['document_url'] = $resultItem['clickpath']->document_urls[sizeof($resultItem['clickpath']->document_urls)-1];
      $visitors[$index]['host']         = $resultItem['host'];
      $visitors[$index]['referer']      = $resultItem['referer'];
    }
  } 
}

$table = array();

if (!empty($visitors)) {
  foreach($visitors as $visitor) $tmp[] = $visitor['last_access'];
  array_multisort($tmp, SORT_DESC, $visitors);
  foreach ($visitors as $visitor) {
      $table[] = array(
        'last_access' => date('H:i:s', $visitor['last_access']),
        'site' => $visitor['site'],
        'document' => $visitor['document'] != $visitor['document_url'] ? $visitor['document'] : 'n/a',
        'document_url' => substr(($visitor['document_url']), 0, 50),
        'host' => $visitor['host'],
        'referer' => substr(($visitor['referer'] != '' ? $visitor['referer'] : 'n/a'), 0, 50)
    );
  }
}

$smarty->assign('table', $table);
$smarty->assign('pot_version', PHPOPENTRACKER_VERSION);
$smarty->assign('user', $user);
$smarty->assign('page', 'activity');        
$smarty->display('current_activity.tpl.html'); 

?>
--- NEW FILE: index.tpl.html ---
{* index.tpl.html for use with Smarty and phpOpenTracker Example Report *}
{include file="header.tpl.html"}
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="90%">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="7">
      Access Statistics
    </th>
  </tr>
  <tr valign="baseline" bgcolor="#bdd0e1">
    <td bgcolor="#a9bbcf" width="10%">
      Client
    </td>
    <td align="center" bgcolor="#a9bbcf" colspan="2" width="30%">
      Today
    </td>
    <td align="center" bgcolor="#a9bbcf" colspan="2" width="30%">
      This Month
    </td>
    <td align="center" bgcolor="#a9bbcf" colspan="2" width="30%">
      Total
    </td>
  </tr>
{section name=mysec loop=$clients}
{strip}
   <tr bgcolor="#bdd0e1">
   <td>
	  	<a href="total.php?client_id={$clients[mysec].client_id}">
			{$clients[mysec].client}
    	</a></td>
  <td align="left">
    {$clients[mysec].visits_today} visits
  </td>
  <td align="left">
    {$clients[mysec].avg_visits_per_day} avg/day
  </td>
  <td align="left">
    {$clients[mysec].visits_month} visits
  </td>
  <td align="left">
    {$clients[mysec].pi_month} page impressions
  </td>
    <td align="left">
    {$clients[mysec].visits_total} visits
  </td>
  <td align="left">
    {$clients[mysec].pi_total} page impressions
  </td>
   </tr>
{/strip}
{/section}
</table>
{include file="footer.tpl.html"}

--- NEW FILE: login.php ---
<?php
//
// phpOpenTracker - The Website Traffic and Visitor Analysis Solution
//
// Copyright 2000 - 2004 Sebastian Bergmann. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// $Id: login.php,v 1.1 2004/04/11 09:45:15 bergmann Exp $
//

// load Smarty library
require_once('Smarty.class.php');
$smarty = new Smarty;
// your web server must have write access to the following directories
$smarty-> compile_dir = '/tmp/compile';
$smarty -> config_dir = '/tmp/config';
$smarty -> cache_dir = '/tmp/cache';
// switch to 'true' for production deployment
$smarty-> force_compile = false;

$smarty->display('login.tpl.html'); 

?>
--- NEW FILE: month.php ---
<?php
//
// phpOpenTracker - The Website Traffic and Visitor Analysis Solution
//
// Copyright 2000 - 2004 Sebastian Bergmann. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// $Id: month.php,v 1.1 2004/04/11 09:45:15 bergmann Exp $
//

require_once('includes/prepend.php');

    $start = mktime(0,   0,  0, $month, 1, $year);
    $end   = mktime(23, 59, 59, $month, date('t', $start), $year);
    
  $totalPageImpressions = phpOpenTracker::get(
    array(
      'client_id' => $clientID,
      'api_call'  => 'page_impressions',
      'start'     => $start,
      'end'       => $end
    )
  );

  $totalVisits = phpOpenTracker::get(
    array(
      'client_id' => $clientID,
      'api_call'  => 'visits',
      'start'     => $start,
      'end'       => $end
    )
  );
  
    // Query Page Impressions for this client and each day of this month
    $pi = phpOpenTracker::get(
      array(
        'client_id' => $clientID,
        'api_call'  => 'page_impressions',
        'start'     => $start,
        'end'       => $end,
        'interval'  => 86400
      )
    );

    // Query visits for this client and each day of this month
    $visits = phpOpenTracker::get(
      array(
        'client_id' => $clientID,
        'api_call'  => 'visits',
        'start'     => $start,
        'end'       => $end,
        'interval'  => 86400
      )
    );
    
    // Loop through days
    for ($i = 0; $i < sizeof($pi); $i++) {

      // Generate link to day statistics page
      $_day = sprintf(
        '<a href="day.php?client_id=%s&amp;day=%s&amp;month=%s&amp;year=%s">%s</a>',
        $clientID,
        $i + 1,
        $month,
        $year,
        $i + 1
      );

      // Fill in template variables
      $days[] = array(
          'day' => $_day,
          'pi_number' => $pi[$i]['value'],
          'pi_percent' => $totalPageImpressions ? number_format(((100 * $pi[$i]['value']) / $totalPageImpressions), 2) : '0',
          'visits_number' => $visits[$i]['value'],
          'visits_percent' => $totalVisits ? number_format(((100 * $visits[$i]['value']) / $totalVisits), 2) : '0'
        );
    }

$smarty->assign('total_pi', $totalPageImpressions);
$smarty->assign('total_visits', $totalVisits);

$smarty->assign('days', $days);

$smarty->assign('client_id', $clientID); 
$smarty->assign('client', $clients[$clientID]);
$smarty->assign('limit', $limit);
$smarty->assign('pot_version', PHPOPENTRACKER_VERSION);


// get many similar datasets and assign smarty arrays

  $batchKeys = array(
    'pages',
    'entry_pages',
    'exit_pages',
    'exit_targets',
    'hosts',
    'referers',
    'operating_systems',
    'user_agents'
  );

  $batchWhat = array(
    'document',
    'entry_document',
    'exit_document',
    'exit_target',
    'host',
    'referer',
    'operating_system',
    'user_agent'
  );

  $table = array();

  // Loop through $batchKeys / $batchWhat
  for ($i = 0; $i < sizeof($batchKeys); $i++) {
    // Query Top <$limit> items of category <$batchWhat[$i]>
    $result = phpOpenTracker::get(
      array(
        'client_id' => $clientID,
        'api_call'  => 'top',
        'what'      => $batchWhat[$i],
        'start'     => $start,
        'end'       => $end,
        'limit'     => $limit
      )
    );

    for ($j = 0; $j < sizeof($result['top_items']); $j++) {
      // Fill in table variables
      $table[] = array(
          'rank' => $j + 1,
          'count' => $result['top_items'][$j]['count'],
          'percent' => $result['top_items'][$j]['percent'],
          'string' => $result['top_items'][$j]['string']
        );
    }
    
	$smarty->assign($batchKeys[$i], $table);
	
	// re-intialize table
	$table = array();
	
    $smarty->assign("total_".$batchKeys[$i], $result['unique_items']);
  }
  
  $totalSearchEngines  = 0;
  $totalSearchKeywords = 0;

  if (phpOpenTracker_API::pluginLoaded('search_engines')) {
    $result = phpOpenTracker::get(
      array(
          'client_id' => $clientID,
          'api_call'  => 'search_engines',
          'what'      => 'top_search_engines',
          'start'     => $start,
          'end'       => $end,
          'limit'     => $limit
      )
    );

    $totalSearchEngines = $result['unique_items'];

    for ($j = 0; $j < sizeof($result['top_items']); $j++) {
      // Fill in table variables
      $table[] = array(
          'rank' => $j + 1,
          'count' => $result['top_items'][$j]['count'],
          'percent' => $result['top_items'][$j]['percent'],
          'string' => $result['top_items'][$j]['string']
        );
    }
    
	$smarty->assign('search_engines', $table);

	// re-intialize table
	$table = array();
	
    $result = phpOpenTracker::get(
      array(
          'client_id' => $clientID,
          'api_call'  => 'search_engines',
          'what'      => 'top_search_keywords',
          'start'     => $start,
          'end'       => $end,
          'limit'     => $limit
      )
    );

    $totalSearchKeywords = $result['unique_items'];

    for ($j = 0; $j < sizeof($result['top_items']); $j++) {
      // Fill in table variables
      $table[] = array(
          'rank' => $j + 1,
          'count' => $result['top_items'][$j]['count'],
          'percent' => $result['top_items'][$j]['percent'],
          'string' => $result['top_items'][$j]['string']
        );
    }
    
    $smarty->assign('search_keywords', $table);
    
    $smarty->assign('total_search_engines', $totalSearchEngines);
    $smarty->assign('total_search_keywords', $totalSearchKeywords);
    
  } // end if 'search_engines'

$smarty->assign('month', $monthNames[$month - 1]);
$smarty->assign('year', $year);
$smarty->assign('start', $start);
$smarty->assign('end', $end);
$smarty->assign('user', $user);
$smarty->assign('page', $monthNames[$month - 1].' '.$year);
$smarty->display('month.tpl.html'); 
?>
--- NEW FILE: index.php ---
<?php
//
// phpOpenTracker - The Website Traffic and Visitor Analysis Solution
//
// Copyright 2000 - 2004 Sebastian Bergmann. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// $Id: index.php,v 1.1 2004/04/11 09:45:14 bergmann Exp $
//

require_once('includes/prepend.php');

$table = array();
$i = 0;
if (sizeof($clients)) {
	foreach($clients as $clientID => $client) {
		$table[$i] = array(
		'client_id' => $clientID,
		'client' => $client, 
		'pi_today' => 
            // today's Page Impressions for current client
            phpOpenTracker::get(
              array(
                'client_id' => $clientID,
                'api_call'  => 'page_impressions',
                'range'     => 'today'
              )
            ),
         'pi_month' => 
            // Page Impressions this month for current client
            phpOpenTracker::get(
              array(
                'client_id' => $clientID,
                'api_call'  => 'page_impressions',
                'range'     => 'current_month'
              )
            ),
		'pi_total' => 
            // Total Page Impressions for current client
            phpOpenTracker::get(
              array(
                'client_id' => $clientID,
                'api_call'  => 'page_impressions',
                'range'     => 'total'
              )
            ),
        'visits_today' => 
            // Visits today for current client
            phpOpenTracker::get(
              array(
                'client_id' => $clientID,
                'api_call'  => 'visits',
                'range'     => 'today'
              )
            ),
         'visits_month' => $visits_month = 
            // Visits this month for current client
            phpOpenTracker::get(
              array(
                'client_id' => $clientID,
                'api_call'  => 'visits',
                'range'     => 'current_month'
              )
            ),
		'visits_total' => 
            // Total Visits for current client
            phpOpenTracker::get(
              array(
                'client_id' => $clientID,
                'api_call'  => 'visits',
                'range'     => 'total'
              )
            ),
         'avg_visits_per_day' => round($visits_month / $day)
		);
		$i++;
	}
}

$smarty->assign('clients', $table);
$smarty->assign('pot_version', PHPOPENTRACKER_VERSION);
$smarty->assign('user', $user);
$smarty->assign('page', 'all');      
$smarty->display('index.tpl.html'); 

?>

--- NEW FILE: current_clicks.php ---
<?php
//
// phpOpenTracker - The Website Traffic and Visitor Analysis Solution
//
// Copyright 2000 - 2004 Sebastian Bergmann. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// $Id: current_clicks.php,v 1.1 2004/04/11 09:45:14 bergmann Exp $
//

require_once('includes/prepend.php');

$visitors = array();

foreach ($clientSet2 as $clientID => $client) {

  $resultSet = phpOpenTracker::get(
    array(
      'client_id' => $clientID,
      'api_call'  => 'visitors_online',
      // see sessions since when? in minutes:
	  'session_lifetime' => '1440' 
    )
  );

  if ($resultSet) {
    foreach ($resultSet as $resultItem) {
      $index = sizeof($visitors);
      $visitors[$index]['last_access']  = $resultItem['last_access'];
      $visitors[$index]['site']         = $client;
      $visitors[$index]['document']     = implode(" -> ", $resultItem['clickpath']->documents);
      $visitors[$index]['host']         = $resultItem['host'];
      if(empty($resultItem['search_engine'])) {
	      	$visitors[$index]['referer'] = $resultItem['referer'];
      } else {
			$visitors[$index]['referer'] = $resultItem['search_engine'].': "'.$resultItem['keywords'].'"';
      }
    }
  } 
}

$table = array();

if (!empty($visitors)) {
  foreach($visitors as $visitor) $tmp[] = $visitor['last_access'];
  array_multisort($tmp, SORT_DESC, $visitors);
  foreach ($visitors as $visitor) {
      $table[] = array(
        'last_access' => date('H:i:s', $visitor['last_access']),
        'site' => $visitor['site'],
        'document' => $visitor['document'],
        'host' => $visitor['host'],
        'referer' => substr($visitor['referer'], 0, 50),
    );
  }
}

$smarty->assign('table', $table);
$smarty->assign('pot_version', PHPOPENTRACKER_VERSION);
$smarty->assign('user', $user);
$smarty->assign('page', 'clickpaths');          
$smarty->display('current_clicks.tpl.html'); 

?>
--- NEW FILE: conversions.tpl.html ---
{* current_activity.tpl.html for use with Smarty and phpOpenTracker Example Report *}
{include file="header.tpl.html" title="phpOpenTracker Sample Report"}
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="90%">
  <tr valign="baseline" bgcolor="#a9bbcf">
    <td align="left">
      Last Access
    </td>
    <td align="left">
      Inq.
    </td>
    <td align="left">
      Join
    </td>
    <td align="left">
      Sale
    </td>
    <td align="left">
      Source
    </td>
    <td align="left">
      Visits
    </td>
    <td align="left">
      Clickpath
    </td>
    <td align="left">
      Email
    </td>
    <td align="left">
      Zip
    </td>
    <td align="left">
      Country
    </td>
    <td align="left">
      Name
    </td>
  </tr>
{section name=mysec loop=$table}
{strip}
   <tr bgcolor="#bdd0e1">
  <td align="left">
    {$table[mysec].last_access}
  </td>
  <td align="left">
    {$table[mysec].inquiry}
  </td>
  <td align="left">
    {$table[mysec].signup}
  </td>
  <td align="left">
    {$table[mysec].sale}
  </td>
  <td align="left">
    {$table[mysec].source}
  </td>
  <td align="left">
    {$table[mysec].num_visits}
  </td>
  <td align="left">
  	{$table[mysec].site}: 
    {$table[mysec].document}
  </td>
  <td align="left">
    {$table[mysec].email}
  </td>
  <td align="left">
    {$table[mysec].zip}
  </td>
  <td align="left">
    {$table[mysec].country}
  </td>
  <td align="left">
    {$table[mysec].name}
  </td>
   </tr>
{/strip}
{/section}
</table>
{include file="footer.tpl.html"}
--- NEW FILE: current_clicks.tpl.html ---
{* current_activity.tpl.html for use with Smarty and phpOpenTracker Example Report *}
{include file="header.tpl.html" title="phpOpenTracker Sample Report"}
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="90%">
  <tr valign="baseline" bgcolor="#a9bbcf">
    <td align="left">
      Last Access
    </td>
    <td align="left">
      Referrer
    </td>
    <td align="left">
      Clickpath
    </td>
    <td align="left">
      Host
    </td>
  </tr>
{section name=mysec loop=$table}
{strip}
   <tr bgcolor="#bdd0e1">
  <td align="left">
    {$table[mysec].last_access}
  </td>
  <td align="left">
    {$table[mysec].referer}
  </td>
  <td align="left">
  	{$table[mysec].site}: 
    {$table[mysec].document}
  </td>
  <td align="left">
    {$table[mysec].host}
  </td>
   </tr>
{/strip}
{/section}
</table>
{include file="footer.tpl.html"}
--- NEW FILE: conversions_summary.tpl.html ---
{* current_activity.tpl.html for use with Smarty and phpOpenTracker Example Report *}
{include file="header.tpl.html" title="phpOpenTracker Report"}
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="90%">
  <tr valign="baseline" bgcolor="#a9bbcf">
    <td align="left">
      Source
    </td>
	  <td align="left">
	  Sale
	</td>
	  <td align="left">
	  Inq.
	</td>
	<td align="left">
	  Join
	</td>
  </tr>
{section name=mysec loop=$table}
{strip}
   <tr bgcolor="#bdd0e1">
	<td align="left">
	    {$table[mysec].source}
	</td>
  <td align="left">
    ${$table[mysec].sale}
  </td>
  <td align="left">
    {$table[mysec].inquiry}
  </td>
  <td align="left">
    {$table[mysec].signup}
  </td>

   </tr>
{/strip}
{/section}
</table>
{include file="footer.tpl.html"}
--- NEW FILE: day.php ---
<?php
//
// phpOpenTracker - The Website Traffic and Visitor Analysis Solution
//
// Copyright 2000 - 2004 Sebastian Bergmann. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// $Id: day.php,v 1.1 2004/04/11 09:45:14 bergmann Exp $
//

require_once('includes/prepend.php');

    $start = mktime(0,   0,  0, $month, $day, $year);
    $end   = mktime(23, 59, 59, $month, $day, $year);
    
  $totalPageImpressions = phpOpenTracker::get(
    array(
      'client_id' => $clientID,
      'api_call'  => 'page_impressions',
      'start'     => $start,
      'end'       => $end
    )
  );

  $totalVisits = phpOpenTracker::get(
    array(
      'client_id' => $clientID,
      'api_call'  => 'visits',
      'start'     => $start,
      'end'       => $end
    )
  );
  
    // Query Page Impressions for this client and each hour of this day
    $pi = phpOpenTracker::get(
      array(
        'client_id' => $clientID,
        'api_call'  => 'page_impressions',
        'start'     => $start,
        'end'       => $end,
        'interval'  => 3600
      )
    );

    // Query Visits for this client and each day of this day
    $visits = phpOpenTracker::get(
      array(
        'client_id' => $clientID,
        'api_call'  => 'visits',
        'start'     => $start,
        'end'       => $end,
        'interval'  => 3600
      )
    );
    
    // Loop through hours
    for ($i = 0; $i < sizeof($pi); $i++) {

      $hour = sprintf(
        '%02d:00 - %02d:00',
        $i,
        (($i + 1) < 24) ? ($i + 1) : 0
      );

      // Fill in template variables
      $hours[] = array(
          'hour' => $hour,
          'pi_number' => $pi[$i]['value'],
          'pi_percent' => $totalPageImpressions ? number_format(((100 * $pi[$i]['value']) / $totalPageImpressions), 2) : '0',
          'visits_number' => $visits[$i]['value'],
          'visits_percent' => $totalVisits ? number_format(((100 * $visits[$i]['value']) / $totalVisits), 2) : '0'
        );
    }

$smarty->assign('total_pi', $totalPageImpressions);
$smarty->assign('total_visits', $totalVisits);

$smarty->assign('hours', $hours);

$smarty->assign('client_id', $clientID);
$smarty->assign('client', $clients[$clientID]);
$smarty->assign('limit', $limit);
$smarty->assign('pot_version', PHPOPENTRACKER_VERSION);


// get many similar datasets and assign smarty arrays

  $batchKeys = array(
    'pages',
    'entry_pages',
    'exit_pages',
    'exit_targets',
    'hosts',
    'referers',
    'operating_systems',
    'user_agents'
  );

  $batchWhat = array(
    'document',
    'entry_document',
    'exit_document',
    'exit_target',
    'host',
    'referer',
    'operating_system',
    'user_agent'
  );

  $table = array();

  // Loop through $batchKeys / $batchWhat
  for ($i = 0; $i < sizeof($batchKeys); $i++) {
    // Query Top <$limit> items of category <$batchWhat[$i]>
    $result = phpOpenTracker::get(
      array(
        'client_id' => $clientID,
        'api_call'  => 'top',
        'what'      => $batchWhat[$i],
        'start'     => $start,
        'end'       => $end,
        'limit'     => $limit
      )
    );

    for ($j = 0; $j < sizeof($result['top_items']); $j++) {
      // Fill in table variables
      $table[] = array(
          'rank' => $j + 1,
          'count' => $result['top_items'][$j]['count'],
          'percent' => $result['top_items'][$j]['percent'],
          'string' => $result['top_items'][$j]['string']
        );
    }
    
	$smarty->assign($batchKeys[$i], $table);
	
	// re-intialize table
	$table = array();
	
    $smarty->assign("total_".$batchKeys[$i], $result['unique_items']);
  }
  
  $totalSearchEngines  = 0;
  $totalSearchKeywords = 0;

  if (phpOpenTracker_API::pluginLoaded('search_engines')) {
    $result = phpOpenTracker::get(
      array(
          'client_id' => $clientID,
          'api_call'  => 'search_engines',
          'what'      => 'top_search_engines',
          'start'     => $start,
          'end'       => $end,
          'limit'     => $limit
      )
    );

    $totalSearchEngines = $result['unique_items'];

    for ($j = 0; $j < sizeof($result['top_items']); $j++) {
      // Fill in table variables
      $table[] = array(
          'rank' => $j + 1,
          'count' => $result['top_items'][$j]['count'],
          'percent' => $result['top_items'][$j]['percent'],
          'string' => $result['top_items'][$j]['string']
        );
    }
    
	$smarty->assign('search_engines', $table);

	// re-intialize table
	$table = array();
	
    $result = phpOpenTracker::get(
      array(
          'client_id' => $clientID,
          'api_call'  => 'search_engines',
          'what'      => 'top_search_keywords',
          'start'     => $start,
          'end'       => $end,
          'limit'     => $limit
      )
    );

    $totalSearchKeywords = $result['unique_items'];

    for ($j = 0; $j < sizeof($result['top_items']); $j++) {
      // Fill in table variables
      $table[] = array(
          'rank' => $j + 1,
          'count' => $result['top_items'][$j]['count'],
          'percent' => $result['top_items'][$j]['percent'],
          'string' => $result['top_items'][$j]['string']
        );
    }
    
    $smarty->assign('search_keywords', $table);
    
    $smarty->assign('total_search_engines', $totalSearchEngines);
    $smarty->assign('total_search_keywords', $totalSearchKeywords);
    
  } // end if 'search_engines'

$smarty->assign('day', $day);
$smarty->assign('month', $monthNames[$month - 1]);
$smarty->assign('year', $year);
$smarty->assign('start', $start);
$smarty->assign('end', $end);
$smarty->assign('user', $user);
$smarty->assign('page', $day.' '.$monthNames[$month - 1].' '.$year);   
$smarty->display('day.tpl.html'); 
?>
--- NEW FILE: day.tpl.html ---
{* day.tpl.html for use with Smarty and phpOpenTracker Example Report *}
{include file="header.tpl.html" title="phpOpenTracker Sample Report"}
<small>
  <a href="#hourly_statistics">
    Hourly Statistics
  </a>

  |

  <a href="#pages">
    Top Pages
  </a>

  |

  <a href="#referers">
    Top Referers
  </a>

  |

  <a href="#entry_pages">
    Top Entry Pages
  </a>

  |

  <a href="#exit_pages">
    Top Exit Pages
  </a>

  |

  <a href="#exit_targets">
    Top Exit Targets
  </a>

  |

  <a href="#hosts">
    Top Hosts
  </a>

  <br />

  <a href="#operating_systems">
    Top Operating Systems
  </a>

  |

  <a href="#user_agents">
    Top User Agents
  </a>

  |

  <a href="#search_engines">
    Top Search Engines
  </a>

  |

  <a href="#search_keywords">
    Top Search Keywords
  </a>
</small>

<br />
<br />

<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="2">
      Hourly Statistics for {$day} {$month} {$year} for Site '{$client}'
    </th>
  </tr>
  <tr valign="baseline" bgcolor="#bdd0e1">
    <td align="left" bgcolor="#a9bbcf" width="75%">
      Total Page Impressions
    </td>
    <td align="right" width="25%">
      {$total_pi}
    </td>
  </tr>
  <tr valign="baseline" bgcolor="#bdd0e1">
    <td align="left" bgcolor="#a9bbcf">
      Total Visits
    </td>
    <td align="right">
      {$total_visits}
    </td>
  </tr>
</table>

<br />

<a id="hourly_statistics" name="hourly_statistics"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" bgcolor="#ffffff" colspan="5">
      Hourly Statistics for {$day} {$month} {$year}

      <br />

      <img alt="" src="graph.php?client_id={$client_id}&amp;what=access_statistics&amp;start={$start}&amp;end={$end}&amp;interval=hour&amp;width=700&amp;height=260" />
    </th>
  </tr>
  <tr valign="baseline" bgcolor="#bdd0e1">
    <td bgcolor="#79a0c7" width="10%">
      &nbsp;
    </td>
    <td align="center" bgcolor="#79a0c7" colspan="2" width="45%">
      Page Impressions
    </td>
    <td align="center" bgcolor="#79a0c7" colspan="2" width="45%">
      Visits
    </td>
  </tr>
{section name=hours loop=$hours}
{strip}
  <tr valign="baseline" bgcolor="#bdd0e1">
   <td align="left" bgcolor="#a9bbcf">
	{$hours[hours].hour}
   </td>
   <td align="left" width="22%">
    {$hours[hours].pi_number}
   </td>
   <td align="left" width="22%">
    {$hours[hours].pi_percent}%
   </td>
   <td align="left" width="22%">
    {$hours[hours].visits_number}
   </td>
   <td align="left" width="22%">
    {$hours[hours].visits_percent}%
  </td>
  </tr>
{/strip}
{/section}
</table>

<br />

<a id="pages" name="pages"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_pages} Total Pages
    </th>
  </tr>
  <tr valign="baseline" bgcolor="#bdd0e1">
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Page Impressions
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Page
    </td>
  </tr>
{section name=pages loop=$pages}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$pages[pages].rank}
  </td>
  <td align="left" width="10%">
    {$pages[pages].count}
  </td>
  <td align="left" width="10%">
    {$pages[pages].percent}%
  </td>
  <td align="left">
    {$pages[pages].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="referers" name="referers"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_referers} Total Referers
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors refered here
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Referer
    </td>
  </tr>
{section name=referers loop=$referers}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$referers[referers].rank}
  </td>
  <td align="left" width="10%">
    {$referers[referers].count}
  </td>
  <td align="left" width="10%">
    {$referers[referers].percent}%
  </td>
  <td align="left">
    {$referers[referers].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="entry_pages" name="entry_pages"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_entry_pages} Total Entry Pages
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors entered here
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Page
    </td>
  </tr>
{section name=entry_pages loop=$entry_pages}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$entry_pages[entry_pages].rank}
  </td>
  <td align="left" width="10%">
    {$entry_pages[entry_pages].count}
  </td>
  <td align="left" width="10%">
    {$entry_pages[entry_pages].percent}%
  </td>
  <td align="left">
    {$entry_pages[entry_pages].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="exit_pages" name="exit_pages"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_exit_pages} Total Exit Pages
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors exited here
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Page
    </td>
  </tr>
{section name=exit_pages loop=$exit_pages}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$exit_pages[exit_pages].rank}
  </td>
  <td align="left" width="10%">
    {$exit_pages[exit_pages].count}
  </td>
  <td align="left" width="10%">
    {$exit_pages[exit_pages].percent}%
  </td>
  <td align="left">
    {$exit_pages[exit_pages].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="exit_targets" name="exit_targets"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_exit_targets} Total Exit Targets
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Clicks
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Target URL
    </td>
  </tr>
{section name=exit_targets loop=$exit_targets}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$exit_targets[exit_targets].rank}
  </td>
  <td align="left" width="10%">
    {$exit_targets[exit_targets].count}
  </td>
  <td align="left" width="10%">
    {$exit_targets[exit_targets].percent}%
  </td>
  <td align="left">
    {$exit_targets[exit_targets].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="hosts" name="hosts"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_hosts} Total Hosts
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors from there
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Host
    </td>
  </tr>
{section name=hosts loop=$hosts}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$hosts[hosts].rank}
  </td>
  <td align="left" width="10%">
    {$hosts[hosts].count}
  </td>
  <td align="left" width="10%">
    {$hosts[hosts].percent}%
  </td>
  <td align="left">
    {$hosts[hosts].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="operating_systems" name="operating_systems"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_operating_systems} Total Operating Systems
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors used this
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Operating System
    </td>
  </tr>
{section name=operating_systems loop=$operating_systems}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$operating_systems[operating_systems].rank}
  </td>
  <td align="left" width="10%">
    {$operating_systems[operating_systems].count}
  </td>
  <td align="left" width="10%">
    {$operating_systems[operating_systems].percent}%
  </td>
  <td align="left">
    {$operating_systems[operating_systems].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="user_agents" name="user_agents"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_user_agents} Total User Agents
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors used this
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      User Agent
    </td>
  </tr>
{section name=user_agents loop=$user_agents}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$user_agents[user_agents].rank}
  </td>
  <td align="left" width="10%">
    {$user_agents[user_agents].count}
  </td>
  <td align="left" width="10%">
    {$user_agents[user_agents].percent}%
  </td>
  <td align="left">
    {$user_agents[user_agents].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="search_engines" name="search_engines"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_search_engines} Total Search Engines
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors used this
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Search Engine
    </td>
  </tr>
{section name=search_engines loop=$search_engines}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$search_engines[search_engines].rank}
  </td>
  <td align="left" width="10%">
    {$search_engines[search_engines].count}
  </td>
  <td align="left" width="10%">
    {$search_engines[search_engines].percent}%
  </td>
  <td align="left">
    {$search_engines[search_engines].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="search_keywords" name="search_keywords"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_search_keywords} Total Search Keywords
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors searched for this
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Search Keyword(s)
    </td>
  </tr>
{section name=search_keywords loop=$search_keywords}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$search_keywords[search_keywords].rank}
  </td>
  <td align="left" width="10%">
    {$search_keywords[search_keywords].count}
  </td>
  <td align="left" width="10%">
    {$search_keywords[search_keywords].percent}%
  </td>
  <td align="left">
    {$search_keywords[search_keywords].string}
  </td>
</tr>
{/strip}
{/section}
</table>
{include file="footer.tpl.html"}
--- NEW FILE: index_do.php ---
<?php
//
// phpOpenTracker - The Website Traffic and Visitor Analysis Solution
//
// Copyright 2000 - 2004 Sebastian Bergmann. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// $Id: index_do.php,v 1.1 2004/04/11 09:45:14 bergmann Exp $
//

$user = 'guest';
$loggedin = false;
session_start();
$user = $_SESSION['user'];
$loggedin = $_SESSION['loggedin'];

// check for valid username and password
if (!empty($_REQUEST['name']) && !empty($_REQUEST['password'])) {
	if ($_REQUEST['name']=='client1' && $_REQUEST['password']=='secret') {
	$loggedin = true;
	}
	if ($_REQUEST['name']=='webmonkey' && $_REQUEST['password']=='secret') {
	$loggedin = true;
	}
} 

if ($loggedin) {
	// assign the form value
	$user = $_REQUEST['name'];
	$_SESSION['user'] = $user;
	$_SESSION['loggedin'] = $loggedin;
	// redirects to the main page
	header('Location: index.php');
	exit();
} else {
	// redirects to the login page
	header('Location: login.php');
}

?>
--- NEW FILE: total.tpl.html ---
{* total.tpl.html for use with Smarty and phpOpenTracker Example Report *}
{include file="header.tpl.html" title="phpOpenTracker Sample Report"}
<small>
  <a href="#monthly_statistics">
    Monthly Statistics
  </a>

  |

  <a href="#pages">
    Top Pages
  </a>

  |

  <a href="#referers">
    Top Referers
  </a>

  |

  <a href="#entry_pages">
    Top Entry Pages
  </a>

  |

  <a href="#exit_pages">
    Top Exit Pages
  </a>

  |

  <a href="#exit_targets">
    Top Exit Targets
  </a>

  |

  <a href="#hosts">
    Top Hosts
  </a>

  <br />

  <a href="#operating_systems">
    Top Operating Systems
  </a>

  |

  <a href="#user_agents">
    Top User Agents
  </a>

  |

  <a href="#search_engines">
    Top Search Engines
  </a>

  |

  <a href="#search_keywords">
    Top Search Keywords
  </a>
</small>

<br />
<br />

<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="2">
      Total Statistics ({$first} to {$last}) for Site '{$client}'
    </th>
  </tr>
  <tr valign="baseline" bgcolor="#bdd0e1">
    <td align="left" bgcolor="#a9bbcf">
      num_unique_visitors: {$num_unique_visitors} 
    </td>
  </tr>
  <tr valign="baseline" bgcolor="#bdd0e1">
    <td align="left" bgcolor="#a9bbcf">
      num_one_time_visitors: {$num_one_time_visitors}
    </td>
  </tr>
  <tr valign="baseline" bgcolor="#bdd0e1">
    <td align="left" bgcolor="#a9bbcf">
      num_returning_visitors: {$num_returning_visitors}
    </td>
  </tr>
  <tr valign="baseline" bgcolor="#bdd0e1">
    <td align="left" bgcolor="#a9bbcf">
      num_return_visits: {$num_return_visits}
    </td>
  </tr>
  <tr valign="baseline" bgcolor="#bdd0e1">
    <td align="left" bgcolor="#a9bbcf">
      average_visits: {$average_visits}
    </td>
  </tr>
  <tr valign="baseline" bgcolor="#bdd0e1">
    <td align="left" bgcolor="#a9bbcf">
      average_time_between_visits: {$average_time_between_visits}
    </td>
  </tr>
</table>

<br />

<a id="monthly_statistics" name="monthly_statistics"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="5">
      Monthly Statistics
    </th>
  </tr>
  <tr valign="baseline" bgcolor="#bdd0e1">
    <td bgcolor="#a9bbcf" width="20%">
      &nbsp;
    </td>
    <td align="center" bgcolor="#a9bbcf" colspan="2" width="40%">
      Visits (of total {$total_visits} to date)
    </td>
    <td align="center" bgcolor="#a9bbcf" colspan="2" width="40%">
      Page Impressions (of {$total_pi} total to date)
    </td>
  </tr>
{section name=months loop=$months}
{strip}
  <tr valign="baseline" bgcolor="#bdd0e1">
   <td align="left" bgcolor="#a9bbcf">
	{$months[months].month}
   </td>
   <td align="left" width="22%">
    {$months[months].visits_number}
   </td>
   <td align="left" width="22%">
    {$months[months].visits_percent}%
  </td>
   <td align="left" width="22%">
    {$months[months].pi_number}
   </td>
   <td align="left" width="22%">
    {$months[months].pi_percent}%
   </td>
  </tr>
{/strip}
{/section}
</table>
<br />

<a id="pages" name="pages"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_pages} Total Pages
    </th>
  </tr>
  <tr valign="baseline" bgcolor="#bdd0e1">
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Page Impressions
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Page
    </td>
  </tr>
{section name=pages loop=$pages}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$pages[pages].rank}
  </td>
  <td align="left" width="10%">
    {$pages[pages].count}
  </td>
  <td align="left" width="10%">
    {$pages[pages].percent}%
  </td>
  <td align="left">
    {$pages[pages].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="referers" name="referers"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_referers} Total Referers
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors refered here
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Referer
    </td>
  </tr>
{section name=referers loop=$referers}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$referers[referers].rank}
  </td>
  <td align="left" width="10%">
    {$referers[referers].count}
  </td>
  <td align="left" width="10%">
    {$referers[referers].percent}%
  </td>
  <td align="left">
    {$referers[referers].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="entry_pages" name="entry_pages"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_entry_pages} Total Entry Pages
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors entered here
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Page
    </td>
  </tr>
{section name=entry_pages loop=$entry_pages}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$entry_pages[entry_pages].rank}
  </td>
  <td align="left" width="10%">
    {$entry_pages[entry_pages].count}
  </td>
  <td align="left" width="10%">
    {$entry_pages[entry_pages].percent}%
  </td>
  <td align="left">
    {$entry_pages[entry_pages].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="exit_pages" name="exit_pages"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_exit_pages} Total Exit Pages
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors exited here
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Page
    </td>
  </tr>
{section name=exit_pages loop=$exit_pages}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$exit_pages[exit_pages].rank}
  </td>
  <td align="left" width="10%">
    {$exit_pages[exit_pages].count}
  </td>
  <td align="left" width="10%">
    {$exit_pages[exit_pages].percent}%
  </td>
  <td align="left">
    {$exit_pages[exit_pages].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="exit_targets" name="exit_targets"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_exit_targets} Total Exit Targets
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Clicks
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Target URL
    </td>
  </tr>
{section name=exit_targets loop=$exit_targets}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$exit_targets[exit_targets].rank}
  </td>
  <td align="left" width="10%">
    {$exit_targets[exit_targets].count}
  </td>
  <td align="left" width="10%">
    {$exit_targets[exit_targets].percent}%
  </td>
  <td align="left">
    {$exit_targets[exit_targets].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="hosts" name="hosts"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_hosts} Total Hosts
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors from there
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Host
    </td>
  </tr>
{section name=hosts loop=$hosts}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$hosts[hosts].rank}
  </td>
  <td align="left" width="10%">
    {$hosts[hosts].count}
  </td>
  <td align="left" width="10%">
    {$hosts[hosts].percent}%
  </td>
  <td align="left">
    {$hosts[hosts].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="operating_systems" name="operating_systems"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_operating_systems} Total Operating Systems
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors used this
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Operating System
    </td>
  </tr>
{section name=operating_systems loop=$operating_systems}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$operating_systems[operating_systems].rank}
  </td>
  <td align="left" width="10%">
    {$operating_systems[operating_systems].count}
  </td>
  <td align="left" width="10%">
    {$operating_systems[operating_systems].percent}%
  </td>
  <td align="left">
    {$operating_systems[operating_systems].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="user_agents" name="user_agents"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_user_agents} Total User Agents
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors used this
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      User Agent
    </td>
  </tr>
{section name=user_agents loop=$user_agents}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$user_agents[user_agents].rank}
  </td>
  <td align="left" width="10%">
    {$user_agents[user_agents].count}
  </td>
  <td align="left" width="10%">
    {$user_agents[user_agents].percent}%
  </td>
  <td align="left">
    {$user_agents[user_agents].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="search_engines" name="search_engines"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_search_engines} Total Search Engines
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors used this
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Search Engine
    </td>
  </tr>
{section name=search_engines loop=$search_engines}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$search_engines[search_engines].rank}
  </td>
  <td align="left" width="10%">
    {$search_engines[search_engines].count}
  </td>
  <td align="left" width="10%">
    {$search_engines[search_engines].percent}%
  </td>
  <td align="left">
    {$search_engines[search_engines].string}
  </td>
</tr>
{/strip}
{/section}
</table>

<br />

<a id="search_keywords" name="search_keywords"></a>
<table cellspacing="1" cellpadding="3" align="center" bgcolor="#000000" border="0" width="760">
  <tr valign="middle" bgcolor="#79a0c7">
    <th align="center" colspan="4">
      Top {$limit} of {$total_search_keywords} Total Search Keywords
    </th>
  </tr>
  <tr>
    <td bgcolor="#a9bbcf" width="10%">
      &nbsp;
    </td>
    <td align="left" bgcolor="#a9bbcf" colspan="2" width="20%">
      Visitors searched for this
    </td>
    <td align="left" bgcolor="#a9bbcf" width="70%">
      Search Keyword(s)
    </td>
  </tr>
{section name=search_keywords loop=$search_keywords}
{strip}
<tr valign="baseline" bgcolor="#bdd0e1">
  <td align="left" bgcolor="#a9bbcf">
    {$search_keywords[search_keywords].rank}
  </td>
  <td align="left" width="10%">
    {$search_keywords[search_keywords].count}
  </td>
  <td align="left" width="10%">
    {$search_keywords[search_keywords].percent}%
  </td>
  <td align="left">
    {$search_keywords[search_keywords].string}
  </td>
</tr>
{/strip}
{/section}
</table>
{include file="footer.tpl.html"}


--- NEW FILE: current_clicks_all.php ---
<?php
//
// phpOpenTracker - The Website Traffic and Visitor Analysis Solution
//
// Copyright 2000 - 2004 Sebastian Bergmann. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// $Id: current_clicks_all.php,v 1.1 2004/04/11 09:45:14 bergmann Exp $
//

require_once('includes/prepend.php');

$visitors = array();

foreach ($clients as $clientID => $client) {

  $resultSet = phpOpenTracker::get(
    array(
      'client_id' => $clientID,
      'api_call'  => 'visitors_online',
      // see sessions since when? in minutes:
	  'session_lifetime' => '1440' 
    )
  );

  if ($resultSet) {
    foreach ($resultSet as $resultItem) {
      $index = sizeof($visitors);
      $visitors[$index]['last_access']  = $resultItem['last_access'];
      $visitors[$index]['site']         = $client;
      $visitors[$index]['document']     = implode(" -> ", $resultItem['clickpath']->documents);
      $visitors[$index]['host']         = $resultItem['host'];
      if(empty($resultItem['search_engine'])) {
	      	$visitors[$index]['referer'] = $resultItem['referer'];
      } else {
			$visitors[$index]['referer'] = $resultItem['search_engine'].': "'.$resultItem['keywords'].'"';
      }
    }
  } 
}

$table = array();

if (!empty($visitors)) {
  foreach($visitors as $visitor) $tmp[] = $visitor['last_access'];
  array_multisort($tmp, SORT_DESC, $visitors);
  foreach ($visitors as $visitor) {
      $table[] = array(
        'last_access' => date('H:i:s', $visitor['last_access']),
        'site' => $visitor['site'],
        'document' => $visitor['document'],
        'host' => $visitor['host'],
        'referer' => substr($visitor['referer'], 0, 50),
    );
  }
}

$smarty->assign('table', $table);
$smarty->assign('pot_version', PHPOPENTRACKER_VERSION);
$smarty->assign('user', $user);
$smarty->assign('page', 'clickpaths');         
$smarty->display('current_clicks.tpl.html'); 

?>
--- NEW FILE: rss_current_activity.php ---
<?php
//
// phpOpenTracker - The Website Traffic and Visitor Analysis Solution
//
// Copyright 2000 - 2004 Sebastian Bergmann. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// $Id: rss_current_activity.php,v 1.1 2004/04/11 09:45:15 bergmann Exp $
//

require_once('includes/prepend.php');
include('includes/rss10.php');

$visitors = array();

$rss=new RSSWriter("http://www.site.com/", "Site Metrics", 
	"Web traffic data.");
		
$rss->setImage("http://www.site.com/images/rss.gif",
	"Web traffic data from site.com.");

foreach ($clientSet2 as $clientID => $client) {

  $resultSet = phpOpenTracker::get(
    array(
      'client_id' => $clientID,
      'api_call'  => 'visitors_online',
      // see sessions since when? in minutes:
	  'session_lifetime' => '1440' 
    )
  );

  if ($resultSet) {
    foreach ($resultSet as $resultItem) {
      $index = sizeof($visitors);
      $visitors[$index]['last_access']  = $resultItem['last_access'];
      $visitors[$index]['site']         = $client;
      $visitors[$index]['document']     = $resultItem['clickpath']->documents[sizeof($resultItem['clickpath']->documents)-1];
      $visitors[$index]['document_url'] = $resultItem['clickpath']->document_urls[sizeof($resultItem['clickpath']->document_urls)-1];
      $visitors[$index]['host']         = $resultItem['host'];
      $visitors[$index]['referer']      = $resultItem['referer'];
    }
  } 
}

$table = array();

if (!empty($visitors)) {
  foreach($visitors as $visitor) $tmp[] = $visitor['last_access'];
  array_multisort($tmp, SORT_DESC, $visitors);
  foreach ($visitors as $visitor) {
	$rss->addItem("http://www.site.com/report/current_activity.php",
		$visitor['site'],
		array("description" => 
		date('H:i:s', $visitor['last_access'])." ".$visitor['host'].
		" ".substr(($visitor['document_url']), 0, 50)." ".
		substr(($visitor['referer'] != '' ? $visitor['referer'] : 'n/a'), 0, 50)));
  }
}

$rss->serialize();

?>
--- NEW FILE: total.php ---
<?php
//
// phpOpenTracker - The Website Traffic and Visitor Analysis Solution
//
// Copyright 2000 - 2004 Sebastian Bergmann. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// $Id: total.php,v 1.1 2004/04/11 09:45:15 bergmann Exp $
//

require_once('includes/prepend.php');

    $start = false;
    $end   = false;
    
    if (isset($start)) {
  $totalPageImpressions = phpOpenTracker::get(
    array(
      'client_id' => $clientID,
      'api_call'  => 'page_impressions',
      'start'     => $start,
      'end'       => $end
    )
  );

  $totalVisits = phpOpenTracker::get(
    array(
      'client_id' => $clientID,
      'api_call'  => 'visits',
      'start'     => $start,
      'end'       => $end
    )
  );
  }
    
    // Query first and last date for this client
    $db->query(
      sprintf(
        "SELECT MIN(timestamp) AS first_access
           FROM %s
          WHERE client_id = '%d'",

        $config['visitors_table'],
        $clientID
      )
    );
    

    $row = $db->fetchRow();

    $month = $firstMonth = date('n', $row['first_access']);
    $year  = $firstYear  = date('Y', $row['first_access']);
    $lastMonth           = date('n', time());
    $lastYear            = date('Y', time());

    // Loop through months from first to last access
    while ($year <= $lastYear) {

      // Get start and end timestamp for this month
      $start = mktime( 0,  0,  0, $month, 1, $year);
      $end   = mktime(23, 59, 59, $month, date('t', $start), $year);
      
      // Query Page Impressions for this client and month
      $pi = phpOpenTracker::get(
        array(
          'client_id' => $clientID,
          'api_call'  => 'page_impressions',
          'start'     => $start,
          'end'       => $end
        )
      );

      // Query Visits for this client and month
      $visits = phpOpenTracker::get(
        array(
          'client_id' => $clientID,
          'api_call'  => 'visits',
          'start'     => $start,
          'end'       => $end
        )
      );

      // Generate link to month statistics page
      $_month = sprintf(
        '<a href="month.php?client_id=%s&amp;month=%s&amp;year=%s">%s</a>',
        $clientID,
        $month,
        $year,
        $monthNames[($month-1)] . ' ' . $year
      );

      // Fill in monthly_statistics template variables
      $months[] = array(
          'pi_number' => $pi,
          'pi_percent' => $totalPageImpressions ? number_format(((100 * $pi) / $totalPageImpressions), 2) : 0,
          'visits_number' => $visits,
          'visits_percent' => $totalVisits ? number_format(((100 * $visits) / $totalVisits), 2) : 0,
          'month' => $_month
        );

      if ($month == $lastMonth && $year == $lastYear) {
        break;
      }

      if ($month < 12) {
        $month++;
      } else {
        $month = 1;
        $year++;
      }
    }

$smarty->assign('total_pi', $totalPageImpressions);
$smarty->assign('total_visits', $totalVisits);

$smarty->assign('months', $months);
    
$smarty->assign('first',  date('d-M-Y', isset($firstAccess) ? $firstAccess : $time));
$smarty->assign('last',  date('d-M-Y', isset($lastAccess) ? $lastAccess : $time));

$smarty->assign('client_id', $clientID); 
$smarty->assign('client', $clients[$clientID]);
$smarty->assign('limit', $limit);
$smarty->assign('pot_version', PHPOPENTRACKER_VERSION);

// reset start and end (otherwise we see only the last month)
    $start = false;
    $end   = false;

// get many similar datasets and assign smarty arrays

  $batchKeys = array(
    'pages',
    'entry_pages',
    'exit_pages',
    'exit_targets',
    'hosts',
    'referers',
    'operating_systems',
    'user_agents'
  );

  $batchWhat = array(
    'document',
    'entry_document',
    'exit_document',
    'exit_target',
    'host',
    'referer',
    'operating_system',
    'user_agent'
  );

  $table = array();

  // Loop through $batchKeys / $batchWhat
  for ($i = 0; $i < sizeof($batchKeys); $i++) {
    // Query Top <$limit> items of category <$batchWhat[$i]>
    $result = phpOpenTracker::get(
      array(
        'client_id' => $clientID,
        'api_call'  => 'top',
        'what'      => $batchWhat[$i],
        'start'     => $start,
        'end'       => $end,
        'limit'     => $limit
      )
    );

    for ($j = 0; $j < sizeof($result['top_items']); $j++) {
      // Fill in table variables
      $table[] = array(
          'rank' => $j + 1,
          'count' => $result['top_items'][$j]['count'],
          'percent' => $result['top_items'][$j]['percent'],
          'string' => $result['top_items'][$j]['string']
        );
    }
    
	$smarty->assign($batchKeys[$i], $table);
	
	// re-intialize table
	$table = array();
	
    $smarty->assign("total_".$batchKeys[$i], $result['unique_items']);
  }
  
  $totalSearchEngines  = 0;
  $totalSearchKeywords = 0;

  if (phpOpenTracker_API::pluginLoaded('search_engines')) {
    $result = phpOpenTracker::get(
      array(
          'client_id' => $clientID,
          'api_call'  => 'search_engines',
          'what'      => 'top_search_engines',
          'start'     => $start,
          'end'       => $end,
          'limit'     => $limit
      )
    );

    $totalSearchEngines = $result['unique_items'];

    for ($j = 0; $j < sizeof($result['top_items']); $j++) {
      // Fill in table variables
      $table[] = array(
          'rank' => $j + 1,
          'count' => $result['top_items'][$j]['count'],
          'percent' => $result['top_items'][$j]['percent'],
          'string' => $result['top_items'][$j]['string']
        );
    }
    
	$smarty->assign('search_engines', $table);

	// re-intialize table
	$table = array();
	
    $result = phpOpenTracker::get(
      array(
          'client_id' => $clientID,
          'api_call'  => 'search_engines',
          'what'      => 'top_search_keywords',
          'start'     => $start,
          'end'       => $end,
          'limit'     => $limit
      )
    );

    $totalSearchKeywords = $result['unique_items'];

    for ($j = 0; $j < sizeof($result['top_items']); $j++) {
      // Fill in table variables
      $table[] = array(
          'rank' => $j + 1,
          'count' => $result['top_items'][$j]['count'],
          'percent' => $result['top_items'][$j]['percent'],
          'string' => $result['top_items'][$j]['string']
        );
    }
    
    $smarty->assign('search_keywords', $table);
    
    $smarty->assign('total_search_engines', $totalSearchEngines);
    $smarty->assign('total_search_keywords', $totalSearchKeywords);
    
  } // end if 'search_engines'
 
	$num_unique_visitors = phpOpenTracker::get(
      array(
          'client_id' => $clientID,
          'api_call'  => 'num_unique_visitors'
      )
    );
	$num_one_time_visitors = phpOpenTracker::get(
      array(
          'client_id' => $clientID,
          'api_call'  => 'num_one_time_visitors'
      )
    );
	$num_returning_visitors = phpOpenTracker::get(
      array(
          'client_id' => $clientID,
          'api_call'  => 'num_returning_visitors'
      )
    );
    $num_return_visits = phpOpenTracker::get(
      array(
          'client_id' => $clientID,
          'api_call'  => 'num_return_visits'
      )
    );
	$average_visits = phpOpenTracker::get(
      array(
          'client_id' => $clientID,
          'api_call'  => 'average_visits'
      )
    );
	$average_time_between_visits = phpOpenTracker::get(
      array(
          'client_id' => $clientID,
          'api_call'  => 'average_time_between_visits'
      )
    );  
  
    $smarty->assign('num_unique_visitors', $num_unique_visitors);
    $smarty->assign('num_one_time_visitors', $num_one_time_visitors);
    $smarty->assign('num_returning_visitors', $num_returning_visitors);
    $smarty->assign('num_return_visits', $num_return_visits);
    $smarty->assign('average_visits', $average_visits);
    $smarty->assign('average_time_between_visits', $average_time_between_visits);

$smarty->assign('user', $user);
$smarty->assign('page', 'total');    
  
$smarty->display('total.tpl.html'); 
?>
--- NEW FILE: graph.php ---
<?php
//
// phpOpenTracker - The Website Traffic and Visitor Analysis Solution
//
// Copyright 2000 - 2004 Sebastian Bergmann. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// $Id: graph.php,v 1.1 2004/04/11 09:45:14 bergmann Exp $
//

require 'phpOpenTracker.php';

switch ($_GET['what']) {
  case 'access_statistics': {
    $time = time();

    phpOpenTracker::plot(
      array(
        'api_call'  => 'access_statistics',
        'client_id' => isset($_GET['client_id']) ? $_GET['client_id'] : 1,
        'start'     => isset($_GET['start'])     ? $_GET['start']     : mktime( 0, 0, 0, date('m', $time),   1, date('Y', $time)),
        'end'       => isset($_GET['end'])       ? $_GET['end']       : mktime( 0, 0, 0, date('m', $time)+1, 0, date('Y', $time)),
        'interval'  => isset($_GET['interval'])  ? $_GET['interval']  : 'day',
        'width'     => isset($_GET['width'])     ? $_GET['width']     : 640,
        'height'    => isset($_GET['height'])    ? $_GET['height']    : 480,
      )
    );
  }
  break;
}
?>



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click