|
|
|
|
![]() ![]() |
Apr 9 2006, 12:16 AM
Post
#31
|
|
|
Advanced Member Group: Members Posts: 190 Joined: 16-February 06 From: Egypt Member No.: 11,326 |
This will not insert any data into the database, it will always say 0 Hits
WOW, i found a solution: CODE $conn = mysql_connect("localhost","db_username","db_password") or die('MySQL said: ' . mysql_error()); $db = mysql_select_db("db_name"); $sql = mysql_query("SELECT * FROM counter") or die('MySQL said: ' . mysql_error()); while($visits = mysql_fetch_array($sql)) { $visits = $visits['visits']; $visits_new = $visits + 1; } $query = "UPDATE counter SET visits = '$visits_new'"; mysql_query($query, $conn) or die(mysql_error()); echo "$visits_new Visits"; i removed TABLE from: $query = "UPDATE TABLE counter SET visits = '$visits_new'"; and don't forget to set the visits value in the database to zero or any number you want, just don't leave it as default. |
|
|
|
Jul 9 2006, 05:33 PM
Post
#32
|
|
|
Newbie [ Level 2 ] Group: Members Posts: 27 Joined: 9-July 06 Member No.: 14,399 |
Dose this script count page loads or unique ips? I have been searching fo a php script that count's unique visitors and not just page loads. Is there a way to mod this?
|
|
|
|
Mar 21 2007, 07:27 PM
Post
#33
|
|
|
Advanced Member Group: Members Posts: 149 Joined: 14-February 07 From: Tuticorin, India Member No.: 20,415 myCENTs:0.55 |
wow a great simple and effective counter.
|
|
|
|
May 4 2007, 09:38 PM
Post
#34
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 4 Joined: 4-May 07 Member No.: 21,796 |
verry good & no mysql !
|
|
|
|
Feb 16 2008, 02:37 AM
Post
#35
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 6 Joined: 15-February 08 Member No.: 28,436 |
Good... but you might find others steal your counter if they find it... they will link to your counter script, and store their page cound on your server. its always good to add some kind of proetection againsed this. a good, but not perfect way is to make sure the referer comes from your own site, and nobody elses. you misunder stand my meaning....... i mean someone could replace CODE <p>Number of guests visiting my site: <? include('alle.txt'); ?>.</p> the include file with a coomplete URL to anouther server. and replace "alle.txt" with a different filename. A solution to your problem just encode your webpage. |
|
|
|
Feb 17 2008, 05:00 PM
Post
#36
|
|
|
Member [ Level 1 ] Group: Members Posts: 48 Joined: 5-February 08 From: Japan Member No.: 28,155 |
file based counter may jam - sometimes it wont be able to overwirte the data - when many visitors navigate to your web.
The other problem is if you ain't got permissions to open a file on your server...hence host dependent. |
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|
Lo-Fi Version | Time is now: 22nd November 2008 - 10:16 PM |