1.2、用户源码用户源码javascript+CSS+Html实现用户注册及登录的注册注册格式验证。在用户登录功能中试加入验证码功能
2.如何用XML和ASP结合做一个用户注册模块
2、javascript+CSS+Html实现用户注册及登录的注册注册格式验证。在用户登录功能中试加入验证码功能
下面是用户源码用户源码源码RS标准关键代码,如果剩下的注册注册源码设计装饰你都搞不懂,我就无语了
JS
<script type="text/javascript" language="javascript">
function reloadcodeOne(){ //刷新验证码函数
var verify = document.getElementById('checkCodeImg');
verify.setAttribute('src',用户源码用户源码 'validateCode?dt=' + Math.random());
}
<script type="text/javascript" >
html
<p>
<label>验证码:</label>
<input class="code" value="请输入验证码" title="请输入验证码" name="rendCode" id="rendCode" onfocus="if (value =='请输入验证码'){ value =''}" onblur="if (value ==''){ value='请输入验证码'}" type="text" size="6" />
<span><img id="checkCodeImg" src="validateCodeServlet" onclick="javascript:reloadcodeOne();" alt="" width="" height="" /></span>
</p>
java代码
package com.zhihui.action.common;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.util.Random;
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet..zhihui.action.base.BaseAction;
/
*** <p>
* 校验码控制器
* </p>
*
* @author liurong
* @version ValidateCodeServlet.java,v 0.1 -- 上午:: Administrator
* Exp
*/
public class ValidateCodeAction extends BaseAction {
private static final long serialVersionUID = 1L;
// 验证码的宽度。
private int width = ;
// 验证码的注册注册高度。
private int height = 5;
// 验证码字符个数
private int codeCount = 5;
private int x = 0;
// 字体高度
private int fontHeight;
private int codeY;
/*char[] codeSequence = { 'A',用户源码用户源码 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J',
'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '2', '3', '4', '5', '6', '7', '8', '9' };*/
char[] codeSequence = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' };
HttpServletRequest req=ServletActionContext.getRequest();
HttpServletResponse resp=ServletActionContext.getResponse();
public String execute()
throws ServletException, java.io.IOException {
// 宽度
String strWidth = "";
// 高度
String strHeight = "";
// 字符个数
String strCodeCount = "5";
width = Integer.parseInt(strWidth);
height = Integer.parseInt(strHeight);
codeCount = Integer.parseInt(strCodeCount);
x = width / (codeCount);
fontHeight = height - 4;
codeY = height - 4;
// 定义图像buffer
BufferedImage buffImg = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
Graphics2D g = buffImg.createGraphics();
Random random = new Random();
// 将图像填充为白色
g.setColor(Color.WHITE);
g.fillRect(0, 0, width, height);
Font font = new Font("Fixedsys", Font.PLAIN, fontHeight);
g.setFont(font);
g.setColor(Color.BLACK);
g.drawRect(0, 0, width - 1, height - 1);
g.setColor(Color.BLACK);
for (int i = 0; i < ; i++) {
int x = random.nextInt(width);
int y = random.nextInt(height);
int xl = random.nextInt(8);
int yl = random.nextInt(8);
g.drawLine(x, y, x + xl, y + yl);
}
// randomCode用于保存随机产生的验证码,以便用户登录后进行验证。注册注册
StringBuffer randomCode = new StringBuffer();
int red = 0,用户源码用户源码 green = 0, blue = 0;
for (int i = 0; i < codeCount; i++) {
String strRand = String.valueOf(codeSequence[random.nextInt(codeSequence.length)]);
red = 0;//random.nextInt();
green = 0;//random.nextInt();
blue = 0;//random.nextInt();
g.setColor(new Color(red, green, blue));
g.drawString(strRand, (i ) * x, codeY);
randomCode.append(strRand);
}
HttpSession session = req.getSession();
session.setAttribute("validateCode", randomCode.toString());
resp.setHeader("Pragma", "no-cache");
resp.setHeader("Cache-Control", "no-cache");
resp.setDateHeader("Expires", 0);
resp.setContentType("image/jpeg");
ServletOutputStream sos = resp.getOutputStream();
ImageIO.write(buffImg, "jpeg", sos);
sos.close();
return null;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public int getCodeCount() {
return codeCount;
}
public void setCodeCount(int codeCount) {
this.codeCount = codeCount;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getFontHeight() {
return fontHeight;
}
public void setFontHeight(int fontHeight) {
this.fontHeight = fontHeight;
}
public int getCodeY() {
return codeY;
}
public void setCodeY(int codeY) {
this.codeY = codeY;
}
public char[] getCodeSequence() {
return codeSequence;
}
public void setCodeSequence(char[] codeSequence) {
this.codeSequence = codeSequence;
}
public HttpServletRequest getReq() {
return req;
}
public void setReq(HttpServletRequest req) {
this.req = req;
}
public HttpServletResponse getResp() {
return resp;
}
public void setResp(HttpServletResponse resp) {
this.resp = resp;
}
}
如何用XML和ASP结合做一个用户注册模块
下面是html部分的代码:
<html>
<body>
<link= "...path/***.asp"><!--这里些的是你的asp
文件的存放地址-->
<form>
姓名:
<input type="text" name="Name">
<br>
密码:
<input type="text" name="Passeword">
<input type="submit" value="提交">
</form>
</body>
</html>
下面是asp文件代码:
dim fname
fname=Request.QueryString("fname")
If fname<>"" Then
Response.Write(fname & "<br />")
Response.Write("欢迎来到POP!")
注册注册End If
注册注册2024-12-27 17:19
2024-12-27 17:08
2024-12-27 16:59
2024-12-27 15:54
2024-12-27 15:46
2024-12-27 15:37
2024-12-27 15:11
2024-12-27 14:55