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

 

Leave a Reply

Your email address will not be published. Required fields are marked *