Input Validator

Released 7 years ago , Last update 7 years ago

Validate input for type and correctness using PHP

These days it's important to validate input. With this class you can validate on:

  • alphanumeric values;
  • alphabetical values;
  • digit values;
  • floating values;
  • if the number is between two numbers;
  • if the date is correct;
  • if a hex color is correct;
  • if the e-mail address is correct;
  • if the URL address is correct;
  • if the phone number is correct;
  • if the file is less then the maximum filesize.

Pricing

14 day 14-day money-back guarantee

$4.99

Personal License

  • Perpetual license

  • 1 site, unlimited servers

  • No distribution (hosted use only)

  • Commercial use

Usage

The first thing you need to do is include the class like this:

<?php
// include class
include 'classes/inputvalidator.class.php';
... rest of the script ...

Validate if the input is alphanumeric:

inputvalidator::alnum('Binpress101'); // returns TRUE
inputvalidator::alnum('B!npress101'); // returns FALSE

Validate if the input is alphabetical:

inputvalidator::alpha('Binpress'); // returns TRUE
inputvalidator::alpha('Binpress1'); // returns FALSE

Validate if the input is a digit:

inputvalidator::digit(1337); // returns TRUE
inputvalidator::digit('1337'); // returns TRUE
inputvalidator::digit('1337a'); // returns FALSE

Validate if the input is a float:

inputvalidator::float('-6.5'); // returns TRUE
inputvalidator::float('1000,00'); // returns TRUE
inputvalidator::float('1000,01d'); // returns FALSE

Validate if the input is a hex color:

inputvalidator::hex('#ffffff'); // returns TRUE
inputvalidator::hex('#ffffgg'); // returns FALSE

Validate if the input is between two numbers: > numberBetween( input number, minimum, maximum )

inputvalidator::numberBetween(8,1,17); // returns TRUE
inputvalidator::numberBetween(8,1,17.7); // returns TRUE
inputvalidator::numberBetween(18,1,17); // returns FALSE

Validate if the input is a valid date:

inputvalidator::date('12/10/1989'); // returns TRUE
inputvalidator::date('12-10-1989'); // returns TRUE
inputvalidator::date('32-10-1989'); // returns FALSE

Validate if the input is a valid email address:

inputvalidator::email('test.mail@gmail.com'); // returns TRUE
inputvalidator::email('test.mail@local'); // returns FALSE

Validate if the input is a valid URL:

inputvalidator::url('http://www.binpress.com/app/user-validator/363'); // returns TRUE
inputvalidator::url('http://imnotavalidurlimjustcheckingifthisworks'); // returns FALSE    

Validate if the input is a valid phone number:

inputvalidator::phone('+32193475000'); // returns TRUE
inputvalidator::phone('+32193475'); // returns FALSE

Validate if the file is less then the maximum size: > maxFilesize( file, maximum size in bytes )

inputvalidator::maxFilesize('classes/uservalidator.class.php', 6000); // returns TRUE
inputvalidator::maxFilesize('classes/uservalidator.class.php', 1600); // returns FALSE
2 licenses, starting from From » $4.99 View Licenses

Get A Quote

What do you need?
  • Custom development
  • Integration
  • Customization / Reskinning
  • Consultation
When do you need it?
  • Soon
  • Next week
  • Next month
  • Anytime

Thanks for getting in touch!

Your quote details have been received and we'll get back to you soon.


Or enter your name and Email
No comments have been posted yet.