Make a Simple Visitor Counter Using Php(In Hindi)-
App Sbhi Ne Website Me Dekha Hoga Ki Wanha Footer Section Me Total Number Of Visitor Means Kitne Visitor(Logo) Ne Hmare Website Ko Open Kiya Hai Ye Sare Detail Kisi Be Website Me Aap Dekh Sakte Ho
Ajj Me Apko Php And Mysql Ki Codding Karke Btaunga Ki Aap Kis Prakar Apne Website Me Total Number Of Visiter Ka Option Add Kar Sakte Ho Easily.
Create A Visitor Counter For Our Website Using PHP-
Aap Ek File Bana Lijiye-
Index.php
<?php
$con=mysqli_connect("localhost","root","","sample2");
$year = date("Y");
$month = date("m");
$day = date("d");
//for user id address
$user_ip=$_SERVER['REMOTE_ADDR'];
//check ip of user
$ip_checking = mysqli_query($con,"select userip from pageview where page='yourpage' and userip='$user_ip'");
if(mysqli_num_rows($ip_checking)>=1)
{
}
else
{
$insertindatabase = mysqli_query($con,"insert into pageview values('','yourpage','$user_ip','$year','$month','$day')");
}
?>
<html>
<body>
<h1>VISITOR COUNTER DETAIL</h1>
Total Visitor In <?php echo date("Y"); ?>
[
<?php
$result = mysqli_query($con,"SELECT * FROM pageview where page='yourpage' and year='$year'");
$get_ip = mysqli_num_rows($result);
echo $get_ip;
?>]
<br>
Total Visitor In <?php echo date("M"); ?>
[<?php
$result=mysqli_query($con,"SELECT * FROM pageview where page='yourpage' and year='$year' and month='$month'");
$get_ip = mysqli_num_rows($result);
echo $get_ip;
?>]
</br>
Total Visitor Today- <?php echo date("D"); ?>[
<?php
$result = mysqli_query($con,"SELECT * FROM pageview where page='yourpage' and year='$year' and month='$month' and day='$day'");
$get_ip = mysqli_num_rows($result);
echo $get_ip;
?>]
<br>
Total Visitor of these website In All Time
[
<?php
$result = mysqli_query($con,"SELECT * FROM pageview where page='yourpage'");
$get_ip = mysqli_num_rows($result);
echo $get_ip;
?>]
</body>
</html>
· Ab Aap Database Bana Lijiye Sample2 Name Se
· Yanha Apko Table Create Karne Hai Pagewiew Name Se Ya Simple Aap
· Apne Browser Me Locahost/Phpmyadmin Section Open Karke Query Me Niche Nig Ye Statement Ko Execute Karde Apke Wanha Automatically Database And Table Create Ho Jayege
-- phpMyAdmin SQL Dump
-- version 4.7.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 28, 2018 at 01:21 PM
-- Server version: 10.1.26-MariaDB
-- PHP Version: 7.1.8
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `sample2`
--
-- --------------------------------------------------------
--
-- Table structure for table `pageview`
--
CREATE TABLE `pageview` (
`id` int(11) NOT NULL,
`page` text NOT NULL,
`userip` text NOT NULL,
`year` int(11) NOT NULL,
`month` int(11) NOT NULL,
`day` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `pageview`
--
INSERT INTO `pageview` (`id`, `page`, `userip`, `year`, `month`, `day`) VALUES
(1, 'yourpage', '::1', 2017, 10, 5),
(2, 'yourpage', '127.0.0.1', 2017, 10, 31),
(3, 'yourpage', '', 2018, 4, 28);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `pageview`
--
ALTER TABLE `pageview`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `pageview`
--
ALTER TABLE `pageview`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Is Parkar Aap Ise Apne Website Me Integrate Kar Sakte Hai Ab Jab Be Koi Visitor Apne Computer Ya Mobile Se Hmare Website Par Ayega To Uska Ip Address Ke Addar Par Hmare Website Me Wo Count Hoga .Is Visitor counter Ki Sabse Badi bat ye hai ki yeh Unique Visitor ko He Count karege means ye Ip Address par based hai ek Ip address ko sirf ek bar Count Karegea
Me Ummid Karta Hu Ki Apko Mere Ye Post Achi Lagi Hogi Agar Apka Koi Be Swal Ho To Aap Mujse Comment Section Me Puch Sakte Ho Me Apki Puri Sahayta Karunga
Thank You
Team Gajabwap Web In Hindi
5 comments
Click here for commentsnice information. bro your all code are working I like it bro
Replynice article sir mere email ID par yeah code bhej dijiye soniyasharma123@gmail.com
Replyawesome.. Esse mujhe boht help mili hai
Replyphp training in chandigarh
very nice information bro....... this article is awsmmmmmmmmm
ReplyHai I am dharm
ReplyConversionConversion EmoticonEmoticon