
March 11th, 2007 by

Jon Moffet
If you encounter session error on PHP 4.4.x, especially when you're porting scripts written from earlier PHP release (i.e PHP 4.1.x, 4.2.x) when handling sessions, chances are that you are using the deprecated session_register() function.
Solution: Replace session_register function with $_SESSION variable instead.
This will make your scripts upward-compatible with PHP installations that disabled register globals and eliminate those weird session errors message
reference: http://www.php.net/session_register
Tags: php, session, programming
Posted in Uncategorized |
No Comments »

March 10th, 2007 by

Jon Moffet
If you're porting your PHP4 scripts that uses DOM-XML for xml-parsing to PHP5, then you might have stumbled into this particular problem, PHP5 has no DOM-XML extension.
This is because PHP 5 has a new integrated DOM functions which replaces PHP4 dom-xml equivalent.
However you don't need to do a complete rewrite in order to make your DOM-XML PHP 4 scripts work with PHP 5. All you need to do is to include a fix from http://alexandre.alapetite.net website.
First, download domxml.phps, then include it in your php scripts
PHP:
-
require('domxml.phps');
-
-
// the rest of your script that uses dom-xml goes here...
After that your PHP4 script is able to work normally in PHP5 environment :)
Tags: php5, php, dom-xml, dom, xml, porting
Posted in Uncategorized |
No Comments »

March 8th, 2007 by

Jon Moffet
Here's a simple function to validate email in your PHP scripts.
To use it just call isValidateAddress("email@example.com"). The function returns 'true' if the email is valid and 'false' otherwise.
PHP:
-
<?php function isValidAddress( $email, $check = false )
-
{
-
##############################
-
# PHP Email Address Validator
-
# (C) Derrick Pallas
-
#
-
# Authors: Derrick Pallas
-
# Website: http://derrick.pallas.us/email-validator/
-
# License: Academic Free License 3.0
-
# Version: 2006-12-01a
-
-
-
. '^'
-
. '[-!#$%&\'*+/0-9=?A-Z^_a-z{|}~]'
-
. '(\\.?[-!#$%&\'*+/0-9=?A-Z^_a-z{|}~])*'
-
. '@'
-
. '[a-zA-Z](-?[a-zA-Z0-9])*'
-
. '(\\.[a-zA-Z](-?[a-zA-Z0-9])*)+'
-
. '$'
-
, $email
-
) ) return false;
-
list( $local,
$domain ) =
split( "@",
$email,
2 );
-
if ( strlen($local)>
64 ||
strlen($domain)>
255 ) return false;
-
-
return true;
-
-
# END
-
######
-
}
Tags: php, scripts, email, validator, email validator, snippets
Posted in Uncategorized |
No Comments »

March 7th, 2007 by

Jon Moffet
Yesterday I had to look for a simple Java XML-RPC library in a simple proof of concept application.
Plainly speaking, I'm going to demonstrate XML-RPC concept to a bunch of friends who is unfamiliar with programming languages other than Java (but they are not 1337 programmers either!)
I'm looking for a simple library which isn't bloated with functionality and easy to use. After much surfing, I found Redstone XML-RPC Library.
Read the rest of this entry »
Posted in Uncategorized |
1 Comment »

March 6th, 2007 by

Jon Moffet
Spam blog or splog is a nuisance, it is a blog which consists of content largely taken from other website without any modification. The primary motivation for creating splog is for getting a top searching placement and getting profit from Pay-Per-Click advertisement.
If not monitored closely, Spam blog can be harmful to content searching where it pollutes search engine with copycat content or articles which has no value at all.
Luckily there is a service which lets you identify spam blog, antisplog.net which contains database of well known spam blogs.
Antisplog provide a simple api which you can use to check whether the given website url is a splog or otherwise, this can be use to integrate AntiSplog functionality right into your own web application in order to weed out spam blog listing in your website.
Here's the sample code to check spam blog using AntiSplog api :
Read the rest of this entry »
Posted in Uncategorized |
1 Comment »