ACTIVE SERVER PAGE > csImageFile ÄÄÆ÷³ÍÆ® - ÀÚµ¿È ¹æÁö ĸÂ÷(capcha) À̹ÌÁö ¸¸µé±â
µî·ÏÀÏ : 2021-08-11 15:06
Á¶È¸¼ö : 66,786
»ç¿ëÀÚ°¡ ½ÇÁ¦ »ç¶÷ÀÎÁö ÄÄÇ»ÅÍ ÇÁ·Î±×·¥ÀÎÁö ÆǺ°ÇØÁÖ´Â ±â¼úÀÌ Ä¸Â÷(CAPTCHA) ÀÔ´Ï´Ù.
csImageFile ÄÄÆ÷³ÍÆ®¸¦ ÀÌ¿ëÇؼ À̹ÌÁö ĸÂ÷¸¦ ¸¸µå´Â ¹æ¹ýÀ» ±â¼ú Çϵµ·Ï ÇÏ°Ú½À´Ï´Ù.
http://ankyu.entersoft.kr/lecture/asp/csimagefile/csimage_captcha.asp
¸ÕÀú À§ÀÇ ¿¹Á¦¿¡¼ »ç¿ëµÇ´Â ¹æ¹ýÀ» È®ÀÎ ÇÒ ¼ö ÀÖ½À´Ï´Ù.
1. ·£´ý °ªÀ» ¸¸µé¾î session º¯¼ö¿¡ °ª¿¡ ³Ö½À´Ï´Ù.
2. À§ session º¯¼ö¸¦ ÀÌ¿ëÇÑ À̹ÌÁö¸¦ ¸¸µì´Ï´Ù.
3. session º¯¼ö¿Í ÀÔ·ÂµÈ ÅؽºÆ® °ªÀ» ºñ±³ÇÕ´Ï´Ù.
1. ·£´ý °ªÀ» ¸¸µé¾î session º¯¼ö¿¡ °ª¿¡ ³Ö½À´Ï´Ù.
Randomize
Session.Value("Code") = Chr(Int(Rnd * 26) + 65) & Chr(Int(Rnd * 26) + 65) & Chr(Int(Rnd * 26) + 65) & Chr(Int(Rnd * 26) + 65)
2. À§ session º¯¼ö¸¦ ÀÌ¿ëÇÑ À̹ÌÁö¸¦ ¸¸µì´Ï´Ù.
Response.Expires = 0
Response.Buffer = true
Response.Clear
Set Image = Server.CreateObject("csImageFile.Manage")
'Draw the image
Image.NewImage 100, 50, "FFFFFF"
Image.BrushStyle = 4
Image.BrushColor = "000000"
Image.FloodFill 0, 0
'Draw the text
Image.TextFont = "Courier New"
Image.TextOpaque = false
Image.TextSize = 36
Image.TextBold = true
Image.Text 5, 5, Session("Code")
'Export as a GIF
Response.ContentType = "Image/gif"
Response.BinaryWrite Image.GIFData
3. session º¯¼ö¿Í ÀÔ·ÂµÈ ÅؽºÆ® °ªÀ» ºñ±³ÇÕ´Ï´Ù.
°¨»çÇÕ´Ï´Ù.