PHP

How to install and customize-personalize Zen-Cart

By greg | Posted in PHP Zen-Cart
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...
Read more »

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

By greg | Posted in PHP Zen-Cart
Delete the Zen-Cart Store Demo files, images, and Data

"How to clean up default install and remove example store related files." How to remove, or delete, the "Zen Cart demonstration categories and products". How to Delete all the Zen-Cart Sample Store files, images, and Data. Install Zen-Cart and choose "NO" to the "Store Demo": (Would you like to install the Zen Cart demonstration categories...
Read more »

Function: Convert Numbers to Words

By greg | Posted in PHP Advanced

This little, recursive, script is to convert a number, an integer, to words. It has an upper limit of 999,999,999 but you can expand or reduce it from there. Put the function in your include file and try it out. /* * Function: number_to_words * Description: recursive numerics...
Read more »

Stopping Website Visitor Blog Spam

By greg | Posted in PHP Advanced, PHP WordPress

Stopping Website Visitor Comment Spam. (ex: wordpress) 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...
Read more »

Structured display of All Variables in memory

By greg | Posted in PHP Advanced

"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...
Read more »

PHP6: Character encoding and other new features

By greg | Posted in PHP Advanced

The Internet is converging on UTF-8 for a common / universal character encoding. Set your apache environment to utf-8 by adding 'AddDefaultCharset utf-8' to your .htaccess. If you do not use apache add 'default_charset utf-8' to your php.ini. You have to do either of them (not both), php will use...
Read more »

SQL db Injection, Cross-Scripting, RFI, and LFI

It is possible for a hacker to enter the following seemingly innocuous text into the UserName textbox to gain entry to the system without having to know a valid user name and password: ' Or 1=1 -- The hacker breaks into the system by injecting malformed SQL into the query. This particular hack works because...
Read more »

Clean up WordPress

By greg | Posted in PHP WordPress

There are some problems with WordPress which can be easy to fix if someone would just tell you how. Some issues involve portability: when you change internet hosting providers, and when you have a copy of your web site, certainly your wordpress blog, on your pc, it is a backup copy, and a...
Read more »

Comparing OOP in php, java, and C++

By greg | Posted in C++ and C#, PHP Advanced

Sample introductory Object Oriented Programming code in php, java, and C++ showing the similarities and differences. Never-the-less, OOP, despite all the bragging we hear about it, is a lot more expensive to write and to maintain than clean structured code. The reality of it does not live up to the theory, ...
Read more »

Writing your own functions

By admin | Posted in PHP Intro

"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; .... ...
Read more »

PHP Date Functions

By greg | Posted in PHP Advanced

PHP date functions: (see www.php-date.com for much more) (the hard way) if today is 8-4-2009 Yesterday: ex: 2009 08 03 strftime("%Y %m %d", mktime(0,0,0, date("m"), date("d")-1, date("Y"))) or 2009-08-03 strftime("%Y-%m-%d", mktime(0,0,0, date("m"), date("d")-1, date("Y"))) 1249282800 = ...
Read more »

A few NorthWind MySQL PHP scripts

By greg | Posted in MySQL, PHP Advanced

Note that the dates on the NorthWind data range only across 1 full year, 1997: from July 1996 to May 1998. Each line of data below comes from 3 files (tables): the orders file, the order-details file, and the customer file. There are also files of employees, products, suppliers,...
Read more »

php: ctype vs. str_ vs. preg Speed; regular expressions

By greg | Posted in PHP Advanced

It should be noted that ctype functions are always preferred over regular expressions, and even to some equivalent str_* and is_* functions. This is because of the fact that ctype uses a native C library and thus processes significantly faster. NOTE: the ereg... functions have been removed from PHP6 {ereg, eregi,...
Read more »

Syntax Check a PHP Pgm

By greg | Posted in PHP Intro

if you have error_reporting turned on: @ini_set('display_errors', '1'); error_reporting(E_ALL); # (E_ALL ^ E_NOTICE) or everything: (E_ALL) and you still get nothing but a blank page ... then, by all means, your next step might be to take the syntax check option built into PHP! From a linux/unix command line (terminal session), run...
Read more »

two online PHP tests

By greg | Posted in PHP test Q's

These questions have come from 2 online tests. Here, you can read, look up the answers, test out the code and see what happens, etc. when taking the test, at preVisor, you are limited to 3 minutes / question. the questions are displayed one question at a time - one page per question and you...
Read more »