Tag Archive for 'php'

5 steps to reorganize “Categories” on your blog

If you have started your blog in rush just like me. And you have been writing a lot of posts and have not planned your “Categories” on the beginning. One day you may notice that you may have way to much “Categories”. The more you have, the less processional your blog is looking. There may be just one case when you have “hundreds” of categories. It is when your blog have no any general topic.
Continue reading…

Booking Calendar Lite 1.1 released!

New version of “Booking Calendar Lite” have been released. This great script is best choice to publish if some resource are reserved, occupied or free. It is very quick to setup and easy to manage. In this version you will find a lot of improvements. Here is the list:

  • improved installation script,
  • improved administration – all settings may be changed in admin panel (no need to edit configuration files in notepad as in previous versions),
  • possibility to disable copyright notice with one click  (Powered by…),
  • optimized MySQL queries (less server load and faster responses),
  • some more code cleanup.

If you are interested in new release you may get more details on Booking Calendar Lite page.

MiniUrlz – url shortening script released in free version

As I have written some time ago I have decided to release most of my script to public (first was Booking Calendar Lite). Now it is time for "MiniUrlz". Script that may help you build url shortening service in a few minutes! It is very easy to install.

Some of most important features:

  • No database required!
  • Unlimited number of urls with unlimited url lenght!
  • PHP totally separated from main page template!
  • Administrator panel to mange submitted urls
  • Quick 1-2-3 setup

You can download and get more details about my url shortening script here.

Booking Calendar Lite released as free GPL script

I have decided to release some of my code as a free scripts under a GPL licence. My first choice is my “Booking Calendar Lite” written in PHP with MySQL support. Nice script that allow to publish on your website if some resource is free, reserved or occupied (or any other states you set in a config). You may find it under “CODE” section on my blog and see the script with a demo here “Booking Calendar Lite“. I hope you will enjoy my script as much as I did when I was writing it :).

MySQL login details in WordPress

If you have decided to move a copy of your wordpress to other host propably you will have problem with your mysql login details. Even if mysql database name, login and password are same – propably you will have to change login host (until it is not localhost :) ). It is very easy to do. All you need to change after you copy WordPress script to your new account is to edit wp-config.php file. Open it in any text editor (Notepad would be ok), find and edit following lines:

define('DB_NAME', 'put_db_name_here');
define('DB_USER', 'put_db_login_here');
define('DB_PASSWORD', 'put_db_password_here');
define('DB_HOST', 'put_mysql_host_here');

And that’s all :)

URL Shortening Script

Here is a demo of my url shortening script. It let your visitors to make short redirections of their very long url’s (for example it is useful for twitter users where they are limited to 140 characters). Script is made to be as simple as possible. HTML is separated from PHP so it may be customized by editing one HTML file without touching any PHP code! It do not need MySQL database – all data is stored in the file system. Users are redirected by .htaccess file to desired shortcut. Additionally there is administrator backend module to manage (edit/add/delete) url shortcuts. Below you may click for demo installed on my dev server.

Url shortening script frontend

Frontend demo

Url shortening script backend

Backend demo (Login: admin, Password: demo999)

You may get a copy of this script for $30 (installation included) – contact me if interested.

Update: Free version of this script have been released. Click here for more details.

Web hosting review website

My last project have just been launched. It is Web Hosting Reviews website based on customized WordPress and K2 theme. Below you may see front page screenshot. Click it to visit working site.

Web Hosting Reviews

Web Hosting Reviews

There is a lot of customization in PHP, the design and a few customized free plugins just to make it work a desired way. Site presents web hosting companies and let’s visitors to write a review, make a star rating and choose best web hosting offer by reading real users opinions.

Form element name change with JavaScript and radio button

Today I have had to modify very complex script to change look of html form. It is quite easy to make changes in the form. But sometimes it is a problem to modify not to well written PHP script to receive data from new form.
Continue reading…

Sort VARCHAR as INT in MySQL query

If you need to sort varchar data as int, there is one very nice function in MySQL. Problem I had to solve was to sort values as below in a human logical way. Values were similar to this (and I wanted it to be sorted like below):

1; 2; 2a; 3; 4; 5; 5a; 5b; 5c; 6; 7; 11; 14; 14a; 16;

The problem was that if I put this data to MySQL database as varchar and sort by this column, MySQL returned it this way:

1; 11; 14; 14a; 16; 2; 2a; 3; 4; 5; 5a; 5b; 5c; 6; 7;
Continue reading…

How to enable error reporting in PHP script

If error reporting is disabled by default on your host you have two solutions.
First is to add to your PHP script this little piece of code:

<!--?php 
  error_reporting(E_ALL);
  ini_set("display_errors", 1);
  // the rest of your script...
?-->

Additionally it is very useful to enable E_STRICT reporting level as well (not included in E_ALL). E_STRICT run-time notices, enable to have PHP suggest changes to your code which will ensure the best interoperability and forward compatibility of your code. To turn it on your code should look like this:

<!--?php 
  error_reporting(E_ALL | E_STRICT);
  ini_set("display_errors", 1);
  // the rest of your script...
?-->

But putting this code on the top of your script will not catch any parse errors. A missing “)” or “;” will still lead to a blank page. This is because the entire script is parsed before any of it is executed. If you are unable to change php.ini (that would be the best solution) and set in it

display_errors On

then there is a possible workaround (found on comments on php.net website). This code would solve this problem:

<!--?php 
  error_reporting(E_ALL | E_STRICT);
  ini_set("display_errors", 1);
  include("file_with_errors.php");
?-->

You may go even further and make a little debug script with error reporting (when it is disabled for the rest of your scripts). Just create a file called “debug.php” with this content:

<!--?php 
  error_reporting(E_ALL | E_STRICT);
  ini_set("display_errors", 1);
  include($_GET["file"]);
?-->

Then you will be able to execute any script on your web host just by calling “debug.php” with urls like this

http://domain.com/folder/debug.php?file=file_with_errors.php

http://domain.com/folder/debug.php?file=subfolder/file_with_errors.php

http://domain.com/folder/debug.php?file=../file_with_errors.php

Second alternative soulution is to edit your .htaccess file. It would enable error reporting for all files in current directory. All you need to do is to simply add the following lines:

php_value display_errors 1
php_value display_startup_errors 1