Category Archives: General

If I don’t know where else to put something or don’t think a post warrants a new category, it will just end up here.

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

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

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)

Toggle Password Display in HTML5 with jQuery

Do you have  a password field that the user wants to be able to view at the click of a button? Here is the solution I came up with to handle that need…

The field…

<div class="input-group">
  <input type="password" name="password" value="P@$$w0rD" placeholder="Password" id="input-password" class="form-control" required>
  <span id="view-password" class="input-group-addon"><i class="fa fa-eye" aria-hidden="true"></i></span>
</div>

The javascript… Continue reading Toggle Password Display in HTML5 with jQuery

How to Move a Domain Between BlueHost Accounts

Save yourself the trouble and don’t bother asking BlueHost support when you run into a problem trying to assign a domain from one BlueHost account to another. They misinformed us about more than a few aspects and the notices displayed on the page when the assignment encounters a problem is not very intuitive.

First things first: If you are using BlueHost for email and have your email program configured for IMAP, you have a bit of work ahead of you.

Continue reading How to Move a Domain Between BlueHost Accounts

How to Uninstall a Program on Windows 7 (with pictures)

Most applications for Windows 7 use an installation program such as Windows Installer to install the application in the system.

Windows Installer ensures that installed programs can be easily removed from the system. Under no circumstances should you simply delete the program folder of the application. Doing so would leave numerous files and registry entries in the system, which could compromise operating system stability. Continue reading How to Uninstall a Program on Windows 7 (with pictures)

Split fields by characters in MySQL

I have a project where the geographical coordinates for records are stored in a single field separated by a comma. While this may suit general display purposes, it eliminates the capability to search by distance.

Sample data: 34.7451738,-86.5941693

My solution was to add two new FLOAT(10, 6) fields named “lat” and “lng” to the database table. Then I ran this query to populate the two new fields with the existing “coordinates” data.

UPDATE `locations` SET `lat` = SUBSTRING_INDEX(SUBSTRING_INDEX(`coordinates`, ',', 1) , ',', -1), `lng` = SUBSTRING_INDEX(SUBSTRING_INDEX(`coordinates`, ',', 2), ',', -1);

Who doesn’t love one-liners for mass-updates in a table 😉