PHP Classes

Iran National ID Check: Check if a national ID from Iran can be valid

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 92 All time: 9,918 This week: 455Up
Version License PHP version Categories
national-id-check 1GNU General Publi...5Algorithms, PHP 5, Validation, Security
Description 

Author

This package is specific mainly for applications used in Iran Iran .

This is a simple class can check if a national ID from Iran can be valid.

It takes a given national ID number of a citizen of Iran and applies the Luhn algorithm to determine if the number can be valid.

Picture of Alireza Nasseh
  Performance   Level  
Name: Alireza Nasseh <contact>
Classes: 1 package by
Country: Iran Iran
Age: ???
All time rank: 442593 in Iran Iran
Week rank: 164 Up2 in Iran Iran Up

Example

<?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>


  Files folder image Files (2)  
File Role Description
Accessible without login Plain text file index.php Example Sample usage
Plain text file NationalIDCheck.php Class The main class

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:92
This week:0
All time:9,918
This week:455Up
User Comments (1)
Your code saved my Time! Thank you Alireza
8 years ago (behzad ashrafian)
70%StarStarStarStar