웹마스터 팁

wing님께서 문의 하셨던 자바스크립트로 여러개 아이디 로그인 하는 소스를 공개합니다.
이 소스의 원래 근천은 "자스코"이며, 여러 user에 의해 약간 수정되었습니다.

현재 저의 옛날 홈페이지 http://manitocity.com.ne.kr/index.html 에서 확인 할수 있습니다.
일단 로그인을 만들려면 여러개의 프레임이 있어야 하고, 여러개의 문서가 필요 하오니, 저의 강의를 따라오시면 되겠습니다.

1) 프레임을 나누기
- 현재 http://manitocity.com.ne.kr/index.html 이 홈페이지처럼 구현을 해봅시다. 이 홈페이지는 cgi이나 php,asp를 모르는 분을 위하여 자바스크립트로 여러개의 아이디로 로그인을 할수있는 홈페이지로 구현을 해놓은겁니다. 2001년 학교 축제에 내놓았던 홈페이지기도 하죠^^

1> 두 프레임으로 나눕시다. <frameset></frameset> 태그로 두 프레임을 나누는데요..^^
현재 http://manitocity.com.ne.kr/index.html 에서 나눠진 프레임 소스는 아래와 같습니다.
아래와 같이 소스를 index.html 파일에 삽입을 하여 주시고요.. 환경설정을 하기위해 폴더를 menu와 main이라는 폴더를 생성하여 주세요...

<!--
만든이: ljsgood1004@hanmail.net
-->
<Html>        
        <Head>
                <Title>(::::[Html+JavaScript]::::)</Title>

        <Meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
        <Frameset cols="148,*" frameborder="0" border="0" marginwidth="0" marginheight="0" framespacing="0" Style="border-color:#000000;border-width:2pt;border-style:solid">
         <Frame src="./menu/index.html" name="menu" scrolling="no" noresize>
         <Frame src="./main/index.html" name="main" scrolling="auto">
        </Frameset>
        </Head>

        <Noframes>
        <Body>
         <P align="center">This page uses frames, but your browser doesn't support them.</P>
        </Body>
        </Noframes>
</Html>

2> 일단 프레임이 2개로 나눠져있기 때문에, 가장 중심부인 왼쪽 로그인 메뉴를 꾸며 봅시다.

1>번에서 소스를 index.html에서 삽입을 하여 저장후 웹에 올리셨다면, 프레임이 2개로 나눠져 있을것입니다.
2>번 과정에서 하고자 하는 일은, 웹사이트 로그인을 하는 메뉴를 만들고 자 합니다. 간단한 form태그와 input태그의 조합이고, table태그로 정리를 해 놓은것입니다. 아래의 소스는 http://manitocity.com.ne.kr/index.html 에서 사용하는 소스이므로, 그대로 사용하셔도 좋습니다. menu폴더에 html파일을 생성하여 저장합시다.

<!--
만든이: ljsgood1004@hanmail.net
-->
<Html>        
        <Head>
                <Title>(::::[Html+JavaScript]::::)</Title>

        <Meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<style>
        <!--
        Body,select {font-size:10pt;font-family:굴림,굴림체;scrollbar-face-color:#ffffff;scrollbar-shadow-color:#5f5f5f; scrollbar-highlight-color:#5f5f5f;scrollbar-3dlight-color:#ffffff;scrollbar-darkshadow-color:#ffffff;scrollbar-track-color: #ffffff;scrollbar-arrow-color:#5f5f5f}
        Td {font-size:9pt;font-family:새굴림}
        .ad{color:black;background-color:white;border:1 solid black}
        .adb{color:black;background-color:white;border:1 solid black}
        .adf{color:black;background-color:#fff8dd;border:1 solid black}
        A:link    {color:#0000ff;text-decoration:none;font-family:굴림,굴림체}
        A:visited {color:#000000;text-decoration:none;font-family:굴림,굴림체}
        A:active  {color:red;font-family:굴림,굴림체}
        A:hover   {color:red;text-decoration:underline;font-family:굴림,굴림체}
        -->
</style>

<script>
        <!--
        function Login() {
                if (document.login.username.value=="") {
                        alert("아이디를 입력하지 않았습니다. 아이디를 입력하여 주십시오!");
                        document.login.username.focus(); //history.foward(-1);
                        return false;
                }
                if (document.login.password.value=="") {
                        alert("비밀번호를 입력하지 않았습니다. 비밀번호를 입력하여 주십시오!");
                        document.login.password.focus(); //history.go(-1);
                        return false;
                }

        var done=0;
        var username=document.login.username.value;
        username=username.toLowerCase();
        var password=document.login.password.value;
        password=password.toLowerCase();
        if (username=="guest" && password=="guest") {window.alert("안녕하세요? '"+document.login.username.value+"'님 로그인에 성공하였습니다.");window.location.href="../members/guest/guest.html"; done=1;}
        if (username=="manitocity" && password=="0427000") {window.alert("안녕하세요? '"+document.login.username.value+"'님  로그인에 성공하였습니다.");window.location.href="../members/manitocity/manitocity.html"; done=1;}
        if (username=="kkuell1" && password=="glacejin") {window.alert("안녕하세요? '"+document.login.username.value+"'님  로그인에 성공하였습니다.");window.location.href="../members/kkuell1/kkuell1.html"; done=1;}
        if (done==0) {alert("Invalid login!");}
        }

        function change(s) {
                if(s.selectedindex !=0){
                parent.main.location=s.options[s.selectedIndex].value
                }
        }
        //-->
</script>
</Head>

<Body oncontextmenu="return false" ondragstart="return false" onselectstart="return false" topmargin="10" bottommargin="10" leftmargin="10" rightmargin="10" bgcolor="#ffffee" text="#000000" link="#0000EE" vlink="#1A8B55" alink="#FF0000">

      <Div align="center">
       <Form name="login" method="post" action="#" enctype="multipart/form-data"> <!--text/plain-->
        <!--로그인 테이블-->
        <Table border="1" align="center" cellpadding="1" cellspacing="1" width="125" height="0" Style="border-color:#000000;border-width:1pt;border-style:solid">
         <Tr>
          <Td align="center" width="100%" height="0" colspan="4" bgcolor="#fed74e" Style="border-color:#000000;border-width:1pt;border-style:solid">
           <span style="background-color:yellow"><a href="../main/index.html" target="main" title="처음으로...">회원 로그인</a></span>
         </Td>
        </Tr>
         <Tr>
          <Td align="center" width="25%" height="0" bgcolor="#fee89c" Style="cursor:hand;border-color:#000000;border-width:1pt;border-style:solid" title="I.D">I.D</Td>
          <Td align="center" width="75%" height="0" valign="middle" bgcolor="#fff8dd" Style="border-color:#000000;border-width:1pt;border-style:solid">
           <input type="mage" value="" name="username" size="10" maxlength="10" onBlur="this.className='adb'" onFocus="this.className='adf'" class="ad" Style="cursor:text;color:#5c3327;">
         </Td>
         </Tr>
         <Tr>
          <Td align="center" width="25%" height="0" bgcolor="#fee89c" Style="cursor:hand;border-color:#000000;border-width:1pt;border-style:solid" title="password">P.D</Td>
          <Td align="center" width="75%" height="0" valign="middle" bgcolor="#fff8dd" Style="border-color:#000000;border-width:1pt;border-style:solid">
           <input type="password" value="" name="password" size="10" maxlength="10" onBlur="this.className='adb'" onFocus="this.className='adf'" class="ad" Style="cursor:text;color:#5c3327;"></Td>
         </Tr>
         <Tr>
          <Td align="center" width="100%" height="0" colspan="4" bgcolor="#fed74e" Style="border-color:#000000;border-width:1pt;border-style:solid">

        <input type="button" onclick="javascript:Login()"
style=border-color:#b0b0b0;background-color:#3d3d3d;color:#ffffff;font-size:8pt;font-family:Tahoma;height:20px; value="확인">
        <input type="reset" style=border-color:#b0b0b0;background-color:#3d3d3d;color:#ffffff;font-size:8pt;font-family:Tahoma;height:20px; value="취소">
        <input type="button" style=border-color:#b0b0b0;background-color:#3d3d3d;color:#ffffff;font-size:8pt;font-family:Tahoma;height:20px; value="신고" onclick="window.open('../members/password_false.html','main');">
          </Td>
         </Tr>
        </Table>
        <!--/로그인 테이블-->
       </Form>                
      </Div>        

        </Body>
</Html>

3> 여기서 꼭 설정 해야하는 것이 있습니다.
<script>
        function Login() {
                if (document.login.username.value=="") {
                        alert("아이디를 입력하지 않았습니다. 아이디를 입력하여 주십시오!");
                        document.login.username.focus(); //history.foward(-1);
                        return false;
                }
                if (document.login.password.value=="") {
                        alert("비밀번호를 입력하지 않았습니다. 비밀번호를 입력하여 주십시오!");
                        document.login.password.focus(); //history.go(-1);
                        return false;
                }

        var done=0;
        var username=document.login.username.value;
        username=username.toLowerCase();
        var password=document.login.password.value;
        password=password.toLowerCase();
        if (username=="guest" && password=="guest") {window.alert("안녕하세요? '"+document.login.username.value+"'님 로그인에 성공하였습니다.");window.location.href="../members/guest/guest.html"; done=1;}
        if (username=="manitocity" && password=="0427000") {window.alert("안녕하세요? '+ '"+document.login.username.value+"'님  로그인에 성공하였습니다.");window.location.href="../members/manitocity/manitocity.html"; done=1;}
        if (username=="kkuell1" && password=="glacejin") {window.alert("안녕하세요? '"+document.login.username.value+"'님  로그인에 성공하였습니다.");window.location.href="../members/kkuell1/kkuell1.html"; done=1;}
        if (done==0) {alert("Invalid login!");}
        }
</script>
여기서 말이죠..^^ if (username=="guest" && password=="guest") {window.alert("안녕하세요? '"+document.login.username.value+"'님 로그인에 성공하였습니다.");window.location.href="../members/guest/guest.html"; done=1;} 이 부분이 로그인을 하기 위한 user방인데요;; username은 로그인 아이디 password는 로그인을 할려는 비번.. href뒤의 url은 로그인후 이동할 페이지


2) 왼쪽 로그인을 만들었습니다. 오른쪽 main 폴더에 문서를 집어 넣으시고 만들 면 되겠네요;;
이렇게 로그인 소스를 만들어 보았습니다. 더욱더 알고 싶다고요? nzeo의 mysql 용량을 줄이고자 글을줄입니다.
나중에 제가 zip파일로 소스를 몽땅 압축하여 공개하겠습니다. 그럼~~ wing님 많은 도움이 되기를~~
제목 글쓴이 날짜
[기본] 글씨 꾸미기 ^ㅡ^; [13] 2002.08.24
접속하자 마자 풀스크린으로 바뀌는 홈페이지만들기 [20] 노명수 2002.09.02
브라우저 언어에 따라 다른 페이지 보이기 [11] 써니얌 2002.09.03
[re] 문서중 http://***.*** 에 자동링크 ~ 저도 한번 해봤습니다.. [3] 점퍼워니 2002.09.05
문서중 http://***.*** 에 자동링크 - 이제 서버측에서 하지 마세요.. [9] 정명주 2002.09.04
원하는곳에 배경그림고정 [1] 아벨라 2002.09.17
자바스크립트로 여러개 아이디 로그인 하기 [5] ZipShin 2002.09.17
타이틀 바 마퀴 소스 [2] 미친개 2002.09.18
개판 오분전 넷 비디오 [1] 미친개 2002.09.19
asx파일 만들어 나만의 뮤직비디오 만들기 [5] zinie 2002.09.19
간단하고 빠른 페이지포워딩 [3] Draco 2002.09.19
자바스크립트로 클릭하면 출력되는 메뉴를 만들어 보자~!!! [6] 유지호 2002.09.20
페이지 맨위로 이동하는 top 버튼 [7] 조정환 2002.09.28
크롬리스 인터6.0 sp1인한 문제 수정패치 [1] 이태운 2002.09.29
엔지오 메인 화면에서 배너 클릭하면 뜨는 프롬프트 달기 [1] Eccen 2002.09.30
Select의 값을 iframe으로 넣는것입니다. [3] ZipShin 2002.10.03
크롬리스 윈도우창 띄우기 [21] 臥龍先生 2002.10.09
문자열 길이(byte)에 따라 자르기... 행복한고니 2002.10.11
공중에 이리저리 떠다니는 레이어 [2] 아벨라 2002.10.13
MSN 메신져 이모티콘을 게시판에서 사용해보자! [6] 민이 2002.10.16