<?php

/**
 *
 * INDEXU
 * Copyright(C), Nicecoder, 2000-2006, All Rights Reserved.
 *
 * INDEXU(tm) is protected by Indonesia and International copyright laws.
 * Unauthorized use or distribution of INDEXU(tm) is strictly prohibited,
 * violators will be prosecuted. To obtain a license for using INDEXU(tm),
 * please register at Nicecoder home page at http://www.nicecoder.com
 *
 * Author:
 *    Dody Rachmat Wicaksono (dody@nicecoder.com)
 *    M. Zuber (zubby@nicecoder.com)
 *
 */

  function IsDigit($str) {
    if (ereg("^(0|[1-9][0-9]*)$", $str, $regs)) {
      return true;
    }
    else {
      return false;
    }
  }


  function IsMoney($str) {
    if (ereg("^([0-9]+|[0-9]{1,3}(,[0-9]{3})*)(\.[0-9]{1,2})?$", $str, $regs)) {
      return true;
    }
    else {
      return false;
    }
  }


  function IsEmailAddress($str) {
    if (ereg("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$", $str, $regs)) {
      return true;
    }
    else {
      return false;
    }
  }


  function IsAlphanumeric($str) {
    if (ereg("^[a-zA-Z0-9]+$", $str, $regs)) {
      return true;
    }
    else {
      return false;
    }
  }


  function IsAlphanumericUnderscore($str) {
    if (ereg("^[a-zA-Z0-9_]+$", $str, $regs)) {
      return true;
    }
    else {
      return false;
    }
  }

?>
