HOME PHP HTML Python CentOS Web Development DNS today email validation Networking Socket Programming Amazon S3 REST yepp S3 mysqld timeout metaWeblog API file attachment Similarity mt_rand REMOTE_ADDR extract_filename File Attributes XHTML File Delete Function GD Library get current file Knuth json_encode Internet Protocols javascript calendar JSON json_decode User IP AUTO_INCREMENT POST Method PHP.INI URLDecode Programming HTTP_USER_AGENT Application Version KMP Algorithm KMP Base64-Encoding body BR tag Browser IXMLDOMDocument IP address Browser Information HX5V echo Cloud Berry copy & paste zip File Downloading Data Handling Data Import dictionary diff DNS Protocol

PHP.ZIP

Mastering Excel Data Importation in PHP   (created at Apr 24, 2024)   35  

You may use an Excel spreadsheet to manage your data for many cases, and had some chances that you want to use it as a direct data source from time to time.You can use PHP libraries like PHPExcel or PhpSpreadsheet to handle Excel files with multiple sheets...

JSON format control in PHP   (created at Sep 13, 2012)   163  

PHP provides an easy way to handle JSON format, whether you're creating or parsing it. Let's delve into how to do both.Creating JSON format in PHP is straightforward. You can use arrays and the json_encode() function to convert PHP data into a JSON string....

Checking similarity between two strings in PHP   (created at Jun 16, 2013)   110  

PHP includes a function similar_text() very rarely used but quite useful that compare two strings and returns the percentage of similarity of between two. 

Create Blob Image in HTML based on the given Text, Width and Height in the Center of the Image without saving file   (created at Apr 21, 2024)   86  

Creating images dynamically within HTML can be a powerful tool for web developers, allowing for personalized and customizable content. By leveraging PHP's GD library, developers can generate images on-the-fly based on user input or other dynamic data, with...

How to ban / block IP addresses   (created at Oct 15, 2007)   116  

This example gets the users IP address and exits the page if it matches a banned number. 

How to force cookies, disable php sessid in URL ?   (created at Oct 15, 2007)   139  

This commands disables php from rewriting URLs to add a phpsessid, and forces the use of cookie sessions instead. Using cookies is largely thought of as the preferred way to use sessions - both more secure and better for SEO. This can be accomplished by se...

Building a Basic DNS Server in PHP/Python: A Beginner's Guide   (created at Mar 15, 2024)   145  

Creating a full-fledged DNS server in PHP is not recommended for production environments due to performance and security concerns. DNS servers require low-level networking capabilities and efficient handling of DNS protocol messages, which PHP is not optim...

Uploading files to Amazon S3 with REST API in PHP   (created at Sep 27, 2010)   342  

You can upload files with socket based REST API in PHP. In order to access Amazon S3 API, you need Access Key and Secret Key. Following is the example.   

File downloading function through PHP code   (created at May 29, 2012)   147  

Sometimes, you may need to implement download function for access control to avoid illegal connection. Refer below reference code.

GD library version in PHP   (created at Sep 25, 2012)   193  

In case that you need to know the version of GD library, you can use below function in PHP.

Simple PHP code performance measuring example   (created at May 19, 2013)   328  

Below code is the simple reference to measure code execution time. Sometimes, you may need to check Performance for optimization to reduce server cost.

PHP socket programming to get content with post method   (created at Oct 19, 2009)   52  

When you need to get content with POST method in PHP internal code, you need to get the desired result through alternate socket programming as below.Actually what I wanted is emailing through alternate server located in different domain, because the curren...

Convert plain HTML to XHTML   (created at Mar 04, 2013)   115  

Below is the example of converting from plain HTML to XHTML.

Image file resizing in PHP   (updated at Dec 17, 2023)   181  

Below example shows how to resize image in half size. Actually imagecopyresized() do the necessary things.

Function can extract file name in string having full path in PHP   (created at Jun 18, 2011)   157  

Sometimes, I make string operation function regarding file operation. Actually extracting file name only is frequently using function in terms of my point of view. But one thing if you do the same thing like me, please use below function already provided b...

How to create private URL on S3/CloudFront with time-limit ?   (created at May 26, 2011)   154  

For security reason, many companies may require one time temporary or private URL with time-limit. Some people call this as private or signed URL. Below URL is based on PHP and contains S3 signed URL generation function and CloudFront signed URL generation...

Apache server unstable detection and the related server(mysql, apache) restart automatically   (created at Mar 19, 2012)   138  

I am using CentOS with php, and mysql for web service, and sometimes my server is dead by unknown reason so I optimize mysql database and restart web server manually. Following is the first my /etc/cron.hourly/optimze process for seamless service. But...

PHP Code can know the current OS is windows or not   (created at Feb 20, 2014)   104  

Below PHP code is for knowing the current OS working is Microsoft Windows or not. I have used below example code to call COM object in case that the OS is Microsoft Windows.

Setup Apache+PHP+MySQL on Centos 6.7   (created at Nov 02, 2015)   146  

If you installed Centos in minial installation mode, you should install Apache + PHP + MySQL manually.The followings are the procedure to install Apache + PHP + MySQL:Making apache and mysql to start automatically

Simple PHP calendar   (created at Jun 02, 2013)   109  

Below is the simple PHP calendar generation function.

mysql optimization – if you are using Word Press, do not turn off persistent connection   (created at Jun 12, 2012)   134  

I am using Virtual Private Hosting service, and I found that my server has some problem as below. As you can see the CPU occupation rate is more than 300%. So my server response speed is the most slower than I had experiences before. I had read some articl...
mysql optimization – if you are using Word Press, do not turn off persistent connection

Parsing XML in PHP   (created at Mar 06, 2011)   120  

To parse XML easily in PHP, I recommend you to use SimpleXML extension. The below is the sample reference to use SimpleXML extension.    

Unzip a ZIP file in PHP   (created at Oct 24, 2010)   56  


Human readable random string for captchas in PHP   (created at Jul 05, 2010)   100  

The below function will generate a human readable string that will look more cose to dictionary words, and this will be useful for captchas.

How to get browser information in PHP?   (created at Jun 22, 2010)   94  

PHP provides to get browser information by function. Below is the simple example.Above example may display as following, if you use FireFox.Mozilla/5.0 (Windows; U; Windows NT 5.1; ko; rv:1.9.2.3) Gecko/201004...

How to get the duration between days in PHP   (created at Jun 15, 2010)   84  

Following is the funcation can calculate the duration, actually number of days between the given parameters (from,to). The argument must be subclass of DateTime.  

Date format validation in PHP   (created at Nov 28, 2009)   57  

Below code is designed for date format validation in PHP. Even though simple, but useful many times. Actually PHP provides date validation function as checkdate(). See the detail below.  

PHP function converts new line to BR tag   (created at Nov 27, 2009)   94  

In case of displaying normal text having CR+LF character string on web browser, you may need to change it to
tag.PHP provides speedy converting function for supporting that. Following function is very useful.Proto-type:function nl2br( ...

Email Validation Snipet in PHP   (created at Nov 08, 2009)   85  

Following email validation snipet is useful when implement user registration module on website.

How to remove HTML tags in text string?   (created at Aug 05, 2009)   85  

strip_tags() function is the simplest & fast PHP function to remove HTML tags in text string.Here's the simple example.      $m_school = strip_tags( $m_school);