Posts Tagged ‘PHP’

How To: Enable the Use of Sessions On Your WordPress Blog

April 14th, 2010

WordPress does not use sessions to hold any data being that it is a stateless application. This makes it quite a problem for tasks like a shopping cart, which requires data(the user’s selected product) to be remembered from one page to the next. This means that if you want to use PHP sessions in your plugins or custom modifications of WordPress you will need to do some custom coding.

Luckily the fix is a simple one that anyone can handle! You only need to do a little hacking to enable sessions within WordPress.

(more…)

Creating Search Engine Friendly URLs With Apache and PHP

February 3rd, 2010

Utilizing URLs on your site that are search engine friendly is simple and easy to do thanks to PHP and Apache. We will be utilizing permalinks that get rid of all the nasty $_GET data that trails the end of most PHP scripts. An example of a SEO unfriendly URL we will clean is:

http://www.myguysolutions.com/article.php?id=123&title=seo-php-url

Using a combination of Apache’s ForceType directive, the PHP explode() function and PHP’s PATH_INFO variable we can easily turn the sample URL into:

http://www.myguysolutions.com/article/123/seo-php-url

This not only helps our website’s SEO (search engine optimization), but also accomplishes a security concept is known as “security by obscurity”. By obscuring the fact that our web site is using a PHP script, we may detract potential hackers from looking for exploits within our scripts.

(more…)