Pesquisar este blog

sábado, 11 de setembro de 2010

Função para validar CPF em PHP

/*
     Delphi-like function para converter string para inteiro
*/
function StrToInt($value){
  return (int)$value; } /*   Função para validar CPF.   Baseado na função validaCPF (Delphi) do PoliGestor da empresa Polidados Informática Ltda. */ function validaCPF($cpf){   $CPFInvalido = array ('00000000000', '11111111111', '22222222222', '33333333333', '44444444444',                         '55555555555', '66666666666', '77777777777', '88888888888', '99999999999');   $digitado = "";   $calculado = "";   $Result = false;   try {      // verifica CPF inválido      for ($i = 0; $i < 9; $i++)        if ($cpf == $CPFInvalido[$i])          return false;      if ($cpf != ''){        $n1 = StrToInt($cpf[0]);        $n2 = StrToInt($cpf[1]);        $n3 = StrToInt($cpf[2]);        $n4 = StrToInt($cpf[3]);        $n5 = StrToInt($cpf[4]);        $n6 = StrToInt($cpf[5]);        $n7 = StrToInt($cpf[6]);        $n8 = StrToInt($cpf[7]);        $n9 = StrToInt($cpf[8]);        $d1 = $n9*2+$n8*3+$n7*4+$n6*5+$n5*6+$n4*7+$n3*8+$n2*9+$n1*10;        $d1 = 11-($d1 % 11);        if ($d1>=10)           $d1 = 0;        $d2 = $d1*2+$n9*3+$n8*4+$n7*5+$n6*6+$n5*7+$n4*8+$n3*9+$n2*10+$n1*11;        $d2 = 11-($d2 % 11);        if ($d2>=10)          $d2 = 0;        $calculado = $d1 . $d2;        $digitado = $cpf[9] . $cpf[10];        return ($calculado == $digitado) ? true : false;      }   }   catch (Exception $e) {     $Result = false;   } } ?>

sábado, 4 de setembro de 2010

Principais Visões para ORACLE

Lista das principais visões do ORACLE utilizadas no desenvolvimento PL/SQL e na administração do banco de dados. 


Fonte: http://www.techonthenet.com/oracle/sys_tables/index.php


ALL_ARGUMENTS Arguments in object accessible to the user
ALL_CATALOG All tables, views, synonyms, sequences accessible to the user
ALL_COL_COMMENTS Comments on columns of accessible tables and views
ALL_CONSTRAINTS Constraint definitions on accessible tables
ALL_CONS_COLUMNS Information about accessible columns in constraint definitions
ALL_DB_LINKS Database links accessible to the user
ALL_ERRORS Current errors on stored objects that user is allowed to create
ALL_INDEXES Descriptions of indexes on tables accessible to the user
ALL_IND_COLUMNS COLUMNs comprising INDEXes on accessible TABLES
ALL_LOBS Description of LOBs contained in tables accessible to the user
ALL_OBJECTS Objects accessible to the user
ALL_OBJECT_TABLES Description of all object tables accessible to the user
ALL_SEQUENCES Description of SEQUENCEs accessible to the user
ALL_SNAPSHOTS Snapshots the user can access
ALL_SOURCE Current source on stored objects that user is allowed to create
ALL_SYNONYMS All synonyms accessible to the user
ALL_TABLES Description of relational tables accessible to the user
ALL_TAB_COLUMNS Columns of user's tables, views and clusters
ALL_TAB_COL_STATISTICS Columns of user's tables, views and clusters
ALL_TAB_COMMENTS Comments on tables and views accessible to the user
ALL_TRIGGERS Triggers accessible to the current user
ALL_TRIGGER_COLS Column usage in user's triggers or in triggers on user's tables
ALL_TYPES Description of types accessible to the user
ALL_UPDATABLE_COLUMNS Description of all updatable columns
ALL_USERS Information about all users of the database
ALL_VIEWS Description of views accessible to the user
DATABASE_COMPATIBLE_LEVEL Database compatible parameter set via init.ora
DBA_DB_LINKS All database links in the database
DBA_ERRORS Current errors on all stored objects in the database
DBA_OBJECTS All objects in the database
DBA_ROLES All Roles which exist in the database
DBA_ROLE_PRIVS Roles granted to users and roles
DBA_SOURCE Source of all stored objects in the database
DBA_TABLESPACES Description of all tablespaces
DBA_TAB_PRIVS All grants on objects in the database
DBA_TRIGGERS All triggers in the database
DBA_TS_QUOTAS Tablespace quotas for all users
DBA_USERS Information about all users of the database
DBA_VIEWS Description of all views in the database
DICTIONARY Description of data dictionary tables and views
DICT_COLUMNS Description of columns in data dictionary tables and views
GLOBAL_NAME global database name
NLS_DATABASE_PARAMETERS Permanent NLS parameters of the database
NLS_INSTANCE_PARAMETERS NLS parameters of the instance
NLS_SESSION_PARAMETERS NLS parameters of the user session
PRODUCT_COMPONENT_VERSION version and status information for component products
ROLE_TAB_PRIVS Table privileges granted to roles
SESSION_PRIVS Privileges which the user currently has set
SESSION_ROLES Roles which the user currently has enabled.
SYSTEM_PRIVILEGE_MAP Description table for privilege type codes. Maps privilege type numbers to type names
TABLE_PRIVILEGES Grants on objects for which the user is the grantor, grantee, owner, or an enabled role or PUBLIC is the grantee
TABLE_PRIVILEGE_MAP Description table for privilege (auditing option) type codes. Maps privilege (auditing option) type numbers to type names