Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Conexao {
- public $con;
- function __construct () {
- try {
- $this->con = new PDO(DBNAME, USER, PASSWORD);
- return $this->con;
- }
- catch ( PDOException $e ) {
- echo 'Falha na conexão: '.$e->getMessage( );
- return false;
- }
- }
- function __destruct( ) {
- $this->handle = NULL;
- }
- function getCountArticle($tabela = ''){
- $retorno = $this->con->prepare("SELECT COUNT(*) FROM ".$tabela);
- return $retorno;
- }
- function getCountArticleErro($tabela = ''){
- $retorno = $this->con->prepare("SELECT COUNT(*) FROM ".$tabela);
- return $retorno;
- }
- function getArticle($tabela = '', $valor = ''){
- $retorno = $this->con->prepare("SELECT id, a_body FROM ".$tabela." WHERE id = ".$valor." LIMIT 1");
- return $retorno;
- }
- function getMaxFlagArticle($tabela = ''){
- $retorno = $this->con->prepare("SELECT MAX(articles_id) as id FROM ".$tabela);
- return $retorno;
- }
- function identificaEncoding($array) {
- ## IDENTIFICA O ENCODING DO CONTEUDO ##
- $erro = 0;
- foreach ($array as $row) {
- //$htmlclean = html_entity_decode(strip_tags(preg_replace($search, '', $row['a_body'])));
- $identificacao = mb_detect_encoding ($row['a_body']);
- if (mb_check_encoding($row['a_body'], "UTF-8")) {
- echo 'USANDO UTF-8 - Ticket nº ';
- }else{
- if (mb_check_encoding($row['a_body'], "ISO-8859-1")) {
- echo 'USANDO ISO-8859-1 - Ticket nº ';
- }
- }
- if (empty($identificacao)){
- echo '<font color="red">';
- }
- echo $row['id'];
- echo ' - ';
- echo $identificacao;
- if (empty($identificacao)){
- echo 'ERRO AO IDENTIFICAR ENCODING</font>';
- $erro++;
- }
- echo '</br></br>';
- }
- if($erro > 0){
- echo '<h5> NAO FOI POSSIVEL IDENTIFICAR ENCODING EM : '.$erro . ' MSG(s)</h5>';
- }
- }
- function setArticleErro($tabela = '', $valor = '') {
- $retorno = $this->con->prepare("INSERT INTO ".$tabela." (articles_id) VALUES (".$valor.")");
- return $retorno;
- }
- function atualizaHtml($campo = '', $tabela = '', $valor = '', $condicao = '') {
- $retorno = $this->con->prepare("UPDATE ".$tabela." SET ".$campo." = '".$valor."' WHERE id = ".$condicao);
- return $retorno;
- }
- function delArticleErro($tabela = '', $valor = '') {
- $retorno = $this->con->prepare("DELETE FROM ".$tabela." WHERE articles_id = ".$valor." LIMIT 1");
- return $retorno;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement