<%@ page language="java" import="java.io.*, java.util.regex.*" %><% String strErro = null; String referer = request.getHeader("Referer"); String img = request.getParameter("img"); if (referer == null || img == null || (referer.indexOf("http://www.mhavila.com.br/topicos/seguranca/") != 0 && referer.indexOf("http://www.mhavila.com/topicos/seguranca/") != 0) || ! img.matches("^\\w+$") ) { strErro = "ERRO: Este exemplo de fraude foi solicitado de forma não autorizada"; } else { String contentType = "image/png"; InputStream in = application.getResourceAsStream("/topicos/seguranca/img/scam/real/scam_" + img + ".png"); if (in == null) { contentType = "image/jpeg"; in = application.getResourceAsStream("/topicos/seguranca/img/scam/real/scam_" + img + ".jpg"); } if (in != null) { try { response.setContentType(contentType); ServletOutputStream binOut = response.getOutputStream(); byte[] buffer = new byte[8*1024]; int lidos = 0; while ((lidos = in.read(buffer)) != -1) { binOut.write(buffer, 0, lidos); } in.close(); binOut.flush(); binOut.close(); } catch (Exception e) { strErro = "ERRO: " + e; } } else { strErro = "ERRO: A imagem de exemplo de scam não pôde ser lida"; } } if (strErro != null) { %> <%= strErro %>

<%= strErro %>.

<% } %>