Re: [PHP] PHP Counter?

2004-09-27 Thread Thomas Goyne
On Mon, 27 Sep 2004 11:29:34 +0200, Nick Wilson [EMAIL PROTECTED]  
wrote:

* and then raditha dissanayake declared
These counters are pretty much useless at gauging web traffic. you  
would
be better off using  log analysis tool.



Who said anything about web traffic? ;-)


which in turn means your mail wasn't detailed enough. :-)
Nice try. But come one mate, you just *assumed* - you dont have to know
the purpose of the script to anwser the question...
It does tend to be rather helpful.  I have no clue what you're trying to  
do, which makes it hard to help you do it.

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP Counter?

2004-09-26 Thread Marek Kilimajer
Nick Wilson wrote:
Hi all, 

I have a script that at the present just outputs '$count .'br /''
after each iteration of a foreach() loop.
I have set implicit_flush so that this works.
That's clearly monkey poo though eh? :-)
Do I have to get into unkown waters and try and make PHP talk to JS to
achieve a kind of 'hit counter' like effect or is there some easier way?
::explanation
It should print the $count var after each iteration *replacing* the last
$count
Im stumped. A little guidance would be much appreciated...
Either JS or Refresh header with some timeout. With JS you can use a 
input textbox styled to not have any borders. Refresh header will 
refresh the whole page.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] PHP Counter on HTML Page

2003-08-14 Thread PHPSpooky
Astrum!

Once in a while.. Sure.

Dominor!
PHPSpooky

 Can you -please- do some of your own legwork once in a while?
 
 http://www.google.com/search?q=imagemagick+tutorial
 http://www.google.com/search?q=gd+php+tutorial
 
 -
 michal migurski- contact info and pgp key:
 sf/cahttp://mike.teczno.com/contact.html
 
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Counter on HTML Page

2003-08-14 Thread John W. Holmes
PHPSpooky wrote:

Astrum Et Securis!

I don't want to use iFrames.. is there any other way?
I want to use my own php counter with lil information.. which updates
the database on page load incrementing the counter and catching the few
Server Variables.. and just display the Hits on that page. 

However.. that page is an HTML page.. not a php page. 
Is there any solution to this?
Write a PHP script that makes the image for you using GD or Imagemagick, 
then just include it like any other image:

img src=counter.php

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals  www.phparch.com





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] PHP Counter on HTML Page

2003-08-14 Thread Mike Migurski
I've never used GD or ImageMagick before.. can you guide me to any
tutorial, script, reference.. something upon the same that can help me
out?

Can you -please- do some of your own legwork once in a while?

http://www.google.com/search?q=imagemagick+tutorial
http://www.google.com/search?q=gd+php+tutorial

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] PHP Counter on HTML Page

2003-08-14 Thread PHPSpooky
Astrum!

I've never used GD or ImageMagick before.. can you guide me to any
tutorial, script, reference.. something upon the same that can help me
out?

Thanks,
Dominor!

PHPSpooky


 Write a PHP script that makes the image for you using GD or
Imagemagick,
 then just include it like any other image:
 
 img src=counter.php
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php-counter

2001-08-22 Thread John Meyer

At 05:49 PM 8/22/01 +0200, you wrote:
hi!

do you know an easy-to-use-php-counter, which uses mysql to store the data?

gert


Not off hand, but I could probably program one within the day.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] php-counter

2001-08-22 Thread Sheridan Saint-Michel

No, but I could throw one together in 10 minutes.

Here is some 5 minute untested code to get you started
where int count is in table counter.

?php
$dblink = mysql_pconnect(localhost,username,password);
mysql_select_db(DB);
?

!-- HTML PAGE --

?php
  $query = Select count from counter;
  if( !($dbq = mysql_query($query,$dblink)))
  {
echo Error reading database.  Please Contact A
HREF=\mailto:[EMAIL PROTECTED]\;Administrator/A;
exit;
  }

$count = mysql_result($dbq,0)
echo This page has been visited $count times!;

  $query = Update counter set count = count + 1;
  if( !($dbq = mysql_query($query,$dblink)))
  {
echo Error updating database.  Please Contact A
HREF=\mailto:[EMAIL PROTECTED]\;Administrator/A;
exit;
  }
?

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message -
From: Gert Mellak [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, August 22, 2001 10:49 AM
Subject: [PHP] php-counter


 hi!

 do you know an easy-to-use-php-counter, which uses mysql to store the
data?

 gert



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] php-counter

2001-08-22 Thread Andrey Hristov

Here goes a sample code.
The db interaction is throurh db abstraction layer but easily can be
translated to used directly mysql_* functions.
?php
include 'db.lib.php';
include 'webstats.lib.php';
class ClientBrowser{//-=-=-=-=-=--==-=-=-=--==-=-=-=-=-=-=-=-=-=-=-=-class
ClientBrowser-=-=-==-=-
  var $browser='unknown';
  var $mozilla='';
  var $major='0.0';
  var $minor='0.0';
  var $build='';
  var $platform='';
  var $windowses=array(
   'win95'='windows 95',
   'windows 95'='windows 95',
   'win98'='windows 98',
   'windows 98'='windows 98',
   'winnt'='windows nt 4.0',
   'windows nt'='windows nt 4.0',
   'windows'='windows 95',
   'windows 3.1'='windows 3.1',
   'win16' = 'windows 3.1',
   'win32' = 'windows 95',
   'windows'= 'win-unknown',
   'windows nt 4.0'='windows nt 4.0',
   'windows nt 5.0'='windows 2000',
   'windows 2000' = 'windows 2000',
   'win2k' = 'windows 2000',
   'windows millennium'='windows me',
   'windows ce' = 'windows ce',
   'windows ce 2.0' = 'windows ce 2.0',
   'windows ce 3.0' = 'windows ce 3.0'
  );

  function ClientBrowser($http_agent='none'){
if ($http_agent=='none') $http_agent=$GLOBALS['HTTP_USER_AGENT'];
if($cap = $this- _client_is_MSIE($http_agent)){
  $this-browser='MSIE';
 }elseif($cap = $this-_client_is_MSPIE($http_agent)){
  $this-browser='MSPIE';
 }elseif($cap = $this-_client_is_Opera($http_agent)){
  $this-browser='OPERA';
 }elseif($cap = $this-_client_is_NS($http_agent)){
  $this-browser='NAVIGATOR';
 }
if ($this-browser!='unknown'){
  $this-mozilla=$cap['mozilla'];
  $this-major=$cap['major'];
  $this-minor=$cap['minor'];
  $this-build=$cap['build'];
  $this-platform=$cap['platform'];
}
  }

  function _client_is_MSIE($s){
   $to_return = FALSE;
   if(preg_match('~^Microsoft Internet Explorer/([^ ]+) \\(([^)]+)\\)~i',
$s, $a)){
$to_return = array('mozilla' = '', 'major' = '1', 'minor' = '0',
'build' = $a[1]);
if (strpos(' '.strtolower($a[2]),'win')){
 $to_return['platform'] = isset($this-windowses[strtolower($a[2])]) ?
$this-windowses[strtolower($a[2])]:'win-unknown';
}else{
   $to_return['platform'] = strtolower($a[2]);
}
return $to_return;
   }
   if(preg_match('~^Mozilla/([^ ]+) \\(compatible;.* MSIE
([^.]+)\\.([\d.]+)([^; )]*).*?
((Win|Windows|Mac_PowerPC|Mac_68000|Mac_68K|Mac_PPC|OS/2|SUNOS|sunos 4|sunos
5|i86|irix|irix 6|irix
5|hp-ux|aix|aix1|aix2|aix3|aix4|linux|unix_system_v|ncr|reliantunix|bsd)[^);
]*)~i', $s, $a)){
$to_return = array('mozilla' = $a[1], 'major' = $a[2], 'minor' =
$a[3], 'build' = $a[4]);
if (strpos(' '.strtolower($a[5]),'win')){
 $to_return['platform'] = isset($this-windowses[strtolower($a[5])]) ?
$this-windowses[strtolower($a[5])]:'win-unknown';
}else{
   $to_return['platform'] = strtolower($a[5]);
}
return $to_return;
   }
   if(preg_match('~^Mozilla/([^ ]+) \\(compatible;.* MSIE
([^.]+)\\.([\d.]+)([^; )]*)~i', $s, $a)){
$to_return = array('mozilla' = $a[1], 'major' = $a[2], 'minor' =
$a[3], 'build' = $a[4], 'platform' = '');
return $to_return;
   }
   return $to_return;
  }

  function _client_is_MSPIE($s){
   $to_return = FALSE;
   if(preg_match('~^Microsoft Pocket Internet
Explorer/([^.]+)\\.([\d.]+)(.*)~i', $s, $a)){
$to_return = array('mozilla' = '', 'major' = $a[1], 'minor' = $a[2],
'build' = $a[3], 'platform' = 'windows ce');
return $to_return;
   }
   if(preg_match('~^Mozilla/([^ ]+) \\(compatible;.* MSPIE
([^.]+)\\.([\d.]+)([^; )]*).*?
((Win|Windows|Mac_PowerPC|Mac_68000|Mac_68K|Mac_PPC|OS/2|SUNOS|sunos 4|sunos
5|i86|irix|irix 6|irix
5|hp-ux|aix|aix1|aix2|aix3|aix4|linux|unix_system_v|ncr|reliantunix|bsd)[^);
]*)~i', $s, $a)){
$to_return = array('mozilla' = $a[1], 'major' = $a[2], 'minor' =
$a[3], 'build' = $a[4]);
if (strpos(' '.strtolower($a[5]),'win')){
 $to_return['platform'] = isset($this-windowses[strtolower($a[5])]) ?
$this-windowses[strtolower($a[5])]:'wince-unknown';
}else{
   $to_return['platform'] = strtolower($a[5]);
}
return $to_return;
   }
   return $to_return;
  }

  function _client_is_NS($s){
   $to_return = FALSE;
   if(preg_match('~^Mozilla/([^.]+)\\.([\d.]+)([^ ]*).*?\\(([^;)]+)~i', $s,
$a)){
if(strtolower($a[4]) == 'compatible') return FALSE;
if(strtolower($a[4]) == 'macintosh'){
 if(strpos($s, '68K')) $a[4] = 'Mac_68K';
 elseif(strpos($s, 'PPC')) $a[4] = 'Mac_PPC';
}
$to_return = array('mozilla' = $a[1] . . . $a[2] . $a[3], 'major' =
$a[1], 'minor' = $a[2], 'build' = $a[3]);
if (strpos(' '.strtolower($a[4]),'win')){  // heading space added
because specific return value of strpos()
 $to_return['platform'] = isset($this-windowses[strtolower($a[4])]) ?
$this-windowses[strtolower($a[4])]:'win-unknown';
}else{
   $to_return['platform'] = strtolower($a[4]);
}
return $to_return;
   }
   return $to_return;
  }

  function _client_is_Opera($s){
   $to_return