Membuat Visit Counter Sederhana dengan PHP MYSQL

Di Tulis Oleh : Ivan Silalahi 10 comments
Pasang Iklan Murah


Halo Sahabat Belajar Pintar PHP sekalian ...!!! kali ini saya akan membagikan kepada anda sebuah script PHP untuk membuat visit counter sederhana seperti yang terdapat di bagian footer blog saya ini. Bagi anda yang udah merasa sudah bisa membuatnya, ada baiknya anda berhenti membaca sekarang juga, karna dari judulnya saja ini hanya membuat yang sederhana saja, tapi jika anda sedikit penasaran dengan ini, tidak ada salahnya anda lanjut membacanya, karena saya yakin anda semua adalah orang yang rendah hati. Cara kerja counter ini adalah sebagai berikut : halaman utama dibuka->input ke database->Output berupa jumlah records dari table yang dijadikan counter. OK, langsung ke TKP ...!!!

Pertama, buatlah table dengan nama counter pada database MySQL kamu dengan field sebagai berikut:

a. ip
b. user_agent
c. tanggal

Sekarang, tambahkan script berikut pada halaman utama website kamu. Ingat, tempatkan script ini di bagian paling atas sebelum tag.



$ip=getenv(remote_addr);
$date=getdate(date("U"));
$day=$date[mday];
$month=$date[month];$year=$date[year];


if (!isset($_COOKIE["visitor"]))
{
setcookie("visitor", "$ip", time() +3600);
mysql_connect("localhost", "user",
"password"); //sesuaikan host, user, dan password-nya !
mysql_select_db("nama_db") or die(mysql_error

()); //sesuaikan nama database-nya
mysql_query("INSERT INTO counter(ip, user_agent,
tanggal) VALUES('$ip', '$_SERVER[HTTP_USER_AGENT]',
'$day/$month/$year')");
}
?>




Pada code di atas, saat pertama jika diakses halaman website kita akan membuat cookies dengan nama visitor yang isinya IP address dari visitor kita. Kalo cookies belom diset, maka record table Counter akan ditambah satu.
Untuk mendapatkan jumlah pengunjung, kita tinggal menghitung berapa jumlah records dari table Counter, gunakan code berikut:

$qhit=mysql_query("SELECT * FROM counter");
$hit=mysql_num_rows($qhit);
echo "
Kamu adalah pengunjung ke: $hit
";
?>




Sekarang, kamu tinggal meletakkan code di atas untuk menampilkan berapa jumlah pengunjung website kamu.
Semoga bermanfaat dan tolong dikembangkan masing-masing.


Pasang Iklan Murah

Tutorial terkait dengan Membuat Visit Counter Sederhana dengan PHP MYSQL :

Terimakasih Atas Kunjungan Sahabat Setia Belajar Pintar PHP
Judul Pelajaran PHP : Membuat Visit Counter Sederhana dengan PHP MYSQL
Ditulis oleh Ivan Silalahi
Rating postingan ini 5 dari 5
Semoga artikel ini bermanfaat bagi saudara. Jika ingin mengutip, baik itu sebagian atau keseluruhan dari isi artikel ini harap menyertakan link dofollow ke https://planetsphp.blogspot.com/2012/11/membuat-visit-counter-sederhana-dengan.html. Terima kasih sudah singgah membaca artikel ini. Jangan lupa like dan sharenya serta komentarnya
10 comments:
Mmichaeltsaico Mico said... Balas

artikel yg menarik mas ulasannya nie dan salam kenal juga dari mico ok makasi dan juga situs ini sangat membantu gue untuk mencari referensi loe hehe thanks sobat

ALDI said... Balas

Iya, setuju banget. mantap deh. Ditunggu postingan-postingan selanjutnya.

joinonline good said... Balas


jasa seo
jasa seo indonesia
jasa seo terpercaya
seo indonesia
jasa seo web judi
jasa buat website
jasa pembuatan website

Sbobet
Agen Sbobet
Agen IBcbet
agen MAXBET
bandar bola
judi bola
judi online
taruhan bola
agen resmi sbobet
agen bola
agen bola terpercaya
agen sbobet terpercaya

agen poker
poker online
agen poker terbaik
agen poker terpercaya
poker uang asli
situs poker

agen poker
poker online
pagen poker terbaik
agen poker terpercaya
poker uang asli

sabung ayam
adu ayam
ngadu ayam
laga ayam
permainan adu ayam
ayam petarung
ayam sabung
ngadu ayam jago
adu ayam online
taruhan ayam
sabung ayam terbaik
judi online ayam
ayam sabung online
judi adu ayam
situs sabung online
judi sabung online
permainan laga ayam
sabung online
sbobet
agen sbo
agen sbobet
agen sbobet terbaik
agen sbobet terpercaya
sbobet asia
ibcbet
agen ibcbet
agen ibcbet terbaik
agen ibcbet terpercaya
ibcbet online
sbobet online

LK21

joinonline good said... Balas


agen casino indonesia
agen judi sbobet
agen sbobet indonesia
agen sbo
agen sbobet terpercaya
agen sbobet
agen sbo terpercaya
agen judi terpercaya
sbosports
agent sbobet
agen sbobet indonesia
bandar judi terpercaya
agen judi bola terpercaya
agen judi ibcbet
sbobet indonesia
agen bola online
bandar judi bola
master agen betting online
bandar bola sbobet terpercaya
judi online

BANDARQ
Agen Poker
situs poker
poker online
Judi Poker Online
situs poker online terpercaya
Poker Online Terpercaya
poker uang asli
Domino QQ
Domino Poker
Capsa Online
QQ Online
Ceme Online
Blackjack Online
Poker Online Indonesia
Agen poker online
poker online asli
agen poker terbaik
agen poker terpercaya
situs poker uang asli

BANDARQ
Agen Poker
situs poker
poker online
Judi Poker Online
situs poker online terpercaya
Poker Online Terpercaya
poker uang asli
Domino QQ
Domino Poker
Capsa Online
QQ Online
Ceme Online
Blackjack Online
Poker Online Indonesia
Agen poker online
poker online asli
agen poker terbaik
agen poker terpercaya
situs poker uang asli

joinonline good said... Balas


agen bola terpercaya
pasang bola
judi bola online
agen bola terpercaya

Agen bola
Judi Online
Agen Bola Online

casino online terbaik
casino online
judi online
agen casino online
judi live casino

agen judi
agen bola
situs judi
judi bola
judi online
bandar bola
bandar judi
situs taruhan
taruhan bola
taruhan online
situs judi bola
situs judi online
situs judi terpercaya
agen bola terpercaya
agen judi online
judi online terpercaya
agen judi terpercaya
bandar judi online
bandar bola terpercaya
judi bola online
agen piala dunia 2018
bandar piala dunia 2018
situs taruhan piala dunia 2018
situs judi piala dunia 2018
agen resmi piala dunia 2018

joinonline good said... Balas


Agen togel
judi togel
bandar togel online
bandar togel
togel singapura
togel online
bandar judi togel
agen togel online
judi togel online
togel sydney
togel hongkong

Agen togel
judi togel
bandar togel
bandar togel online
togel singapura
togel online
bandar judi togel
agen togel online
judi togel online
togel sydney
togel hongkong

agen poker
agen poker terbaik
agen poker terpercaya
poker uang asli
situs poker

RAVIKA PUTRI said... Balas

Situs Bandar Taruhan Agen Judi Bola Terbesar Dan Terpercaya Indonesia.
Segara Daftar kan Diri Anda Di Link Bawah Ini :

http://hokijudi99.id

Tedy Suwanda said... Balas

Terima kasih atas sharingnya, gan. Mungkin lain waktu akan coba tutorial di atas dengan menyimpan cookie visitor kemudian di simpan di database.

Kunjungi blog saya ya: https://tedsu.mahasiswa.atmaluhur.ac.id
dan website kampus saya: http://www.atmaluhur.ac.id

admin said... Balas

https://iza-anwar.blogspot.com/2016/08/alice-through-looking-glass-2016.html?showComment=1538726756749#c4997188614962860565

Search engine optimization (SEO) or Indonesian SEO is the process of influencing the visibility of websites or web pages in search engine results - often referred to as "natural", "organic" or "earned" results. In general, the earlier (or rank higher on search results pages), and more often sites appear in the list of search results, the more visitors will receive from search engine users, and these visitors can be converted to customers.

SEO can target various types of searches, including image search, local search, video search, academic search, news search and industry-specific vertical search engines.

Indonesian SEO

Specialist SEO.com is an Indonesian SEO Service launched in 2011 when search engines were in the early stages of developing their algorithms, Google was a big company that was very promising. Search engine optimization (SEO) has a completely different meaning. Since then many things have changed and internet marketing has become a necessity for every company that wants to survive in the online world competitively.

Specialist SEO Indonesia SEO Services deal with Web Marketing technology from the start. After hours of research and development, trial and error, we can now offer the most reliable solutions in the world of Digital Marketing.

Indonesian SEO Service

You can chat, video call, phone, view photos, have fun, and even meet!
online datingsite, online dating indonesia, free online dating, best online dating site free, online dating app, online dating terbaik, dating online chat, situs online dating, free dating sites without payment, dating online with video call, dating, meet me, meet, people nearby, soulmate, heart, online dating apps, free online dating, video call, audio chat, find your partner, setipe, skout, flurv, bigo live, Tinder, OkCupid, Hookup, BeeTalk
online dating site

admin said... Balas

Welcome to asetqq.vip, the Best and Most Trusted Indonesian Online Poker Site. AsQQQ provides 6 games that can be played in 1 User Id only. Online Poker, DominoQQ, Bandar Ceme, Capsa Susun, Live Poker, Ceme Keliling Games, using Indonesian real money
poker online

jdk88.id/ is the jadwal bola, first trusted online betting agent in Indonesia that provides live baccarat, roulette and sicbo online services. Giving customer satisfaction and serving better than others.
Always determined to be able to serve customers better. Trying to remain a Soccer Agent, Casino Agent, the best and most trusted Online Betting in Indonesia
Jadwal bola

Onekartu is a trusted online poker agent Site. Original Money Poker uses IDNPlay servers that are 100% proven trusted and fairplay. Deposit and Withdraw Process in Crotqq start from 10 thousand rupiah and with fast and safe process. Customer Service Crotqq is available 24 hours to help you if you are having problems. onekartu.net is always trying to become a trusted online poker agent for those of you who want a Fairplay Poker game.

poker uang asli

TRUSTED !! POKER ONLINE | POKER AGENT | ORIGINAL MONEY POKER SITE
RELIABLE MurniPoker Online Poker Site Category that provides poker games for real money, Ceme Online, and Domino Online
This Site Is Engaged in Online Gambling.
ENJOY THE BIGGEST BONUS SENSATION IN MURNIPOKER
MurniPoker is the most attractive Poker Gambling site and many enthusiasts of Lapak303 online poker lovers.
By ensuring the game is fairplay and has sophisticated technology, games are provided like
Dominoqq, Capsa Susun and many others, we have become one of the best and trusted in Indonesia
plus more available Ceme Online million rupiah jackpot that you can win every day.

Poker Online

happydomino is also the best and trusted Online Domino Poker site in Indonesia which has been proven by reputation and gained the trust of International Online gambling. Both the review of reputable poker sites and the quality of the games we provide do not need to be doubted. By providing the best service and providing assistance that is not complicated and we will provide an explanation that is as easy as possible so that you can easily understand it. We also provide playing tips and tricks so you can easily win in the best online gambling agent games in Indonesia. happydomino is guaranteed to be the fair play 100% online gambling site. There are no Robots in pure games Member vs Member. Our site is also equipped with the most sophisticated security system that is always updated on online gambling issues.

poker online

POKERSEJATI is a Poker site We provide interesting online game variants. You can access all of these games practically using just one account.

situs poker

Post a Comment

Template by Tutorial Website - Belajar Pintar PHP. Design by Ivan Silalahi | Copyright of Belajar Pintar PHP.