'정보/ASP'에 해당되는 글 7건
- 2010/03/12 [ASP] UTF-8 다국어 사이트 Upload 컴포넌트 사용시 글자 깨짐 문제
- 2009/07/20 [ASP] 트리구조 출력하기
- 2009/07/10 [ASP] 날짜값으로 요일 출력하기(Weakday함수)
- 2009/06/17 [ASP] 기본적인 base64 인코딩 디코딩
- 2009/06/16 [ASP] iFrame을 이용하여 페이지 바꾸지 않고 데이터 보내기
- 2009/06/15 [ASP] iFrame 안 페이지에서 부모 페이지로 값 전달
- 2009/06/15 [ASP] Base64기준 인코딩, 디코딩 컴퍼넌트
<%@Language="VBScript" CODEPAGE="65001"%>
<%Response.ContentType="text/html;charset=UTF-8"%>
선언은 당연히 되어있을테고....
set uploadform=server.CreateObject("DEXT.FileUpload")
UploadForm.CodePage = 65001 <<<<<<<<<<< 이 부분을 추가하여 준다.
<script language="JavaScript">
<!--//
// Title: Tigra Tree
// Description: See the demo at url
// URL: http://www.softcomplex.com/products/tigra_menu_tree/
// Version: 1.1
// Date: 11-12-2002 (mm-dd-yyyy)
// Notes: This script is free. Visit official site for further details.
function tree (a_items, a_template) {
this.a_tpl = a_template;
this.a_config = a_items;
this.o_root = this;
this.a_index = [];
this.o_selected = null;
this.n_depth = -1;
var o_icone = new Image(),
o_iconl = new Image();
o_icone.src = a_template['icon_e'];
o_iconl.src = a_template['icon_l'];
a_template['im_e'] = o_icone;
a_template['im_l'] = o_iconl;
for (var i = 0; i < 64; i++)
if (a_template['icon_' + i]) {
var o_icon = new Image();
a_template['im_' + i] = o_icon;
o_icon.src = a_template['icon_' + i];
}
this.toggle = function (n_id) { var o_item = this.a_index[n_id]; o_item.open(o_item.b_opened) };
this.select = function (n_id) { return this.a_index[n_id].select(); };
this.mout = function (n_id) { this.a_index[n_id].upstatus(true) };
this.mover = function (n_id) { this.a_index[n_id].upstatus() };
this.a_children = [];
for (var i = 0; i < a_items.length; i++)
new tree_item(this, i);
this.n_id = trees.length;
trees[this.n_id] = this;
for (var i = 0; i < this.a_children.length; i++) {
document.write(this.a_children[i].init());
this.a_children[i].open();
}
}
function tree_item (o_parent, n_order) {
this.n_depth = o_parent.n_depth + 1;
this.a_config = o_parent.a_config[n_order + (this.n_depth ? 2 : 0)];
if (!this.a_config) return;
this.o_root = o_parent.o_root;
this.o_parent = o_parent;
this.n_order = n_order;
this.b_opened = !this.n_depth;
this.n_id = this.o_root.a_index.length;
this.o_root.a_index[this.n_id] = this;
o_parent.a_children[n_order] = this;
this.a_children = [];
for (var i = 0; i < this.a_config.length - 2; i++)
new tree_item(this, i);
this.get_icon = item_get_icon;
this.open = item_open;
this.select = item_select;
this.init = item_init;
this.upstatus = item_upstatus;
this.is_last = function () { return this.n_order == this.o_parent.a_children.length - 1 };
}
function item_open (b_close) {
var o_idiv = get_element('i_div' + this.o_root.n_id + '_' + this.n_id);
if (!o_idiv) return;
if (!o_idiv.innerHTML) {
var a_children = [];
for (var i = 0; i < this.a_children.length; i++)
a_children[i]= this.a_children[i].init();
o_idiv.innerHTML = a_children.join('');
}
o_idiv.style.display = (b_close ? 'none' : 'block');
this.b_opened = !b_close;
var o_jicon = document.images['j_img' + this.o_root.n_id + '_' + this.n_id],
o_iicon = document.images['i_img' + this.o_root.n_id + '_' + this.n_id];
if (o_jicon) o_jicon.src = this.get_icon(true);
if (o_iicon) o_iicon.src = this.get_icon();
this.upstatus();
}
function item_select (b_deselect) {
if (!b_deselect) {
var o_olditem = this.o_root.o_selected;
this.o_root.o_selected = this;
if (o_olditem) o_olditem.select(true);
}
var o_iicon = document.images['i_img' + this.o_root.n_id + '_' + this.n_id];
if (o_iicon) o_iicon.src = this.get_icon();
get_element('i_txt' + this.o_root.n_id + '_' + this.n_id).style.fontWeight = b_deselect ? 'normal' : 'bold';
this.upstatus();
return Boolean(this.a_config[1]);
}
function item_upstatus (b_clear) {
window.setTimeout('window.status="' + (b_clear ? '' : this.a_config[0] + (this.a_config[1] ? ' ('+ this.a_config[1] + ')' : '')) + '"', 10);
}
function item_init () {
var a_offset = [],
o_current_item = this.o_parent;
for (var i = this.n_depth; i > 1; i--) {
a_offset[i] = '<img src="' + this.o_root.a_tpl[o_current_item.is_last() ? 'icon_e' : 'icon_l'] + '" border="0" align="absbottom">';
o_current_item = o_current_item.o_parent;
}
return '<table cellpadding="0" cellspacing="0" border="0"><tr><td>' + (this.n_depth ? a_offset.join('') + (this.a_children.length
? '<a href="javascript: trees[' + this.o_root.n_id + '].toggle(' + this.n_id + ')" onmouseover="trees[' + this.o_root.n_id + '].mover(' + this.n_id + ')" onmouseout="trees[' + this.o_root.n_id + '].mout(' + this.n_id + ')"><img src="' + this.get_icon(true) + '" border="0" align="absbottom" name="j_img' + this.o_root.n_id + '_' + this.n_id + '"></a>'
: '<img src="' + this.get_icon(true) + '" border="0" align="absbottom">') : '')
+ '<a href="' + this.a_config[1] + '" target="' + this.o_root.a_tpl['target'] + '" onclick="return trees[' + this.o_root.n_id + '].select(' + this.n_id + ')" ondblclick="trees[' + this.o_root.n_id + '].toggle(' + this.n_id + ')" onmouseover="trees[' + this.o_root.n_id + '].mover(' + this.n_id + ')" onmouseout="trees[' + this.o_root.n_id + '].mout(' + this.n_id + ')" class="t' + this.o_root.n_id + 'i" id="i_txt' + this.o_root.n_id + '_' + this.n_id + '">' + this.a_config[0] + '</a></td></tr></table>' + (this.a_children.length ? '<div id="i_div' + this.o_root.n_id + '_' + this.n_id + '" style="display:done"></div>' : '');
}
function item_get_icon (b_junction) {
return this.o_root.a_tpl['icon_' + ((this.n_depth ? 0 : 32) + (this.a_children.length ? 16 : 0) + (this.a_children.length && this.b_opened ? 8 : 0) + (!b_junction && this.o_root.o_selected == this ? 4 : 0) + (b_junction ? 2 : 0) + (b_junction && this.is_last() ? 1 : 0))];
}
var trees = [];
get_element = document.all ?
function (s_id) { return document.all[s_id] } :
function (s_id) { return document.getElementById(s_id) };
var TREE_ITEMS = [
<%=treelist%>
];
/*
Feel free to use your custom icons for the tree. Make sure they are all of the same size.
User icons collections are welcome, we'll publish them giving all regards.
*/
var TREE_TPL = {
'target' : 'right', // name of the frame links will be opened in
//other possible values are: _blank, _parent, _search, _self and _top
'icon_e' : 'inc/images/empty.gif', // empty image
'icon_l' : 'inc/images/line.gif', // vertical line
'icon_32' : 'inc/images/1.gif', // root leaf icon normal
'icon_36' : 'inc/images/1.gif', // root leaf icon selected
'icon_48' : 'inc/images/1.gif', // root icon normal
'icon_52' : 'inc/images/1.gif', // root icon selected
'icon_56' : 'inc/images/1.gif', // root icon opened
'icon_60' : 'inc/images/1.gif', // root icon selected
'icon_16' : 'inc/images/folder.gif', // node icon normal
'icon_20' : 'inc/images/folderopen.gif', // node icon selected
'icon_24' : 'inc/images/folderopen.gif', // node icon opened
'icon_28' : 'inc/images/folderopen.gif', // node icon selected opened
'icon_0' : 'inc/images/3.gif', // leaf icon normal
'icon_4' : 'inc/images/3_2.gif', // leaf icon selected
'icon_2' : 'inc/images/joinbottom.gif', // junction for leaf
'icon_3' : 'inc/images/join.gif', // junction for last leaf
'icon_18' : 'inc/images/plusbottom.gif', // junction for closed node
'icon_19' : 'inc/images/plus.gif', // junctioin for last closed node
'icon_26' : 'inc/images/minusbottom.gif',// junction for opened node
'icon_27' : 'inc/images/minus.gif' // junctioin for last opended node
};
new tree (TREE_ITEMS, TREE_TPL);
//-->
</script>
'/////////////////////////////////////////////////////////////////////////
SQL 쿼리에서 treelist = treelist & "['<img src=inc/images/4-1.gif border=0>내용' ]"
많은 분들이 알고 계시겠지만 Weakday함수를 사용하면 데이터 형식의 값에서 요일을 출력 할 수 있습니다.
기본형은 물론 yyyy-mm-dd 이런식이 되겠죠? ^^
<%
nday="20090502"
day1=Left(nday,4)
day2=Mid(nday,5,2)
day3=Right(nday,2)
Response.write day1&"<br>"
Response.write day2&"<br>"
Response.write day3&"<br>"
MyDate = CDate(day1&"-"&day2&"-"&day3)
Response.Write MyDate&"<br>"
Response.Write Weekdayname(Weekday(MyDate))
%>
<!--출력결과-->
2009
05
02
2009-05-02
토요일
<%
'[ASP] Base64 URL Encoding
'OPTION EXPLICIT
const BASE_64_MAP_INIT = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
dim nl
' zero based arrays
dim Base64EncMap(63)
dim Base64DecMap(127)
'/////////////////////////////////////////////////
'/// must be called before using anything else
'/// 다른 작업이전에 먼저 호출해야하는 함수입니다.
'/////////////////////////////////////////////////
PUBLIC SUB initCodecs()
' init vars
nl = "<P>" & chr(13) & chr(10)
' setup base 64
dim max, idx
max = len(BASE_64_MAP_INIT)
for idx = 0 to max - 1
' one based string
Base64EncMap(idx) = mid(BASE_64_MAP_INIT, idx + 1, 1)
next
for idx = 0 to max - 1
Base64DecMap(ASC(Base64EncMap(idx))) = idx
next
END SUB
'/////////////////////////////////////////////////
'/// encode base 64 encoded string
'/// Base64로 인코딩하는 함수입니다.
'/////////////////////////////////////////////////
PUBLIC FUNCTION base64Encode(plain)
if len(plain) = 0 then
base64Encode = ""
exit function
end if
dim ret, ndx, by3, first, second, third
by3 = (len(plain) \ 3) * 3
ndx = 1
do while ndx <= by3
first = asc(mid(plain, ndx+0, 1))
second = asc(mid(plain, ndx+1, 1))
third = asc(mid(plain, ndx+2, 1))
ret = ret & Base64EncMap( (first \ 4) AND 63 )
ret = ret & Base64EncMap( ((first * 16) AND 48) + ((second \ 16) AND 15 ) )
ret = ret & Base64EncMap( ((second * 4) AND 60) + ((third \ 64) AND 3 ) )
ret = ret & Base64EncMap( third AND 63)
ndx = ndx + 3
loop
' check for stragglers
if by3 < len(plain) then
first = asc(mid(plain, ndx+0, 1))
ret = ret & Base64EncMap( (first \ 4) AND 63 )
if (len(plain) MOD 3 ) = 2 then
second = asc(mid(plain, ndx+1, 1))
ret = ret & Base64EncMap( ((first * 16) AND 48) + ((second \ 16) AND 15 ) )
ret = ret & Base64EncMap( ((second * 4) AND 60) )
else
ret = ret & Base64EncMap( (first * 16) AND 48)
ret = ret & "="
end if
ret = ret & "="
end if
base64Encode = ret
END FUNCTION
'/////////////////////////////////////////////////
'/// decode base 64 encoded string
'/// Base64로 디코딩하는 함수 입니다.
'/////////////////////////////////////////////////
PUBLIC FUNCTION base64Decode(scrambled)
if len(scrambled) = 0 then
base64Decode = ""
exit function
end if
' ignore padding
dim realLen
realLen = len(scrambled)
do while mid(scrambled, realLen, 1) = "="
realLen = realLen - 1
loop
dim ret, ndx, by4, first, second, third, fourth
ret = ""
by4 = (realLen \ 4) * 4
ndx = 1
do while ndx <= by4
first = Base64DecMap(asc(mid(scrambled, ndx+0, 1)))
second = Base64DecMap(asc(mid(scrambled, ndx+1, 1)))
third = Base64DecMap(asc(mid(scrambled, ndx+2, 1)))
fourth = Base64DecMap(asc(mid(scrambled, ndx+3, 1)))
ret = ret & chr( ((first * 4) AND 255) + ((second \ 16) AND 3))
ret = ret & chr( ((second * 16) AND 255) + ((third \ 4) AND 15) )
ret = ret & chr( ((third * 64) AND 255) + (fourth AND 63) )
ndx = ndx + 4
loop
' check for stragglers, will be 2 or 3 characters
if ndx < realLen then
first = Base64DecMap(asc(mid(scrambled, ndx+0, 1)))
second = Base64DecMap(asc(mid(scrambled, ndx+1, 1)))
ret = ret & chr( ((first * 4) AND 255) + ((second \ 16) AND 3))
if realLen MOD 4 = 3 then
third = Base64DecMap(asc(mid(scrambled,ndx+2,1)))
ret = ret & chr( ((second * 16) AND 255) + ((third \ 4) AND 15) )
end if
end if
base64Decode = ret
END FUNCTION
'/////////////////////////////////////////////////
'/// initialize
'/// 초기화
'/////////////////////////////////////////////////
call initCodecs
'/////////////////////////////////////////////////
'/// Testing code
'/// 테스트 코딩
'/////////////////////////////////////////////////
' dim inp, encode
' inp = request.QueryString("input")
' encode = base64Encode(inp)
'response.write "Encoded value = " & encode & nl
' response.write "Decoded value = " & base64Decode(encode) & nl
%>
<iframe name="hidden_i" src="hidden_i.asp?member_id=<%=memberid%>&addr1=<%=addr1%>&addr2=<%=adr2%>" width="0" height="0" frameborder="no"></iframe>
메인페이지는 바뀌지 않는다.
<script language="javascript">
function setValue(){
document.order.target = "_parent";
document.order.submit();
}
</script>
<body onload="javascript:setValue();" oncontextmenu="return false" onselectstart="return false" ondragstart="return false">
<form name="order" action="test2.asp" method="post">
<input type="hidden" name="value1" value="<%=value1%>">
</form>
</body>
오브젝트 선언하고 사용할것
인코딩
<%
'샘플 명령어 strEncodeData = objEncode.Encode(strContents)
Sub Decode()
Set objEncode = Server.CreateObject("Base64Lib.Base64")
End Sub
Sub Encodeclose()
Set objDecode = Nothing
End Sub
%>
디코딩
<%
'샘플 명령어 strDecodeData = objDecode.Decode(strContents)
Sub Decode()
Set objDecode = Server.CreateObject("Base64Lib.Base64")
End Sub
Sub Decodeclose()
Set objDecode = Nothing
End Sub
%>
images.zip