Articles Archive for October 2008
Posted: Oct 20 | Filed under: ModRewrite
Well today I had to rewrite some URL’s from upper to lower-case letters. Somehow it did not rewrite this automatically. I didn’t figure out the reason why it did not work properly but I found a workaround.
If you have access to the httpd.conf file of the apache server, then simply add the following lines:
<VirtualHost IP:80> stuff here <IfModule mod_rewrite.c> RewriteEngine on rewritemap lowercase int:tolower RewriteCond $1 [A-Z] RewriteRule ^/(.*)$ /${lowercase:$1} [R=301,L] </IfModule>
Now it will redirect the URL’s properly. Yay!
Source
Posted: Oct 19 | Filed under: SQL
Well I’m not so familar with SQL, that’s why I was struggling with that problems for about 10 minutes. Actually it’s fairly simply, the error message says that there is already an entry with the ID 127 in the database.
The problem is the size of the SQL field. A signed TinyINT can only save entries from -127 to 127, an unsigned TinyINT can hold entries that range from 0 to +255.
You can find some more information about it here.
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


