SlideShare a Scribd company logo
Script
<?php
include_once "koneksi.php";
$ip = $_SERVER['REMOTE_ADDR']; // Getting the user's computer IP
$tanggal = date("Ymd"); // Getting the current date
$waktu = time(); //
// Check your by IPnya, whether the user has had access to today's
$s = mysql_query("SELECT * FROM statistik WHERE ip='$ip' AND tanggal='$tanggal'");
// If not there, save the user data to the database
if(mysql_num_rows($s) == 0){
mysql_query("INSERT INTO statistik(ip, tanggal, hits, online) VALUES('$ip','$tanggal','1','$waktu')");
}
else{
mysql_query("UPDATE statistik SET hits=hits+1, online='$waktu' WHERE ip='$ip' AND
tanggal='$tanggal'");
}
$pengunjung = mysql_num_rows(mysql_query("SELECT * FROM statistik WHERE tanggal='$tanggal'
GROUP BY ip"));
$totalpengunjung = mysql_result(mysql_query("SELECT COUNT(hits) FROM statistik"), 0);
$hits = mysql_fetch_assoc(mysql_query("SELECT SUM(hits) as hitstoday FROM statistik WHERE
tanggal='$tanggal' GROUP BY tanggal"));
$totalhits = mysql_result(mysql_query("SELECT SUM(hits) FROM statistik"), 0);
$tothitsgbr = mysql_result(mysql_query("SELECT COUNT(hits) FROM statistik"), 0);
$bataswaktu = time() - 300;
$pengunjungonline = mysql_num_rows(mysql_query("SELECT * FROM statistik WHERE online >
'$bataswaktu'"));
$path = "counter/";
$ext = ".png";
$tothitsgbr = sprintf("%06d", $tothitsgbr);
for ( $i = 0; $i <= 9; $i++ ){
$tothitsgbr = str_replace($i, "<img src='$path$i$ext' alt='$i'>", $tothitsgbr);
}
echo "<br /><p align=center>$tothitsgbr </p>
<table>
<tr><td class='news-title'><img src=counter/hariini.png> Pengunjung hari ini </td><td class='news-title'>
: $pengunjung </td></tr>
<tr><td class='news-title'><img src=counter/total.png> Total pengunjung </td><td class='news-title'> :
$totalpengunjung </td></tr>
<tr><td class='news-title'><img src=counter/hariini.png> Hits hari ini </td><td class='news-title'> :
$hits[hitstoday] </td></tr>
<tr><td class='news-title'><img src=counter/total.png> Total Hits </td><td class='news-title'> : $totalhits
</td></tr>
<tr><td class='news-title'><img src=counter/online.png> Pengunjung Online </td><td class='news-title'>
: $pengunjungonline </td></tr>
</table>";
?>
Database:
Tabel: Statistik

More Related Content

What's hot

Threading
ThreadingThreading
Threading
b290572
 

What's hot (20)

AngularJS $http Interceptors (Explanation and Examples)
AngularJS $http Interceptors (Explanation and Examples)AngularJS $http Interceptors (Explanation and Examples)
AngularJS $http Interceptors (Explanation and Examples)
 
Flutter Reactive Programming 介紹 - part 1 (Stream)
Flutter Reactive Programming 介紹 - part 1 (Stream)Flutter Reactive Programming 介紹 - part 1 (Stream)
Flutter Reactive Programming 介紹 - part 1 (Stream)
 
19. CodeIgniter imagini in mysql
19. CodeIgniter imagini in mysql19. CodeIgniter imagini in mysql
19. CodeIgniter imagini in mysql
 
Php Mysql
Php Mysql Php Mysql
Php Mysql
 
G* on GAE/J 挑戦編
G* on GAE/J 挑戦編G* on GAE/J 挑戦編
G* on GAE/J 挑戦編
 
Etoy proyecto
Etoy proyectoEtoy proyecto
Etoy proyecto
 
Threading
ThreadingThreading
Threading
 
TDC2015 Porto Alegre - Automate everything with Phing !
TDC2015 Porto Alegre - Automate everything with Phing !TDC2015 Porto Alegre - Automate everything with Phing !
TDC2015 Porto Alegre - Automate everything with Phing !
 
HeadCouch - CouchDB PHP Client
HeadCouch - CouchDB PHP ClientHeadCouch - CouchDB PHP Client
HeadCouch - CouchDB PHP Client
 
MySQL flexible schema and JSON for Internet of Things
MySQL flexible schema and JSON for Internet of ThingsMySQL flexible schema and JSON for Internet of Things
MySQL flexible schema and JSON for Internet of Things
 
Gaelyk
GaelykGaelyk
Gaelyk
 
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
 
Sql inyection
Sql inyectionSql inyection
Sql inyection
 
Mongo db for C# Developers
Mongo db for C# DevelopersMongo db for C# Developers
Mongo db for C# Developers
 
Php update and delet operation
Php update and delet operationPhp update and delet operation
Php update and delet operation
 
与 PHP 和 Perl 使用 MySQL 数据库
与 PHP 和 Perl 使用 MySQL 数据库与 PHP 和 Perl 使用 MySQL 数据库
与 PHP 和 Perl 使用 MySQL 数据库
 
PostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersPostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL Superpowers
 
Do something useful in Apps Script 5. Get your analytics pageviews to a sprea...
Do something useful in Apps Script 5. Get your analytics pageviews to a sprea...Do something useful in Apps Script 5. Get your analytics pageviews to a sprea...
Do something useful in Apps Script 5. Get your analytics pageviews to a sprea...
 
Node.js - Demnächst auf einem Server in Ihrer Nähe
Node.js - Demnächst auf einem Server in Ihrer NäheNode.js - Demnächst auf einem Server in Ihrer Nähe
Node.js - Demnächst auf einem Server in Ihrer Nähe
 
Do something in 5 with gas 4- Get your analytics profiles to a spreadsheet
Do something in 5 with gas 4- Get your analytics profiles to a spreadsheetDo something in 5 with gas 4- Get your analytics profiles to a spreadsheet
Do something in 5 with gas 4- Get your analytics profiles to a spreadsheet
 

Similar to 25437 pertemuan25(hitcounter)

Keeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkKeeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro Framework
Jeremy Kendall
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Masahiro Nagano
 

Similar to 25437 pertemuan25(hitcounter) (20)

Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Silex meets SOAP & REST
Silex meets SOAP & RESTSilex meets SOAP & REST
Silex meets SOAP & REST
 
Eden Hackathon Benilde (Mysql & SMTP)
Eden Hackathon Benilde (Mysql & SMTP)Eden Hackathon Benilde (Mysql & SMTP)
Eden Hackathon Benilde (Mysql & SMTP)
 
Full Stack Web Development.pptx
Full Stack Web Development.pptxFull Stack Web Development.pptx
Full Stack Web Development.pptx
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For Beginners
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ Etsy
 
The State of Lithium
The State of LithiumThe State of Lithium
The State of Lithium
 
Php
PhpPhp
Php
 
Database api
Database apiDatabase api
Database api
 
The Zen of Lithium
The Zen of LithiumThe Zen of Lithium
The Zen of Lithium
 
Bag Of Tricks From Iusethis
Bag Of Tricks From IusethisBag Of Tricks From Iusethis
Bag Of Tricks From Iusethis
 
Keeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkKeeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro Framework
 
WordPress as an application framework
WordPress as an application frameworkWordPress as an application framework
WordPress as an application framework
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
 
Introduction to Zend Framework web services
Introduction to Zend Framework web servicesIntroduction to Zend Framework web services
Introduction to Zend Framework web services
 
Undercover Pods / WP Functions
Undercover Pods / WP FunctionsUndercover Pods / WP Functions
Undercover Pods / WP Functions
 
Bacbkone js
Bacbkone jsBacbkone js
Bacbkone js
 
WordPress Realtime - WordCamp São Paulo 2015
WordPress Realtime - WordCamp São Paulo 2015WordPress Realtime - WordCamp São Paulo 2015
WordPress Realtime - WordCamp São Paulo 2015
 
The History of PHPersistence
The History of PHPersistenceThe History of PHPersistence
The History of PHPersistence
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony Apps
 

More from Universitas Bina Darma Palembang

More from Universitas Bina Darma Palembang (20)

30448 pertemuan1
30448 pertemuan130448 pertemuan1
30448 pertemuan1
 
29510 pertemuan18(form method-get-post-dan-session(1))
29510 pertemuan18(form method-get-post-dan-session(1))29510 pertemuan18(form method-get-post-dan-session(1))
29510 pertemuan18(form method-get-post-dan-session(1))
 
28501 pertemuan14(php)
28501 pertemuan14(php)28501 pertemuan14(php)
28501 pertemuan14(php)
 
28500 pertemuan22(header dokumen html dgn tag title)
28500 pertemuan22(header dokumen html dgn tag title)28500 pertemuan22(header dokumen html dgn tag title)
28500 pertemuan22(header dokumen html dgn tag title)
 
23921 pertemuan 3
23921 pertemuan 323921 pertemuan 3
23921 pertemuan 3
 
19313 pertemuan6
19313 pertemuan619313 pertemuan6
19313 pertemuan6
 
18759 pertemuan20(web html editor)
18759 pertemuan20(web html editor)18759 pertemuan20(web html editor)
18759 pertemuan20(web html editor)
 
18040 pertemuan13(css)
18040 pertemuan13(css)18040 pertemuan13(css)
18040 pertemuan13(css)
 
17945 pertemuan5
17945 pertemuan517945 pertemuan5
17945 pertemuan5
 
16406 pertemuan17(konsep basis-data-di-web)
16406 pertemuan17(konsep basis-data-di-web)16406 pertemuan17(konsep basis-data-di-web)
16406 pertemuan17(konsep basis-data-di-web)
 
15294 pertemuan9(eksplorasi &defenisi masalah0
15294 pertemuan9(eksplorasi &defenisi masalah015294 pertemuan9(eksplorasi &defenisi masalah0
15294 pertemuan9(eksplorasi &defenisi masalah0
 
13926 pertemuan4
13926 pertemuan413926 pertemuan4
13926 pertemuan4
 
12738 pertemuan 15(php lanjutan)
12738 pertemuan 15(php lanjutan)12738 pertemuan 15(php lanjutan)
12738 pertemuan 15(php lanjutan)
 
6346 pertemuan21(web statis dengan struktur html)
6346 pertemuan21(web statis dengan struktur html)6346 pertemuan21(web statis dengan struktur html)
6346 pertemuan21(web statis dengan struktur html)
 
5623 pertemuan11(html1)
5623 pertemuan11(html1)5623 pertemuan11(html1)
5623 pertemuan11(html1)
 
4740 pertemuan8(komponen dalam web)
4740 pertemuan8(komponen dalam web)4740 pertemuan8(komponen dalam web)
4740 pertemuan8(komponen dalam web)
 
4075 pertemuan10 (analisa kebutuhan)
4075 pertemuan10 (analisa kebutuhan)4075 pertemuan10 (analisa kebutuhan)
4075 pertemuan10 (analisa kebutuhan)
 
2670 pertemuan12(html lanjut)
2670 pertemuan12(html lanjut)2670 pertemuan12(html lanjut)
2670 pertemuan12(html lanjut)
 
2190 pertemuan24(polling)
2190 pertemuan24(polling)2190 pertemuan24(polling)
2190 pertemuan24(polling)
 
999 pertemuan7(prinsip perancangan web)
999 pertemuan7(prinsip perancangan web)999 pertemuan7(prinsip perancangan web)
999 pertemuan7(prinsip perancangan web)
 

Recently uploaded

Teachers record management system project report..pdf
Teachers record management system project report..pdfTeachers record management system project report..pdf
Teachers record management system project report..pdf
Kamal Acharya
 
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Lovely Professional University
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
Kamal Acharya
 
Digital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdfDigital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdf
AbrahamGadissa
 
Paint shop management system project report.pdf
Paint shop management system project report.pdfPaint shop management system project report.pdf
Paint shop management system project report.pdf
Kamal Acharya
 

Recently uploaded (20)

Research Methodolgy & Intellectual Property Rights Series 2
Research Methodolgy & Intellectual Property Rights Series 2Research Methodolgy & Intellectual Property Rights Series 2
Research Methodolgy & Intellectual Property Rights Series 2
 
Teachers record management system project report..pdf
Teachers record management system project report..pdfTeachers record management system project report..pdf
Teachers record management system project report..pdf
 
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
 
Natalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in KrakówNatalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in Kraków
 
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
 
Construction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxConstruction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptx
 
"United Nations Park" Site Visit Report.
"United Nations Park" Site  Visit Report."United Nations Park" Site  Visit Report.
"United Nations Park" Site Visit Report.
 
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
 
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
 
2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge
 
Lect 2 - Design of slender column-2.pptx
Lect 2 - Design of slender column-2.pptxLect 2 - Design of slender column-2.pptx
Lect 2 - Design of slender column-2.pptx
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
 
An improvement in the safety of big data using blockchain technology
An improvement in the safety of big data using blockchain technologyAn improvement in the safety of big data using blockchain technology
An improvement in the safety of big data using blockchain technology
 
Arduino based vehicle speed tracker project
Arduino based vehicle speed tracker projectArduino based vehicle speed tracker project
Arduino based vehicle speed tracker project
 
Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...
 
Digital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdfDigital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdf
 
Peek implant persentation - Copy (1).pdf
Peek implant persentation - Copy (1).pdfPeek implant persentation - Copy (1).pdf
Peek implant persentation - Copy (1).pdf
 
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
 
Paint shop management system project report.pdf
Paint shop management system project report.pdfPaint shop management system project report.pdf
Paint shop management system project report.pdf
 

25437 pertemuan25(hitcounter)

  • 1. Script <?php include_once "koneksi.php"; $ip = $_SERVER['REMOTE_ADDR']; // Getting the user's computer IP $tanggal = date("Ymd"); // Getting the current date $waktu = time(); // // Check your by IPnya, whether the user has had access to today's $s = mysql_query("SELECT * FROM statistik WHERE ip='$ip' AND tanggal='$tanggal'"); // If not there, save the user data to the database if(mysql_num_rows($s) == 0){ mysql_query("INSERT INTO statistik(ip, tanggal, hits, online) VALUES('$ip','$tanggal','1','$waktu')"); } else{ mysql_query("UPDATE statistik SET hits=hits+1, online='$waktu' WHERE ip='$ip' AND tanggal='$tanggal'"); }
  • 2. $pengunjung = mysql_num_rows(mysql_query("SELECT * FROM statistik WHERE tanggal='$tanggal' GROUP BY ip")); $totalpengunjung = mysql_result(mysql_query("SELECT COUNT(hits) FROM statistik"), 0); $hits = mysql_fetch_assoc(mysql_query("SELECT SUM(hits) as hitstoday FROM statistik WHERE tanggal='$tanggal' GROUP BY tanggal")); $totalhits = mysql_result(mysql_query("SELECT SUM(hits) FROM statistik"), 0); $tothitsgbr = mysql_result(mysql_query("SELECT COUNT(hits) FROM statistik"), 0); $bataswaktu = time() - 300; $pengunjungonline = mysql_num_rows(mysql_query("SELECT * FROM statistik WHERE online > '$bataswaktu'")); $path = "counter/"; $ext = ".png"; $tothitsgbr = sprintf("%06d", $tothitsgbr); for ( $i = 0; $i <= 9; $i++ ){ $tothitsgbr = str_replace($i, "<img src='$path$i$ext' alt='$i'>", $tothitsgbr); } echo "<br /><p align=center>$tothitsgbr </p> <table> <tr><td class='news-title'><img src=counter/hariini.png> Pengunjung hari ini </td><td class='news-title'> : $pengunjung </td></tr> <tr><td class='news-title'><img src=counter/total.png> Total pengunjung </td><td class='news-title'> : $totalpengunjung </td></tr> <tr><td class='news-title'><img src=counter/hariini.png> Hits hari ini </td><td class='news-title'> : $hits[hitstoday] </td></tr> <tr><td class='news-title'><img src=counter/total.png> Total Hits </td><td class='news-title'> : $totalhits </td></tr>
  • 3. <tr><td class='news-title'><img src=counter/online.png> Pengunjung Online </td><td class='news-title'> : $pengunjungonline </td></tr> </table>"; ?> Database: Tabel: Statistik