Using special characters in a file link
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 …
» Read more…
Rewrite uppercase URL’s to lowercase
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
Find occurences of multiple needles in haystack
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 ![]()
Sponsored blog posts requirements
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.
Wordpress: Improve security, change default admin username
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!
PageNavi not working on front page if you exclude categories
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
