<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)航:
     
    主站蜘蛛池模板: 亚洲av永久中文无码精品综合 | 色综合久久精品亚洲国产| 亚洲国产一区视频| 亚洲一区二区三区免费观看| 亚洲精品色播一区二区| 67pao强力打造67194在线午夜亚洲| 大地资源网高清在线观看免费| 亚洲综合网站色欲色欲| 免费看AV毛片一区二区三区| 特级精品毛片免费观看| 国产V片在线播放免费无码| 国产成人亚洲精品91专区高清| 中文字幕亚洲综合久久菠萝蜜 | 国产精品视频免费一区二区三区| 美女又黄又免费的视频| 亚洲综合校园春色| 久久亚洲日韩看片无码| 久久精品7亚洲午夜a| 国产亚洲成av片在线观看| 亚洲黄片手机免费观看| 国产一级高清免费观看| 免费毛片在线视频| 扒开双腿猛进入爽爽免费视频| 美女被暴羞羞免费视频| 亚洲精品人成网线在线播放va| 亚洲男人的天堂一区二区| 性感美女视频免费网站午夜| 中文字幕影片免费在线观看 | 国产无遮挡吃胸膜奶免费看视频| jizz在线免费观看| 无忧传媒视频免费观看入口| 日韩色日韩视频亚洲网站| 亚洲a∨国产av综合av下载| 亚洲大尺度无码无码专线一区| 亚洲成AV人片在WWW色猫咪| 亚洲中文字幕在线第六区| 亚洲精品无码你懂的网站| 亚洲男人的天堂一区二区| 亚洲精品无码国产| 亚洲AV中文无码乱人伦下载| 久久亚洲精品国产精品黑人|