Friday, 17 December 2010

Filtering the URL in text, checking the links/URLs in text

/ *
* @param string $text = the text for checking URLs/Links.
* @return array $urls = 'is_url_exist' for true/false, 'urls'= list of found URLs
* /
static function is_url_exist_in_text($text="")
$urls = array();
$is_url_exist = false;

/ / $reg_exUrl = "/((http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)|(/[a-zA-Z\.]+\.[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/))?/";
$reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/"; // for url format : |
preg_match($reg_exUrl, $text, $url_1);
$reg_exUrl = "/(www)\.[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/"; // for url format : |
preg_match($reg_exUrl, $text, $url_2);

$urls = array_merge($url_1, $url_2);
if(count($urls)>=1) { $is_url_exist = true; }

$results = array('is_url_exist'=>$is_url_exist, 'urls'=>$urls);

return $results;

To upload the big files using PhpMyAdmin, I cannot upload big dump files (memory, HTTP or timeout problems)

I cannot upload big dump files (memory, HTTP or timeout problems). (local URL: http://localhost/phpmyadmin/Documentation.html)

Starting with version 2.7.0, the import engine has been re–written and these problems should not occur. If possible, upgrade your phpMyAdmin to the latest version to take advantage of the new import features.

The first things to check (or ask your host provider to check) are the values of upload_max_filesize, memory_limit and post_max_size in the php.ini configuration file. All of these three settings limit the maximum size of data that can be submitted and handled by PHP. One user also said that post_max_size and memory_limit need to be larger than upload_max_filesize.

There exist several workarounds if your upload is too big or your hosting provider is unwilling to change the settings:

* Look at the $cfg['UploadDir'] feature. This allows one to upload a file to the server via scp, ftp, or your favorite file transfer method. PhpMyAdmin is then able to import the files from the temporary directory. More information is available in the Configuration section of this document.
* Using a utility (such as BigDump) to split the files before uploading. We cannot support this or any third party applications, but are aware of users having success with it.
* If you have shell (command line) access, use MySQL to import the files directly. You can do this by issuing the "source" command from within MySQL: source filename.sql.

Monday, 6 December 2010

Change/Modify the timestamp into GMT format in PHP

/ ** Change/Modify the timestamp into GMT date time format.
* e.g. Thu, 02 Dec 2010 18:34:11 GMT * /

$today_timestamp= mktime(0, 0, 0, date("m") , date("d"), date("Y"));
// Changing the time stamp into GMT format
$get_GMT_format = gmdate('D, d M Y H:i:s T', strtotime($today_timestamp));