Re: [PHP] PHP Counter?
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?
Nick Wilson wrote: Hi all, I have a script that at the present just outputs '$count .''' 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
[PHP] PHP Counter?
Hi all, I have a script that at the present just outputs '$count .''' 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... -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Counter on HTML Page
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: > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Counter on HTML Page
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? Dominor! PHPSpooky ~ "Every man has a right to fulfill his own Will without being afraid that it may interfere with that of others; for if he is in his proper path, it is the fault of others if they interfere with him. Do what thy wilt shall be the whole of the Law! Love is the Law, Love under Will" - Aleister Crowley, "Magick without Tears" Rahul Sitaram 'fearless' Johari {rahulsjohari.com} Shining Star Productions [Italy] The Internet Architects Group [USA] NKB Software Solutions (P) Ltd. [India] ~ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Counter on HTML Page
>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
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: -- ---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
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
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 = FALSE; if(preg_match('~Mozilla/([^ ]+) \\(((Win|Windows|Mac_PowerPC|Mac_68000|Mac_68K|Mac_PPC)[^);]*).*Opera ([^.]+)\\.([\d.]+)([^; )]*)~i', $s, $a)){ $to_return = array('mozilla' => $a[1], 'major' => $a[4], 'minor' => $a[5], 'build' => $a[6]); 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('~Opera/([^.]+)\\.([\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' => '', 'major' => $a[1], 'minor' => $a[2], 'build' => $a[3]); if (strpos(' '.strtolower($a[5]),'win')){ $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; } } // -=-=-=-=-=--==-=-=-=--==-=-=-=-=-=-=-=-=-=-=-=-class ClientBrowser-=-=-==-=- // -=--==-=-=-=-=-=--==-=-=-=-=--==-=-MAIN--==-=-=--==-=--==-=-=-=-// $client = new ClientBrowser($HTTP_USER_AGENT); $page_name = $HTTP_GET_VARS['page']; $screen_width = $HTTP_GET_VARS['scr_w']+0; $screen_height = $HTTP_GET_VARS['scr_h']+0; $screen_color = $HTTP_GET_VARS['scr_c']+0; if (preg_match('/^([0-9\.]+)$/',$screen_width.''.$screen_height.''.$screen_colo r)==0){ exit; } if ($WEBSTATS_pages[$page_name]['collecting']==1){ // You must have the $WEBSTATS_pages array in the included file webstats.lib.php . Collecting shows if we collect info about this page db_connect(); $res = db_exec('SELECT COUNT(*) FROM webPages WHERE webpage_name="'.$page_name.'";'); list($is_there)=db_fetch_array($res); if ($is_there==0){ db_free_result($res); db_exec('INSERT INTO webPages VALUES("","'.$page_name.'");'); }else{ db_free_result($res); } $res = db_exec('SELECT webpage_id FROM webPages WHERE webpage_name="'.$page_name.'";'); list($webpage_id) = db_fetch_array($res); db_free_result($res); $sql_to_exec = "SELECT COUNT(*) FROM webStats WHERE webpage_id=$webpage_id AND os_name='".$client->platform. "' AND browser='".$client->browser." ".$client->major.".".$client->minor. "' AND screen_w=$screen_width AND screen_h=$screen_height AND screen_c=$screen_color;"; $res = db_exec($sql_to_exec); $is_there = 0; list($is_there) = db_fetch_array($res); db_free_result($res); if ($is_there==1){ $update_sql = "UPDATE webStats set counter=counter+1 WHERE webpage_id=$webpage_id AND os_name='".$client->platform. "' AND browser='".$client->browser." ".$client->major.".".$client->minor. "' AND screen_w=$screen_width AND screen_h=$screen_height AND screen_c=$screen_color;"; db_exec($update_sql); }else{ $insert_sql = "INSERT INTO webStats (webpage_id, os_name, browser, screen_w, screen_h, screen_c, counter) ". "VALUES($webpage_id,'".$client->platform."','".$client->browser." ".$client->major.".".$client->minor."',". "$screen_width, $screen_height, $screen_color, 1);"; db_exec($insert_sql); } } ?> Andrey Hristov IcyGEN Corporation http://www.icygen.com 99% - Original Message - From: "Gert Mellak" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, August 22, 2001 6:49 PM 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
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. mailto:[EMAIL PROTECTED]\";>Administrator"; 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 mailto:[EMAIL PROTECTED]\";>Administrator"; 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
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]
[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]