Erro: Falha na conexão MySQL."); } $db_name = "mascate1nv"; // Your database name $dbuse=mysql_select_db($db_name,$db); if(!$dbuse){ die("Erro: Banco de ".$db_name." Dados não configurado."); } @ini_set('session.auto_start',1); @session_start(); ?> MASCATE AUTOMAÇÃO - DESENVOLVEDORA DE SOFTWARE PARA AUTOMAÇÃO COMERCIAL | Programas para gerenciamento de todos os segmentos comerciais
titulo noticias
Erro: Falha na conexão MySQL."); } $db_name = "mascate1nv"; // Your database name $dbuse=mysql_select_db($db_name,$db); if(!$dbuse){ die("Erro: Banco de ".$db_name." Dados não configurado."); } @ini_set('session.auto_start',1); @session_start(); ?> 0){ echo "
Registros encontrados: $tr |  "; $NumRegistroInicial = ($pg*$rpp)+1; if ($pg <> $pages) {$NumRegistroFinal = ($pg*$rpp)+$rpp;} else {$NumRegistroFinal = $tr;} echo "Exibindo de $NumRegistroInicial a $NumRegistroFinal
"; // echo "

Páginas:    "; echo'

'; if ($pg <> 0) { $showpage = $pg - 1; echo '
'; echo 'Primeira  '; echo 'Anterior  '; echo '
'; }else if($pg == 0){ //links desativados /* echo '
'; echo '  '; echo '  '; echo '
'; */ } for ($i = $pg-5; $i<$pg; $i++) { $showpage=$i+1; if ($i>=0) { echo '
'; echo ''.$showpage.''; //echo '  '; echo '
'; } } for ($i = $pg; ($i<=$pages AND $i<=($pg+5)); $i++) { $showpage=$i+1; if ($i == $pg) { //pagina atual echo '
'; echo ''.$showpage.''; echo '
'; //echo ' '; } else { echo '
'; echo ''.$showpage.''; echo '
'; //echo '  '; //echo ' '; } } if ($pg < $pages) { $showpage = $pg + 1; echo '
'; echo 'Proxima  '; echo 'Última  '; echo '
'; // echo ' '; // echo ' '; }else if($pg >= $pages){ /* echo '
'; echo 'Proxima Página  '; echo 'Ultima Página  '; echo '
'; */ } echo '
'; } } /*****************************************************/ /* THUMBNAILS */ /*****************************************************/ function criar_thumbnail($origem,$destino,$largura,$pre,$formato) { switch($formato) { case 'JPEG': $tn_formato = 'jpg'; break; case 'PNG': $tn_formato = 'png'; break; } $ext = split("[/\\.]",strtolower($origem)); $n = count($ext)-1; $ext = $ext[$n]; $arr = split("[/\\]",$origem); $n = count($arr)-1; $arra = explode('.',$arr[$n]); $n2 = count($arra)-1; $tn_name = str_replace('.'.$arra[$n2],'',$arr[$n]); $destino = $destino.$tn_name.$pre.'.'.$tn_formato; if ($ext == 'jpg' || $ext == 'jpeg'){ $im = imagecreatefromjpeg($origem); }elseif($ext == 'png'){ $im = imagecreatefrompng($origem); }elseif($ext == 'gif'){ return false; } $w = imagesx($im); $h = imagesy($im); if ($w > $h) { $nw = $largura; $nh = ($h * $largura)/$w; }else{ $nh = $largura; $nw = ($w * $largura)/$h; } if(function_exists('imagecopyresampled')) { if(function_exists('imageCreateTrueColor')) { $ni = imageCreateTrueColor($nw,$nh); }else{ $ni = imagecreate($nw,$nh); } if(!@imagecopyresampled($ni,$im,0,0,0,0,$nw,$nh,$w,$h)) { imagecopyresized($ni,$im,0,0,0,0,$nw,$nh,$w,$h); } }else{ $ni = imagecreate($nw,$nh); imagecopyresized($ni,$im,0,0,0,0,$nw,$nh,$w,$h); } if($tn_formato=='jpg'){ imagejpeg($ni,$destino,60); }elseif($tn_formato=='png'){ imagepng($ni,$destino); } } //fim da funcao de criar miniaturas function removeDir($path) { // Add trailing slash to $path if one is not there if (substr($path, -1, 1) != "/") { $path .= "/"; } $normal_files = glob($path . "*"); $hidden_files = glob($path . "\.?*"); $all_files = array_merge($normal_files, $hidden_files); foreach ($all_files as $file) { # Skip pseudo links to current and parent dirs (./ and ../). if (preg_match("/(\.|\.\.)$/", $file)) { continue; } if (is_file($file) === TRUE) { // Remove each file in this Directory unlink($file); //echo "Removed File: " . $file . "
"; } else if (is_dir($file) === TRUE) { // If this Directory contains a Subdirectory, run this Function on it removeDir($file); } } // Remove Directory once Files have been removed (If Exists) if (is_dir($path) === TRUE) { rmdir($path); //echo "
Removed Directory: " . $path . "

"; } } function checkFiles($dir){ $dh = opendir($dir); $count = 0; while (($file = readdir($dh)) !== false) { if($file != "." && $file != ".."){ $count++; } } closedir($dh); return $count; } function dirShowImg($dir){ $dh = opendir($dir); $count = 0; while (($file = readdir($dh)) !== false) { if($file != "." && $file != ".." && (substr($file,0,2) == "t_")){ echo '  '; if($count > 3) echo '
'; $count++; } } closedir($dh); } /** * FUNCTIONS * */ ////////////////////////////////////////////////////////////////////// function select($table, $field, $value, $sortField) { $sql = "SELECT * FROM ". $table; if($value) { $sql .= " WHERE ".$field." = '". $value."'"; } if($sortField) { $sql .= " ORDER BY ".$sortField; } //print $sql; return $sql; } function insert($dados,$table,$debug) { $sql = "INSERT INTO ".$table." ("; $cont = count($dados); $v=1; foreach ($dados as $dado=>$value) { $sql .= $dado; $sql .= ($v >= $cont)?") VALUES (":","; $v++; } $v=1; foreach ($dados as $dado=>$value) { $sql .= "'".$value."'"; $sql .= ($v >= $cont)?")":","; $v++; } if($debug) { debugVar("",$sql,1); } else { @mysql_query($sql); } } ///////////////////////////////////////////////////////////////////////// function update($table, $id, $campo, $dados, $debug) { $sql = "UPDATE ".$table." SET "; $cont = count($dados); $v=1; foreach ($dados as $dado=>$value) { if($dado != $campo) { $sql .= ($v >= $cont)? "$dado = '$value' ":"$dado = '$value', "; } $v++; } $sql .= "WHERE ".$campo." = ".$id; if($debug) { debugVar("",$sql); } else { @mysql_query($sql); } } /** * FUNCTION EMAIL * */ function send($para,$assunto,$mensagem,$headers) { if(@mail($para,$assunto,$mensagem,$headers)) { return true; } else { return false; } } ///////////////////////////// function debugVar($nome , $var, $exit = 0) { if(is_array($var) || is_object($var)) { echo '
********************* D E B U G *************************
'; echo $nome."
";print_r($var); echo '
********************************************************

'; } else { echo '
********************* D E B U G *************************
'; echo $nome."
";echo(wordwrap($var,50,"
",1)); echo '
********************************************************

'; } if($exit)exit; } /////////////////////////////////////////// function formataData($data,$tipo) { if($tipo == 0) //MySQL para Brasileiro yyyy-mm-dd para dd/mm/yyy { $tempData = explode("-",$data); $newData = $tempData[2].'/'.$tempData[1].'/'.$tempData[0]; } else if($tipo == 1) //Brasileiro para MySQL dd/mm/yyyy para yyyy-mm-dd { $tempData = explode("/",$data); $newData = $tempData[2].'-'.$tempData[1].'-'.$tempData[0]; } return $newData; } /////////////////////////////////////////////// function operacaoData($date, $operation, $where = FALSE, $quant, $return_format = FALSE) { // Verifica erros $warning = "
Warning! Date Operations Fail… "; if(!$date || !$operation) { return "$warning invalid or inexistent arguments
"; }else{ if(!($operation == "sub" || $operation == "-" || $operation == "sum" || $operation == "+")) return "
$warning Invalid Operation…
"; else { // Separa dia, mês e ano list($day, $month, $year) = split("/", $date); // Determina a operação (Soma ou Subtração) ($operation == "sub" || $operation == "-") ? $op = "-" : $op = " "; #// Determina aonde será efetuada a operação (dia, mês, ano) if($where == "day") $sum_day = $op."$quant"; if($where == "month") $sum_month = $op."$quant"; if($where == "year") $sum_year = $op."$quant"; // Gera o timestamp $date = mktime(0, 0, 0, $month + $sum_month, $day + $sum_day, $year + $sum_year); // Retorna o timestamp ou extended ($return_format == "timestamp" || $return_format == "ts") ? $date = $date : $date = date("d/m/Y", "$date"); // Retorna a data return $date; } } } /////////////////////////////////////////////////// function alert($msg,$redirect) { echo ""; if($redirect) { echo ''; } } /////////////////////////////////////////////////// function confirm($msg,$redirect) { } //////////////////////////////////////////////////////// function showImg($dir, $campo, $tipo, $display) { $parts = explode(".",$campo); $sufix = (!$tipo)?"_thumb":""; $disp = (!$display)?"vspace=\"2\" hspace=\"2\" align=\"left\" valign=\"top\"":""; $str = ''; return $str; } //////////////////////////////////////////////////////////// function delImg($dir,$imagem) { if($imagem != "semimagem.jpg"){ @unlink("{$dir}/{$imagem}"); // deleta imagem normal $thumb = explode(".",$imagem); @unlink("{$dir}/{$thumb[0]}_thumb.{$thumb[1]}"); //deleta miniatura } } ////////////////////////////////////////////////////// function delFile($dir, $file) { @unlink("{$dir}/{$file}"); } ////////////////////////////////////////// function formatFileSize($data) { // bytes if( $data < 1024 ) { return "{$data} bytes"; } // kilobytes else if( $data < 1024000 ) { return round( ( $data / 1024 ), 1 ) . " Kb"; } // megabytes else { return round( ( $data / 1024000 ), 1 ) . " Mb"; } } ///////////////////////////////// function redir($url) { echo ''; } //////////////////////////////////////// function mime_type( $file ) { $filetype = substr(strrchr( $file, '.' ), 1 ); $mimetypes = array( "ez" => "application/andrew-inset", "atom" => "application/atom+xml", "hqx" => "application/mac-binhex40", "cpt" => "application/mac-compactpro", "doc" => "application/msword", "lha" => "application/octet-stream", "lzh" => "application/octet-stream", "exe" => "application/octet-stream", "so" => "application/octet-stream", "dms" => "application/octet-stream", "class" => "application/octet-stream", "bin" => "application/octet-stream", "dll" => "application/octet-stream", "oda" => "application/oda", "pdf" => "application/pdf", "ps" => "application/postscript", "eps" => "application/postscript", "ai" => "application/postscript", "smi" => "application/smil", "smil" => "application/smil", "mif" => "application/vnd.mif", "xls" => "application/vnd.ms-excel", "ppt" => "application/vnd.ms-powerpoint", "wbxml" => "application/vnd.wap.wbxml", "wmlc" => "application/vnd.wap.wmlc", "wmlsc" => "application/vnd.wap.wmlscriptc", "bcpio" => "application/x-bcpio", "vcd" => "application/x-cdlink", "pgn" => "application/x-chess-pgn", "cpio" => "application/x-cpio", "csh" => "application/x-csh", "dir" => "application/x-director", "dxr" => "application/x-director", "dcr" => "application/x-director", "dvi" => "application/x-dvi", "spl" => "application/x-futuresplash", "gtar" => "application/x-gtar", "gz" => "application/x-gzip", "hdf" => "application/x-hdf", "php" => "application/x-httpd-php", "phps" => "application/x-httpd-php-source", "js" => "application/x-javascript", "skm" => "application/x-koan", "skt" => "application/x-koan", "skp" => "application/x-koan", "skd" => "application/x-koan", "latex" => "application/x-latex", "cdf" => "application/x-netcdf", "nc" => "application/x-netcdf", "sh" => "application/x-sh", "shar" => "application/x-shar", "swf" => "application/x-shockwave-flash", "sit" => "application/x-stuffit", "sv4cpio" => "application/x-sv4cpio", "sv4crc" => "application/x-sv4crc", "tar" => "application/x-tar", "tcl" => "application/x-tcl", "tex" => "application/x-tex", "texi" => "application/x-texinfo", "texinfo" => "application/x-texinfo", "roff" => "application/x-troff", "t" => "application/x-troff", "tr" => "application/x-troff", "man" => "application/x-troff-man", "me" => "application/x-troff-me", "ms" => "application/x-troff-ms", "ustar" => "application/x-ustar", "src" => "application/x-wais-source", "xht" => "application/xhtml+xml", "xhtml" => "application/xhtml+xml", "zip" => "application/zip", "au" => "audio/basic", "snd" => "audio/basic", "midi" => "audio/midi", "kar" => "audio/midi", "mid" => "audio/midi", "mp3" => "audio/mpeg", "mp2" => "audio/mpeg", "mpga" => "audio/mpeg", "aifc" => "audio/x-aiff", "aif" => "audio/x-aiff", "aiff" => "audio/x-aiff", "m3u" => "audio/x-mpegurl", "rm" => "audio/x-pn-realaudio", "ram" => "audio/x-pn-realaudio", "rpm" => "audio/x-pn-realaudio-plugin", "ra" => "audio/x-realaudio", "wav" => "audio/x-wav", "pdb" => "chemical/x-pdb", "xyz" => "chemical/x-xyz", "bmp" => "image/bmp", "gif" => "image/gif", "ief" => "image/ief", "jpe" => "image/jpeg", "jpeg" => "image/jpeg", "jpg" => "image/jpeg", "png" => "image/png", "tif" => "image/tiff", "tiff" => "image/tiff", "djvu" => "image/vnd.djvu", "djv" => "image/vnd.djvu", "wbmp" => "image/vnd.wap.wbmp", "ras" => "image/x-cmu-raster", "pnm" => "image/x-portable-anymap", "pbm" => "image/x-portable-bitmap", "pgm" => "image/x-portable-graymap", "ppm" => "image/x-portable-pixmap", "rgb" => "image/x-rgb", "xbm" => "image/x-xbitmap", "xpm" => "image/x-xpixmap", "xwd" => "image/x-xwindowdump", "igs" => "model/iges", "iges" => "model/iges", "mesh" => "model/mesh", "silo" => "model/mesh", "msh" => "model/mesh", "vrml" => "model/vrml", "wrl" => "model/vrml", "css" => "text/css", "htm" => "text/html", "html" => "text/html", "asc" => "text/plain", "txt" => "text/plain", "rtx" => "text/richtext", "rtf" => "text/rtf", "sgml" => "text/sgml", "sgm" => "text/sgml", "tsv" => "text/tab-separated-values", "wml" => "text/vnd.wap.wml", "wmls" => "text/vnd.wap.wmlscript", "etx" => "text/x-setext", "xml" => "text/xml", "xsl" => "text/xml", "mpe" => "video/mpeg", "mpeg" => "video/mpeg", "mpg" => "video/mpeg", "mov" => "video/quicktime", "qt" => "video/quicktime", "mxu" => "video/vnd.mpegurl", "avi" => "video/x-msvideo", "movie" => "video/x-sgi-movie", "ice" => "x-conference/x-cooltalk" ); return implode( '', array_keys( array_flip( $mimetypes ), $filetype )); }