PHP Classes

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

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 92 This week: 1All time: 9,894 This week: 560Up
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: 442093 in Iran Iran
Week rank: 411 Up4 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  
File Role Description
Accessible without login Plain text file index.php Example Sample usage
Plain text file NationalIDCheck.php Class The main class

 Version Control Unique User Downloads Download Rankings  
 0%
Total:92
This week:1
All time:9,894
This week:560Up
User Comments (1)
Your code saved my Time! Thank you Alireza
8 years ago (behzad ashrafian)
70%StarStarStarStar