Archive

Posts Tagged ‘PHP Script’

Handling File Read/write Concurrency Problem in PHP

Feb 23rd, 2010

Recently I need to use file for caching little bit of data. Then I thought of concurrency problem can arise in File based structure due to read/write issue. For small data and that also if  not so useful , usage of Database can be avoided. Though Database can handle any kind of conflict and other [...]

PHP require/include and relative path error

Jan 7th, 2010

Finding the correct relative path for use in you php page for include/require.

Getting all Parent Folders of a Folder and File

Dec 26th, 2009

I need to get all the parent folders of a File for a work. I searched on net to find easy solution for this and also to find some tips for my work. As, my work was heavily dependent on this logic, so I have given some time to it. But whatever I have found [...]

Online HTML Characters Encoding Tool for Script posting

Dec 13th, 2009

It is an online HTML characters encoding tool for posting script to webpage or blogs. Suitable for all who posts HTML, PHP, JavaScript and other kind of codes on blog.

Get All Included Files in PHP

Nov 15th, 2009

Get all files included in current scope in a PHP script. File included using require, require_once,include, include_once all will be captured.

How to Set Default File Path for Include Files?

Nov 15th, 2009

Files residing in a deep directory and you want to set include path for all those files,
you can set it using ini_set() or set_include_path().

Getting Visitors IP Address in PHP

Oct 26th, 2009

Find the visitors’ real IP address and know how to store it in database. Discussion about the various ways to handle the IP address for storing and comparison.

Permanent 301 Redirect, using HTML and PHP

Oct 25th, 2009

In case, you do not have option of using server side header directive then you can use HTML method of 301 permanent redirect.

PHP Custom Error Handler

Oct 5th, 2008

This is custom error handler in PHP. You can use your custom error handler for showing the error in you customized format, logging the error in a log file and for other reason.

<?php
//error handler function
function customError($errno, $errstr, $fileName, $lineNo)
{

switch ($errno) {

// fatal error. die it.
case E_USER_ERROR:
echo [...]

Open CSV (Comma Separated Value) File in MS Word

Sep 28th, 2008

CSV file is a text file, so this type of file can easily be opened in MS Word. Just use your MS Word Menu File->Open. Or right click on file and use “Open With…”. Select “Microsoft Word for Window”.
CSV file data can easily be converted into table structure in MS Word application. For converting [...]