LiveZilla Input Field Validation (eg: Require Email)

I realize LiveZilla has their own suggestion for performing input field validation, but here is my spin on the process.

Create `validation.php` in your main LiveZilla folder with the following code (update input field IDs accordingly)…

<?php

$debug = true;

if (isset($_GET['id']) && isset($_GET['value'])) {
    switch ($_GET['id']) {
        case '112':
            $field = 'Email';
            $valid = filter_var($_GET['value'], FILTER_VALIDATE_EMAIL);
            break;
        default:
            $field = 'Unknown';
            $valid = false;
    }

    if ($debug) {
        date_default_timezone_set('America/New_York');
        file_put_contents('./validation.log', sprintf("%s - %s (%d): %s (%s)\n", date('Y-m-d G:i:s'), $field, $_GET['id'], $_GET['value'], $valid ? 'pass' : 'fail'), FILE_APPEND);
    }
    
    echo sprintf('lz_validate_input_result(%s,%d);', $valid ? 'true' : 'false', $_GET['id']);
}

Note: Includes optional debug logging in case you need to test new fields and encounter unexpected results.

Configure LiveZilla…

  1. Server Configuration > Input Fields > Email > Validation
    • Validation Active: Checked
    • Validation URL:
      /livezilla/validation.php?id=112&value=<!–value–>
      Change “livezilla” to match your installation folder
    • Timeout: 5
    • Pass on timeout / error: Checked
    • Click Ok
  2. Click Ok or Apply

 

Better Windows Batch (.bat) File for Testing Internet Connections

I wrote a post yesterday about testing your internet connectivity using a Windows batch file, but since I cannot leave well-enough alone, I decided to keep working on it.

A few things to keep in mind…

  • The line “set ESC=” ends with a non-printable ASCII ESC character (ASCII 27; Hexadecimal 0x1B) that may not be visible in your browser. Editors like Notepad++ show non-printable characters.
  • If you add “hosts” you should also add “names” – hosts entry will be displayed otherwise.
  • hosts index should start at zero with no sequence gaps
  • The “for” loop’s “end” should match count(hosts + 1)

Continue reading Better Windows Batch (.bat) File for Testing Internet Connections

Create a Windows Batch (.bat) File to Test Your Internet Connectivity

I have been having issues with my ISP‘s WiFi router, so I decided to create a batch file I could run as-needed to check internet connectivity.

@echo off
cls
set "router=192.168.0.1"
set /p "router=Enter router IP address or press [ENTER] for default [%router%]: "
@ping %router% -n 1 | FIND "Reply"
@ping google.com -n 1 | FIND "Reply"
@ping bing.com -n 1 | FIND "Reply"
echo Press any key to exit...
pause >nul

Save that as `ping.bat` and put in somewhere convenient. Then… Continue reading Create a Windows Batch (.bat) File to Test Your Internet Connectivity

Disable SSH (Secure Shell) “root” user login Linux / cPanel / WHM

I was hardening a server this morning and decided my reference for disabling root access within Linux / cPanel / WHM may benefit someone else.

Note: Some may end up here trying to find out how to disable the WHM’s  root user login. I do not believe that is possible. Continue reading Disable SSH (Secure Shell) “root” user login Linux / cPanel / WHM

Organizing Images or Other Files with Hashed Folder Names

I finally decided to tackle a site that had over 20GB of images in a single folder. I won’t say who created this monster (whoops), but while moving the site to a new dedicated server, I decided it was time to remedy the situation.

The first issue is with anything you want to (graphically) process folders is limited greatly by the GUI and how much data needs to be processed for each request. This is why I decided a hashed folder naming convention would be the best approach. The folder names do not matter, just so long as there is reasonable grouping and/or separation. Continue reading Organizing Images or Other Files with Hashed Folder Names

How to Find Your Payeezy FirstData GGe4 Credentials for Payment Module Settings

My most common request for help stems from the following error…

Error 4025: Invalid credentials
The credentials supplied in the authorization request are invalid.

This error indicates you are using the wrong credentials for the transaction server selected in your payment module’s settings. It can also indicate FirstData has not enabled web transactions for your terminal. Continue reading How to Find Your Payeezy FirstData GGe4 Credentials for Payment Module Settings

Additional Alert Email Does Not Work in OpenCart 2.3.0.2

Even though we are still finding bug in Open Cart 2.3.0.2, it is still a far cry better than what we’ve seen from 3.x by far.

You may have noticed the “Additional Alert Email” field simply will not save in your OpenCart “Store Settings” editor. This is a result of the OC devs renaming the input field in 2.3.0.2 without changing the references everywhere else. Continue reading Additional Alert Email Does Not Work in OpenCart 2.3.0.2

SEO URLs for OpenCart Using a “web.config” File on Windows IIS Server

I always suggest Linux hosting for any OpenCart installations. The main OC developers either don’t know much about Windows IIS or neglect to include the necessary SEO URL configuration file for it to work.

This omission results in “not found” 404 (dead link) errors when you visit a page with an SEO URL assigned after enabling SEO URLs in your OpenCart store settings.
Continue reading SEO URLs for OpenCart Using a “web.config” File on Windows IIS Server

PHP Function to Sum or Concatenate Associative Array Values

Here is a quick function I created to merge multiple arrays and sum or concatenate the values thereof. If the values are numeric they will be added together (sum). Otherwise the values will be appended to each other (concatenation).

function arrayMergedSumConcat() {
	$out = array();

	$num_args = func_num_args();
	
	$arg_list = func_get_args();
	
	for ($i = 0; $i < $num_args; $i++) { $in = $arg_list[$i]; foreach ($in as $key => $value) {
			if (isset($out[$key])) {
				if (is_numeric($in[$key]) && is_numeric($out[$key])) {
					$out[$key] += $in[$key];
				} else {
					$out[$key] .= $in[$key];
				}
			} else {
				$out[$key] = $in[$key];
			}
		}
	}
	
	return $out;
}

Add Hints to Custom Fields in Open Cart 2.x

We have published a new extension that allows you to add a “hint” for your custom field at Account and Address locations.

More details: https://www.opencart.com/index.php?route=marketplace/extension/info&extension_id=32138

The name of a custom field is often not enough to inform a customer what the entry is for or the required format. This extension gives you an extra field to better describe the purpose and validation requirements for all of your custom fields. The field hint is displayed in all relevant guest and customer forms. See the images included on this page for examples.

CCleaner… loved by many, avoided by me (with good reason)

I have always been of the mindset, the more you add to a system to automate mundane tasks, the more you open yourself to exploits. I have had to deal with many workstations, servers, and personal computers that were previously maintained by other (less experienced) administrators that swear by the use of CCleaner, Defraggler, and Speccy (not linking intentionally, use Google if you want links to their software). I have always immediately removed them as one of my first clean-up tasks. Continue reading CCleaner… loved by many, avoided by me (with good reason)

Freelance LAMP (Linux, Apache, MySQL, PHP) Developer for Hire