Pages

MySQLi and PDO_MySQL library

The entire ext/mysql PHP extension, which provides all functions named with the prefix mysql_, is officially deprecated as of PHP v5.5.0 and will be removed in the future.

It was originally introduced in PHP v2.0 (November 1997) for MySQL v3.20, and no new features have been added since 2006. Coupled with the lack of new features are difficulties in maintaining such old code amidst complex security vulnerabilities.

The manual has contained warnings against its use in new code since June 2011. As the error message suggests, there are two other MySQL extensions that you can consider: MySQLi and PDO_MySQL, either of which can be used instead of ext/mysql. Both have been in PHP core since v5.0, so if you're using a version that is throwing these deprecation errors then you can almost certainly just start using them right away—i.e. without any installation effort.

I have collected some of above said library for your reference.

SimplePDO Database Wrapper
SimpleMysqli
Custom php mysqli database class
MeekroDB
A Simple PHP Class For Prepared Statements in MySQLi 

Get the visitor browser-type

This method tests the $_SERVER vars for an HTTP_USER_AGENT entry. Through a series of if statements, preg_match, and regex patterns, a browser-type will be returned. If a browser-type is unable to be determined 'other' will be used in it's place.

Rewrite and Redirection by .htaccess


Force www


RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]

Force www in a Generic Way


RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
This works for any domain.


Force non-www


It's still open for debate whether www or non-www is the way to go, so if you happen to be a fan of bare domains, here you go:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

Collection of WordPress Template Tags

WordPress Themes are files that work together to create the design and functionality of a WordPress site. Each Theme may be different, offering many choices for site owners to instantly change their website look but they are made up with simply following functions.

the_title()
Displays the posts/pages title
the_content()
Displays the content of the post/page
the_excerpt()
Displays the excerpt of the current post/page
the_time()
Displays the time of the current post/page