PHP Classes

File: validtest.php

Recommend this page to a friend!
  Classes of umesh deshmukh   Validate Data   validtest.php   Download  
File: validtest.php
Role: Example script
Content type: text/plain
Description: Class file for validating user input data.
Class: Validate Data
Data validation with support for multibyte text
Author: By
Last change:
Date: 20 years ago
Size: 2,822 bytes
 

Contents

Class file image Download
<?
ini_set
("default_charset","EUC_JP");
ini_set("mbstring.http_output","EUC_JP");

include
"validator.php";

global
$oValidat;

if(
$_POST["btnCheck"]=="Check")
{
   
$oValidat=new Validatdata();

    if (
$oValidat->isEmail($_POST["txtEmail"])==FALSE)
    {
        echo
$_POST["txtEmail"]." is invalid. ". "<BR>";
    }
    else
    {
        echo
$_POST["txtEmail"]." is valid. ". "<BR>";
    }

    if(
$oValidat->IsHiragana($_POST["txtHiragana"])==FALSE)
    {
        echo
$_POST["txtHiragana"]." : is Not Hiragana <BR>";
    }
    else
    {
        echo
$_POST["txtHiragana"]." : is Hiragana <BR>";
    }

    if(
$oValidat->IsKatakana($_POST["txtKatakana"])==FALSE)
    {
        echo
$_POST["txtKatakana"]." : is Not Katakana <BR>";
    }
    else
    {
        echo
$_POST["txtKatakana"]." : is Katakana <BR>";
    }

    if(
$oValidat->isDoubleByte($_POST["txtKatakana"])==FALSE)
    {
        echo
$_POST["txtKatakana"]." : is Not Doublebyte <BR>";
    }
    else
    {
        echo
$_POST["txtKatakana"]." : is Doublebyte <BR>";
    }

    if(
$oValidat->isKanji($_POST["txtKanji"])==FALSE)
    {
        echo
$_POST["txtKanji"]." : is Not Kanji <BR>";
    }
    else
    {
        echo
$_POST["txtKanji"]." : is Kanji <BR>";
    }

    if(
$oValidat->isDate($_POST["txtDate"])==FALSE)
    {
        echo
$_POST["txtDate"]." : is Not Valid Date <BR>";
    }
    else
    {
        echo
$_POST["txtDate"]." : is Valid Date <BR>";
    }

    if(
$oValidat->isAlphaNum($_POST["txtAlphaNum"])==FALSE)
    {
        echo
$_POST["txtAlphaNum"]." : is Not Alpha Numeric <BR>";
    }
    else
    {
        echo
$_POST["txtAlphaNum"]." : is Alpha Numeric <BR>";
    }

    if(
$oValidat->isNum($_POST["txtAlphaNum"])==FALSE)
    {
        echo
$_POST["txtAlphaNum"]." : is Not Numeric <BR>";
    }
    else
    {
        echo
$_POST["txtAlphaNum"]." : is Numeric <BR>";
    }

    echo
"Lenght of : ".$_POST["txtKanji"]. " ".$oValidat->getLength($_POST["txtKanji"])."<BR>";

unset(
$oValidat);

}
?>
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=x-sjis">
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<Center><BR><BR>
<Form name="frmTest" action="validtest.php" method="post">
<Table width="100">
    <TR>
        <TD align="right">Email : </TD>
        <TD><INPUT type="text" size=50 name="txtEmail"><BR></TD>
    </TR>
    <TR>
        <TD align="right">Hiragana : </TD>
        <TD><INPUT type="text" size=50 name="txtHiragana"><BR></TD>
    </TR>
    <TR>
        <TD align="right">Katakana : </TD>
        <TD><INPUT type="text" size=50 name="txtKatakana"><BR></TD>
    </TR>
    <TR>
        <TD align="right">Kanji : </TD>
        <TD><INPUT type="text" size=50 name="txtKanji"><BR></TD>
    </TR>
    <TR>
        <TD align="right">Date : </TD>
        <TD><INPUT type="text" size=50 name="txtDate"><BR></TD>
    </TR>
    <TR>
        <TD align="right">AlphaNumber : </TD>
        <TD><INPUT type="text" size=50 name="txtAlphaNum"><BR></TD>
    </TR>
    <TR>
        <TD colspan="2" align="Center"><Input type="Submit" name="btnCheck" value="Check"></TD>
    </TR>
</Table>
</Form>
</Center>
</BODY>
</HTML>