Pop-ups

Status
Niet open voor verdere reacties.

Rolf Veenhuizen

Gebruiker
Lid geworden
25 feb 2007
Berichten
85
Ik heb op een website een telelr van webstats motigo. Ik heb blijkbaar de kleine lettertjes niet gelezen, wan ter verschijnen nu hierdoor zeer regelmatig pop-ups wanneer een pagina geopend wordt. Is er een mogelijkheid om dit te voorkomen, zonder de teller te verwijderen?

Alvast bedankt!
 
Een fatsoenlijk teller script nemen :)

Die dingen zijn overal te vinden en heel simpel te bouwen, dus gewoon deze weggooien en een betere nemen.
 
Als je php hebt heb ik een mooie code.
ff gekopieert en geplakt vanuit mijn site:
Hoi,
Ik heb een mooie code op internet gevonden en aangepast zodat er een goede site counter uitkomt.
Het script:
Stats.php
Code:
<strong><br /> 
              <?php 
 ob_start(); 

 error_reporting(E_ALL); 

 include("config.php"); 

 mysql_connect($conf['MysqlHost'], $conf['MysqlUser'], $conf['MysqlPass']); 
 mysql_select_db($conf['MysqlDb']); 
?> 
<html> 

<head> 
<title>Statistieken :: <?php echo $conf['Titel']; ?></title> 
<style> 
body, td { font-family: Verdana; font-size: x-small; } 
</style> 
</head> 

<body> 

<center> 
<?php 
 if($conf['Totaal']) { 
  $query = mysql_query("SELECT * FROM stats GROUP BY ip") or die(mysql_error()); 
  $uhits = mysql_num_rows($query); 

  $hits = mysql_result(mysql_query("SELECT sum(hits) as total FROM stats"), 0, "total"); 

  $query = mysql_query("SELECT * FROM stats GROUP BY datum") or die(mysql_error()); 
  $delen = mysql_num_rows($query); 

  $total = $uhits + $hits; 

  $bar1 = round($hits / $total * 100); 
  $bar2 = round($uhits / $total * 100); 
?> 
<table border="0" cellpadding="5" cellspacing="0" width="100%" style="border: 1px solid #DDDDDD;"> 
 <tr> 
  <td colspan="2" style="border-bottom: 1px dashed #DDDDDD;" bgcolor="#EFEFEF"><b>Totaal</b></td> 
 </tr> 
 <tr> 
  <td width="140">Hits: (<?php echo $hits; ?>)</td> 
  <td><img src="bar_line.gif" width="1" height="15"><img src="bar_line.gif" width="1" height="15"><img src="bar_line.gif" width="1" height="15"></td> 
 </tr> 
 <tr> 
  <td width="140" bgcolor="#EFEFEF">Unieke hits: (<?php echo $uhits; ?>)</td> 
  <td bgcolor="#EFEFEF"><img src="bar_line.gif" width="1" height="15"><img src="bar_line.gif" width="1" height="15"><img src="bar_line.gif" width="1" height="15"></td> 
 </tr> 
</table> 
<br> 
<?php 
 } 

 $select1 = mysql_query("SELECT * FROM stats GROUP BY datum ORDER BY datum DESC LIMIT 0,".$conf['Limit']) or die (mysql_error()); 

 while($get = mysql_fetch_object($select1)) { 
  $select = mysql_query("SELECT * FROM stats WHERE datum = '".$get->datum."'") or die (mysql_error()); 
  $uhits = mysql_num_rows($select); 

  $hits = mysql_result(mysql_query("SELECT sum(hits) as total FROM stats WHERE datum = '".$get->datum."'"), 0, "total"); 

  $total = $uhits + $hits; 

  $bar1 = $hits / $total * 100; 
  $bar2 = $uhits / $total * 100; 

  $date = explode("-", $get->datum); 
?> 
<table border="0" cellpadding="5" cellspacing="0" width="100%" style="border: 1px solid #DDDDDD;"> 
 <tr> 
  <td colspan="2" style="border-bottom: 1px dashed #DDDDDD;" bgcolor="#EFEFEF"><b><?php echo $date[2]."-".$date[1]."-".$date[0]; ?></b></td> 
 </tr> 
 <tr> 
  <td width="140">Hits: (<?php echo $hits; ?>)</td> 
  <td><img src="bar_line.gif" width="1" height="15"><img src="bar_line.gif" width="1" height="15"><img src="bar_line.gif" width="1" height="15"></td> 
 </tr> 
 <tr> 
  <td width="140" bgcolor="#EFEFEF">Unieke hits: (<?php echo $uhits; ?>)</td> 
  <td bgcolor="#EFEFEF"><img src="bar_line.gif" width="1" height="15"><img src="bar_line.gif" width="1" height="15"><img src="bar_line.gif" width="1" height="15"></td> 
 </tr> 
</table> 
<br> 
<?php 
 } 
?>
Dit plaats je waar geteld moet worden
Code:
<?php 
 include("config.php"); 

 mysql_connect($conf['MysqlHost'], $conf['MysqlUser'], $conf['MysqlPass']); 
 mysql_select_db($conf['MysqlDb']); 

 $query = mysql_query("SELECT * FROM stats WHERE ip = '".$_SERVER['REMOTE_ADDR']."' AND datum = '".date("Y-m-d")."'") or die(mysql_error()); 
 $count = mysql_num_rows($query); 

 if($count == 0) { 
  $query = "INSERT INTO stats (ip, datum, hits) VALUES ('".$_SERVER['REMOTE_ADDR']."', '".date("Y-m-d")."', '1')"; 
 } else { 
  $obj = mysql_fetch_object($query); 
  $hits = $obj->hits + 1; 
  $query = "UPDATE stats SET hits = '".$hits."' WHERE ip = '".$_SERVER['REMOTE_ADDR']."' AND datum = '".date("Y-m-d")."'"; 
 } 

 mysql_query($query) or die(mysql_error()); 
?>
config.php
Code:
<?php 
 $conf['MysqlHost'] = "localhost"; // Mysql host (meestal localhost) 
 $conf['MysqlUser'] = "***"; // Mysql gebruiker 
 $conf['MysqlPass'] = "***"; // Mysql wachtwoord 
 $conf['MysqlDb'] = "***"; // Mysql database 

 ########################################### 

 $conf['Titel'] = "SiteTile.nl"; // Titel van je site 
 $conf['Totaal'] = TRUE; // TRUE als hij het totaal moet laten zien en FALSE als dat niet moet 
 $conf['Limit'] = 30; // Van hoeveel dagen moet hij de statistieken laten zien 
?>
MySQL
Code:
CREATE TABLE `stats` ( 
  `ip` varchar(20) NOT NULL DEFAULT '', 
  `datum` date NOT NULL DEFAULT '0000-00-00', 
  `hits` int(10) NOT NULL DEFAULT '1' 
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


Voorbeeld:
http://www.opensourceweb.nl/stats.php
De counter staat op http://www.opensourceweb.nl/
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan