1. Halo Guest, pastikan Anda selalu menaati peraturan forum sebelum mengirimkan post atau thread baru.

[ask] PHP Cara mengetahui visitor Bot atau human

Discussion in 'Pemrograman Web' started by nicefirework, Oct 6, 2011.

  1. nicefirework

    nicefirework Super Hero

    Joined:
    Aug 21, 2010
    Messages:
    1,304
    Likes Received:
    251
    Salam bro..
    Mau tanya, google sekarang kan agak sensitif sama situs affiliate. Gimana caranya mengetahui visitor yang datang adalah bot atau manusia???
    nanti kan bisa di hide link affiliatenya kalau yang datang cuma bot :D
     
  2. GentZu AoZora

    GentZu AoZora Forbidden

    Joined:
    Nov 28, 2010
    Messages:
    2,932
    Likes Received:
    275
    Location:
    Bandung City
    kalau gk salah gini bos...
    PHP:
    <?php if (stristr($_SERVER['HTTP_USER_AGENT'],'google') || stristr($_SERVER['HTTP_USER_AGENT'],'boot') || 
        
    stristr($_SERVER['HTTP_USER_AGENT'],'.com')) { ?>
    bukan link afiliasi
    <?php } else { ?>
    link satu
    link dua
    content
    <?php ?>
     
  3. mp3online

    mp3online Super Hero

    Joined:
    Jul 19, 2011
    Messages:
    2,228
    Likes Received:
    294
    Location:
    jakarta
    Code:
    <?php
    if(!preg_match('/bot|crawler|spider|archive|slurp/i', [COLOR=#000000][COLOR=#0000bb]$_SERVER[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'HTTP_USER_AGENT'[/COLOR][COLOR=#007700]])) {[/COLOR][/COLOR]
    // tampil link affiliasi di sini
    }
    ?>
     
    nicefirework likes this.
  4. nababan

    nababan Ads.id Fan

    Joined:
    Mar 8, 2011
    Messages:
    136
    Likes Received:
    57
    Location:
    Flashdisk
    Tambah lagi ah biar ga nemu error:
    PHP:
    <?php
    echo 'jawaban diatas udah 2 versi tinggal pilih yg lebih cepatt';
    ?>
     
  5. idiotcode

    idiotcode Super Hero

    Joined:
    Mar 4, 2010
    Messages:
    1,465
    Likes Received:
    982
    Location:
    Venice, Italy
    nice code, i guess this is faster than regex.. :)
    but what is "boot" and ".com"? is this a bot? please..
     
    Last edited: Oct 13, 2011
  6. mp3online

    mp3online Super Hero

    Joined:
    Jul 19, 2011
    Messages:
    2,228
    Likes Received:
    294
    Location:
    jakarta
    "boot" he mis type, it must bot.
    ".com" he mean some bot user agen have .com text eg.
    Code:
    baidu bot
    Mozilla/5.0 (compatible; Baiduspider/2.0; http://www.baidu[U].com[/U]/search/spider.html)
    
    bing bot
    Mozilla/5.0 (compatible; bingbot/2.0; http://www.bing[U].com[/U]/bingbot.htm)
    etc.
    heleh bahasa inggris barang... marai mumet ndasku :pusing:
     
  7. GentZu AoZora

    GentZu AoZora Forbidden

    Joined:
    Nov 28, 2010
    Messages:
    2,932
    Likes Received:
    275
    Location:
    Bandung City
    Kan kalau boot biasanya nyertain urlnya, misal yahoo.com, google.com.
    Jadi ane kasih .com
    Apa ada user agent biasa selain boot yg ada .com nya.
    com sama .com beda ya...
     
  8. mp3online

    mp3online Super Hero

    Joined:
    Jul 19, 2011
    Messages:
    2,228
    Likes Received:
    294
    Location:
    jakarta
    belum pernah nemu yg pakai .com tapi kalau yang pakai .net ada :)
    Code:
    Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; GTB7.1; Avant Browser; [B][U].NET[/U][/B]  CLR 2.0.50727; InfoPath.2; [B][U].NET[/U][/B] CLR 1.1.4322; [B][U].NET[/U][/B] CLR 3.0.4506.2152; FDM)
    kalau com yang gak pakai "." cometbird bisa kena :D
     
  9. newbisa

    newbisa I'm Blogger Lovers

    Joined:
    Dec 13, 2010
    Messages:
    2,417
    Likes Received:
    539
    Location:
    DigitalJV.com
    PHP:
    <?php
    echo 'hahaha,. bisa aja agan ini :D';
    ?>  
     
  10. irw10062

    irw10062 Ads.id Starter

    Joined:
    Jul 28, 2009
    Messages:
    94
    Likes Received:
    5
    Location:
    Paradise
    kalau wordpress ane pake ap honeypot,,, dulu ane kebanjiran traffic yang taunya cuma robot,spam,bot ga jelas...
    pake ini pada mental semua mereka ,,,, suer
    :D
     
  11. mp3online

    mp3online Super Hero

    Joined:
    Jul 19, 2011
    Messages:
    2,228
    Likes Received:
    294
    Location:
    jakarta
    baidu spider juga tukang nyedot bandwidth tuh, tapi untungnya dia bukan badbot. kita disallow di robots.txt baidu spider udah nurut gak merayapi situs kita lagi
     
  12. ceye.cahya

    ceye.cahya Newbie

    Joined:
    Oct 14, 2011
    Messages:
    26
    Likes Received:
    0
    Sudah dijawab mastah2 gan.. Nyimak aja.. :D
     
  13. mp3online

    mp3online Super Hero

    Joined:
    Jul 19, 2011
    Messages:
    2,228
    Likes Received:
    294
    Location:
    jakarta
    aku ketemu ama user agent yang pakai .com brur, firefox pakai addons ant.com toolbar. user agentnya jadi ada tambahan Ant.com Toolbar
     
  14. fendermf

    fendermf Banned

    Joined:
    Dec 27, 2015
    Messages:
    205
    Likes Received:
    1
    belum pernah nemu yg pakai .com tapi kalau yang pakai .net ada


    Code:
    Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; GTB7.1; Avant Browser; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; FDM)
    kalau com yang gak pakai "." cometbird bisa kena
     
  15. wahyu kris

    wahyu kris Ads.id Pro

    Joined:
    Nov 23, 2012
    Messages:
    353
    Likes Received:
    5
    Location:
    kediri
    mantab...ikutan nyimak aja biar tambah pinter.. :D
     

Share This Page