精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>● PHP>>荷音 PHP 库>>HEYIN PHP扩展库 (7)

主题:HEYIN PHP扩展库 (7)
发信人: bb_rain()
整理人: tang(2001-01-31 09:00:37), 站内信件
<?

/*********************************************************************
*********

Check Module for PHP3 & PHP4 ( v 1.00 )

Copyright (C) 2000 heyin.com, All Rights Reserved.
http://www.heyin.com
Rain ( Email: [email protected] Oicq: 1235686 )

cl_check.php, 2000/8/18

**********************************************************************
*********/


// Data Check Class

class DataCheck {
var $CHECK_TYPE;
var $ERROR_CODE;
var $NewData;
var $OldData;

function DataCheck($CheckType,$ErrorCode,$NewData,$OldData="") {
$this->CHECK_TYPE = $CheckType;
    $this->ERROR_CODE = $ErrorCode;
    $this->NewData = $NewData;
    $this->OldData = $OldData;
  }

  function Set($varname,$value) {
    $this->$varname=$value;
  }

  function PrintError() {
    global $PATH;

    header("Location: ".$PATH."function/error.php?err=".$this->ERROR_C
ODE."\n");
    exit;
  }
}


//  Check Null Class

class CheckNull extends DataCheck {

  function Check() {
    switch ($this->CHECK_TYPE) {
      case 0:
        if ($this->NewData=="") $this->PrintError();
        break;
      case 1:
        if ($this->NewData!="") $this->PrintError();
        break;
    }
  }
}


//  Check Equal Class

class CheckEqual extends DataCheck {

  function Check() {
    switch ($this->CHECK_TYPE) {
      case 0:
        if ($this->NewData==$this->OldData) $this->PrintError();
        break;
      default:
        if ($this->NewData!=$this->OldData) $this->PrintError();
        break;
    }
  }
}


//  Check REG Class

class CheckREG extends DataCheck {
  var $REG;

  function Check() {
    switch ($this->CHECK_TYPE) {
      case 0:
        if (ereg($this->REG,$this->NewData)) $this->PrintError();
        break;
      default:
        if (!ereg($this->REG,$this->NewData)) $this->PrintError();
        break;
    }
  }
}


//  Check Equal Class

class CheckLicense extends DataCheck {
  function Check() {
    if ($this->NewData<$this->OldData) $this->PrintError();
  }
}

?>

--
HEYIN 软件 http://www.heyin.com  
虚拟社区,聊天室,交友程序,网上超市,电子商务 ...

※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 61.133.178.72]

[关闭][返回]