<?php /* * example for email validation using validator class */ require_once "../vendor/autoload.php"; use codeace\validator\validator; $valid = new validator(); if (!empty($_POST)) { // form submit try { extract($_POST); if (!$valid->is_valid_host()) { // prevent hack throw new Exception("Please don't use tricks."); } elseif (empty($email)) { throw new Exception("Please enter email address"); } elseif ($valid->is_valid_email($email) === false) { throw new Exception("Please enter valid email address."); } else { throw new Exception("Valid email submitted."); } } catch (Exception $e) { echo $e->getMessage(); } } ?> <form id="" name="signin" method="post"> <section class="login-form"> <section> <input type="text" tabindex="1" placeholder="Email address" name="email" id="email" class="input">
<?php /* * example for email validation using validator class * */ require_once "../vendor/autoload.php"; use codeace\validator\validator; $valid = new validator(); if (!empty($_POST)) { try { extract($_POST); if (!$valid->is_valid_host()) { // prevent hack throw new Exception("Please don't use tricks."); } elseif (empty($numbers)) { throw new Exception("Please enter numbers"); } elseif ($valid->is_valid_numeric($numbers) === false) { throw new Exception("Please enter valid numbers."); } else { throw new Exception("Valid data submitted."); } } catch (Exception $e) { echo $e->getMessage(); } } ?> <form id="" name="signin" method="post"> <section class="login-form"> <section> <input type="text" tabindex="1" placeholder="Only Number" name="numbers" >
<?php /* * example for url validation using validator class */ require_once "../vendor/autoload.php"; use codeace\validator\validator; $valid = new validator(); if (!empty($_POST)) { try { extract($_POST); if (!$valid->is_valid_host()) { // prevent hack throw new Exception("Please don't use tricks."); } elseif (empty($url)) { throw new Exception("Please enter url"); } elseif ($valid->is_valid_url($url) === false) { throw new Exception("Please enter valid url."); } else { throw new Exception("Valid data submitted."); } } catch (Exception $e) { echo $e->getMessage(); } } ?> <form id="" name="signin" method="post"> <section class="login-form"> <section> <input type="text" tabindex="1" placeholder="URL Only" name="url" >
<?php /* * example for character validation using validator class * */ require_once "../vendor/autoload.php"; use codeace\validator\validator; $valid = new validator(); if (!empty($_POST)) { try { extract($_POST); if (!$valid->is_valid_host()) { // prevent hack throw new Exception("Please don't use tricks."); } elseif (empty($char_only)) { throw new Exception("Please enter characters"); } elseif ($valid->is_valid_alpha($char_only) === false) { throw new Exception("Please enter only characters."); } else { throw new Exception("Valid data submitted."); } } catch (Exception $e) { echo $e->getMessage(); } } ?> <form id="" name="signin" method="post"> <section class="login-form"> <section>