PHP

PHP INTRO, debugging, html quotes, email, closing tags, security, if, cookies, alt. syntax

December 12, 2016

updated 2020-05-11. PHP is now the most popular servers-side scripting language in the world. It is, in fact, the programming component of the “LAMP” environment: Linux, Apache, MySql, Php and is built in to all major linux distributions. PHP is surprisingly more popular than Microsoft’s own ASP web scripting language! PHP initially started on Linux/unix environment but today there are more PHP developers on...

Read more »

php basic String functions

June 6, 2016

updated 2020-08-28 strlen, strcmp, substring, strtoupper, strtolower, str_replace, addslashes, trim, strstr, strpos, str_repeat, strrev, explode, implode, chunk_split, . . .   string length $length = strlen($str); an empty string if( empty($string) ) : A variable is empty if it’s undefined, null, false, 0 or an empty string.   substring $str = "abcdefgh"; echo substr($str, 1); // bcdefgh echo substr($str, 3); // defgh echo substr($str,...

Read more »

PHP: Deleting Files

July 14, 2015

To delete all files of a particular extension, or in fact, delete a group with any wildcard, echo `rm -f path/to/*.jpg`; # note the backquotes, not single nor double quotes or foreach (glob("*.jpg") as $filename) { echo "$filename size " . filesize($filename) . "\n"; unlink($filename); } sometimes, the function realpath() may be needed: unlink(realpath($fileName)); or $mask = "*.jpg" array_map( "unlink", glob( $mask ) );...

Read more »

TAKE jpg webcam PHOTO with HTML5

July 5, 2014
TAKE jpg webcam PHOTO with HTML5

updated 2016-03-03 How to take-upload your visitors webcam photo How to upload a jpg photo on your website with your visitors webcam html5 webcam getUserMedia examples and demo How to take a jpg webcam photo with html5 One of the really cool things that has come from HTML5 is the ability to access a website visitor’s webcam and upload a snapshot through the browser...

Read more »

how to add and edit reports in zencart

May 16, 2014

updated 2014-06-21 How To Create Your Own Reports in ZenCart I have done google searches on how to create my own reports in zencart and searches on how to edit the reports that are there and got no worthwhile information. There is a plugin zencart offers under “Admin Tools”, called “Graphical Sales Report” and another simply called “Sales Report”. They look helpful but are...

Read more »

basic loops in PHP

February 10, 2013

Loops execute a block of code a specified number of times, or while a specified condition is true. for for ($i = 1; $i

Read more »

Delete the Zen-Cart Store Demo files, images, and Data

October 11, 2012
Delete the Zen-Cart Store Demo files, images, and Data

How to get rid of zen-carts demo store – including version 1.5.0. “How to clean up default install and remove example store related files.” How to remove, or delete, the “Zen Cart demonstration categories and products”. Help with installing Zen-cart, help removing Zen-cart’s demo store. How to Delete all the Zen-Cart Sample Store files, images, and Data. Install Zen-Cart and choose “NO” to the...

Read more »

make your Zen-Cart 1.5.0+ configuration.php files flexible

September 28, 2012

On you backup or testing server, for development, (not your live, commercial, site!!) you can create a fake SSL certificate (for free, of course!) officially called a “Self Signed Certificate” and operate with SSL turned on everywhere. Regardless! In your zen-cart configuration files, do not hard-code any settings that might be different on your backup or testing server or that you might want to...

Read more »

zen-cart v.150: cannot test off-site, “not accepting payments from your region”

September 25, 2012

“Sorry, we are not accepting payments from your region at this time” Problems with testing Zen-Cart 1.5.0 off-site updated Sept. 25th 2012 SSL certificate required for zen-cart on a development server? You’re kidding! I just started testing an upgrade (to v.150) on one of our development servers. I made sure it was working properly as is (v.138a in “test mode”) before starting the upgrade...

Read more »

Stopping Website Visitor Blog Spam

April 9, 2012

Stopping Website Visitor Comment Spam. IF you have a blog and want visitors to easily add a comment to an item, you will also get spam – lots of it – unless you, traditionally, forced visitors to create a login before commenting, or you used a captcha. As one guy said, “It’s really disgusting the stuff I have to block from my blog every...

Read more »

PHP DATE and TIME Functions, warnings

March 22, 2012
PHP DATE and TIME Functions, warnings

updated 2019-09-21 The Current Date, Time today (yyyy-mm-dd): echo date("Y-m-d") ; today (mm-dd-yyyy): echo date("m-d-Y") ; this year (yyyy): echo date('Y') ; date("F jS Y, h:i:s a T", time() ) ex: October 1st 2012, 05:05:31 pm EDT (ex: USA Eastern time zone during DST) j = day of the month 1-31 without leading 0. d = day of the month 01-31 with leading 0....

Read more »

php, Arrays

March 12, 2012

updated 2016-04-09 Array keys start from 0, not 1. In an associative array a key is associated with a value. An array in PHP is actually an ordered map. (each key is mapped to a value). array values can be other arrays, trees and multidimensional arrays are also possible. A value can be any PHP type. A key may be either an integer or...

Read more »

php 5.3: Speed Optimizations for Strings and Arrays

January 27, 2012

updated 2020-02-03 str, ctype, preg, explode, etc.. example: switch y-m-d to m-d-y list($YY,$mm,$dd) = explode("-",$date_stored); $displaydate = $mm."/".$dd."/".$YY; Real-World Experience Buffering A customer I contracted with had the experience of rare cases where visitors to his site would experience the computer starting to process their page request and then being sidelined while the cpu co-processed other visitors page requests – for as much as...

Read more »

php 5.3: how to stop strtotime(), date(), error

January 15, 2012
php 5.3: how to stop strtotime(), date(), error

Warning: date(): It is not safe to rely on the system’s timezone settings

Read more »

PHP 5.3 Breaks “many things”

January 9, 2012

“PHP 5.3 brought many problems due to the PHP authors’ decisions to . . . break many things…” Also, they initiated the warnings of more things they intend to break in PHP 6. Be sure your error reporting is turned on: (for your testing copy or for your IP address) @ini_set('display_errors', '1'); error_reporting(E_ALL ^ E_NOTICE); # or error_reporting(E_ALL); “PHP 5.3 breaks AtMailOpen.” “I tried...

Read more »