• Feed

  • « | Main | »

    Busy Day.. aka get info from your users in PHP

    By maurizio | June 20, 2007

    Today I was/am so busy that I don’t have enough time to browse as I’d like, so I’m just posting a simple trick in PHP, just to make all blogger users a bit envy of us who can use PHP on your blog :-)

    The trick is very basic. Scroll down this page and you’ll see it on my left bar. At least if you are not coming here directly.
    With the help of Otto’s PHP widget plugin, I put some PHP code on a widget.

    “What is your code doing” you are probably wondering.. well, my code just read some information from your browser and show them there. What I’m reading right now is only the page who sent you here. For example, if you click a link on UntwistedVortex.com that redirect you here, you will see a text like

    Hello visitor from
    www.untwistedvortex.com

    Nice, isn’t it?
    The code is very basic:

    <?php
    if ($_SERVER['HTTP_REFERER'] != "")
    echo 'Hello visitor from <br/>'. $_SERVER['HTTP_REFERER'];
    else
    echo "Hi there!";
    ?>

    If the HTTP_REFERER variable is empty, I print “Hi there” on the widget, otherwise I print “Hello visitor from” and the url of the previous site. (Note <br/> which is just a newline command in html)
    You can read a lot of stuff from the $_SERVER variable; this is just the interesting one. This is surely the same variable that Wordpress reads to create the linking info on the Dashboard.

    Topics: Programming | 3 Comments »

    Read other related posts:

  • Top10 list for 12.6-26.6
  • Generate traffic with StumbleUpon: tips
  • Clicky and Performancing widgets
  • 3 Responses to “Busy Day.. aka get info from your users in PHP”

    1. Generate traffic with StumbleUpon: tips | Nafurai Says: MyAvatars 0.2
      June 21st, 2007 at 3:23 am

      [...] Busy Day.. aka get info from your users in PHP [...]

    2. Clicky and Performancing widgets | Nafurai Says: MyAvatars 0.2
      June 29th, 2007 at 1:01 am

      [...] 30 days1Nafurai5532Who was the first president of the United States? 4033AdSense alternative 2284Busy Day.. aka get info from your users in PHP 1455Digg Vs StumbleUpon: better free traffic 1206Ads907Analytics Top10 Creator 708How to set Firefox [...]

    3. Hong Xiaowan's Studio Says: MyAvatars 0.2
      July 2nd, 2007 at 10:58 pm

      AuctionAds+Twitter+Adsense+Wordpress=toBid.info…

      Cause AuctionAds allow using multiple AuctionAds units on a single page, so, plan to use AuctionAds as the main content for toBid.info
      Use the keywords from search box and title to define the keyword that needed for the AuctionAds to get the fitting c…

    Comments

    Subscribe without commenting