仿騰訊登入驗證碼

2022-07-03 14:12:08 字數 1270 閱讀 6497

protected void page_load(object sender, eventargs e)

protected static int vcode_length = 4;

private static readonly int _width = 80, _height = 35;

//字型集

private static readonly string _font_family = ;

//字型大小集

private static readonly int _font_size = ;

//前景字型顏色集

private static readonly color _color_face = ;

//背景顏色集

private static readonly color _color_background = ;

//文字布局資訊

private static stringformat _dl_format = new stringformat(stringformatflags.noclip);

//左右旋轉角度

private static readonly int _angle = 60;

private string getcheckcode(int codecount)

int t = rand.next(35);

if (temp == t)

temp = t;

randomcode += allchararray[t];

}return randomcode;

}private void createimage(string code)

//交替x,y座標點

px_x = py_x;

px_y = py_y;

}#endregion

//初始化游標的開始位置

g.translatetransform(-5, 2);

#region 繪製校驗碼字串

for (int i = 0; i < code.length; i++)

//反轉

g.rotatetransform(-angle);

//重新定位游標位置

g.translatetransform(-2, -dot.y);

}#endregion}}

using (system.io.memorystream ms = new system.io.memorystream())}}

結果:

登入驗證碼

生成驗證碼 指定驗證碼的長度 public static string createvalidatecode int length 生成隨機數字 for int i 0 i length i 抽取隨機數字 for int i 0 i length i 生成驗證碼 for int i 0 i leng...

登入驗證碼C

一.新建乙個checkcode.aspx using system using system.data using system.configuration using system.collections using system.web using system.web.security usi...

註冊登入驗證碼

1 判斷是不是手機號 public boolean ismobileno string mobiles matcher m p.matcher mobiles return m.matches 2 判斷密碼格式是否正確 public boolean iscorrectpassword string ...