WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : How to validate an Israeli ID number.
Categories : Ecommerce, PHP, Algorithms
Boaz Yahav
Date : Dec 15th 1999
Grade : 3 of 5 (graded 4 times)
Viewed : 9300
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Boaz Yahav
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

This algorithem checks if an Israeli ID (9 digits) number is valid. The algorithem (MOD 10) is
based on Error Brett code from example 74.

The algorithem might work on various ID's cause MOD 10 is the basis of many ID checksums.

Add a comment to this example if this algorithem works for you too.

<?
// takes a string and returns an array of characters

function toCharArray($input){
$len = strlen($input);
for ($j=0;$j<$len;$j++){
$char[$j] = substr($input, $j, 1);
}
return ($char);
}


function validateID($ID){
//Clean spaces
$ID = ereg_replace('[-[:space:]]', '',$ID);

//Grab the test digit
$Bikoret=substr($ID,8,1);

//Take only 8 left digits of the Id.
$ID = substr($ID,0,strlen($ID)-1);
$dig = toCharArray($ID);
$numdig = sizeof($dig);
$j = 0;

for($i=($numdig-1) ; $i>=0 ; $i-=2){
$dbl[$j] = $dig[$i] * 2;
$j++;
}
$dblsz = sizeof($dbl);
$validate = 0;

//Sum all the 2x
for($i=0 ; $i<$dblsz ; $i++){
$add = toCharArray($dbl[$i]);
for($j=0 ; $j<sizeof($add) ; $j++){
$validate += $add[$j];
}
$add = '';
}

//Sum all the 1x
for ($i=($numdig-2); $i>=0; $i-=2){
$validate += $dig[$i];
}
If($validate % 10 != 0) {
$Bikoret1=(substr($validate, 0, 1) + 1) * 10;
}
Else {
$Bikoret1=$validate;
}
If($Bikoret1 - $validate == $Bikoret) return 1;
else return 0;
}
?>



Credit Card Identification and Validation Class - The credit_card class provides methods for cleaning, validating and identifying the type of credit card numbers.
Categories : PHP, PHP Classes, Credit Cards, Ecommerce, Algorithms
PHP-MySQL shopping cart
Categories : PHP, Ecommerce, Complete Programs
phpAds, a complete banner and ad management system with detailled tracking and stats.
Categories : MySQL, Complete Programs, Ecommerce, PHP, Databases
what salt do I have to feed the crypt function with to make it work like the htpasswd command of apache?
Categories : Algorithms, PHP, Authentication
Mail-lib provides a simple interface to the sendmail program. Note: you must actually have sendmail on your machine (sorry windows NT users).
Categories : Algorithms, Email, PHP
shopping cart class with add/edit/delete product functionality.
Categories : PHP, PHP Classes, Ecommerce
Example Shopping cart class
Categories : Ecommerce, PHP, PHP Classes
Boolean Keyword Interpreter
Categories : PHP, Algorithms, Search Engines
Dollar Serial Number Validator
Categories : PHP, Security, Algorithms
Validation function for LUHNMod10 and variant. Can discriminate credit card numbers of varying lengths. Uses [Double >> Sum-of-Digits] transform.
Categories : Credit Cards, Authentication, Ecommerce, PHP
A simple bubblesort that takes 2 arrays as argument.The first one is the actual data used for sorting, the second is data that will "tag along" with the first array, for instance a descriptive text about the data in the first array.
Categories : Algorithms, Arrays, PHP, Complete Programs
Prime number finder (Sieve of Erastothenes)
Categories : PHP, Algorithms, Math.
The Porter Word Stemming Algorithm in PHP Reduces words to their base stem for search engines and indexing
Categories : Algorithms, PHP, Strings
A recursive function to traverse a multi-dimensional array where the dimensions are not known
Categories : Arrays, PHP, Algorithms
Get TemplateMonster data
Categories : Arrays, Ecommerce, PHP, Strings