0plus1 Blog

Naga-Ox Release

by david on Jun.18, 2009, under 0plus1, Programming

The first public release of Naga-Ox has been released, this php script acts as an ads server, it keeps tracks of clicks, impression, can group and rotate banner automagically using jquery, each banner is individually configurable and rendered based on his status and expiration date.

Everything is really, really easy to configure and use, everything has been made considering simplicity and fastness.

You can get it here or try it here.

Leave a Comment :, more...

European Countries array

by david on Jun.03, 2009, under Programming

We recently had to create a select reserved only to contries from the european union, here’s the array with the standard countries codes:

$eu_countries = array(
  "AT" => "Austria",
  "BE" => "Belgium",
  "BG" => "Bulgaria",
  "CY" => "Cyprus",
  "CZ" => "Czech Republic",
  "DK" => "Denmark",
  "EE" => "Estonia",
  "FI" => "Finland",
  "FR" => "France",
  "DE" => "Germany",
  "GR" => "Greece",
  "HU" => "Hungary",
  "IE" => "Ireland",
  "IT" => "Italy",
  "LV" => "Latvia",
  "LT" => "Lithuania",
  "LU" => "Luxembourg",
  "MT" => "Malta",
  "NL" => "Netherlands",
  "PL" => "Poland",
  "PT" => "Portugal",
  "RO" => "Romania",
  "SK" => "Slovakia (Slovak Republic)",
  "SI" => "Slovenia",
  "ES" => "Spain",
  "SE" => "Sweden",
  "GB" => "United Kingdom"
);

source

Leave a Comment :, more...

How to allow ad-sense bot to crawl phpbb3 private forums

by david on May.29, 2009, under Communities

If you operate a forum with private sections and public section, you’ll find that the ads that ad-sense pushes on your website are created based solely on the public content. If you want more accurate result you may want to look into the ad-sense’ s “Site Authentication” feature. Here’s a small how-to on how to achieve this:

phpbb3

  • Create a user in the acp (for this example sake let’s use: adsense as username and adsense as password).
  • Give him permission based on your forum structure, we advise to give him read-only access on the whole forum.

ad-sense

  • go to the AdSense Setup tab, then click on the Site Authentication section.
  • click on the add a login link
  • Set it like this:
    • Restricted Directory or URL: the forum url (example: http://www.example.com/forum)
    • Authentication URL: the path to the ucp.php?mode=login file (example: http://www.example.com/forum/ucp.php?mode=login)
    • Authentication method: POST
    • Parameters: (you have to add them manually)
      • Attribute: login - Value: Login
      • Attribute: password - Value: userpassword (example: adsense)
      • Attribute: username - Value: username (example: adsense)
  • Now click on: Test My Authentication URL to check if everything went ok
    • Hope this will help you

Leave a Comment :, , more...

print_r output beautifier

by david on May.13, 2009, under Programming

Today I wrote a script that needed to manipulate several multidimensional arrays, some of them pretty deep.

The standard php function print_r is an hellish mess, browsing through the marvellous php.net documentation I’ve found several examples to beautify the output of print_r (just to give credit: “Bob” and “Everett” were my inspiration) since no one actually did it the way I wanted I made a custom one myself:

function print_rr($array){
    foreach($array as $key=>$value){
       if(is_array($value)){
          $id = md5(rand());
          echo '[<a href="#" onclick="return expandParent(\''.$id.'\')">'.$key.'</a>]<br />';
          echo '<div id="'.$id.'" style="display:none;margin:10px;border-left:1px solid; padding-left:5px;">';
          print_rr($value, $count);
          echo '</div>';
       } else {
       echo "<b>$key</b>: ".$value."<br />";
       }
    }
echo '<script language="Javascript">
function expandParent(id){toggle="block";if(document.getElementById(id).style.display=="block"){toggle="none"}document.getElementById(id).style.display=toggle};
</script>';
}

Feel free to use it anyway you like it.

Leave a Comment :, , more...

Welcome

by david on May.13, 2009, under 0plus1

Welcome to the official blog from 0plus1.

Leave a Comment :, more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...

Archives

All entries, chronologically...