[php] "like" On Each Page Without Editing Code: P

Discussion in 'Programming' started by Virtix, Jan 31, 2013.

  1. #1
    This is a simple code that I made for my site, but bring them if they need it ...
    what it does is, it adds to any page you like add the code, without changing anything.


    <?php
    function like(){
    function url()
    {
    return 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    }
    $url =  url();
    [hide]return '<iframe src="http://www.facebook.com/plugins/like.php?href='.$url.'&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>';
    }
    echo like();
    ?>
    PHP:
    you can include on each page using this code, keeping the above code in a file called like.php

    <?php
    include("like.php");
    ?>
    PHP:

     
    Virtix, Jan 31, 2013 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    So bad, hope facebook doesn't figure out your doing this.....
     
    EricBruggema, Feb 2, 2013 IP