Posted: Jan 17 | Filed under: Code Snippets

If you want to validate a form and you have to check if all variables are set you have to keep a few things in mind:

a) If you disable a input field so users can only see the content you will not be able to fetch the value via $_POST

disabled=”disabled” if you add this to a input field and you submit the form you won’t be able to fetch it via $_POST

Instead use readonly=”true”

b) Textareas are slightly different. You will first have to strip all slashes if you want to fetch the real value of it.

  Posted: Jan 17 | Filed under: General

Statistics can come in handy. Especially web developers have to know how common Safari or Google Chrome is nowadays.

Here is the full report.

  Posted: Jan 10 | Filed under: Adsense

Do you want to increase your adsense earnings? Then visit the following page http://gathadams.com/

Apparently Adsense loads the ads with the highest PPC cost to the first ad that appears in the source code. If this ad is NOT the ad that has the most clicks you are possibly loosing income!

Must-read in my opinion!

  Posted: Dec 27 | Filed under: Wordpress

Guide to fix popularity contest, a very popular WP Plugin!

Open popularity-contest.php and scroll down to line 59. Replace require(’../../wp-blog-header.php’); with require(’../wp-blog-header.php’);

If you get the following error:
wp_ak_popularity_options’ doesn’t exist on line: 124, then you will have to add the tables manually:

    CREATE TABLE IF NOT EXISTS `PREFIX_ak_popularity` (
    `post_id` int(11) NOT NULL,
    `total` int(11) NOT NULL,
    `feed_views` int(11) NOT NULL,
    `home_views` int(11) NOT NULL,
    `archive_views` int(11) NOT NULL,
    `category_views` int(11) NOT NULL,
    `single_views` int(11) NOT NULL,
    `comments` int(11) NOT NULL,
    `pingbacks` int(11) NOT NULL,
    `trackbacks` int(11) NOT NULL,
    `last_modified` datetime,
    KEY `post_id` (`post_id`)
    ) ENGINE=MyISAM;
 
    CREATE TABLE IF NOT EXISTS `PREFIX_ak_popularity_options` (
    `option_name` varchar(50) NOT NULL,
    `option_value` varchar(50) NOT NULL
    ) ENGINE=MyISAM;

Enjoy the holidays!

  Posted: Dec 20 | Filed under: Javascript

If you want to retrieve various URL parameters without using PHP you can also do it via Javascript.

(more…)

  Posted: Nov 11 | Filed under: General

Today some people were uploading stuff with foot signs in the file name to one of my blogs. Obviously the links were all broken. I know the basic syntax for example for spaces (%2B), because you see it all the time, but I had to lookup the others in a book.

This small table can help us to fix URL’s …
(more…)

  Posted: Oct 17 | Filed under: Code Snippets, PHP

Let’s say you got a form and you don’t want to allow that people submit certain words. How would you do that? Right you will have to use the PHP function strpos. Unfortunately you can’t feed strpos with arrays (a list of needles)!

Here is a very simple solution that you can use to to check multiple needles and their occurence in a specific string.

 
$haystack = $myhaystack;
$needle = array('badword','badword','badword','badword');
 
foreach($needle as $value){
$pos = strpos($haystack, $value);
if ($pos !== false){ /* If we find one of those bad words do the following */
 
	header("Location: http://mysite.com?error=badcontent");
	exit;
 
	}
}

I used the “header” command to redirect people to a specific site if they enter those bad words. You can output a customized error message by adding a variable at the end of the URL e.g. the variable “error”. Simply retrieve the variable via GET and then echo an appropriate message.

If you have any question feel free to ask!

Enjoy :)

  Posted: Oct 16 | Filed under: General

Well I recently signed up for some PPP programs, which stands for “Pay Per Post”.
Webmasters can earn money for their opinion and increase their blog earnings.
But there are some requirements if you want to participate in one of those programs.

PayPerPost.com
1) Blogs must contain a monthly chronological archive of posts.
2) Posts may not be truncated. (I suppose that means “Read more” is not allowed, which is pretty stupid!)

PayPerPost does not accept blogs from advertising community blog sites or AdSense monetized blogs such as, Blogger Party, WritingUp, BlogCharm, Blogitive, Blog4Cash, Senserely, etc.

SocialSpark.com
1) Blog Posts must have a clearly visible time stamp.
2) Blog must have 20 posts within the last 90 days.
3) “Read more” is allowed on frontpage.

Obviously there are some more requirements.

Another great PPP program is www.sponsoredreviews.com:

SponsoredReviews.com rejection might be due to the following reasons:

1. Blog is too new and has poor stats, including little traffic and/or links.
2. Blog has too much paid content and does not meet our 2:1 ratio rule.
3. Blog was over-priced based on its stats and our suggested price.
4. Blog is written in a foreign language and does not follow guidelines on how to properly submit.

  Posted: Oct 14 | Filed under: General

Obviously one big security flaw of Wordpress is that the admin username is by default “admin”. This is a security risk, because hackers will only need your password and already have your username, that’s a clear advantage! People without experience don’t know that they can change this via PHPMyAdmin and therefore don’t change it.

To improve your blog security install the following plugin.

This way you can change your admin username. Once that is done relogin and your wordpress blog should be a little bit more secure!

  Posted: Oct 02 | Filed under: Wordpress

Well did you ever use the command “query_posts(’cat=-xx’);” to exclude certain posts from your main page? I did!
Recently I found out that my pagenavi was no longer working.


A solution is to get this plugin that provides cms-like functions to exclude certain categories completely from specific parts of your blog.


If you don’t want to exclude posts from the sidebar you might also want to take a glance at this plugin: Simply Exclude