July 18th, 2008
To use it, you’ll have to first download the GeoIP Free Country file and extract it into a directory in your Web server. Then you’ll have to pick which language API to use with the database file. For simplicity, we’re going to use the pure PHP version because it doesn’t require any additional configuration or Apache modules. Remember to read the license terms before installing these on your Web site to ensure you are in compliance.
The code in Listing A demonstrates the basics of using the module (geoip.inc) to access the GeoIP Free Country database (GeoIP.dat). The example assumes both the PHP include and the country database file are in the same directory as the PHP file itself. You’ll have to change the paths as needed if this is not the case in your installation.
The sample code is pretty straightforward. After including the GeoIP PHP function library, the first step is to open the GeoIP database file with the geoip_open() function. This function accepts two arguments: the path to the database file and the type of database.
We then use the handle returned by the call to geoip_open() to obtain the two-letter country code and human-friendly name corresponding to the given IP address, via the geoip_country_code_by_addr() and geoip_country_code_by_name() functions, respectively. Both functions accept two arguments: the handle returned by geoip_open() and the IP address to resolve.
Once the required information is obtained, we close the database file with a call to geoip_close(). Simple as that.
No Comments » |
Uncategorized |
Permalink
Posted by admin
July 16th, 2008
Firefox 3 does not use cookies.txt but rather cookies.sqlite.
Solution: Uses a python script to extract the data from cookies.sqlite.
http://blog.schlunzen.org/2008/06/19/firefox-3-und-cookiestxt/
#!/usr/bin/python
import sqlite3 as db
import sys
cookiedb = '/home/USENAME/.mozilla/firefox/PROFIL/cookies.sqlite'
targetfile = '/home/USERNAME/cookies.txt'
what = sys.argv[1]
connection = db.connect(cookiedb)
cursor = connection.cursor()
contents = “host, path, isSecure, expiry, name, value”
cursor.execute(”SELECT ” +contents+ ” FROM moz_cookies WHERE host LIKE ‘%”
+what+ “%’”)
file = open(targetfile, ‘w’)
index = 0
for row in cursor.fetchall():
file.write(”%s\tTRUE\t%s\t%s\t%d\t%s\t%s\n” % (row[0], row[1],
str(bool(row[2])).upper(), row[3], str(row[4]), str(row[5])))
index += 1
print “Gesucht nach: %s” % what
print “Exportiert: %d” % index
file.close()
connection.close()
No Comments » |
Uncategorized |
Permalink
Posted by admin
July 7th, 2008
http://area51.phpbb.com/docs/coding-guidelines.html
4. Templating
File naming
Variables
Blocks/Loops
Including files
PHP
Conditionals/Control structures
Extended syntax for Blocks/Loops
No Comments » |
Uncategorized |
Permalink
Posted by admin
July 4th, 2008
Hooks a function on to a specific action. See Plugin API for a list of hooks for action.
Usage
Examples
To email some friends whenever an entry is posted on your blog:
function email_friends($post_ID) {
$friends = ‘bob@example.org, susie@example.org’;
mail($friends, “sally’s blog updated” , ‘I just put something on my blog: http://blog.example.com’);
return $post_ID;
}
add_action(’publish_post’, ‘email_friends’);
Parameters
$tag
(string) The name of the action you wish to hook onto.
$function_to_add
(callback) The name of the function you wish to be called. Note: any of the syntaxes explained in the PHP documentation for the ‘callback’ type are valid.
$priority
How important your function is. Alter this to make your function be called before or after other functions. The default is 10, so (for example) setting it to 5 would make it run earlier and setting it to 12 would make it run later.
$accepted_args
How many arguments your function takes. In WordPress 1.5.1+, hooked functions can take extra arguments that are set when the matching do_action() or apply_filters() call is run. For example, the action comment_id_not_found will pass any functions that hook onto it the ID of the requested comment.
No Comments » |
Uncategorized |
Permalink
Posted by admin
July 3rd, 2008
Diablo III is an action role-playing game currently in development and the third installment of Blizzard’s Diablo franchise. It was unveiled on June 28, 2008 at the 2008 Blizzard Entertainment Worldwide Invitational in Paris, France.
StarCraft II is a military science fiction real-time strategy video game currently under development by Blizzard Entertainment as a sequel to the award-winning 1998 video game StarCraft. First announced on May 19, 2007, in Seoul, South Korea,[5][6] StarCraft II is being developed for concurrent release on Windows XP, Windows Vista, and Mac OS X. The game has no certain release date[4] although a multiplayer demonstration was playable at BlizzCon 2007
No Comments » |
Uncategorized |
Permalink
Posted by admin
July 1st, 2008
http://www.googletutor.com/2008/02/19/easy-wordpress-and-google-calendar-integration/
http://code.google.com/p/wpng-calendar/
The Wordpress Google calendar plugin allows for the integration of a Google calendar into a Wordpress blog. This section describes how to install the plugin and get it working.
1. Request Google GDATA API key (see link below)
2. Upload the contents of the ZIP file to the /wp-content/plugins/ directory
3. Activate the plugin through the Plugins menu
4. Configure your GDATA API key in the plugin options panel
5. Configure a Google calendar in the plugin options panel
6. Configure the option to render the description field as Wiki markup
7. Create a page and add the ’show-wpng-calendar’ custom field with the number of weeks you want to be displayed
8. Add the widget to your sidebar and configure the title and number of events to display
No Comments » |
Uncategorized |
Permalink
Posted by admin
June 30th, 2008
After a week long tease by Blizzard, Diablo 3 has just been announced in Paris. The splash screen has been updated at their homepage.
http://www.blizzard.com/diablo3/
No Comments » |
Uncategorized |
Permalink
Posted by admin
June 27th, 2008
The PDT project provides a PHP Development Tools framework for the Eclipse platform. This project encompasses all development components necessary to develop PHP and facilitate extensibility. It leverages the existing Web Tools Project in providing developers with PHP capabilities.
Project Principles:
* Intuitive and easy to learn
* Seamless integration with the Web Tools project
* Adherence to Eclipse standards
* Extensibility
* Continuous support of PHP developments
No Comments » |
Uncategorized |
Permalink
Posted by admin
June 27th, 2008
phpDocumentor tags are very similar to tags for the JavaDoc tool for Sun’s Java Programming Language. Tags are only parsed if they are the first thing on a new line of a DocBlock. You may use the @ character freely throughout documents as long as it does not begin a new line. An example:
/**
* tags demonstration
* @author this tag is parsed, but this @version tag is ignored
* @version 1.0 this version tag is parsed
*/
No Comments » |
Uncategorized |
Permalink
Posted by admin
June 25th, 2008
To deploy the web-site blocking mechanism in Squid, add the following entries to your Squid configuration file (in my system, it’s called squid.conf and it’s located in the /etc/squid directory):
acl bad url_regex “/etc/squid/squid-block.acl”
http_access deny bad
The file /etc/squid/squid-block.acl contains web sites or words you want to block. You can name the file whatever you like. If a site has the URL or word listed in squid-block.acl file, it won’t be accesible to your users. The entries below are found in squid-block.acl file used by my clients:
.oracle.com
.playboy.com.br
sex
…
With the squid-block.acl file in action, internet users cannot access the following sites:
* Sites that have addresses ending with .oracle.com
* Sites that have addresses ending with .playboy.com.br
* Sites containing the word “sex” in its pages
You should beware that by blocking sites containing the word “sex”, you will also block sites such as Middlesex University, Sussex University, etc. To resolve this problem, you can put those sites in a special file called squid-noblock.acl:
^http://www.middlesex.ac.uk
^http://www.sussex.ac.uk
No Comments » |
Uncategorized |
Permalink
Posted by admin