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

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

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

    三分自留地

    Follow your heart

      BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
      4 Posts :: 2 Stories :: 1 Comments :: 0 Trackbacks

    一、清晰型

    <%@ 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); // 隨機產(chǎn)生160條干擾線,使圖象中的認(rèn)證碼不易被其它程序探測到。
    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 on 2013-11-01 13:43 大山 閱讀(115) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 日韩色日韩视频亚洲网站| 亚洲精品视频观看| 色五月五月丁香亚洲综合网| 成人免费无毒在线观看网站| 亚洲不卡中文字幕| 国产免费不卡v片在线观看| 亚洲乱码一二三四区乱码| 曰批视频免费30分钟成人| 99999久久久久久亚洲| 24小时日本在线www免费的| 99亚偷拍自图区亚洲| 成人免费午夜视频| 国产精品亚洲а∨天堂2021 | 日本人成在线视频免费播放| 亚洲av永久无码精品网站| 久久久久久国产精品免费免费男同| 久久精品国产99精品国产亚洲性色| 亚洲精品免费观看| 亚洲不卡中文字幕| 亚洲成A人片在线观看中文| 中文字幕免费观看全部电影| 亚洲高清在线mv| 成人在线免费观看| 亚洲精品偷拍视频免费观看| 亚洲av无码不卡| 国产免费女女脚奴视频网| 亚洲av无一区二区三区| 亚洲色成人WWW永久网站| 18级成人毛片免费观看| 蜜桃传媒一区二区亚洲AV| ZZIJZZIJ亚洲日本少妇JIZJIZ| 一级特黄aa毛片免费观看| 亚洲欧洲AV无码专区| 国产亚洲成人久久| 久草视频免费在线| 一级免费黄色毛片| 亚洲人成在久久综合网站| 亚洲国产成人爱av在线播放| **实干一级毛片aa免费| 日本高清免费中文在线看| 亚洲综合久久1区2区3区|