Location: PHPKode > scripts > txtPHPCounter > txtphpcounter/functions.inc.php
<?
// -------------------------------- Functions Below ----------------------


// Create Graphics Output---------------------Create Graphics Output
function DoGraphics($count) {
  global $img_path;
  for($i=0; $i<strlen($count); $i++) {
    $retStr .= "<img src=\"" . $img_path . substr($count,$i,1) . ".gif\" alt\"" . substr($count,$i,1) . "\" border=\"0\" />";
  }
  return $retStr;
}


// Total Hits---------------------------------Total Hits
function TotalHits($graphics) {
global $arr;
  for($i=0;$i<count($arr)+1;$i++) {
      $count+=$arr[$i][1];
  }
  if($graphics==TRUE) {
    return DoGraphics($count);
  }else{
    return $count;
  }
}


// Unique Visitors----------------------------Unique Visitors
function UniqueHits($graphics) {
global $arr;
  if($graphics==TRUE) {
    return DoGraphics(count($arr));
  }else{
    return count($arr);
  }
}


// Impressions--------------------------------Impressions
function MyImpressions($graphics) {
global $arr;
global $RemoteIP;
  for($i=0;$i<count($arr)+1;$i++) {
    if($arr[$i][0]==$RemoteIP) {
      if($graphics==TRUE) {
        return DoGraphics($arr[$i][1]);
      }else{
        return $arr[$i][1];
      }      
      break;
    }
  }
}


// List Visitors------------------------------List Visitors
function ListVisitors($listNums, $graphics) {  
global $arr;
  $sndStr .= "<table border=\"1\" cellpadding=\"3\" cellspacing=\"0\"><tr><td>IP Address</td>";
  if($listNums==TRUE) { $sndStr .= "<td>Visits</td>"; }
  $sndStr .= "</tr>";
  for($i=0;$i<count($arr)+1;$i++) {
    if(trim($arr[$i][0])!="") { 
      $sndStr .= "<tr><td>" . $arr[$i][0] . "</td>";
      if($listNums==TRUE) {
        if($graphics==TRUE) {
          $sndStr .= "<td class=\"right\">" . DoGraphics($arr[$i][1]) . "</td>";
        }else{
          $sndStr .= "<td class=\"right\">" . $arr[$i][1] . "</td>"; 
        }
        $sndStr .= "</tr>";
      }
    }
  }
  $sndStr .= "</table>";    
  return $sndStr;   
}
?>
Return current item: txtPHPCounter