PHP

basic loops in PHP

February 10, 2013
By

Loops execute a block of code a specified number of times, or while a specified condition is true. for for ($i = 1; $i $mon) { echo $key . ” – ” . $mon . ““; } output: 0 – January 1 – February … 11 – December $characters = “Porky Pig”; $characters = “Daffy Duck”; $characters = “Speedy Gonzales”; foreach ($characters as $key...

Read more »

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

September 28, 2012
By

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
By

“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 »

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

July 11, 2012
By
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 »

Stopping Website Visitor Blog Spam

April 9, 2012
By

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
By
PHP DATE and TIME Functions, warnings

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') ; ex: October 01st 2010, 05:05 pm EDT   (ex: USA Eastern time zone during DST) date("F dS Y, h:i a T", time() ) ex: 2010-10-01, 05:05 pm EDT date("Y-m-d, h:i a T", time() ) To see all the formatting options for date() and gmdate(),...

Read more »

php, Arrays

March 12, 2012
By

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 a string....

Read more »

PHP INTRO, debugging, html quotes, closing tags, security

March 12, 2012
By

PHP is perhaps the most widely-used general-purpose scripting language*, especially suited for Web development. It is, in fact, the programming component of the “LAMP” environment: Linux, Apache, MySql, Php. PHP is surprisingly more popular than Microsoft’s own ASP web scripting language! PHP runs lot faster than ASP on MS Windows and has more features and functionalities than Microsoft ASP. PHP is much more robust,...

Read more »

php 5.3: Speed Optimizations for Strings and Arrays

January 27, 2012
By

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 a minute...

Read more »

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

January 15, 2012
By
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: Writing your own functions

December 16, 2011
By

“All custom functions should start with xxx_ so that the developer knows a native PHP function is not being called.* where xxx == your initials, or the project’s initials, or …” An example custom function style: function pwb_my_function($parameter1, $parameter2) { global $an_outside_variable; .... return true; } functions with optional parameters suppose you are using a function with 1 param, and in some new cases,...

Read more »

Structured display of All Variables in memory

November 2, 2011
By

“The function, get_defined_vars(), returns a multidimensional array containing a list of all defined variables at that location in your program.” To get ALL variables, list ALL variables, display ALL variables, in memory and available at the point where you request it, your scope, (not just SESSION variables, everything … except private function variables – invisible/unavailable externally). To get more than just a string of...

Read more »

moodle: Time Spent in a lesson, not being added

October 29, 2011
By

Moodle: To require a minimum time spent in a lesson The lesson dependency, time spent, is not being added up to determine if a student has spent the required time in the previous lesson. (previous or some other dependent-lesson) Also, in the first page of a lesson, if a person refreshes the page, it writes a new record wiping out credit for all the...

Read more »

Enhancing, expanding limits, customizing, phpMyAdmin

October 29, 2011
By
Enhancing, expanding limits, customizing, phpMyAdmin

The database tool, phpMyAdmin is and has been, the most popular and most awarded among MySQL administrators and developers. It was mentioned by the author of the first php and MySQL book I read. The administrators and developers I have met since, all use it. It is also one which can be installed on the website. Over time, I have learned ways to customize...

Read more »

How to install and customize-personalize Zen-Cart

October 28, 2011
By
How to install and customize-personalize Zen-Cart

Tutorial help: how to find settings to set up, customize, Zen-Cart Fast. What Zen-Cart Won’t Tell You Running the installation program is easy. The time consuming part is removing their sample store demo files and changing ZC’s settings which are scattered all over. I made changes to the html several times because I did not know there was some setting in admin. The admin...

Read more »