¸ÞÀÎ È­¸é¿¡¼­ ·Î±×ÀÎ ³Ö±â

ÀÎÁõ¿¡ ´ëÇÑ ±â´ÉÀº KCKAuth¿¡¼­ ó¸®ÇÕ´Ï´Ù.
¿¹Á¦ ÆäÀÌÁö´Â ¼³Ä¡µð·ºÅ丮/sample/main_login.php ¸¦ ÂüÁ¶ÇϽñ⠹ٶø´Ï´Ù.
¼Ò½º º¸±â
 

<?
L01:    if(!defined("K_USER_ROOT"))   define("K_USER_ROOT", $DOCUMENT_ROOT);
L02:    if(!defined("K_INSTALL_DIR")) define("K_INSTALL_DIR", "/KLO_release");
L03:    if(!defined("K_LIB_ENV")) require(K_USER_ROOT . K_INSTALL_DIR . "/kEnv.php");
L04:   
L05:
L06:    if(!defined("KCKAUTH")) require(K_KLOCLASS_PATH . "/KCKAuth.php");
L07:    $Auth    = new KCKAuth;
L08:
L09:    if($Auth->IsAuth())
L10:    {            
L11:    ?>
L12:        <table width="0" border="0" align="center" cellpadding="0" cellspacing="0">
L13:            <tr height=25 >
L14:              <td width="60"  align=right><strong>¾ÆÀ̵ð : </strong></td>
L15:              <td width="70" align=center>&nbsp;<strong><font color='#619BD4'>
L16:                  <? echo $Auth->GetUserId();?></font></strong>
L17:               </td>
L18:              <td width="60" align=right><strong >À̸§</font> : </strong></td>
L19:              <td width="70" align=center>&nbsp;<strong><font color='#619BD4'>
L20:                  <? echo $Auth->GetName();?></font></strong>
L21:              </td>
L22:              <td width="61">
L23:                  <a href='<? echo K_INSTALL_DIR ;?>/login/Logout.php?nu=%2Fver1%2F'><img  src="/ver1/images/logout_go.gif"  border=0></a>
L24:               </td>
L25:            </tr>
L26:       </table>
L27:    <?
L28:    }
L29:    else
L30:    {
L31:    ?>            
L32:        <table width="350" border="0" align="center" cellpadding="0" cellspacing="0">
L33:            <form action='<? echo K_INSTALL_DIR ;?>/login/Login.php' method=post>
L34:            <input type=hidden name="nu" value="/ver1/">
L35:            <tr>
L36:              <td width="47"><strong>¾ÆÀ̵ð</strong></td>
L37:              <td width="100"><input name="UserId" type="text" size="10"></td>
L38:              <td width="64"><strong>ÆÐ½º¿öµå</strong></td>
L39:              <td width="100"><input type="password"  name="Passwd" size="10"></td>
L40:              <td width="61"><input type=image  src="/ver1/images/login_go.gif" width="61" height="25"></td>
L41:            </tr>
L42:            </form>
L43:      </table>      
L44:    <?
L45:    }
L46:?>   

-·Î±×ÀÎÀÎ µÇ¾úÀ» ¶§ (L09 ~ L28)
    - L07 : KCKAuth´Â .KLO¿¡¼­ »ç¿ëÇÏ´Â ÀÎÁõ °ü·Ã classÀÔ´Ï´Ù.
    - L09 : ·Î±×ÀÎÀÌ µÇ¾ú´ÂÁö¸¦ »ìÇÌ´Ï´Ù. IsAuth()ÇÔ¼ö´Â ·Î±×ÀÎ µÇ¾úÀ» ¶§ true ±×·¸Áö ¾ÊÀº °æ¿ì false¸¦ ¸®ÅÏÇÕ´Ï´Ù.
    - L16 : $Auth->GetUserId()Àº »ç¿ëÀÚ ¾ÆÀ̵𸦠¹ÝȯÇÕ´Ï´Ù.
    - L20 : $Auth->GetName()Àº »ç¿ëÀÚ À̸§À» ¹ÝȯÇÕ´Ï´Ù.
    - L23 : Àº ·Î±× ¾Æ¿ôÀ» ½ÇÇàÇÏ´Â URL¸¦ Ãâ·ÂÇϰí ÀÖ½À´Ï´Ù. ·Î±×¾Æ¿ô ÆÄ¶ó¹ÌÅÍ·Î nu(next url)·Î ´Ù½Ã µ¹¾Æ¿Ã url¸¦ ¼³Á¤ÇÕ´Ï´Ù.%2F´Â '/'ÀÌ ÀÎÄÚµù µÈ °ÍÀÔ´Ï´Ù. ('%2Fver1%2F' = '/ver/' )

- ·Î±×ÀÎÀÌ µÇÁö ¾Ê¾ÒÀ» ¶§ (L29 ~ L45)
    - L33 : ·Î±×ÀÎ µÉ ÁÖ¼Ò´Â ¼³Ä¡ µð·ºÅ丮 ¹ØÀ¸·Î /login/Login.phpÀÔ´Ï´Ù.
    - L34 : ·Î±×ÀÎ ÇÑ ÈÄ µÇµ¹¾Æ¿Ã url¸¦ ¼³Á¤ÇÕ´Ï´Ù. ¼­Á¤ÇÑ ÁÖ¼Ò¸¦ nu(next url)·Î ¼³Á¤ÇÕ´Ï´Ù.
    - L37 : ·Î±×ÀÎ ÇÒ »ç¿ëÀÚ Id¸¦ ÀÔ·ÂÇÕ´Ï´Ù.
    - L39 : ·Î±×ÀÎ ÇÒ »ç¿ëÀÚÀÇ ÆÐ½º¿öµå¸¦ ÀÔ·ÂÇÕ´Ï´Ù.

 Â÷·Ê