function validaCPF($cpf) { $cpf = limpaCpf($cpf); // Verifiva se o n˙mero digitado contÈm todos os digitos $cpf = str_pad(ereg_replace('[^0-9]', '', $cpf), 11, '0', STR_PAD_LEFT); // Verifica se nenhuma das sequÍncias abaixo foi digitada, caso seja, retorna falso // if (strlen($cpf) != 11 || $cpf == '00000000000' || $cpf == '11111111111' || $cpf == '22222222222' || $cpf == '33333333333' || $cpf == '44444444444' || $cpf == '55555555555' || $cpf == '66666666666' || $cpf == '77777777777' || $cpf == '88888888888' || $cpf == '99999999999') if (strlen($cpf) != 11 || $cpf == '00000000000' || $cpf == '22222222222' || $cpf == '33333333333' || $cpf == '44444444444' || $cpf == '55555555555' || $cpf == '66666666666' || $cpf == '77777777777' || $cpf == '88888888888' || $cpf == '99999999999') { return false; } else { // Calcula os n˙meros para verificar se o CPF È verdadeiro for ($t = 9; $t < 11; $t++) { for ($d = 0, $c = 0; $c < $t; $c++) { $d += $cpf[$c] * ($t + 1 - $c); } $d = 10 * $d % 11 % 10; if ($cpf[$c] != $d) { return false; } } return true; } }
$pi .= "</table>"; $pi .= "<div><input type='hidden' name='ACTION' value='ACTION'/></div>"; $pi .= "</form>"; $pi .= "</div>"; $pi .= "<form name='List'>"; //$pi .= "<div class='BtnButtomManage' onclick=\"location = 'index.php?actionType=gerenciar.usuarios.add'\" title='".getLabel('LABEL_ADICIONAR', $_SESSION['LANGUAGE'])."'><span class='BtnProprio'>".getLabel('LABEL_ADICIONAR', $_SESSION['LANGUAGE'])."</span></div>"; $pi .= "<div class='BtnButtomManage' onclick=\"url('gerenciar.usuarios.edit', '', '" . getLabel('LABEL_JS_MAIS_DE_UM', $_SESSION['LANGUAGE']) . "', '" . getLabel('LABEL_JS_NENHUM', $_SESSION['LANGUAGE']) . "', '" . getLabel('LABEL_JS_UPDATE', $_SESSION['LANGUAGE']) . "')\" title='" . getLabel('LABEL_EDITAR', $_SESSION['LANGUAGE']) . "'><span class='BtnProprio'>" . getLabel('LABEL_EDITAR', $_SESSION['LANGUAGE']) . "</span></div>"; $pi .= "<div class='ResetFloat'></div>"; $pi .= "<div class='MasterList'>"; $pi .= "<table class='Tableinter'>"; $pi .= "<tr>"; $pi .= "<td valign='top'>"; $criterio = ""; if (!empty($_POST['buscar'])) { $xnome = trim(htmlentities($_POST['buscar'])); $xcpf = trim(limpaCpf($_POST['buscar'])); $criterio = "AND (pessoa.NOME LIKE '%{$xnome}%' OR pessoa.CPF LIKE '%{$xcpf}%')"; } $result = mysql_query("SELECT \r\r\t\t\t\t\t\tlogin.*, \r\r\t\t\t\t\t\tpessoa.NOME,\r\r\t\t\t\t\t\tpessoa.OWNER as DONO,\r\r\t\t\t\t\t\tDATE_FORMAT( login.DTA, '%d/%m/%Y - %Hh%i.' ) as DTA\r\r\t\t\t\t\t\tFROM \r\r\t\t\t\t\t\tlogin \r\r\t\t\t\t\t\tINNER JOIN login_rel_pessoa ON login.CODLOGIN=login_rel_pessoa.CODLOGIN \r\r\t\t\t\t\t\tINNER JOIN pessoa ON pessoa.CODPESSOA=login_rel_pessoa.CODPESSOA \r\r\t\t\t\t\t\tWHERE login.LOGIN NOT IN('admin','internet') \r\r\t\t\t\t\t\t{$criterio}\r\r\t\t\t\t\t\tGROUP BY login.CODLOGIN \r\r\t\t\t\t\t\tORDER BY login.DTA DESC"); $pi .= "<div class='separador'></div>"; $pi .= "<div>"; $pi .= "<table class='Tableinter'>"; $pi .= "<tr id='adminTopTable'>"; $pi .= "<td style='width: 10px;'></td>\r\r\t\t\t\t\t\t\t\t<td>" . getLabel('LABEL_DTA_CADASTRO', $_SESSION['LANGUAGE']) . ":</td>\r\r\t\t\t\t\t\t\t\t<td>" . getLabel('LABEL_NAME', $_SESSION['LANGUAGE']) . ":</td>\r\r\t\t\t\t\t\t\t\t<td>" . getLabel('LABEL_SITUACAO', $_SESSION['LANGUAGE']) . ":</td>\r\r\t\t\t\t\t\t\t\t<td>" . getLabel('LABEL_CRIADO_POR', $_SESSION['LANGUAGE']) . ":</td>"; $pi .= "</tr>"; $i = 0; while ($pessoa = mysql_fetch_object($result)) { $dono = $pessoa->OWNER; if ($pessoa->STATUS == "1") { $status = "<span class='AtivoStatus' onclick=\"javascript:getAlterstatusfull('{$pessoa->CODLOGIN}', 'CODLOGIN', 'STATUS', 'login', '" . getLabel('LABEL_JS_REGISTRO', $_SESSION['LANGUAGE']) . "')\">" . getLabel('LABEL_ATIVO', $_SESSION['LANGUAGE']) . "</span>"; } else {