PHP – Count the number of files in a Directory / folder

How to count the number of files and/or sub-folder in a Directory / folder using PHP

I was working on a PHP project and needed to display an error message when a given folder / directory is empty. Below is a function that count the number of files (and/or folder) in a folder or directory. [php] < ?php function countFolder($dir) { return (count(scandir($dir)) - 2); } [/php] To use the function, pass the directory to be counted as the function's argument. Note: i subtracted "2" from the gross-count to get the … [Continue reading]

Simple PHP Tool for Converting Character to HTML entities

Simple PHP Tool for Converting Character to HTML entities

I have been using MobilePress to mobilize my blog since its inception. I discovered when HTML source codes are included in a blog post, the code is parsed as HTML when the article is viewed on mobile but is ok when viewed on PC. Mind you, I do wrap the code using a syntax highlighter to prevent the code from being parsed. The problem was as a result of the absent of the syntax highlighter component (JavaScript and CSS files) in … [Continue reading]

Capture and Validate Multi-Value Form Data in PHP

How to count the number of files and/or sub-folder in a Directory / folder using PHP

I am not going to make this tutorial unnecessarily long so you won't get bored rather I will as much as possible make this article brief and succinct. When writing HTML form, form element such as <checkbox> and <select multiple> are used for capturing multi-value data. Below is an example code for an HTML form consisting of a multi-select and checkbox element. [html] <form method="post" … [Continue reading]

Verify Google Adsense without PIN but a Proof of Identity Document

Adsense Personal Identification Number (PIN) verified

To say the postal service in my country is terrible is an understatement. I remember thrice requesting for my Google Adsense PIN which I never received (lost in transit). To protect the security of accounts, Google requires you to verify your address before they can send you payment. To do so, a Personal Identification Number (PIN) is mailed to your payment address. You'll then need to enter this PIN within your account. You have 6 months … [Continue reading]

Top 5 Video Software for easy Video Cropping

Aimersoft Video Editor

Video editors play a key role in enhancing the image quality. At present, there are several video editors available online to assist people in editing their evergreen pictures. Selecting the best video editing software assures high quality images with excellent resolution. Which is the best video editing software that can be availed online? This is a common query heard from many people across the world. Here is some of the best recommended … [Continue reading]

PHP Script for Hiding “HTTP Referer” Header

Hide HTTP Referer Header Script

In my previous post, i showed us what HTTP referer are, how to spoof & remove it from the list of Request Header sent to a web server and reasons why you might want to remove it. I showed us how to remove the remove the Referer field from the list of Request Headers using online tools such as anonym.to, href.li, nullrefer.com which anonymously link to a website without the site knowing who the referer is. Would love to build your own … [Continue reading]

PHP PDOStatement: bindParam vs bindValue

PHP PDOStatement: bindParam vs bindValue

It’s commonplace to repeatedly execute a query, with each iteration using different parameters. However, doing so using the conventional query() method and a looping mechanism comes at a cost of both overhead, because of the repeated parsing of the almost identical query for validity, and coding convenience, and the need to repeatedly reconfigure the query using the new values for each iteration. Using prepared statement eliminate this … [Continue reading]