PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Alireza Nasseh   Iran National ID Check   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Sample usage
Class: Iran National ID Check
Check if a national ID from Iran can be valid
Author: By
Last change:
Date: 9 years ago
Size: 963 bytes
 

Contents

Class file image Download
<?php
/**
 * Created by PhpStorm.
 * User: Alireza Nasseh
 * Date: 12/1/2015
 * Time: 9:05 PM
 */

require("NationalIDCheck.php");

$idCheck = new NationalIDCheck();

$code = strip_tags($_POST["code"]);
if (
$code) {
    if (
$idCheck->check($code)) $mess = "<p class='success'>$code is a valid national ID number.</p>";
    else
$mess = "<p class='error'>$code is not a valid national ID number!</p>";
}
?>
<html>
<head>
    <meta charset="UTF-8" />
    <style type="text/css">
        body, input {
            font-family:tahoma;
            font-size:12px;
        }
        .success { color:green }
        .error { color:red }
    </style>
    <title>National ID Validity Check</title>
</head>
<body>
<?php echo $mess; ?>
<form action="index.php" method=post>
    <input type=text name="code" placeholder="National ID Number"/>
    <input type=submit name="submit_check" value="Check Validity"/>
</form>
</body>
</html>