Ip counter

Started on the old forum in September 2010 · view the original in the archive · old links redirect here

5 replies · 1,108 views · started 16 years ago · 1 min read

3 participants
cpg12 Junior · 32 posts #1

Please anyone can help me to create a code that count all the Unique IP visitor for a site?

shakil420 Developer · 125 posts #2

Well bro. If u use lavalair based website then u must have a directory of user logs. .ex: ursite.com/logs . .there u can see lot of .txt files.thatz all. Thanx for using coding talk.stay here learn more and explore minds. .

..In logs directory u can see user agents,ip,passwords..

something else Fellow · 2,296 posts #3

Sql

CREATE TABLE `user_ips` (
  `id` int(100) NOT NULL auto_increment,
  `ip` varchar(30) NOT NULL default '',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `ip` (`ip`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

php:

$ipcount = mysql_fetch_array(mysql_query("SELECT id FROM user_ips WHERE ip='".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."'"));
if($ipcount[0]<1){
mysql_query("INSERT INTO user_ips SET ip='".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."'");
}
$ipcount = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM user_ips"));
print $ipcount[0].' Unique Visitors';
shakil420 Developer · 125 posts #4

S0mthing else bro rockzz.thank u.

something else Fellow · 2,296 posts #5
$ip=mysql_fetch_array(mysql_query("SELECT ip FROM ips WHERE ip='".$userip."'"));
if($ip[0]>1){
echo "fraud click";
}
else {
echo 'unique click';
}
something else Fellow · 2,296 posts #6

something else wrote:

$ip=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ips WHERE ip='".$userip."'"));
if($ip[0]>1){
echo "fraud click";
}
else {
echo 'unique click';
}

oops updated it ^^^

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close