WebRoot/ma.jsp

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<%@ page contentType="image/jpeg" pageEncoding="gb2312"%>
<%@ page import="java.awt.*,java.awt.image.*"%>
<%@ page import="java.util.*,javax.imageio.*"%>

<table width="30%" height="149" border="1" cellpadding="0" cellspacing="0">
  <tr>
    <td height="147" align="center" valign="top">
	
	
	
	<%!
//产生随机颜色函数getRandColor
Color getRandColor(int fc,int bc){
   Random r=new Random();
   if(fc>255) fc=255;
   if(bc>255) bc=255;
   int red=fc+r.nextInt(bc-fc); //red
   int green=fc+r.nextInt(bc-fc); //green
   int blue=fc+r.nextInt(bc-fc); //blue
   return new Color(red,green,blue);
}
%>
<%
//设置页面不缓存
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires",0);

//创建随机类
Random r=new Random();

//在内存中创建图像,宽度为width,高度为height
int width=60,height=20;
BufferedImage pic=new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);

//获取图形上下文环境
Graphics gc=pic.getGraphics();

//设定背景图形上下文填充
gc.setColor(getRandColor(200,250));
gc.fillRect(0,0,width,height);

//设定图形上下文环境字体
gc.setFont(new Font("Times New Roman",Font.PLAIN,18));

//随机产生200条干扰直线,使图像中的认证码不易被其他分析程序探测
gc.setColor(getRandColor(160,200));
for(int i=0;i<200;i++){
   int x1=r.nextInt(width);
   int y1=r.nextInt(height);
   int x2=r.nextInt(15);
   int y2=r.nextInt(15);
   gc.drawLine(x1,y1,x1+x2,y1+y2);
}

//随机产生100个干扰点,使图像中的验证码不易被其他分析程序探测到
gc.setColor(getRandColor(120,240));
for(int i=0;i<100;i++)
{
   int x=r.nextInt(width);
后面还有 34 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。