웹마스터 팁

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님 많은 도움이 되기를~~
제목 글쓴이 날짜
[PHP]간단한 로그인페이지 만들기 [15] ZipShin 2002.07.09
MYSQL에 접속하기..^^ [9] ZipShin 2002.05.20
[OsE=] Session을 배워보자~ [#1] OsE= 2002.03.02
파일시스템에서 비밀번호 생성/수정/인증 [7] 두기두바 2002.01.10
[추천 소스] phpMyAdmin 다중사용자용... [5] WOWpc 2001.11.29
대화방을 만들어보쟈~ [20] 해그리드짱!!! 2001.06.03
PHP 인증 페이지를 만들자! - Lesson 3 수정본 #1 [3] ☺[폐]허접-_- 2002.01.24
쿠키(cookie)의 활용 [44] zero 2000.03.06
{로그인}관리자 로그인 폼 간단함 [2] 김민환 2006.10.10
상위 셀렉트박스 값 변경시 하위셀렉트박스(다수)제어하기. [2] Xian 2005.02.19
특정위치에 떠있는 레이어 (슬라이딩 애드콘) - 노프레임홈에서의 문제해결 [8] 검미르 2004.05.03
[초간단 자바스크립트!] 자바로 로그인폼 만들기 [3] ∑Ztxy 2004.01.26
[초간단 자바스크립트!] 홈페이지에 FTP 폼 넣기?! [10] ∑Ztxy 2003.09.29
크롬리스(Chromless) 웹어플리케이션 -5 [3] sundew 2003.05.28
다음 로그인 폼 입니다... 로그인후 원하는 곳으로!! [3] 정성교 2003.03.05
로그인과 로그아웃을 체크하는 방법입니다. [3] 이영호 2003.01.24
텍스트 폼에 커서가 미리 깜빡이도록... [8] 카리 2003.01.22
[re] 아래 행복한고니님의 할아버지 소스의 업글(?) 버젼입니다. [2] Mahican 2002.12.02
[자작] select 폼 태그 html로 허접하게나마 꾸며보기 [18] zero 2002.11.05
자바스크립트로 여러개 아이디 로그인 하기 [5] ZipShin 2002.09.17