Problem with conuting users visiting site

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Leszek

    Problem with conuting users visiting site

    Hi.
    I've written a litle script that should count how many users visited the
    site each day.
    The problem is that now i can see over hundred different ip number in
    database but on the web site of the counter (istats5)
    i that the site was visited only 55 times today. Can anyone tell me why does
    this happen? Do you think that the script doesn't work properly? Or maybe
    its a case of a few users is visiting the site at the same time?

    This is the script (each ip counts only once a day and the data from
    database is deleted after midnight)
    <?php
    $ip = $_SERVER['REMOTE_ADDR'];
    $data=date('Y-m-d');
    $dzis=getdate(s trtotime("$data "));
    $_SESSION['statystyka']="nie";
    $zapytanie15="S ELECT numer_ip, kiedy,id FROM statystyka";
    $wynik15=mysql_ query($zapytani e15);
    if($wynik15){
    while($wiersz15 =mysql_fetch_ar ray($wynik15,MY SQL_NUM))
    {
    if (($ip==$wiersz1 5[0])&&($data==$wie rsz15[1])){

    $_SESSION['statystyka']="tak";
    }
    if($data!=$wier sz15[1]){
    $kiedy=$wiersz1 5[1];
    $iledni=getdate (strtotime("$ki edy"));
    $delta=$dzis['yday']-$iledni['yday'];
    if($delta>=1){
    $zapytanie18="D ELETE
    FROM statystyka WHERE id='".$wiersz15[2]."'";
    $wynik18=mysql_ query($zapytani e18);
    }

    }
    }
    }
    if($_SESSION['statystyka']=="nie"){
    echo "<script language=\"java script\">
    var ipath='www.szac hy.biz/istats5'
    document.write( '<SCR' + 'IPT LANGUAGE=\"Java Script\"
    SRC=\"http://'+ ipath +'/istats.js\"><\/SCR' + 'IPT>');
    </script>";
    $zapytanie16="I NSERT INTO statystyka (numer_ip, kiedy) VALUES
    ('".$ip."','".$ data."')";
    $wynik16=mysql_ query($zapytani e16);
    }
    ?>

    Thanks. Leszek


  • IchBin

    #2
    Re: Problem with conuting users visiting site

    Leszek wrote:
    Hi.
    I've written a litle script that should count how many users visited the
    site each day.
    The problem is that now i can see over hundred different ip number in
    database but on the web site of the counter (istats5)
    i that the site was visited only 55 times today. Can anyone tell me why does
    this happen? Do you think that the script doesn't work properly? Or maybe
    its a case of a few users is visiting the site at the same time?
    >
    This is the script (each ip counts only once a day and the data from
    database is deleted after midnight)
    <?php
    $ip = $_SERVER['REMOTE_ADDR'];
    $data=date('Y-m-d');
    $dzis=getdate(s trtotime("$data "));
    $_SESSION['statystyka']="nie";
    $zapytanie15="S ELECT numer_ip, kiedy,id FROM statystyka";
    $wynik15=mysql_ query($zapytani e15);
    if($wynik15){
    while($wiersz15 =mysql_fetch_ar ray($wynik15,MY SQL_NUM))
    {
    if (($ip==$wiersz1 5[0])&&($data==$wie rsz15[1])){
    >
    $_SESSION['statystyka']="tak";
    }
    if($data!=$wier sz15[1]){
    $kiedy=$wiersz1 5[1];
    $iledni=getdate (strtotime("$ki edy"));
    $delta=$dzis['yday']-$iledni['yday'];
    if($delta>=1){
    $zapytanie18="D ELETE
    FROM statystyka WHERE id='".$wiersz15[2]."'";
    $wynik18=mysql_ query($zapytani e18);
    }
    >
    }
    }
    }
    if($_SESSION['statystyka']=="nie"){
    echo "<script language=\"java script\">
    var ipath='www.szac hy.biz/istats5'
    document.write( '<SCR' + 'IPT LANGUAGE=\"Java Script\"
    SRC=\"http://'+ ipath +'/istats.js\"><\/SCR' + 'IPT>');
    </script>";
    $zapytanie16="I NSERT INTO statystyka (numer_ip, kiedy) VALUES
    ('".$ip."','".$ data."')";
    $wynik16=mysql_ query($zapytani e16);
    }
    ?>
    >
    Thanks. Leszek
    >
    >
    May be that their are search engines or crawlers hitting your site?

    Thanks in Advance...
    IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
    _______________ _______________ _______________ _______________ ______________

    'If there is one, Knowledge is the "Fountain of Youth"'
    -William E. Taylor, Regular Guy (1952-)

    Comment

    Working...