Hey all, i want in my website visitor counter list showing. Plz, can any one tell me script for that and what i have to do.
Cheersssssssss......
Hey all, i want in my website visitor counter list showing. Plz, can any one tell me script for that and what i have to do.
Cheersssssssss......
asked for a visitor counter. There are three practical routes: a quick third‑party widget (fast but gives away control and can send data to another provider), a self‑hosted PHP+database counter (full control, privacy, flexible) or a full analytics service (detailed reports). and pointed toward external widgets; that works for speed but has privacy and accuracy tradeoffs. and correctly handled forum placement; for PHP-specific help, use the PHP forum.
A lightweight, privacy‑friendly pattern: issue each browser a long‑lived random visitor token (cookie), record a hashed IP + user agent and timestamps in a visitors table, and update that row on repeat views. Use prepared statements (PDO) and avoid storing raw IPs by hashing with a secret salt. To keep counts sensible, only increment after a time threshold (for example, 30 minutes). Example concept (trimmed):
// concept only - adapt and secure before use
$salt = 'LONG_RANDOM_SALT';
if (empty($_COOKIE['visitor_id'])) {
$vid = bin2hex(random_bytes(16));
setcookie('visitor_id',$vid,time()+31536000,'/','',isset($_SERVER['HTTPS']),true);
$ip_hash = hash('sha256',($_SERVER['REMOTE_ADDR'] ?? '').$salt);
$pdo->prepare("INSERT INTO visitors (visitor_id,ip_hash,ua,first_visit,last_visit,visits) VALUES (?,?,?,?,NOW(),1)")
->execute([$vid,$ip_hash,$_SERVER['HTTP_USER_AGENT'] ?? '']);
} else {
$pdo->prepare("UPDATE visitors SET last_visit=NOW(),visits=visits+1 WHERE visitor_id=?")
->execute([$_COOKIE['visitor_id']]);
} Notes and troubleshooting: use UTC for timestamps, check cookie domain/path and HTTPS flags, and be aware that user agents and IPs can be spoofed—so counts are approximate. For cookie behavior see HTTP cookies - MDN and for PHP cookie usage see setcookie - PHP manual.
Jump to Post— jasimp 427Your question would be better suited to one of these forums.
i think choose the website
Moved to a more appropriate forum.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.