Note that there are some explanatory texts on larger screens.

plurals
  1. POstrange behavior in my statistics php script
    primarykey
    data
    text
    <p>i ve just created a website, where in the admin panel there is a statsitics module that is very important, and that recognize if an user visit the website for the first time (<strong>unique</strong>) or has already visit the website (<strong>raw</strong>).</p> <p>to recognize if the user is unique or not, the script check if the ip is the same or if a cookie exist (on the same day).</p> <pre><code>if( isset( $_COOKIE['c'] ) &amp;&amp; !empty( $_COOKIE['c'] ) &amp;&amp; ctype_alnum( $_COOKIE['c'] ) ) { $cookie = secure_field( $_COOKIE['c'] ); } else { $cookie = NULL; } $res = mysqli_query( $con, "SELECT id FROM table WHERE ( ip = '$ip' OR id = '$cookie' ) AND DATE_FORMAT( datetime, '%d.%m.%y' ) = DATE_FORMAT( now(), '%d.%m.%y' ) ORDER BY datetime DESC LIMIT 1" ); if( mysqli_num_rows( $res ) == 0 ) { $unique = 1; } else { $unique = 0; } </code></pre> <p>with me this script work perfectly (i've try with many browser, deleting cookie, change IP,..). But now i ve just see a strange behavior with an user, that use the same IP but all it's visits are registred as UNIQUE! </p> <p>here the registred records (i've masked the ip for privacy):</p> <pre><code>2013-09-09 06:06:05 unique 112.201.***.*** Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.36 (K... 2013-09-09 06:06:14 unique 112.201.***.*** Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.36 (K... 2013-09-09 06:11:58 unique 112.201.***.*** Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.36 (K... 2013-09-09 06:14:11 unique 112.201.***.*** Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.36 (K... 2013-09-09 06:17:05 unique 112.201.***.*** Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.36 (K... 2013-09-09 06:17:15 unique 112.201.***.*** Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.36 (K.. </code></pre> <p>How is that possibile? and how i can fix that?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload