$val) { if (strpos(strtolower($url), strval($key)) === 0) { $err_id = $key; break; } } # blank page if ($url === TAG_BLANK) { echo get_page(''); } # blank image elseif ($url === TAG_BLANK_IMG) { $msg = trim($msg); if(strpos($msg, "maxlen_") !== false) { $maxlen = intval(trim(str_replace("maxlen_", "", $url))); filter_by_image_size($cl['u'], $maxlen); exit(); } else { # -------------------------------------------------------------- # return blank image # -------------------------------------------------------------- header("Content-Type: image/gif;"); // charset=windows-1251"); echo GIF_BODY; } } # error code elseif ($err_id !== 0) { $er_msg = strstr($_GET['url'], ' '); echo get_error_page($err_id, $er_msg); } # redirect url elseif ((strpos(strtolower($url), "http://") === 0) or (strpos(strtolower($url), "https://") === 0)) { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # redirect to specified url # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ header("HTTP/1.0"); header("Location: $url", '', 302); } // error arguments else { echo get_page("sgerror: error arguments $url"); } } else { echo get_page($_SERVER['QUERY_STRING']); //$url . implode(" ", $_GET)); # echo get_error_page(500); } # ~~~~~~~~~~ # Exit # ~~~~~~~~~~ exit(); # ---------------------------------------------------------------------------------------------------------------------- # functions # ---------------------------------------------------------------------------------------------------------------------- function get_page($body) { $str = Array(); $str[] = ''; $str[] = "\n$body\n"; $str[] = ''; return implode("\n", $str); } ######################################################### # # # Página de Erro do SquidGuard customizada - Inicio # # # ######################################################### # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # IE displayed self-page, if them size > 1024 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function get_error_page($er_code_id, $err_msg='') { global $err_code; global $cl; global $g; global $config; $str = Array(); $str[] = ''; $str[] = ''; $str[] = ''; $str[] = ''; $str[] = '
'; $str[] = '
'; $str[] = '
'; $str[] = 'logo'; $str[] = '


O endereço requisitado não pôde ser aberto:
'; $str[] = '

'; if ($cl['u']) $str[] = "{$cl['u']}"; $str[] = '
'; $str[] = "

Motivo: {$err_code[$er_code_id]}

"; $str[] = '

O controle de acessos identificou este site como inadequado de acordo com nossa organização.
Todo ou qualquer acesso à internet é registrado em nosso sistema de relatórios.
'; $str[] = '




'; $str[] = '
Informações do Bloqueio:
'; $str[] = '
'; $sge_prefix = (preg_match("/\?/", $cl['u']) ? "&" : "?"); $str[] = ''; if ($cl['n']) $str[] = "Nome do Cliente: {$cl['n']} | "; if ($cl['a']) $str[] = "IP do Cliente: {$cl['a']} | "; if ($cl['i']) $str[] = "Usuário: {$cl['i']} | "; if ($cl['s']) $str[] = "Grupo: {$cl['s']} | "; if ($cl['t']) $str[] = "Categoria: {$cl['t']} "; $str[] = '
'; $str[] = ""; $str[] = ""; return implode("\n", $str); } ######################################################### # # # Página de Erro do SquidGuard customizada - Fim # # # ######################################################### function filter_by_image_size($url, $val_size) { # load url header $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_NOBODY, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $hd = curl_exec($ch); curl_close($ch); $size = 0; $SKEY = "content-length:"; $s_tmp = strtolower($hd); $s_tmp = str_replace("\n", " ", $s_tmp); # replace all "\n" if (strpos($s_tmp, $SKEY) !== false) { $s_tmp = trim(substr($s_tmp, strpos($s_tmp, $SKEY) + strlen($SKEY))); $s_tmp = trim(substr($s_tmp, 0, strpos($s_tmp, " "))); if (is_numeric($s_tmp)) $size = intval($s_tmp); else $size = 0; } # === check url type and content size === # redirect to specified url if (($size !== 0) && ($size < $val_size)) { header("HTTP/1.0"); header("Location: $url", '', 302); } # return blank image else { header("Content-Type: image/gif;"); echo GIF_BODY; } } ?>