<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    三分自留地

    Follow your heart

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      4 Posts :: 2 Stories :: 1 Comments :: 0 Trackbacks

    2013年11月1日 #


    一、清晰型

    <%@ page contentType="image/jpeg" import="java.awt.*, 
    java.awt.image.*,java.util.*,javax.imageio.*" %> 
    <%! 
    Color getRandColor(int fc,int bc) 

    Random random = new Random(); 
    if(fc>255) fc=255; 
    if(bc>255) bc=255; 
    int r=fc+random.nextInt(bc-fc); 
    int g=fc+random.nextInt(bc-fc); 
    int b=fc+random.nextInt(bc-fc); 
    return new Color(r,g,b); 

    %> 
    <% 
    out.clear();
    response.setHeader("Pragma","No-cache"); 
    response.setHeader("Cache-Control","no-cache"); 
    response.setDateHeader("Expires", 0); 
    int width=60, height=20; 
    BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); 
    Graphics g = image.getGraphics(); 
    Random random = new Random(); 
    g.setColor(getRandColor(200,250)); 
    g.fillRect(0, 0, width, height); 
    g.setFont(new Font("Times New Roman",Font.PLAIN,18)); 
    g.setColor(getRandColor(160,200)); 
    for (int i=0;i<155;i++) 

    int x = random.nextInt(width); 
    int y = random.nextInt(height); 
    int xl = random.nextInt(12); 
    int yl = random.nextInt(12); 
    g.drawLine(x,y,x+xl,y+yl); 

    String sRand=""; 
    for (int i=0;i<4;i++){ 
    String rand=String.valueOf(random.nextInt(10)); 
    sRand+=rand; 
    g.setColor(new Color(20+random.nextInt(110),20+random.nextInt(110),20+random.nextInt(110))); 
    g.drawString(rand,13*i+6,16); 

    session.setAttribute("SRA",sRand);
    g.dispose(); 
    ImageIO.write(image, "JPEG", response.getOutputStream()); 
    %>


    二、凌亂型

    <%@ page contentType="image/jpeg"
        import="java.awt.*, 
    java.awt.image.*,java.util.*,javax.imageio.*"%>
    <%! 
    Color getRandColor(int fc,int bc) 

    Random random = new Random(); 
    if(fc>255) fc=255; 
    if(bc>255) bc=255; 
    int r=fc+random.nextInt(bc-fc); 
    int g=fc+random.nextInt(bc-fc); 
    int b=fc+random.nextInt(bc-fc); 
    return new Color(r,g,b); 

    %>
    <% 
    char[] codeSequence = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
            'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
            'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };

    response.setHeader("Pragma","No-cache"); 
    response.setHeader("Cache-Control","no-cache"); 
    response.setDateHeader("Expires", 0); 
    int width=60, height=20; 
    BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); 
    Graphics g = image.getGraphics(); 
    Random random = new Random(); 
    g.setColor(getRandColor(200,250)); 
    g.fillRect(0, 0, width, height); 
    g.setFont(new Font("Fixedsys",Font.PLAIN,18)); 
    g.drawRect(0, 0, width - 1, height - 1); // 隨機產生160條干擾線,使圖象中的認證碼不易被其它程序探測到。
    g.setColor(Color.BLACK);
    for (int i = 0; i < 30; i++) {
        int x = random.nextInt(width);
        int y = random.nextInt(height);
        int xl = random.nextInt(12);
        int yl = random.nextInt(12);
        g.drawLine(x, y, x + xl, y + yl);
    }
    String sRand=""; 
    for (int i=0;i<4;i++){     
    String rand=String.valueOf(codeSequence[random.nextInt(36)]);
    sRand+=rand; 
    g.setColor(new Color(20+random.nextInt(110),20+random.nextInt(110),20+random.nextInt(110))); 
    g.drawString(rand,13*i+6,16); 

    session.setAttribute("SRA",sRand);
    g.dispose(); 
    ImageIO.write(image, "JPEG", response.getOutputStream()); 
    out.clear();
    out = pageContext.pushBody();
    %>


    posted @ 2013-11-01 13:43 大山 閱讀(115) | 評論 (0)編輯 收藏

    主站蜘蛛池模板: 久久精品国产亚洲7777| 在线a级毛片免费视频| 亚洲AⅤ永久无码精品AA| 亚洲综合av一区二区三区不卡| 亚洲av最新在线网址| 国产成人无码精品久久久免费| 免费观看国产精品| 黄色毛片免费网站| 久久影院亚洲一区| 在线看片免费人成视频播| 国产精品国产亚洲精品看不卡| 波多野结衣免费一区视频 | 免费一区二区视频| 春意影院午夜爽爽爽免费| 国产精品亚洲视频| 无码日韩精品一区二区免费暖暖 | 亚洲一区二区视频在线观看| 一本大道一卡二大卡三卡免费 | 国产真人无码作爱视频免费| 成年人免费视频观看| 亚洲精品久久无码av片俺去也 | 久久精品国产这里是免费| 亚洲理论片在线中文字幕| 国产妇乱子伦视频免费| 亚洲成a人无码亚洲成av无码 | 在线观看国产情趣免费视频| 一级免费黄色大片| 91亚洲精品第一综合不卡播放| 曰批全过程免费视频在线观看| 国产亚洲日韩在线a不卡| 国产亚洲一区二区三区在线| 美女视频黄的全免费视频网站| 国产精品亚洲色婷婷99久久精品| 久久影视国产亚洲| 久久久久国色AV免费看图片| 日韩在线视频线视频免费网站| 日本久久久久亚洲中字幕| 国产乱弄免费视频| 在线观看的免费网站无遮挡| 亚洲成a人片在线观看无码| 在线观看免费高清视频|