WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
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 Index
Web Development Resources
Web Development Content
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
Mobile Dev World

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 : Dollar Serial Number Validator
Categories : PHP, Security, Algorithms Click here to Update Your Picture
Alix Axel
Date : Jun 19th 2008
Grade : 4 of 5 (graded 2 times)
Viewed : 3128
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Alix Axel
Action : Grade This Code Example
Tools : My Examples List

 
Like this code?
Show the author your appreciation.
Submit your own code examples 
 

This function lets you validate serial numbers of dollar bank notes.

<?php

/**
* Checks if the input string is a valid Dollar banknote serial number.
*
* @param string $string
* @return bool
*/
function Dollar($string)
{
   
$string = strtoupper(trim($string));

    if (
strlen($string) == 11)
    {
       
$charset = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'V', 'U', 'W', 'X', 'Y', 'Z');

        if (
in_array($string[0], $charset))
        {
           
$string = substr($string, 1);
        }

        else
        {
            return
false;
        }
    }

    if (
strlen($string) == 10)
    {
       
$charset = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L');

        if (
in_array($string[0], $charset))
        {
           
$string = substr($string, 1);
        }

        else
        {
            return
false;
        }

        if (
is_numeric(substr($string, 0, 8)))
        {
           
$string = substr($string, 8);
        }

        else
        {
            return
false;
        }

       
$charset = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', '*', 'P', 'Q', 'R', 'S', 'T', 'V', 'U', 'W', 'X', 'Y', 'Z');

        if (
in_array($string[0], $charset))
        {
            return
true;
        }
    }

    return
false;
}

// Examples:

var_dump(Dollar('CB47511319A'));

?>



A damaged image generator (class) for validating text. CAPTCHA - Completely Automated Public Turing test to tell Computers and Humans Apart
Categories : PHP, PHP Classes, Security, GD image library, Security
Password Creator: This PHP code exmaple shows how to use bitwise operations on a single variable and using it as a flagged variable. The class generates passwords of a given length using specified characters and the flags.
Categories : PHP, PHP Classes, Algorithms, Security
SHA: Implementation of the Secure Hash Algorithm in pure PHP. This is a secure one-way function that can be used to perform challenge response login algorithms over an insecure connection.
Categories : Algorithms, PHP, Security
PHP Function to Encrypt/Decrypt a string without a known key. The string itself has his own different key for every character.
Categories : PHP, Algorithms, Security, Authentication, Encryption
IPhider Obscure Any URL Anonymity connection lores obfuscation corporate survival.
Categories : PHP, Algorithms, Security, URLs
Validate serial numbers of Euro bank notes with PHP
Categories : PHP, Security, Algorithms
Encoding data using PGP via PHP's proc_* functions
Categories : Cryptography, Security, Email, PHP, PGP
send_mail function to defeat Header Injection Hacking/Spamming
Categories : PHP, Email, Form Processing, Security
The Porter Word Stemming Algorithm in PHP Reduces words to their base stem for search engines and indexing
Categories : Algorithms, PHP, Strings
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
Random Password Generator
Categories : PHP, Strings, Security
Passgen: Automatically generate mixed case alpha numeric passwords
Categories : PHP, Security
A recursive function to traverse a multi-dimensional array where the dimensions are not known
Categories : Arrays, PHP, Algorithms
Kasskooye($path) tell you the complete size of a folder
Categories : PHP, Algorithms, Utilities, Filesystem
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