´ÙÀ½ ÀÌÀü Â÷·Ê

13. ÀÚ·á½Ç ¸¸µé±ââ

ÀÚ·á½ÇÀº °£´ÜÇÑ µ¥ÀÌÅÍÀÇ °æ¿ì ¸Å¿ì À¯¿ëÇÏ°Ô »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. º¸Åë ÀϹÝÀûÀÎ À¯Æ¿¸®Æ¼ ÀÚ·á °øÀ¯·Î È°¿ëÇÒ ¼ö ÀÖÀ¸¸ç

¿©±â¼­ ±¸ÇöÇÒ ÀÚ·á½ÇÀº ÀÚ·á¿¡ °üÇÑ ÀÀ´ä ±Û ±â´ÉÀÌ ÀÖ´Â ¾ÆÁÖ °£´ÜÇÑ ¼Ò½ºÀÔ´Ï´Ù.

±×¸². 13-1 ÀÚ·á½Ç ¸ÞÀÎ È­¸é

13.1 ¼Ò½ºÀÇ ±¸¼º

ÀÚ·á½Ç Å×ÀÌºí ¸¸µé±â

ÀÚ·á½ÇÀÇ Å×À̺íÀº ÃÑ µÎ°³·Î ÀÌ·ç¾îÁ® ÀÖ½À´Ï´Ù.    Àüü ÀÚ·á¿¡ °üÇÑ Å×À̺í°ú ÇØ´ç ÀÚ·á¿¡ °üÇÑ ÀÀ´ä ±Û Å×À̺íÀÔ´Ï´Ù.    ¿©±â¼­ ¸¸µé Å×À̺íÀº ´ÜÁö ÀÚ·á½Ç Çϳª¸¸ ¸¸µé °æ¿ì ±× °úÁ¤À» ¼³¸íÇÑ °ÍÀ̸ç ÀÌÈÄ º» »çÀÌÆ®¸¦ ±¸¼ºÇÒ ¶§ ÀÚ·á½Ç°ú °æ¸Å °Ô½ÃÆÇÀº admin ¿µ¿ª¿¡¼­ ÀÚ½ÅÀÌ ¿øÇÏ´Â ¸¸Å­ °Ô½ÃÆÇÀ» »ý¼ºÇÒ ¼ö ÀÖ½À´Ï´Ù.    Áï, ¿©±â¼­ ¼öÀÛ¾÷À¸·Î ¸¸µç ÀÚ·á½Ç Å×À̺íÀº ³ªÁß¿¡ »ý¼ºÇÒ admin ±â´É¿¡¼­ ÀÚ·á½Ç Ç׸ñ¿¡ ³ªÅ¸³ªÁö ¾Ê½À´Ï´Ù. ¶ÇÇÑ ÀÚ·á½Ç ¼Ò½º ºÎºÐ Áß ÀÚ·á½Ç Å×À̺í($f , $f2)À» Áö±Ý »ý¼ºÇÏ´Â Å×ÀÌºí ¸íÀ¸·Î ¹Ù²Ù¾î¼­ »ç¿ëÇØ¾ß ÇÕ´Ï´Ù.    ¿©±â¼­´Â ÀÚ·á½Ç ¼Ò½ºÀÇ ±¸¼º°ú ÀÛ¼º ¿ä·ÉÀ» ÁßÁ¡ÀûÀ¸·Î ¼³¸íÇÕ´Ï´Ù.

    1) µ¥ÀÌÅͺ£À̽º ¸¸µé±â

        mysql>create databases libchal ;
        ÀÚ·á½Ç Å×À̺íÀ» ¸¸µé µ¥ÀÌÅͺ£À̽º¸¦ »ý¼ºÇÕ´Ï´Ù. Libchal µ¥ÀÌÅͺ£À̽º´Â °æ¸Å °Ô½ÃÆÇÀÇ Å×ÀÌºíµµ »ý¼ºÇÕ´Ï´Ù.

                
    2) Å×ÀÌºí ¸¸µé±â

        ./mysql -u root -p libchal < filetest.sql 

 

    CDÀÇ filetest.sql ÆÄÀÏÀ» ÀÌ¿ëÇؼ­ °£´ÜÈ÷ ÀÚ·á½Ç Å×À̺íÀ» »ý¼ºÇÕ´Ï´Ù.
    ÀÌ ¹æ¹ýÀº »õ·Ó°Ô ÆÄÀÏÀ» »ý¼ºÇؼ­ °¢ Å×À̺íÀÇ ¼Ó¼ºÀ» º¯°æÇؼ­ »ç¿ëÇصµ µË´Ï´Ù. 
    ¿©±â¼­ ¸¸µç Å×À̺íÀº ÇöÀç ±¸¼ºÇÒ ½ºÅ©¸³Æ®ÀÇ ÀÚ·á½Ç Å×ÀÌºí ¸íÀ» ¼öÁ¤Çؼ­ º¼ ¼ö ÀÖ½À´Ï´Ù.
    Áï , ³ªÁß¿¡ admin ¿µ¿ª¿¡¼­ »ý¼ºÇÑ ÀÚ·á½Ç °Ô½ÃÆÇÀÌ ¾Æ´Ò °æ¿ì´Â ¸ÞÀÎ È­¸é¿¡ ³ªÅ¸³ªÁö ¾Ê½À´Ï´Ù.
    »ý¼ºµÇ´Â Å×À̺íÀº filetest¿Í filetest2ÀÌ°í ÀÌ Å×À̺íÀ» ÀÚ·á½Ç ½ºÅ©¸³Æ®¿¡ Àû¿ëÇϱâ À§Çؼ­ ¾Æ·¡ÀÇ ¸µÅ©¸¦
    »ç¿ëÇØ¾ß ÇÕ´Ï´Ù.

  
        <a href ='m.php?chanl=main_view&f=ÀÚ·á½Ç ¸ÞÀÎ Å×À̺í¸í

        &f2=ÀÀ´ä ±Û Å×ÀÌºí ¸í&ssid=$username' >

   
    ÀÌ°ÍÀº °æ¸Å °Ô½ÃÆÇÀÇ °æ¿ìµµ ¸¶Âù°¡ÁöÀÔ´Ï´Ù.

±×¸². 13-2 filetest.sql


    3) Å×À̺íÀÇ ±¸¼º ÀÎÀÚµé

        ÀÚ·á½ÇÀÇ Å×À̺íÀº ÃÑ µÎ°³·Î ÀÌ·ç¾îÁ® ÀÖ½À´Ï´Ù.
        ¿©±â¼­ Å×À̺íÀ» ¸¸µé¾î º¸´Â °ÍÀº ´ÜÁö ÀÚ·á½ÇÀÇ Å×ÀÌºí ±¸¼º ¿ä¼Ò¸¦ È®ÀÎÇϱâ À§ÇÔÀÔ´Ï´Ù. 
        Áï Å×À̺íÀ» ¿©±â¼­ ¸¸µéÁö ¾Ê´õ¶óµµ admin ¿µ¿ª¿¡¼­ »ý¼ºÇؼ­ »ç¿ëÇÏ¸é µË´Ï´Ù.

ÀÚ·á½Ç ¸ÞÀÎ Å×À̺í

    °¢ ÀÎÀÚ Áß¿¡ µî·ÏÀÚ À̸§°ú Æнº¿öµå µîÀ» ¼³Á¤ÇÑ °ÍÀº ȸ¿øÁ¦ »çÀÌÆ®Áö¸¸ ÀÚ·á½ÇÀÇ ÀÌ¿ëÀº °ø°³Çϱâ
    À§ÇÔÀÔ´Ï´Ù.   Áï , ȸ¿ø °¡ÀÔÀ» ÇÏÁö ¾Ê°í guest·Î ÀÔÀå ÇÏ´õ¶óµµ ÀÚ·áÀÇ ´Ù¿î·Îµå´Â °¡´ÉÇÕ´Ï´Ù.
    ±×¸®°í ȸ¿øÀÎ °æ¿ì¶óµµ ´Ù¾çÇÑ À̸§°ú Æнº¿öµå·Î µî·Ï°¡´ÉÇÕ´Ï´Ù.

 
        no - ÀÚ·áÀÇ ¹øÈ£¸¦ ºÎ¿©ÇÕ´Ï´Ù. (ÀÚµ¿ Áõ°¡)
        name - ÀÚ·á µî·ÏÀÚ À̸§
        email - ÀÚ·á µî·ÏÀÚ ¸ÞÀÏ ÁÖ¼Ò
        path - µî·ÏµÈ ÀÚ·áÀÇ À§Ä¡
        passw - µî·ÏÀÚ Æнº¿öµå
        title - ÀÚ·á Á¦¸ñ
        content - ÀÚ·á ¼³¸í
        wdate - ÀÚ·á µî·Ï ³¯Â¥
        hit - ÇØ´ç ÀÚ·á Á¶È¸ ¼ö

ÀÀ´ä ±Û Å×À̺í

    ÀÀ´ä ±ÛÀÇ °æ¿ì ÇØ´ç ÀÚ·á¿¡ ´ëÇÑ °íÀ¯ ¹øÈ£¸¦ ÀúÀåÇϸç ÇØ´ç ±ÛÀÇ ³»¿ë¿¡ ³ª¿­µË´Ï´Ù.

 
        name - ÀÀ´ä ±Û µî·ÏÀÚ À̸§
        email - ÀÀ´ä ±Û µî·ÏÀÚ ¸ÞÀÏ ÁÖ¼Ò
        tnum - ÇØ´ç ÀÚ·áÀÇ °íÀ¯ ¹øÈ£ ÀúÀå
        wdate - ÀÀ´ä ±Û µî·Ï ³¯Â¥
        content - ÀÀ´ä ±Û ³»¿ë

¼Ò½º ¸¸µé±â

    ÀÚ·á½Ç ½ºÅ©¸³Æ®´Â ÃÑ µÎ°³·Î ±¸¼ºµË´Ï´Ù.
    ÀÌ ¹æ¹ýÀº ¾ÕÀÇ ¸ÞÀÎ È­¸é ±¸¼º°ú µÚ¿¡ ¼³¸íÇÒ °æ¸Å °Ô½ÃÆÇ , ¼îÇÎ ¸ô , admin ¿µ¿ª ¶ÇÇÑ ¸¶Âù°¡ÁöÀÔ´Ï´Ù. 
    ±¸¼ºÀº ÀÚ·á½Ç °¢ È­¸éÀ» ±¸¼ºÇÏ´Â ÆÄÀÏ(f.php)°ú ÇÔ¼öµéÀ» ´Ù¾çÇÑ ¹æ¹ýÀ¸·Î Ãâ·ÂÇÏ´Â ÆÄÀÏ(m.php)·Î ÀÌ·ç¾î Áý´Ï´Ù.

f.php Àüü ÄÚµå

    <?php

    /////////////////////////////////////////////
    //
    //    ÀÏÀÚ : 2000.3.27 pm 5
    //   ÀÛ¼ºÀÚ: skycry (hong il)
    //
    //   method : ÀÚ·á½Ç ÇÔ¼ö ¸ðÀ½
    //
    //////////////////////////////////////////////
    ?>


    <?php

    $connect = mysql_connect('localhost' ,'root' ,'gksmf444');
    mysql_select_db('libchal' ,$connect);


    if($findtype == name)
    {
      $ally = mysql_query("select no ,title ,name ,hit ,wdate ,email ,path from $f
      where name like '%$findname%' order by no " ,$connect);
    }


    if($findtype == title)
    {
      $ally = mysql_query("select no ,title ,name ,hit ,wdate ,email ,path from $f
      where title like '%$findname%' order by no " ,$connect);
    }


    if($findtype == content)
    {
      $ally = mysql_query("select no ,title ,name ,hit ,wdate ,email ,path from $f
      where content like '%$findname%' order by no " ,$connect);
    }


    if($findtype == t_c)
    {
      $ally = mysql_query("select no ,title ,name ,hit ,wdate ,email ,path from $f
      where title like '%$findname%' or content like '%$findname%' order by no " ,$connect);
    }


    if(!$findtype)
    {
      $ally = mysql_query("select no ,title ,name ,hit ,wdate ,path ,email from $f
      order by no " ,$connect);//$connection »ý·« ÇßÀ½
    }


    $ally4 = mysql_query("select no ,hit ,passw ,name ,path from $f where no='$no'" ,$connect );


    $ally3 = mysql_query("select name ,email ,tnum ,wdate ,content from $f2 where tnum ='$no'
    order by tnum desc" ,$connect );


    $ally2 = mysql_query("select no ,email ,title ,name ,content ,path ,wdate from $f
    where no='$no'" ,$connect );


    $t_num=mysql_num_rows($ally);
    $putup = mysql_fetch_array($ally4);

    ?>



    <?php

    function main_view($t_num ,$ally ,$page ,$findtype ,$findname ,$f ,$f2 ,$root ,$username)
    { 

      $p_dip = 4 ;
      $p_page =5 ;
      $p_pagex = ceil($p_page / 2) ;
      $t_page = ceil($t_num / $p_dip) ;


      if(!$page)
      {
        $page = 1;
      }


      if( $page <= $p_pagex )
      {
        $p_start = $p_pagex + 1 ;
      }
      else
      {
        $p_start = $page + 1;
      }


      $pt_page = ceil($p_start - $p_pagex) ;
      $next_p = $page + 1 ;
      $pre_p = $page - 1 ;
      $start_num = ($t_num - ($page * $p_dip))+($p_dip-1) ;


      if(!$root)
      {
        $admin = "User " ;
      }
      else
      {
        $admin = "Admin ÀÔ´Ï´Ù.";
      }

          
      echo("
      <html>
      <title>
      main_view html
      </title>
      <body bgcolor=black>
      <center>
      <img src=skyt1.jpg border=0>
      <br>

      <table border=0 cellspacing=2 cellpadding=2 width=700 >

      <tr>
      <th bgcolor=white colspan=6 align=left>
      <font style='font-size:12px;font-style:italic;color:#blue'>
      <b>$t_page / $page : $admin</b></font></th>
      </tr>

      <tr>
      <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>No</b></font></td>


      <td bgcolor=#808080 width=370>
      <font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>Title</b></font></td>


      <td bgcolor=#808080 width=50 align=center>
      <font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>Name</b></font></td>


      <td bgcolor=#808080 align=center>
      <font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>Cnt</b></font></td>


      <td bgcolor=#808080 width=50 align=center>
      <font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>down</b></font></td>


      <td bgcolor=#808080 width=125 align=center>
      <font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>µî·ÏÀÏ</b></font></td>
      </tr>");


      if(!$t_num)
      {
        echo ("
        <tr>
        <th bgcolor=black colspan=6>
        <font style='font-size:13px;font-style:italic;color:#fffff0'>
        <b>µî·ÏµÈ ±ÛÀÌ ¾ö½º¿ä...  ^^;</b></font></th>
        </tr>
        </center>
        </table>
        </html>
        ");
      }
      else
      {
        for($pd=$start_num ; $pd > $start_num-$p_dip ; $pd--)
        {

          if($pd >= 0 )
          {
            mysql_data_seek($ally ,$pd);
            $put=mysql_fetch_array($ally);


            echo("
            <tr>
            <td bgcolor=black>
            <font style='font-size:13px;font-style:italic;color:blue'>
            $put[no]</font></td>


            <td bgcolor=black>
            <a href ='m.php?chanl=title&no=$put[no]&f=$f&f2=$f2'>


            <font style='font-size:13px;font-style:italic;color:#fffff0'>
            <b>$put[title]</b></font></a></td>
            <td bgcolor=black align=center>
            <a href = mailto:$put[email] >


            <font style='font-size:13px;font-style:italic;color:#fffff0'>
            <b>$put[name]</b></font></a></td>
            <td bgcolor=black align=center>
            <font style='font-size:13px;font-style:italic;color:#fffff0'>
            <b>$put[hit]</b></font></td>


            <td bgcolor=black align=center>
            <a href ='ftp://192.168.0.3/home/ftp/pub/$put[path]'>
            <font style='font-size:13px;font-style:italic;color:blue'>
            <img src=disksmblk.gif border=0></font></a></td>
            <td bgcolor=black align=center>
            <font style='font-size:13px;font-style:italic;color:red'>
            <b>$put[wdate]</b></font></td>
            </tr>
            ");
          }
        }


        echo("
        <tr>
        <td bgcolor=black colspan=7>&nbsp;</td>
        </tr>
        <tr>
        <td bgcolor=black colspan=7 align=center>
        ");


        if($page == 1)
        {
          echo ("
          <font style='font-size:12px;font-style:italic;color:#fffff0'>first </font> ");
        }
        else
        {
          echo ("
          <a href =m.php?chanl=main_view&page=$pre_p&f=$f&f2=$f2>
          <font style='font-size:12px;font-style:italic;color:#fffff0'><< </font></a>");
        }


        for($pp=$pt_page ; $pp < $p_page+$pt_page ; $pp++)
        {

          if($pp == $page )
          {
            <font style='font-size:13px;font-style:italic;color:red'>
            $pp</font>  ");
          }
          else
          {
            if($pp > 0  && $pp <= $t_page)
            {
              echo("
              <a href =m.php?chanl=main_view&page=$pp&f=$f&f2=$f2>
              font style='font-size:12px;font-style:italic;color:#808080'>[$pp]</font></a>");
            }
          }
        }


        if($page == $t_page)
        {
          echo ("
          <font style='font-size:12px;font-style:italic;color:#fffff0'> last^^ </font>");
        }
        else
        {
          echo ("
          <a href =m.php?chanl=main_view&page=$next_p&f=$f&f2=$f2>
          <font style='font-size:12px;font-style:italic;color:#fffff0'>pre>></font></a>");
        }

      }

      echo("
      </td>
      </tr>
      </center>
      </table>
      <br>
      <center>
          

      <table border=0 cellspacing=2 cellpadding=2 width=700 >
          

      <tr>
      <td bgcolor=black width=100>
      <a href =m.php?chanl=new_libchal&f=$f&f2=$f2>
      <img src=write.gif border=0>
      </a></td>
          

      <td bgcolor=black width=100>
      <a href =userin.php?chanl=main_view&username=$username>
      <img src=home.gif border=0>
      </a></td>
      <td bgcolor=black width=100>
      <a href =db_view.php?chanl=rootin&file=file>
      <img src=admin.gif border=0>
      </a></td>
          

      <td bgcolor=black align=right width=150>
      <form method=post action=m.php>
      <input type=hidden name=chanl size=14 value=main_view>
      <input type=hidden name=f value=$f>
      <input type=hidden name=f2 value=$f2>
      <select name=findtype>
      <option value=name selected>Name
      <option value=title>Title
      <option value=content>Content
      <option value=t_c>Titl+Cont
      </select>
      </font></td>


      <td bgcolor=black width=150>
      <input type=text name=findname size=14>
      </td>


      <td bgcolor=black width=100>
      <input type=submit value=Find>

      </td>
      </tr>
      </table>
      </center>
      </html>
      ");
    }



    function edit_libchal($ally2 ,$no ,$f ,$f2)
    {

      $put3=mysql_fetch_array($ally2);


      echo("
      <html>
      <title>
      input_view html
      </title>
      <body bgcolor=black>
      <center>
      <img src=skyt1.jpg border=0>
      <br>


      <form method=post action=m.php>


      <input type=hidden name=chanl value=edit_libchal_in>
      <input type=hidden name=f value=$f>
      <input type=hidden name=f2 value=$f2>
      <input type=hidden name=no value=$no>


      <table border=0 cellspacing=2 cellpadding=2 width=700 >


      <tr>
      <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>~Title</b></font></td>
      <td bgcolor=black align=left><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <input type=text name=title size=50 value='$put3[title]'></font></td>
      </tr>


      <tr>
      <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>~Name</b></font></td>
      <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <input type=text name=name size=10 value='$put3[name]'></font></td>
      </tr>


      <tr>
      <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>~Passw</b></font></td>
      <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <input type=password name=passw size=10></font></td>
      </tr>


      <tr>
      <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>~E-mail</b></font></td>
      <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <input type=text name=email size=20 value='$put3[email]'></font></td>
      </tr>


      <tr>
      <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>~Content</b></font></td>
      <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <textarea name=content rows=10 cols=70 >$put3[content]</textarea></font></td>
      </tr>


      <tr>
      <td bgcolor=black align=center colspan=4>
      <font style='font-size:13px;font-style:italic;color:#fffff0'>
      <input type=submit value=¼öÁ¤Çϱâ>
      </font></td>
      </tr>
      </table>
      </form>
      </center>
      </body>
      </html>
      ");
    }



    function view_title($ally2 ,$ally3 ,$no ,$f ,$f2)
    {

      $put=mysql_fetch_array($ally2);
      $content=nl2br($put[content]) ;
      $size = filesize("/ftp/pub/$put[path]");
      $t_num=mysql_num_rows($ally3);


      echo("
      <html>
      <title>
      view_title html
      </title>
      <body bgcolor=black>
      <center>
      <img src=skyt1.jpg border=0>
      <br>


      <table border=0 cellspacing=2 cellpadding=2 width=700 >


      <tr>
      <td bgcolor=white align=center width=120>
      <font style='font-size:13px;font-style:italic;color:#blue'><b>$no No</b></font></td>


      <td bgcolor=white align=center width=580>
      <font style='font-size:13px;font-style:italic;color:#black'>
      <b>$put[title]</b></font></td>
      </tr>
      </table>


      <table border=0 cellspacing=2 cellpadding=2 width=700 >


      <tr>
      <td bgcolor=#808080 align=center width=100>
      <font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>$put[wdate]</b></font></td>


      <td bgcolor=#808080 align=center width=200><a href = mailto:$put[email] >
      <font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>name:$put[name]</b></font></a></td>


      <td bgcolor=#808080 align=center width=280>
      <a href ='ftp://192.168.0.3/home/ftp/pub/$put[path]'>
      <font style='font-size:13px;font-style:italic;color:red'>
      <b>$put[path]($size Byte)</b></font></a></td>
      </tr>


      <tr>
      <table border=0 cellspacing=2 cellpadding=2 width=700 height=250>
      <td bgcolor=black valign=top colspan=3 width=700 height=250>
      <font style='font-size:13px;font-style:italic;color:blue'><b>$content</b></font></td>
      </tr>


      <tr>
      <td bgcolor=blue width=700>
      </td>
      </tr>
      </table>

          
      <table border=0 cellspacing=2 cellpadding=2 width=700 height=100>
      ");


      for($s=1 ; $s <= $t_num  ; $s++)
      {
        $put2=mysql_fetch_array($ally3);
        $content=nl2br($put2[content]);


        echo("
        <tr>
        <td bgcolor=#808080><a href = mailto:$put2[email] >
        <font style='font-size:13px;font-style:italic;color:black'>
        <b>$put2[name]´ÔÀÌ ¸»Çϱæ^^;</b>
        </font></a></td>


        <td bgcolor=#808080 align=center width=200>
        <font style='font-size:13px;font-style:italic;color:#fffff0'><b>$put2[wdate]</b>
        </font></td>
        </tr>

        <tr>
        <td bgcolor=black width=700 height=100>
        <font style='font-size:13px;font-style:italic;color:#fffff0'><b>$content</b>
        </font></td>
        </tr>
        ");
      }


      echo("
      </table>
      <table border=0 cellspacing=2 cellpadding=2 width=700 height=100>
     
         
      <tr>
      <td bgcolor=black > &nbsp </td>
      </tr>
      <tr>
      <td bgcolor=black width=200>
      <a href =m.php?chanl=input_newlibchal&tnum=$no&f=$f&f2=$f2>
      <img src=write.gif border=0></a></td>
     

      <td bgcolor=black width=><a href =m.php?chanl=main_view&f=$f&f2=$f2>
      <img src=list.gif border=0></a></td>


      <td bgcolor=black ><a href =m.php?chanl=edit_libchal&no=$no&f=$f&f2=$f2>
      <img src=rewrite.gif border=0></a></td>


      <td bgcolor=black ><a href =m.php?chanl=del&no=$no&f=$f&f2=$f2>
      <img src=delete1.gif border=0></a></td>


      </tr>
      </table>
      </center>
      </html>
      ");
    }



    function error_view($title ,$name ,$passw ,$email ,$content ,$f ,$f2)
    {

      if(!$title)
      {
        echo("
        <script>
        window.alert('ÁÖÁ¦°¡ ¾ø½À´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇØ ÁÖ¼¼¿ä')
        history.go(-1)
        </script>
        ");
        exit;
      }


      if(!$name)
      {
        echo("
        <script>
        window.alert('À̸§ÀÌ ¾ø½À´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇØ ÁÖ¼¼¿ä')
        history.go(-1)
        </script>
        ");
        exit;
      }


      if(!$passw)
      {
        echo("
        <script>
        window.alert('passw°¡ ¾ø½À´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇØ ÁÖ¼¼¿ä')
        history.go(-1)
        </script>
        ");
        exit;
      }


      if(!$email)
      {
        echo("
        <script>
        window.alert('¸ÞÀÏ ÁÖ¼Ò°¡ ¾ø½À´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇØ ÁÖ¼¼¿ä')
        history.go(-1)
        </script>
        ");
        exit;
      }


      if(!$content)
      {
        echo("
        <script>
        window.alert('³»¿ëÀÌ ¾ø½À´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇØ ÁÖ¼¼¿ä')
        history.go(-1)
        </script>
        ");
        exit;
      }
    }



    function input_newlibchal($tnum ,$f ,$f2)
    {

      echo("
      <html>
      <title>
      input_newlibchal html
      </title>
      <head>
      </head>
      <body bgcolor=black>
      <center>
      <img src=skyt1.jpg border=0>
      <br>
      <form method=post action=m.php>
      <input type=hidden name=chanl value=input_newlibchal>
      <input type=hidden name=chanl2 value=input_newlibchal2>
      <input type=hidden name=tnum value=$tnum>
      <input type=hidden name=f value=$f>
      <input type=hidden name=f2 value=$f2>


      <table border=0 cellspacing=2 cellpadding=2 width=700 >
      <tr>
      <td bgcolor=#808080 width=100>
      <font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>~Name</b></font></td>
      <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <input type=text name=name size=10></font></td>
      </tr>


      <tr>
      <td bgcolor=#808080 width=100>
      <font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>~E-mail</b></font></td>


      <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <input type=text name=email size=24></font></td>
      </tr>


      <tr>
      <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>~Content</b></font></td>


      <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <textarea name=content rows=10 cols=70></textarea></font></td>
      </tr>
      </table>
      <br><br>


      <table border=0 cellspacing=2 cellpadding=2  width=71% >


      <tr>
      <td bgcolor=black align=center colspan=4>
      <font style='font-size:13px;font-style:italic;color:#fffff0'>
      <input type=submit value=±Û¿Ã¸®±â>
      <input type=reset  value=Áö¿ì±â></font></td>
      </tr>
      </table>
      </form>
      </center>
      </body>
      </html>
      ");
    }



    function input_view($f ,$f2)
    {
      echo("
      <html>
      <title>
      input_view html
      </title>
      <body bgcolor=black>
      <center>
      <img src=skyt1.jpg border=0>
      <br>
      <form method=post enctype=multipart/form-data action=m.php>
      <input type=hidden name=chanl value=input_new>
      <input type=hidden name=f value=$f>
      <input type=hidden name=f2 value=$f2>

 
      <table border=0 cellspacing=2 cellpadding=2 width=700 >


      <tr>
      <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>~Title</b></font></td>
      <td bgcolor=black align=left><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <input type=text name=title size=44></font></td>
      </tr>


      <tr>
      <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>~Name</b></font></td>
      <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <input type=text name=name size=10></font></td>
      </tr>
 

      <tr>
      <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>~Passw</b></font></td>
      <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <input type=password name=passw size=10></font></td>
      </tr>


      <tr>
      <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>~E-mail</b></font></td>
      <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <input type=text name=email size=24></font></td>
      </tr>


      <tr>
      <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>~up File</b></font></td>
      <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <input type=file name=upfile size=24></font></td>
      </tr>


      <tr>
      <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>~Content</b></font></td>


      <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <textarea name=content rows=10 cols=70></textarea></font></td>
      </tr>


      <tr>
      <td bgcolor=black align=center colspan=4>
      <font style='font-size:13px;font-style:italic;color:#fffff0'>
      <input type=submit value=ÀÚ·áµî·Ï>
      <input type=reset  value=Áö¿ì±â></font></td>
      </tr>
      </table>
      </form>
      </center>
      </body>
      </html>
      ");
    }



    function del($no ,$f ,$f2 ,$root)
    {

      echo("
      <html>
      <title>
      input_newlibchal html
      </title>
      <body bgcolor=black>
      <center>
      <img src=skyt1.jpg border=0>
      <br>
      <form method=post action=m.php>
      <input type=hidden name=chanl value=del_no>
      <input type=hidden name=tnum value=$no>
      <input type=hidden name=no value=$no>
      <input type=hidden name=f value=$f>
      <input type=hidden name=f2 value=$f2>


      <table border=0 cellspacing=2 cellpadding=2  width=700 >


      <tr>
      <td bgcolor=#808080 width=74>
      <font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>~passw</b></font></td>


      <td bgcolor=black width=100><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <input type=password name=passw size=10></font></td>


      <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <input type=submit value=Áö¿ì±â>
      </font></td>
      </table>
      </tr>
      </form>
      </center>
      </body>
      </html>
      ");
    }


    ?>

ÀÚ·á½Ç ¼Ò½º ±¸¼º

    ÀÌ ÀÚ·á½ÇÀÇ °¢ È­¸éÀº ÇÔ¼ö Çü½ÄÀ¸·Î ¸¸µç °ÍÀÔ´Ï´Ù.

    ÀÌ ÆÄÀÏ¿¡ »õ·Î¿î ÀÚ·á½Ç È­¸éÀ» Ãß°¡ÇÒ ¼ö ÀÖÀ¸¸ç m.phpÀÇ È­¸é ±¸¼ºÀ» ¹Ù²Ü ¼ö ÀÖ½À´Ï´Ù. 

database Á¢¼Ó°ú °Ë»ö ¸ðµå ¸¸µé±â

    f.php ÆÄÀÏÀÇ Ã³À½¿¡ ÀÌ ºÎºÐÀÌ µé¾î °¡¸ç ÀÚ·á½ÇÀÇ ÀڷḦ °Ë»öÇϱâ À§ÇØ mysqlÀÇ query¸¦ ¸ðµå º°·Î($findtype)

    ³ª´©¾î ³ª¿­Çß½À´Ï´Ù.


    <?php

    $connect = mysql_connect('localhost' ,'root' ,'gksmf444');
    mysql_select_db('libchal' ,$connect);
    /* mysql Á¢¼Ó°ú µ¥ÀÌÅͺ£À̽º¸¦ ¼±ÅÃÇÏ°Ô ÇÕ´Ï´Ù. */

 
    if($findtype == name)
    {
      $ally = mysql_query("select no ,title ,name ,hit ,wdate ,email ,path from $f
      where name like '%$findname%' order by no " ,$connect);
    }
    /* $findtypeÀÌ nameÀÏ °æ¿ì mysql query´Â ÇØ´ç Å×À̺í($f)¿¡¼­ À̸§¿¡ °üÇØ °Ë»öÇÕ´Ï´Ù.
       ¿©±â¼­ $f´Â ÀÚ·á½Ç Å×À̺íÀ» ³ªÅ¸³»´Â º¯¼öÀ̸ç, ¿©·¯ °³ÀÇ ÀÚ·á½ÇÀ» ó¸®Çϱâ À§ÇØ º¯¼ö¸¦ »ç¿ëÇÕ´Ï´Ù.
       ¸¸¾à ƯÁ¤ ÀÚ·á½Ç¸¸ °Ë»öÇÏ·Á¸é ÇØ´ç ÀÚ·á½Ç Å×ÀÌºí ¸íÀ» Àû¾îÁÖ¸é µË´Ï´Ù.
       ÇÏÁö¸¸ ±Ã±ØÀûÀÎ ¸ñÀûÀÌ ¿©·¯ °³ÀÇ ÀÚ·á½Ç »ý¼ºÀÌ°í »ç¿ëÀ̹ǷΠÀÚ·á½Ç Å×À̺íÀº º¯¼ö·Î »ç¿ëÇÕ´Ï´Ù.
       Äõ¸®ÀÇ °Ë»öÀº like¹®À» »ç¿ëÇؼ­ °Ë»öÇÕ´Ï´Ù.
       Like¹®ÀÇ ÀÚ¼¼ÇÑ ³»¿ëÀº mysql ¼³¸í ºÎºÐÀ» Âü°íÇϼ¼¿ä. */


    if($findtype == title)
    {                   
      $ally = mysql_query("select no , title , name , hit , wdate , email , path from $f
      where title like '%$findname%' order by no " ,$connect);
    }
    /* $findtype ÀÌ titleÀÏ ¶§ ÇØ´ç Å×ÀÌºí¿¡¼­ Á¦¸ñÀ» °Ë»öÇÕ´Ï´Ù. */


    if($findtype == content)
    {
      $ally = mysql_query("select no ,title ,name ,hit ,wdate ,email ,path from $f
      where content like '%$findname%' order by no " ,$connect);
    }
    /* $findtypeÀÌ contentÀÏ ¶§ ÇØ´ç Å×ÀÌºí¿¡¼­ ³»¿ëÀ» °Ë»öÇÕ´Ï´Ù. */


    if($findtype == t_c)
    {
      $ally = mysql_query("select no ,title ,name ,hit ,wdate ,email ,path from $f
      where title like '%$findname%' or content like '%$findname%' order by no " ,$connect);
    }
    /* $findtype°¡ t_cÀÏ ¶§ ÇØ´ç Å×ÀÌºí¿¡¼­ Á¦¸ñ°ú ³»¿ëÀ» °Ë»öÇÕ´Ï´Ù. */


    if(!$findtype)
    {
      $ally = mysql_query("select no ,title ,name ,hit ,wdate ,path ,email from $f
      order by no " ,$connect);//$connection »ý·« ÇßÀ½
    }
    /* $findtypeÀÌ ¾øÀ» °æ¿ì ÇØ´ç Å×ÀÌºí¿¡¼­ ¸ðµç ÀڷḦ ¹øÈ£ ¼øÀ¸·Î Á¤·ÄÇÕ´Ï´Ù. */


    $ally4 = mysql_query("select no ,hit ,passw ,name ,path from $f where no='$no'" ,$connect );
    /* ÇØ´ç Å×À̺í ƯÁ¤ ¹øÈ£¿¡($no) ÇØ´çÇÏ´Â ±ÛÀ» °Ë»öÇÕ´Ï´Ù. */


    $ally3 = mysql_query("select name ,email ,tnum ,wdate ,content from $f2
    where tnum ='$no' order by tnum desc" ,$connect );
    /* ÇØ´ç Å×À̺í($f2 - ÀÚ·á½Ç ÀÀ´ä ±Û Å×À̺í) ƯÁ¤ ¹øÈ£¿¡ ÇØ´çÇÏ´Â ÀÀ´ä ±ÛÀ» °Ë»öÇÕ´Ï´Ù.
       ÀÌ°ÍÀº ÇØ´ç ±ÛÀÇ ÀÀä ±ÛÀ» °Ë»öÇÏ´Â °ÍÀÔ´Ï´Ù. */


    $ally2 = mysql_query("select no ,email ,title ,name ,content ,path ,wdate from $f
    where no='$no'" ,$connect );
    /* ÇØ´ç Å×À̺í ƯÁ¤ ¹øÈ£¿¡ ÇØ´çÇÏ´Â ±ÛÀÇ Á¤º¸¸¦ °Ë»öÇÕ´Ï´Ù. */


    $t_num=mysql_num_rows($ally);
    /* ÀÚ·á½Ç ¸ÞÀÎ Å×ÀÌºí¿¡ µî·ÏµÈ ¸ðµç ÀÚ·áÀÇ ¼ö¸¦ ÀúÀåÇÕ´Ï´Ù. */


    $putup = mysql_fetch_array($ally4);
    /* ÀÚ·á½Ç ¸ÞÀÎ Å×ÀÌºí¿¡ µî·ÏµÈ ƯÁ¤ ¹øÈ£ÀÇ ÀÚ·á Á¤º¸¸¦ $putup º¯¼ö¿¡ ¹è¿­·Î ÀúÀåÇÕ´Ï´Ù. */

    ?>

main_view( ) ÇÔ¼ö

    óÀ½ ÀÚ·á½Ç Á¢¼ÓÇßÀ» ¶§ ¸ÞÀÎ È­¸éÀ» Ãâ·ÂÇÏ´Â ÇÔ¼öÀÔ´Ï´Ù. ÀÚ·á½Ç ¸ÞÀÎ È­¸é ±×¸²À» Âü°íÇϼ¼¿ä.

ÇÔ¼ö ÀÎÀÚ

    function main_view($t_num , $ally , $page , $findtype , $findname , $f , $f2 , $root , $username)

    /* ÀÚ·á½Ç ¸ÞÀÎ È­¸éÀ» Ãâ·ÂÇϱâ À§ÇØ Àü´Þ¹Þ´Â ÀÎÀÚµéÀÔ´Ï´Ù.

    $t_num - ÇØ´ç Å×À̺íÀÇ µî·ÏµÈ ÀÚ·áÀÇ ¼ýÀÚ¸¦ Àü´ÞÇÕ´Ï´Ù.
    $ally -  ÇØ´ç Å×À̺íÀÇ µî·ÏµÈ ¸ðµç ÀÚ·áÀÇ Á¤º¸¸¦ Àü´ÞÇÕ´Ï´Ù.
    $page - ÇØ´ç Å×À̺íÀÇ ÆäÀÌÁö¸¦ Àü´ÞÇÕ´Ï´Ù.
    $findtype - ÇØ´ç Å×À̺íÀÇ °Ë»ö ¸ðµå¸¦ Àü´ÞÇÕ´Ï´Ù.
    $findname - ÇØ´ç Å×À̺íÀÇ °Ë»ö ´Ü¾î¸¦ Àü´ÞÇÕ´Ï´Ù.
    $f - ÀÚ·á½Ç Å×À̺íÀÇ ¸ÞÀÎ È­¸é Å×À̺íÀ» Àü´ÞÇÕ´Ï´Ù. ¿©·¯ °Ô½ÃÆÇ »ç¿ëÀ» À§ÇÔÀÔ´Ï´Ù.
    $f2 - ÀÚ·á½Ç Å×À̺íÀÇ ÀÀ´ä ±Û Å×À̺íÀ» Àü´ÞÇÕ´Ï´Ù.
    $root - ÀÚ·á½Ç ¸ÞÀÎ È­¸é¿¡ À¯ÀúÀÇ Á¢¼Ó°ú adminÀÇ Á¢¼ÓÀ» ±¸ºÐÇϱâ À§ÇØ admin Á¢¼Ó À¯¹«¸¦ Àü´ÞÇÕ´Ï´Ù.
    $username - ÇØ´ç »çÀÌÆ®¿¡ ·Î±×ÀÎÇÑ ID ¼¼¼ÇÀ» Àü´ÞÇÕ´Ï´Ù.

ÆäÀÌÁö ¼³Á¤°ú admin Ç¥½Ã ¸¸µé±â

    $p_dip = 4 ;


    /* ÆäÀÌÁö´ç ±Û ¼ö */
    $p_page =5  ;


    /* ÆäÀÌÁö´ç ÆäÀÌÁö ¸µÅ©¼ö */
    $p_pagex = ceil($p_page / 2) ;
    $t_page = ceil($t_num / $p_dip) ;
    /* ceil ÇÔ¼ö¸¦ ÀÌ¿ëÇؼ­ ÃÖ¼ÒÀÇ Á¤¼ö¸¦ ±¸ÇØ ÁÝ´Ï´Ù. */


    if(!$page)
    {
      $page = 1;
    }
    /* Àü´ÞµÈ ÆäÀÌÁö ¹øÈ£°¡ ¾øÀ» °æ¿ì 1 ÆäÀÌÁö·Î ¼³Á¤ÇÕ´Ï´Ù. */


    if( $page <= $p_pagex )
    {
      $p_start = $p_pagex + 1 ;
    }
    else
    {
      $p_start = $page + 1;
    }


    $pt_page = ceil($p_start - $p_pagex) ;
    $next_p = $page + 1 ;
    /* ´ÙÀ½ ÆäÀÌÁö¸¦ ±¸ÇÕ´Ï´Ù. */


    $pre_p = $page - 1 ;
    /* ÀÌÀü ÆäÀÌÁö¸¦ ±¸ÇÕ´Ï´Ù. */


    $start_num = ($t_num - ($page * $p_dip))+($p_dip-1) ;
    /* ÀÚ·á½ÇÀÇ ÇÑ ÆäÀÌÁö¿¡ Ãâ·ÂÇÏ´Â ±ÛÀÇ ½ÃÀÛ ¹øÈ£¸¦ Ãâ·ÂÇÕ´Ï´Ù. */


    if(!$root)
    {
      $admin = "User " ;
    }
    else
    {
      $admin = "Admin ÀÔ´Ï´Ù.";
    }
    /* $root°¡ ÀÖÀ» °æ¿ì $admin º¯¼ö¸¦ ÇÒ´çÇÕ´Ï´Ù. */

µî·ÏµÈ ÀÚ·á°¡ ¾øÀ» °æ¿ì

    ÀÚ·á½Ç¿¡ µî·ÏµÈ ÀÚ·á°¡ ¾ø´Â Ãʱ⿡ º¸¿©ÁÖ´Â È­¸éÀÔ´Ï´Ù. ÀÌ °æ¿ì´Â


    if(!$t_num)
    {
      echo ("
      <tr>
      <th bgcolor=black colspan=6><font style='font-size:13px;font-style:italic;color:#fffff0'>
      <b>µî·ÏµÈ ±ÛÀÌ ¾ö½º¿ä...  ^^;</b></font></th>
      </tr>
      </center>
      </table>
      </html>
      ");
    }
    /* ÇØ´ç ÀÚ·á½Ç Å×ÀÌºí¿¡ µî·ÏµÈ ÀÚ·á ¼ö°¡($t_num) ¾øÀ» °æ¿ì Ãâ·ÂÇÏ´Â ºÎºÐÀÔ´Ï´Ù. */

±×¸². 13-3 µî·ÏµÈ ±ÛÀÌ ¾øÀ» °æ¿ì

µî·ÏµÈ ÀÚ·á ±Û Ãâ·ÂÇϱâ

    $t_numÀÌ ÀÖÀ» ¶§ for¹®À» ÀÌ¿ëÇؼ­ ÇØ´ç ÀÚ·á½Ç Å×À̺íÀÇ ±ÛÀ» ÆäÀÌÁö ±Û ¼ö¸¸Å­ Ãâ·ÂÇÕ´Ï´Ù.

        
    for($pd=$start_num ; $pd > $start_num-$p_dip ; $pd--)
    {
      if($pd >= 0 )
      {
      /* ÆäÀÌÁö´ç ±Û ¼ö¸¸Å­ $pd°¡ 0º¸´Ù Å©°Å³ª °°À» ¶§ ½ÇÇàÇÕ´Ï´Ù. */


        mysql_data_seek($ally ,$pd);
        /* ÇØ´ç ÀÚ·á½Ç Å×À̺íÀÇ ÀÚ·á¿¡¼­ ´ÙÀ½ ÀÚ·á·Î À̵¿½Ãŵ´Ï´Ù. */


        $put=mysql_fetch_array($ally);
        /* ÇØ´ç ÀÚ·á½Ç Å×À̺íÀÇ Á¤º¸¸¦ ¹è¿­·Î ÀúÀåÇÕ´Ï´Ù. */


        echo("
        <tr>
        <td bgcolor=black>
        <font style='font-size:13px;font-style:italic;color:blue'>
        $put[no]</font></td>
        /* ÇØ´ç ÀÚ·áÀÇ ¹øÈ£¸¦ Ãâ·ÂÇÕ´Ï´Ù. */


        <td bgcolor=black>
        <a href ='m.php?chanl=title&no=$put[no]&f=$f&f2=$f2'>
        <font style='font-size:13px;font-style:italic;color:#fffff0'>
        <b>$put[title]</b></font></a></td>
        /* ÇØ´ç ÀÚ·áÀÇ Á¦¸ñÀ» Ãâ·ÂÇÕ´Ï´Ù. */


        <td bgcolor=black align=center>
        <a href = mailto:$put[email] >
        <font style='font-size:13px;font-style:italic;color:#fffff0'>
        <b>$put[name]</b></font></a></td>
        /* ÇØ´ç ÀÚ·áÀÇ µî·ÏÀÚ À̸§À» Ãâ·ÂÇÕ´Ï´Ù. */


        <td bgcolor=black align=center>
        <font style='font-size:13px;font-style:italic;color:#fffff0'>
        <b>$put[hit]</b></font></td>
        /* ÇØ´ç ÀÚ·áÀÇ Á¶È¸ ¼ö¸¦ Ãâ·ÂÇÕ´Ï´Ù. */


        <td bgcolor=black align=center>
        <a href ='ftp://192.168.0.3/home/ftp/pub/$put[path]'>
        <font style='font-size:13px;font-style:italic;color:blue'>
        <img src=disksmblk.gif border=0></font></a></td>
        /* ÇØ´ç ÀÚ·áÀÇ À§Ä¡¸¦ µð½ºÄÏ À̹ÌÁö·Î ¸µÅ© ½Ãŵ´Ï´Ù. */


        <td bgcolor=black align=center>
        <font style='font-size:13px;font-style:italic;color:red'>
        <b>$put[wdate]</b></font></td>
        /* ÇØ´ç ÀÚ·áÀÇ µî·Ï ³¯Â¥¸¦ Ãâ·ÂÇÕ´Ï´Ù. */
        </tr>
        ");
      }
    }

ÀÌÀü page ¸µÅ© ¸¸µé±â

    if($page == 1)
    {
      echo ("
      <font style='font-size:12px;font-style:italic;color:#fffff0'>first </font> ");
    }
    /* $page°¡ 1ÀÏ °æ¿ì first¿¡ ÇØ´ç ÆäÀÌÁö¸¦ ¸µÅ©ÇÏÁö ¾Ê½À´Ï´Ù. */
        
    else
    {
      echo ("
      <a href =m.php?chanl=main_view&page=$pre_p&f=$f&f2=$f2>
      <font style='font-size:12px;font-style:italic;color:#fffff0'><< </font></a>");
    }
    /* $page°¡ 1ÀÌ ¾Æ´Ò °æ¿ì << ±âÈ£¿¡ $pre_p º¯¼ö¸¦ ¸µÅ©ÇÕ´Ï´Ù. ÀÌ°ÍÀº ÀÌÀü ÆäÀÌÁö·Î À̵¿ °¡´ÉÇÏ°Ô ÇÕ´Ï´Ù. */

ÆäÀÌÁö ¸µÅ© ¸¸µé±â

    ÆäÀÌÁö ¸µÅ©´Â ÀÚ·á½Ç ÇÏ´Ü¿¡ [1][2][3][4]¡¦¸¦ Ç¥ÇöÇϱâ À§ÇÔÀÔ´Ï´Ù. ÀÚ·á½Ç ¸ÞÀÎ È­¸éÀ» Âü°í Çϼ¼¿ä.


    for($pp=$pt_page ; $pp < $p_page+$pt_page ; $pp++)
    {

      if($pp == $page )
      {
        echo ("
        <font style='font-size:13px;font-style:italic;color:red'>
        $pp</font>  ");
      }
      /* Ãâ·ÂÇÏ´Â ÆäÀÌÁö ¸µÅ©°¡ ÇöÀç ÆäÀÌÁö¿Í °°À» °æ¿ì ¸µÅ©¸¦ ¸¸µéÁö ¾Ê½À´Ï´Ù. */
      else
      {
        if($pp > 0  && $pp <= $t_page)
        {
          echo("
          <a href =m.php?chanl=main_view&page=$pp&f=$f&f2=$f2>
          <font style='font-size:12px;font-style:italic;color:#808080'>[$pp]</font></a>");
        }
        /* ¸µÅ© ÆäÀÌÁö´Â 0º¸´Ù Å©°í ±×¸®°í ÃÑ ÆäÀÌÁöº¸´Ù À۰ųª °°À» ¶§ »ý¼ºÇÕ´Ï´Ù. */
      }
    }

´ÙÀ½ ÆäÀÌÁö ¸µÅ©¸¸µé±â

    if($page == $t_page)
    {
      echo ("
      <font style='font-size:12px;font-style:italic;color:#fffff0'> last^^ </font>");
    }
    /* ÇöÀç ÆäÀÌÁö°¡ ÃÑ ÆäÀÌÁö¿Í °°À» °æ¿ì last^^¿¡ ¸µÅ©¸¦ ¸¸µéÁö ¾Ê½À´Ï´Ù. */
    else
    {
      echo ("
      <a href =m.php?chanl=main_view&page=$next_p&f=$f&f2=$f2>
      <font style='font-size:12px;font-style:italic;color:#fffff0'>pre>></font></a>");
    }
    /* ÇöÀç ÆäÀÌÁö°¡ ÃÑ ÆäÀÌÁö¿Í °°Áö ¾ÊÀ» °æ¿ì >> ±âÈ£¿¡ ¸µÅ©¸¦ ¸¸µì´Ï´Ù. */

´Ù¸¥ ¸Þ´º ¸µÅ© ¸¸µé±â

    ÀÚ·á½Ç ¸ÞÀÎ È­¸é°ú ³ª¸ÓÁö È­¸éµé¿¡¼­ ´Ù¸¥ È­¸éÀ¸·Î À̵¿ÇÏ´Â ¸µÅ©¸¦ ¸¸µì´Ï´Ù.
    ÀÌ°ÍÀº º¸Åë top È­¸é°ú ÀÚ·áµî·Ï , Áö¿ì±â , °íÄ¡±â µîÀÔ´Ï´Ù.


    echo("
    </td>
    </tr>
    </center>
    </table>
    <br>
    <center>

    <table border=0 cellspacing=2 cellpadding=2 width=700 >


    <tr>
    <td bgcolor=black width=100>
    <a href =m.php?chanl=new_libchal&f=$f&f2=$f2>
    <img src=write.gif border=0>
    </a></td>
    /* ÇØ´ç Å×À̺íÀÇ ÀÚ·á½Ç¿¡ ÀڷḦ µî·ÏÇÏ´Â È­¸éÀ¸·Î ¸µÅ©ÇÕ´Ï´Ù. */


    <td bgcolor=black width=100>
    <a href =userin.php?chanl=main_view&username=$username>
    <img src=home.gif border=0>
    </a></td>
    /* ÇØ´ç ÀÚ·á½Ç Å×ÀÌºí¿¡¼­ »çÀÌÆ® ¸ÞÀÎ È­¸éÀ¸·Î ¸µÅ©ÇÕ´Ï´Ù. */


    <td bgcolor=black width=100>
    <a href =db_view.php?chanl=rootin&file=file>
    <img src=admin.gif border=0>
    </a></td>
    /* ÇØ´ç ÀÚ·á½Ç Å×ÀÌºí¿¡¼­ admin Á¢¼Ó È­¸éÀ¸·Î ¸µÅ©ÇÕ´Ï´Ù. */


    <td bgcolor=black align=right width=150>
    <form method=post action=m.php>
    <input type=hidden name=chanl size=14 value=main_view>
    <input type=hidden name=f value=$f>
    <input type=hidden name=f2 value=$f2>
    <select name=findtype>
    <option value=name selected>Name
    <option value=title>Title
    <option value=content>Content
    <option value=t_c>Titl+Cont
    </select>
    </font></td>
    /* ÇØ´ç ÀÚ·á½Ç Å×ÀÌºí¿¡¼­ À̸§ , Á¦¸ñ , ³»¿ë , Á¦¸ñ°ú ³»¿ëÀ» ¼±ÅÃÇÏ´Â form¹®À» ¸¸µì´Ï´Ù.
       ÀÌ°ÍÀº ÇØ´ç ÀÚ·áÇ Å×ÀÌºí¿¡¼­ À§ ÀÎÀڵ鿡 ´ëÇÑ °Ë»öÀ» Çϱâ À§ÇÔÀÔ´Ï´Ù. */


    <td bgcolor=black width=150>
    <input type=text name=findname size=14>
    /* $findname º¯¼ö¿¡ °Ë»ö ´Ü¾î¸¦ ÀúÀåÇÕ´Ï´Ù. ÀÌ º¯¼ö¸¦ ÀÌ¿ëÇؼ­ ÇØ´ç Å×À̺íÀ» °Ë»öÇÕ´Ï´Ù. */
    </td>


    <td bgcolor=black width=100>
    <input type=submit value=Find>
    /* find ¹öÆ°À» »ý¼ºÇÕ´Ï´Ù. */


    </td>
    </tr>
    </table>
    </center>
    </html>
    ");

edit_libchal( ) ÇÔ¼ö

    ÀÚ·á½ÇÀÇ ±ÛÀ» ¼öÁ¤ÇÏ´Â ÇÔ¼öÀÔ´Ï´Ù. 
    ÀÚ·á½ÇÀÇ ÇØ´ç ÀڷḦ ¼öÁ¤ÇÏ´Â °ÍÀº ¾Æ´Ï°í ÀÚ·á Á¦¸ñ°ú À̸§ µîÀ» ¼öÁ¤ÇÒ ¼ö ÀÖ°Ô ÇÕ´Ï´Ù.

±×¸². 13-4 ÀÚ·á½Ç ¼öÁ¤ È­¸é

ÇÔ¼ö ÀÎÀÚ

    edit_libchal($ally2 ,$no ,$f ,$f2)

    ÀÚ·á½Ç ±Û ³»¿ë°ú Á¦¸ñ À̸§ µîÀ» ¼öÁ¤ ÇÏ·Á¸é ÇØ´ç ÀÚ·á¿¡ ´ëÇÑ ¹øÈ£¿Í Å×ÀÌºí µ¥ÀÌÅͺ£À̽º Query¸¦
    Àü´Þ¹Þ¾Æ¾ß µË´Ï´Ù. 

   $ally2 - ÇØ´ç ÀÚ·á¿¡ ´ëÇÑ µ¥ÀÌÅͺ£À̽º °Ë»öÀ» Àü´ÞÇÕ´Ï´Ù.
   $no - ÇØ´ç ÀÚ·áÀÇ ¹øÈ£¸¦ Àü´ÞÇÕ´Ï´Ù.
   $f - ÇØ´ç ÀÚ·á½ÇÀÇ ¸ÞÀÎ Å×À̺í À̸§À» Àü´ÞÇÕ´Ï´Ù.
   $f2 - ÇØ´ç ÀÚ·á½ÇÀÇ ÀÀ´ä ±Û Å×À̺í À̸§À» Àü´ÞÇÕ´Ï´Ù.

¿øº» ÀÚ·áÀÇ Á¤º¸ ÀúÀå Çϱâ

    $put3=mysql_fetch_array($ally2);

    /* $ally2´Â ¼öÁ¤ÇÒ ÀÚ·á ¹øÈ£¿¡ ´ëÇØ µ¥ÀÌÅͺ£À̽º¿¡¼­ °Ë»öÇÑ ÀÚ·áÀÇ Á¤º¸À̸ç , ÀÌ°ÍÀ» $put3 º¯¼ö¿¡ ¹è¿­·Î ÀúÀåÇÕ´Ï´Ù. */

¼öÁ¤ Ç׸ñ Àü´Þ form¹® ¸¸µé±â

    ¼öÁ¤ÇÒ ÀÚ·á ¸ñ·ÏÀ» ¼öÁ¤ÇÑ ÈÄ ¼öÁ¤µÈ Ç׸ñµéÀ» Àü´ÞÇϱâ À§ÇØ form¹®À» ¸¸µì´Ï´Ù.


    <form method=post action=m.php>
    <input type=hidden name=chanl value=edit_libchal_in>
    /* m.phpÆÄÀÏ¿¡¼­ $chanlÀÌ edit_libchal_in ÀÎ Ç׸ñ¿¡ ¼öÁ¤ »çÇ×À» Àü´ÞÇÕ´Ï´Ù. */


    <input type=hidden name=f value=$f>
    <input type=hidden name=f2 value=$f2>
    <input type=hidden name=no value=$no>
    /* ÇØ´ç ÀÚ·á½Ç Å×À̺í À̸§ µÎ°³¿Í ÀÚ·á ¹øÈ£¸¦ Àü´ÞÇÕ´Ï´Ù. */

ÀԷ¶õ ¸¸µé±â

    ¼±ÅÃÇÑ ÀÚ·áÀÇ Á¤º¸¸¦ ÀÔ·ÂÇÏ´Â ºÎºÐÀ» ¸¸µì´Ï´Ù. ¹°·Ð óÀ½ µî·ÏÇÑ À¯ÀúÀÇ ID¿Í Æнº¿öµå°¡ ÀÏÄ¡ÇØ¾ß ¼öÁ¤ °¡´ÉÇÕ´Ï´Ù.


    <tr>
    <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <b>~Title</b></font></td>
    <td bgcolor=black align=left><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <input type=text name=title size=50 value='$put3[title]'></font></td>
    /* ÇØ´ç ÀÚ·áÀÇ Á¦¸ñÀ» Ãâ·ÂÇÏ°í ¼öÁ¤ÇÒ ¼ö ÀÖ½À´Ï´Ù.
       $put3[title] º¯¼ö¿¡ ¡® ¡¯¸¦ ÇÑ °ÍÀº ÇØ´ç Á¦¸ñ¿¡ °ø¹éÀÌ ÀÖÀ» °æ¿ì °°ÀÌ Ãâ·ÂÇÏ°Ô ÇÏ´Â °ÍÀÔ´Ï´Ù. */
    </tr>


    <tr>
    <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <b>~Name</b></font></td>
    <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <input type=text name=name size=10 value='$put3[name]'></font></td>
    </tr>
    /* ÇØ´ç ÀÚ·áÀÇ µî·ÏÀÚ À̸§À» Ãâ·ÂÇÏ°í ¼öÁ¤ÇÏ°Ô ÇÕ´Ï´Ù. */


    <tr>
    <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <b>~Passw</b></font></td>
    <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <input type=password name=passw size=10></font></td>
    </tr>
    /* ÇØ´ç ÀÚ·áÀÇ µî·ÏÀÚ Æнº¿öµå¸¦ ÀÔ·Â ÇÏ´Â ºÎºÐÀÔ´Ï´Ù. Type´Â password·Î ´Ù¸¥ »ç¶÷ÀÌ º¼ ¼ö ¾ø°Ô ÇÕ´Ï´Ù. */


    <tr>
    <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <b>~E-mail</b></font></td>
    <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <input type=text name=email size=20 value='$put3[email]'></font></td>
    </tr>
    /* ÇØ´ç ÀÚ·áÀÇ µî·ÏÀÚ ¸ÞÀÏ ÁÖ¼Ò¸¦ Ãâ·ÂÇÏ°í ¼öÁ¤ÇÏ´Â ºÎºÐ ÀÔ´Ï´Ù. */


    <tr>
    <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <b>~Content</b></font></td>
    <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <textarea name=content rows=10 cols=70 >$put3[content]</textarea></font></td>
    </tr>
    /* ÇØ´ç ÀÚ·áÀÇ ¼³¸íÀ» Ãâ·ÂÇÏ°í ¼öÁ¤ÇÏ´Â ºÎºÐ ÀÔ´Ï´Ù.
       TextareaÀÇ °æ¿ì ÇØ´ç ÀÚ·á Á¤º¸´Â <textarea>¿Í </textarea> »çÀÌ¿¡ ³Ö¾î ÁÝ´Ï´Ù.*/


    <tr>
    <td bgcolor=black align=center colspan=4>
    <font style='font-size:13px;font-style:italic;color:#fffff0'>
    <input type=submit value=¼öÁ¤Çϱâ>
    </font></td>
    </tr>
    </table>
    </form>
    /* ¼öÁ¤ÇÑ ¸ðµç Ç׸ñÀ» m.php ÆÄÀÏ¿¡ Àü´ÞÇϱâ À§ÇØ ¼öÁ¤Çϱ⠹öÆ°À» »ý¼ºÇÏ°í , form¹®À» Á¾·áÇÕ´Ï´Ù. */

view_title($ally2 ,$ally3 ,$no ,$f ,$f2) ÇÔ¼ö

    ¼±ÅÃÇÑ ÀÚ·áÀÇ Á¤º¸¸¦ »ó¼¼ÇÏ°Ô º¸¿©ÁÖ´Â ÇÔ¼öÀÔ´Ï´Ù.

    Áï , ÀÚ·á½Ç ¸ÞÀÎ È­¸é¿¡¼­ ƯÁ¤ ÀÚ·áÀÇ Á¦¸ñÀ» Ŭ¸¯ÇÏ¸é º¸¿©ÁÖ´Â ºÎºÐÀ̸ç , ÀÚ·á¿¡ ´ëÇÑ ¼³¸í°ú
        
    µî·ÏÀÚ ÀÀ´ä ±Û µîÀ» Ãâ·ÂÇÕ´Ï´Ù.

±×¸². 13-5 ƯÁ¤ ÀÚ·á º¸±â È­¸é

ÇÔ¼ö Àü´Þ ÀÎÀÚ

    view_title($ally2 , $ally3 , $no , $f , $f2)

    ƯÁ¤ ÀÚ·áÀÇ ¼³¸í°ú µî·ÏÀÚ , ÀÀ´ä ±Û µîÀ» º¼ ¼ö ÀÖ°Ô Çϱâ À§ÇØ ¿©·¯ ÀÎÀÚµéÀ» »ç¿ëÇÕ´Ï´Ù.

    $ally2 - ÇØ´ç Å×ÀÌºí¿¡¼­ ¼±ÅÃÇÑ ÀÚ·á ¹øÈ£¿¡ ´ëÇÑ µ¥ÀÌÅͺ£À̽º °Ë»ö °á°ú¸¦ Àü´ÞÇÕ´Ï´Ù.
    $ally3 - ÀÀ´ä ±Û Å×ÀÌºí¿¡¼­ ¼±ÅÃÇÑ ÀÚ·á ¹øÈ£ÀÇ ÀÀ´ä ±Û Á¤º¸¸¦ Àü´ÞÇÕ´Ï´Ù.
    $no - ¼±ÅÃÇÑ ÀÚ·á ¹øÈ£¸¦ Àü´ÞÇÕ´Ï´Ù.
    $f - ÀÚ·á½Ç ¸ÞÀÎ Å×À̺í À̸§À» Àü´ÞÇÕ´Ï´Ù.
    $f2 - ÀÚ·á½Ç ÀÀ´ä ±Û Å×À̺í À̸§À» Àü´ÞÇÕ´Ï´Ù.

¼±ÅÃÇÑ ÀÚ·áÀÇ Á¤º¸ ÀúÀåÇϱâ

    $put=mysql_fetch_array($ally2);
    /* $ally2´Â ¼±ÅÃÇÑ ÀÚ·á¿¡ ´ëÇÑ °Ë»ö °á°ú¸¦ Àü´ÞÇÕ´Ï´Ù. $put º¯¼ö¿¡ ¹è¿­·Î ÀúÀåÇÕ´Ï´Ù.*/


    $content=nl2br($put[content]) ;
    /* nl2br( ) ÇÔ¼ö¸¦ ÀÌ¿ëÇؼ­ ¼±ÅÃÇÑ ÀÚ·áÀÇ ¼³¸í ³»¿ë Áß nl ºÎºÐÀ» <br>·Î º¯È¯ÇÕ´Ï´Ù.
       ÀÌ°ÍÀº HTML·Î ºê¶ó¿ìÀú¿¡ Ãâ·ÂÇϱ⠶§¹®¿¡ óÀ½ ±Û µî·Ï ¶§ enter¸¦ ÀÔ·ÂÇÑ ºÎºÐÀ» ´Ù½Ã
       <br>·Î º¯È¯ÇÏ´Â °ÍÀÔ´Ï´Ù. */


    $size = filesize("/ftp/pub/$put[path]");
    /* filesize( ) ÇÔ¼ö¸¦ ÀÌ¿ëÇؼ­ µî·ÏÇÑ ÀÚ·áÀÇ Å©±â¸¦ byte·Î ±¸ÇÕ´Ï´Ù. */


    $t_num=mysql_num_rows($ally3);
    /* ¼±ÅÃÇÑ ÀÚ·áÀÇ ÀÀ´ä ±ÛÀÇ ¼ö¸¦ $t_num º¯¼ö¿¡ ÀúÀåÇÕ´Ï´Ù. */

ÀÚ·á Á¤º¸ Ãâ·ÂÇϱâ

    ¼±ÅÃÇÑ ÀÚ·áÀÇ Á¤º¸¸¦ Ãâ·ÂÇÏ´Â ºÎºÐÀÔ´Ï´Ù. Áï ÇØ´ç ÀÚ·áÀÇ Å©±â , µî·ÏÀÚ , µî·ÏÀÏ , ¹øÈ£ , ÀÚ·á ¼³¸í µîÀÌ ÀÖ½À´Ï´Ù.


    <tr>
    <td bgcolor=white align=center width=120>
    <font style='font-size:13px;font-style:italic;color:#blue'><b>$no No</b></font></td>
    /* ¼±ÅÃÇÑ ÀÚ·áÀÇ ¹øÈ£¸¦ Ãâ·ÂÇÕ´Ï´Ù. */


    <td bgcolor=white align=center width=580>
    <font style='font-size:13px;font-style:italic;color:#black'><b>$put[title]</b></font></td>
    /* ¼±ÅÃÇÑ ÀÚ·áÀÇ Á¦¸ñÀ» Ãâ·ÂÇÕ´Ï´Ù. */


    </tr>
    </table>
    <table border=0 cellspacing=2 cellpadding=2 width=700 >


    <tr>
    <td bgcolor=#808080 align=center width=100>
    <font style='font-size:13px;font-style:italic;color:#fffff0'>
    <b>$put[wdate]</b></font></td>
    /* ¼±ÅÃÇÑ ÀÚ·áÀÇ µî·Ï ³¯Â¥¸¦ Ãâ·ÂÇÕ´Ï´Ù. */


    <td bgcolor=#808080 align=center width=200>
    <a href = mailto:$put[email] >
    <font style='font-size:13px;font-style:italic;color:#fffff0'>
    <b>name:$put[name]</b></font></a></td>
    /* ¼±ÅÃÇÑ ÀÚ·áÀÇ µî·ÏÀÚ¸¦ Ãâ·ÂÇÏ°í µî·ÏÀÚÀÇ ¸ÞÀÏ ÁÖ¼Ò¸¦ ¸µÅ©ÇÕ´Ï´Ù. */


    <td bgcolor=#808080 align=center width=280>
    <a href ='ftp://192.168.0.3/home/ftp/pub/$put[path]'>
    <font style='font-size:13px;font-style:italic;color:red'>
    <b>$put[path]($size Byte)</b></font></a></td>
    /* ¼±ÅÃÇÑ ÀÚ·áÀÇ ÀÚ·á À̸§À» Ãâ·ÂÇÏ°í ÀÚ·áÀÇ À§Ä¡¸¦ ¸µÅ©ÇÕ´Ï´Ù.
       À§ ¸µÅ©ÀÇ °æ¿ì ·¹µåÇÖ ¸®´ª½ºÀÇ °æ¿ì ftp´Â ÀÚµ¿À¸·Î ¼³Á¤µÇ¾î ÀÖÀ¸¸ç ¸µÅ©¸¦ ftp://¼­¹ö ¸í/pub/$put[path]·Î
       ¼³Á¤ ÇÏ¸é µË´Ï´Ù. ÀÌ°ÍÀº ¸®´ª½ºÀÇ ¼³Á¤¿¡ µû¶ó ´Ù¸¦ °æ¿ì°¡ ÀÖÀ¸¸ç ÀÚ½ÅÀÇ ftp ¼­¹öÀÇ ¼³Á¤À» nobody Á¢¼ÓÀÌ
       °¡´ÉÇϵµ·Ï ÇؾßÇÏ°í ÇØ´ç µð·ºÅ丮ÀÇ ÆÛ¹Ì¼Ç ¶ÇÇÑ nobody À¯Àú°¡ Á¢¼Ó °¡´É Çϵµ·Ï ÇØ¾ß ÇÕ´Ï´Ù.         */
    </tr>


    <tr>
    <table border=0 cellspacing=2 cellpadding=2 width=700 height=250>
    <td bgcolor=black valign=top colspan=3 width=700 height=250>
    <font style='font-size:13px;font-style:italic;color:blue'><b>$content</b></font></td>
    </tr>
    /* ÇØ´ç ÀÚ·áÀÇ ¼³¸íÀ» Ãâ·ÂÇÕ´Ï´Ù. */

ÀÀ´ä ±Û Ãâ·ÂÇϱâ

    ÇØ´ç ÀÚ·á¿¡ ´ëÇÑ ÀÀ´ä ±ÛÀ» Ãâ·ÂÇÏ°Ô ÇÕ´Ï´Ù.
        
    Áï , ¼±ÅÃÇÑ ÀÚ·áÀÇ ¹øÈ£¸¦ ÀÌ¿ëÇؼ­ ±× ÀÚ·á¿¡ ´ëÇÑ ÀÀ´ä ±ÛÀ» °Ë»öÇÏ°í Ãâ·ÂÇÕ´Ï´Ù.



    for($s=1 ; $s <= $t_num  ; $s++)
    {

      $put2=mysql_fetch_array($ally3);
      $content=nl2br($put2[content]);
      /* ¼±ÅÃÇÑ ÀÚ·áÀÇ ÀÀ´ä ±Û Á¤º¸¸¦ $put2 º¯¼ö¿¡ ¹è¿­·Î ÀúÀåÇÕ´Ï´Ù.
         ±×¸®°í nl2br( ) ÇÔ¼ö¸¦ ÀÌ¿ëÇؼ­ ÀÀ´ä ±ÛÀÇ ³»¿ëÀ» ¼öÁ¤ÇÕ´Ï´Ù. */


      echo("
      <tr>
      <td bgcolor=#808080><a href = mailto:$put2[email] >
      <font style='font-size:13px;font-style:italic;color:black'>
      <b>$put2[name]´ÔÀÌ ¸»Çϱæ^^;</b>
      </font></a></td>
      /* ÇØ´ç ÀÚ·áÀÇ ÀÀ´ä ±Û µî·ÏÀÚ¸¦ Ãâ·ÂÇÏ°í ¸ÞÀÏ ÁÖ¼Ò¸¦ ¸µÅ©ÇÕ´Ï´Ù. */


      <td bgcolor=#808080 align=center width=200>
      <font style='font-size:13px;font-style:italic;color:#fffff0'><b>$put2[wdate]</b>
      </font></td>
      </tr>
      /* ÀÀ´ä ±Û µî·Ï ³¯Â¥¸¦ Ãâ·ÂÇÕ´Ï´Ù. */


      <tr>
      <td bgcolor=black width=700 height=100>
      <font style='font-size:13px;font-style:italic;color:#fffff0'><b>$content</b>
      </font></td>
      </tr>
      /* ÀÀ´ä ±Û ³»¿ëÀ» Ãâ·ÂÇÕ´Ï´Ù. */
      ");
    }

error_view($title ,$name ,$passw ,$email ,$content ,$f ,$f2) ÇÔ¼ö

    ÀڷḦ µî·ÏÇßÀ» °æ¿ì µî·Ï Ç׸ñ Áß ºñ¾îÀÖ´Â ºÎºÐÀ» üũÇÏ´Â ºÎºÐÀÔ´Ï´Ù.

±×¸². 13-6 ÀÚ·á µî·Ï ¿¡·¯ È­¸é

¿¡·¯ È­¸é Ãâ·Â Çϱâ

    ÀÚ·á µî·Ï ¶§ °¢ Ç׸ñÀÇ ÀÔ·Â ¿©ºÎ¸¸À» È®ÀÎÇÕ´Ï´Ù.
    °£´ÜÇÑ java ½ºÅ©¸³Æ®¸¦ ÀÌ¿ëÇؼ­ ÇØ´ç Ç׸ñÀÌ ¾øÀ» °æ¿ì ¿¡·¯ ¹Ú½º¸¦ Ãâ·ÂÇÕ´Ï´Ù.


    if(!$title)
    {
      echo("
      <script>
      window.alert('ÁÖÁ¦°¡ ¾ø½À´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇØ ÁÖ¼¼¿ä')
      history.go(-1)
      </script>
      ");
      exit;
    }
    /* ÀÚ·á Á¦¸ñÀ» ÀÔ·ÂÇÏÁö ¾Ê¾ÒÀ» °æ¿ì Ãâ·ÂÇÏ´Â ºÎºÐÀÌ¸ç ³ª¸ÓÁö Ç׸ñÀÇ ¿¡·¯ Ãâ·Âµµ °°Àº ¹æ¹ýÀ¸·Î ±¸¼º Çß½À´Ï´Ù */

input_newlibchal($tnum , $f , $f2) ÇÔ¼ö

    ÇØ´ç ÀÚ·áÀÇ ÀÀ´ä ±ÛÀ» µî·ÏÇϱâ À§ÇØ ÀÔ·ÂÇÏ´Â ºÎºÐÀÔ´Ï´Ù.

±×¸². 13-7 ÀÀ´ä ±Û ÀÔ·ÂÇϱâ

form¹®°ú Àü´Þ ÀÎÀÚ

    ÀÀ´ä ±ÛÀ» ÀÔ·ÂÇÏ°í ÇØ´ç ÀÎÀÚµéÀ» m.phpÆÄÀÏ¿¡ Àü´Þ ÇϱâÀ§ÇØ form¹® ¸¸µì´Ï´Ù.
    ÀÌ ÇÔ¼öÀÇ Àü´Þ ÀÎÀÚ´Â $tnum(ÀÀ´ä ±ÛÀÇ ¹øÈ£) , $f , $f2°¡ ÀÖ½À´Ï´Ù.


    <form method=post action=m.php>
    <input type=hidden name=chanl value=input_newlibchal>
    <input type=hidden name=chanl2 value=input_newlibchal2>
    /* µî·ÏÇÑ ÀÀ´ä ±Û Ç׸ñÀ» m.php ÆÄÀÏÀÇ $chanlÀÌ input_newlibchalÀÌ°í $chanl2°¡
    input_newlibchal2ÀÎ Ç׸ñ¿¡ Àü´ÞÇÏ´Â form¹®À» ¸¸µì´Ï´Ù. */


    <input type=hidden name=tnum value=$tnum>
    <input type=hidden name=f value=$f>
    <input type=hidden name=f2 value=$f2>
    /* ÇØ´ç ÀÚ·á½ÇÀÇ µÎ°³ÀÇ Å×À̺í°ú ÀÀ´ä ±Û ¹øÈ£¸¦ Àü´ÞÇÕ´Ï´Ù. */

±×¸². 13-8 »õ·Î¿î ÀÚ·á µî·ÏÇϱâ

ÆÄÀÏ µî·ÏÀ» À§ÇÑ form¹®

    ÆÄÀÏ µî·ÏÀ» À§ÇØ form¹®ÀÇ ¼³Á¤À» enctype=multipart/form-data·Î ÇÕ´Ï´Ù.
    ÇÏÁö¸¸ ÀÌ ¼³Á¤ ÀÌ¿Ü¿¡ PHP.INIÀÇ ÆÄÀÏ ¼³Á¤ ºÎºÐÀ» Á¶±Ý ¼öÁ¤Çؼ­ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.
    ÆÄÀÏ µî·Ï ¿ë·®ÀÇ ¼³Á¤ , ÀúÀåÇÒ µð·ºÅ丮 µîÀÇ ¼³Á¤À» ÇÒ ¼ö ÀÖÀ¸¸ç ¿©±â¿¡ »ç¿ëÇÏ´Â ¹æ¹ýÀº µðÆúÆ®
    ¼³Á¤À̸ç form¹®ÀÇ ¼³Á¤¸¸ Çؼ­ »ç¿ëÇÏ¸é µË´Ï´Ù.


    <form method=post enctype=multipart/form-data action=m.php>
    <input type=hidden name=chanl value=input_new>
    <input type=hidden name=f value=$f>
    <input type=hidden name=f2 value=$f2>

ÀԷ¶õ ¸¸µé±â

    ÀÚ·á µî·ÏÀ» À§ÇØ ¿©·¯ ÀÔ·Â »çÇ×°ú ÆÄÀÏÀ» ¼±ÅÃÇÏ´Â ºÎºÐÀ» ¸¸µì´Ï´Ù.


    <tr>
    <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <b>~Title</b></font></td>
    <td bgcolor=black align=left><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <input type=text name=title size=44></font></td>
    </tr>
    /* µî·Ï ÀÚ·áÀÇ Á¦¸ñÀ» ÀÔ·ÂÇÏ´Â ºÎºÐÀÔ´Ï´Ù. */


    <tr>
    <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <b>~Name</b></font></td>
    <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <input type=text name=name size=10></font></td>
    </tr>
    /* µî·Ï ÀÚ·áÀÇ µî·ÏÀÚ À̸§À» ÀÔ·ÂÇÏ´Â ºÎºÐÀÔ´Ï´Ù. */


    <tr>
    <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <b>~Passw</b></font></td>
    <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <input type=password name=passw size=10></font></td>
    </tr>
    /* µî·ÏÀÚ Æнº¿öµå¸¦ ÀÔ·ÂÇÏ´Â ºÎºÐÀ̸ç password typeÀÔ´Ï´Ù. */


    <tr>
    <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <b>~E-mail</b></font></td>
    <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <input type=text name=email size=24></font></td>
    </tr>
    /* µî·ÏÀÚÀÇ ¸ÞÀÏ ÁÖ¼Ò¸¦ ÀÔ·ÂÇÏ´Â ºÎºÐÀÔ´Ï´Ù. */


    <tr>
    <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <b>~up File</b></font></td>
    <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <input type=file name=upfile size=24></font></td>
    </tr>
    /* µî·ÏÇÒ ÆÄÀÏÀ» ã´Â ºÎºÐÀÔ´Ï´Ù. Type=file·Î ¼³Á¤Çϸç ÀÌ°ÍÀº ÀÚ½ÅÀÇ ÄÄÇ»ÅÍ¿¡¼­ µî·ÏÇÒ ÆÄÀÏÀ» ãÀ» ¼ö ÀÖ°Ô ÇÕ´Ï´Ù. */

±×¸². 13-9 ÆÄÀÏ upload Çϱâ

    <tr>
    <td bgcolor=#808080><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <b>~Content</b></font></td>
    <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <textarea name=content rows=10 cols=70></textarea></font></td>
    </tr>
    /* µî·ÏÇÒ ÀÚ·áÀÇ ¼³¸íÀ» ÀÔ·ÂÇÏ´Â ºÎºÐÀÔ´Ï´Ù. */


    <tr>
    <td bgcolor=black align=center colspan=4>
    <font style='font-size:13px;font-style:italic;color:#fffff0'>
    <input type=submit value=ÀÚ·áµî·Ï>
    <input type=reset  value=Áö¿ì±â></font></td>
    </tr>
    /* ÀÚ·á µî·ÏÀ» À§ÇØ ÀÔ·ÂÇÑ »çÇ×°ú ÆÄÀÏÀ» m.php¿¡ º¸³»±â À§ÇØ "ÀÚ·áµî·Ï" ¹öÆ°À» ¸¸µì´Ï´Ù.
       ±×¸®°í ¸ðµç Ç׸ñÀ» ´Ù½Ã ÀÔ·ÂÇϱâ À§ÇØ "Áö¿ì±â" ¹öÆ°À» ¸¸µì´Ï´Ù. */

del($no ,$f ,$f2 ,$root) ÇÔ¼ö

    µî·ÏÇÑ ÀڷḦ Áö¿ì´Â ÇÔ¼öÀÔ´Ï´Ù. Àü´Þ ÀÎÀÚ´Â $no(ÇØ´ç ÀÚ·á ¹øÈ£) , $f , $f2 , $root(admin) ÀÔ´Ï´Ù.
    ¿©±â¼­ $root º¯¼ö¸¦ Àü´ÞÇÏ´Â °ÍÀº ÇØ´ç ÀڷḦ adminÀÌ µî·ÏÀÚ Æнº¿öµå ¾øÀÌ Áö¿ì°Ô ÇÏ´Â ¿ªÇÒÀ» ÇÕ´Ï´Ù.

±×¸². 13-10 ÀÚ·á Áö¿ì±â È­¸é

form¹® ¸¸µé±â

    ÇØ´ç ÀڷḦ »èÁ¦Çϱâ À§ÇØ form¹®À¸·Î ÀÚ·á Á¤º¸¸¦ Àü´ÞÇÕ´Ï´Ù.


    <form method=post action=m.php>
    <input type=hidden name=chanl value=del_no>
    /* m.php ÆÄÀÏÀÇ $chanl=del_noÀÎ Ç׸ñÀ¸·Î ÇØ´ç ÀÚ·áÀÇ Á¤º¸¸¦ Àü´ÞÇÕ´Ï´Ù. */
 

    <input type=hidden name=tnum value=$no>
    <input type=hidden name=no value=$no>
    <input type=hidden name=f value=$f>
    <input type=hidden name=f2 value=$f2>
    /* ÇØ´ç ÀÚ·áÀÇ ¹øÈ£($tnum)¿Í ÀÀ´ä ±Û ¹øÈ£($no) , ÀÚ·á½Ç µÎ Å×À̺í À̸§À» Àü´ÞÇÕ´Ï´Ù.*/

Æнº¿öµå ÀԷ¶õ ¸¸µé±â

    µî·ÏÀÚÀÇ Æнº¿öµå ÀԷ¶õÀ» ¸¸µì´Ï´Ù.


    <tr>
    <td bgcolor=#808080 width=74><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <b>~passw</b></font></td>
    <td bgcolor=black width=100><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <input type=password name=passw size=10></font></td>
    /* ÇØ´ç ÀÚ·á µî·ÏÀÚÀÇ Æнº¿öµå¸¦ ÀÔ·ÂÇÏ´Â ºÎºÐÀÔ´Ï´Ù. */


    <td bgcolor=black><font style='font-size:13px;font-style:italic;color:#fffff0'>
    <input type=submit value=Áö¿ì±â>
    </font></td>
    /* ÀÔ·ÂÇÑ Æнº¿öµå¸¦ Àü´ÞÇϱâ À§ÇØ "Áö¿ì±â" ¹öÆ°À» »ý¼ºÇÕ´Ï´Ù. */

13.2 m.php Àüü ÄÚµå

f.phpÀÇ ÇÔ¼öµéÀ» ºê¶ó¿ìÀú¿¡ Ãâ·ÂÇϱâ À§ÇÑ ½ºÅ©¸³Æ®·Î ±¸¼ºµÇ¾î ÀÖ½À´Ï´Ù.

    <?php
    session_start();
    //////////////////////////////////////////////////
    //
    //    ÀÏÀÚ : 2000.3.27 pm 5
    //   ÀÛ¼ºÀÚ: skycry (hong il)
    //
    //
    //   method : ÀÚ·á½Ç ¸ÞÀÎ È­¸éµé..^^;
    //
    //////////////////////////////////////////////////
    ?>


    <?php

    if($username)
    {

      include('f.php');


      if($chanl == new_libchal && $username != guest)
      {
        input_view($f ,$f2) ;
        mysql_close($connect);
      }


      if($chanl == new_libchal && $username == guest)
      {
        echo("
        <script>
        window.alert('guest´Â ÀÌ¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.')
        history.go(-1)
        </script>
        ");
        exit;
      }


      if($chanl == input_new)
      {
        error_view($title ,$name ,$passw ,$email ,$content ,$f ,$f2);
        $max = mysql_query("select max(no) from $f " ,$connect );
        $new_no = mysql_result($max ,0 ,0);
        $no = $new_no + "1" ;
        $wdate = date("y-m-d");
        $gg=explode("." ,"$upfile_name");
        $tt=$gg[sizeof($gg)-1];
        $path= "/home/ftp/pub/$upfile_name";
     

        if($tt == "php" || $tt == "php3" || $tt == "php4" || $tt == "html" 
                                  || $tt == "htm" || $tt == "inc" || $tt == "txt" )
        {
          echo("
          <script>
          window.alert('ÀÌ È­ÀÏÀº µî·Ï ÇÒ ¼ö ¾ø½À´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇØ ÁÖ¼¼¿ä')
          history.go(-1)
          </script>
          ");
          exit;
        }


        if(file_exists("$path"))
        {
          echo("
          <script>
          window.alert('°° À̸§ÀÇ È­ÀÏÀÌ Á¸ÀçÇÕ´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇØ ÁÖ¼¼¿ä')
          history.go(-1)
          </script>
          ");
          exit;
        }
        else
        {
          copy("$upfile" ,"$path");
          mysql_query("insert into $f(title ,name ,passw ,path ,email ,content ,wdate ,no)
          values('$title' ,'$name' ,password('$passw') ,'$upfile_name' ,'$email' ,'$content' ,
          '$wdate' ,'$no')" ,$connect);


          echo("
          <html>
          <body>
          <center>
          <form method=post action=m.php>
          <font style='font-size:13px;font-style:italic;color:#808080'>
          <b>±ÛÀÌ µî·Ï µÇ¾ú½À´Ï´Ù</b></font>
          <input type=hidden name=chanl value=main_view>
          <input type=hidden name=f value=$f>
          <input type=hidden name=f2 value=$f2>
          <input type=submit value=È®ÀÎ>
          </form>
          </center>
          </body>
          </html>
          ");

          unlink($upfile);
          mysql_close($connect);
        }
      }


      if($chanl == input_newlibchal)
      {
        if($chanl2 == input_newlibchal2)
        {
          $wdate = date("y-m-d");
          mysql_query("insert into $f2(name ,email ,tnum ,wdate ,content)
          values('$name' ,'$email' ,'$tnum' ,'$wdate' ,'$content')" ,$connect);


          echo("
          <html>
          <body>
          <center>
          <form method=post action=m.php>
          <font style='font-size:13px;font-style:italic;color:#808080'>
          <b>±ÛÀÌ µî·Ï µÇ¾ú½À´Ï´Ù</b></font>
          <input type=hidden name=chanl value=main_view>
          <input type=hidden name=f value=$f>
          <input type=hidden name=f2 value=$f2>
          <input type=submit value=È®ÀÎ>
          </form>
          </center>
          </body>
          </html>
          ");
        }
        else
        {
          input_newlibchal($tnum ,$f ,$f2) ;
        }


        mysql_close($connect);
      }


      if($chanl == edit_libchal)
      {
        edit_libchal($ally2 ,$no ,$f ,$f2) ;
        mysql_close($connect);
      }


      if($chanl == edit_libchal_in)
      {
        error_view($title ,$name ,$passw ,$email ,$content ,$f ,$f2);
        $input=mysql_query("select password('$passw') " ,$connect );
        $inputpassw = mysql_result($input ,0 ,0);


        if($putup[passw] == $inputpassw)
        {
          mysql_query("update $f set title='$title' , name='$name' ,passw=password('$passw') , email='$email', 
          content='$content' where no = '$no'" ,$connect);
 
          mysql_close;
        }
        else
        {
          echo("
          <script>
          window.alert('passw°¡ Ʋ·È½À´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇØ ÁÖ¼¼¿ä')
          history.go(-1)
          </script>
          ");
          exit;
        }


        echo("
        <html>
        <body>
        <center>
        <form method=post action=m.php>
        <font style='font-size:13px;font-style:italic;color:#808080'>
        <b>±ÛÀÌ ¼öÁ¤ µÇ¾ú½À´Ï´Ù</b></font>
        <input type=hidden name=no value=$no>
        <input type=hidden name=chanl value=main_view>
        <input type=hidden name=f value=$f>
        <input type=hidden name=f2 value=$f2>
        <input type=submit value=È®ÀÎ>
        </form>
        </center>
        </body>
        </html>
        ");
 
        mysql_close($connect);
      }


      if($chanl == title)
      {
        mysql_query("update $f set hit = '$putup[hit]'+1 where no = '$no'" ,$connect) ;
        view_title($ally2 ,$ally3 ,$no ,$f ,$f2) ;
        mysql_close($connect);
      }


      if($chanl == main_view)
      {
        mysql_select_db('adminp' ,$connect);
        mysql_query("update file set sum='$t_num' where mview = '$f'" ,$connect);
        main_view($t_num ,$ally ,$page ,$findtype ,$findname ,$f ,$f2 ,$root ,$username);
        mysql_close($connect);
      }


      if($chanl == del)
      { 
        del($no ,$f ,$f2 ,$root);
        mysql_close($connect);
      }


      if($chanl == del_no)
      {
        $input=mysql_query("select password('$passw') " ,$connect );
        $inputpassw = mysql_result($input ,0 ,0);


        if($putup[passw] == $inputpassw || $root )
        {
          unlink("/home/ftp/pub/$putup[path]");
          $mldel = "delete from $f where no=$no";
          $rsult = mysql_query($mldel ,$connect);
          $ml2del = "delete from $f2 where tnum=$tnum ";
          $rsult2 = mysql_query($ml2del ,$connect);
        }
        else
        {
          echo("
          <script>
          window.alert('passw°¡ Ʋ·È½À´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇØ ÁÖ¼¼¿ä')
          history.go(-1)
          </script>
          ");
          exit;
        }


        echo("
        <html>
        <body>
        <center>
        <form method=post action=m.php>
        <font style='font-size:13px;font-style:italic;color:#808080'>
        <b>±ÛÀÌ »èÁ¦ µÇ¾ú½À´Ï´Ù</b></font>
        <input type=hidden name=no value=$no>
        <input type=hidden name=chanl value=main_view>
        <input type=hidden name=f value=$f>
        <input type=hidden name=f2 value=$f2>
        <input type=submit value=È®ÀÎ>
        </form>
        </center>
        </body>
        </html>
        ");

        mysql_close($connect);
      }
    }
    else
    {
      echo("
      <script>
      window.alert('Login Çϼ¼¿ä.')
      history.go(-1)
      </script>
      ");
      exit;
    }

    ?>

¼Ò½º ¼³¸í

    m.php´Â f.php ÆÄÀÏÀÇ ÇÔ¼ö¸¦ È­¸é¿¡ ´Ù¾çÇÑ ¹æ¹ýÀ¸·Î Ãâ·ÂÇÏ°Ô ÇÕ´Ï´Ù.
    ±× ¹Û¿¡ Àü´Þ ¹ÞÀº ÀÎÀÚ¿Í ÀڷḦ µ¥ÀÌÅͺ£À̽º¿¡ ÀÔ·ÂÇÏ°í »èÁ¦ÇÏ´Â ±â´ÉÀ» ÇÕ´Ï´Ù.

¼¼¼Ç Ç׸ñ

    ÀÚ·á½ÇÀÇ °¢ È­¸éÀ» Ãâ·ÂÇÏ´Â ÇÔ¼öÀÇ ½ÇÇàÀº µî·ÏµÈ IDÀÇ ·Î±×ÀÎ ¿©ºÎ¿¡ µû¶ó ±ÇÇÑÀ» ´Þ¸®ÇÕ´Ï´Ù.


    session_start();
    /* ¼¼¼ÇÀ» ½ÃÀÛÇÕ´Ï´Ù. */


    if($username)
    {
    /* ·Î±×ÀÎ ÇÑ ¼¼¼ÇÀ» °¡Áø ID°¡ ÀÖÀ» °æ¿ìÀÔ´Ï´Ù. */

      include('f.php');
      /* f.php ÆÄÀÏÀÇ ÇÔ¼ö¸¦ Æ÷ÇÔÇÕ´Ï´Ù. ±×¸®°í if($username){   ¿Í   }else »çÀÌ¿¡ °¢ È­¸éÀÇ ÇÔ¼ö Ãâ·Â ºÎºÐÀ» µÓ´Ï´Ù.
         ÀÌ°ÍÀº ¼¼¼ÇÀ¸·Î ·Î±×ÀÎÇßÀ» °æ¿ì¸¸ È­¸éÀ» º¸¿©ÁÖ±â À§ÇÔÀ̸ç if¹® ¾È¿¡ º¸´Ù ¼¼ºÎÀûÀ¸·Î ¼³Á¤ÇÒ ¼ö ÀÖ½À´Ï´Ù. */
    }
    else
    {
      echo("
      <script>
      window.alert('Login Çϼ¼¿ä.')
      history.go(-1)
      </script>
      ");
      exit;
    }
    /* µî·ÏµÈ ID·Î ·Î±×ÀÎÇÏÁö ¾Ê¾ÒÀ» °æ¿ì Ãâ·ÂÇÏ´Â È­¸éÀÔ´Ï´Ù. */

ÀÚ·á µî·Ï ¸ðµå

    if($chanl == new_libchal && $username != guest)
    {
      input_view($f ,$f2) ;
      mysql_close($connect);
    }
    /* $chanl = new_libchalÀÌ°í ·Î±×ÀÎÇÑ ¼¼¼ÇÀÌ guest°¡ ¾Æ´Ò °æ¿ì ÀÚ·á µî·Ï È­¸éÀ» Ãâ·ÂÇÕ´Ï´Ù. */


    if($chanl == new_libchal && $username == guest)
    {
      echo("
      <script>
      window.alert('guest´Â ÀÌ¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.')
      history.go(-1)
      </script>
      ");
      exit;
    }
    /* ¸¸¾à ·Î±×ÀÎÇÑ ¼¼¼ÇÀÌ guestÀÏ °æ¿ì ÇØ´ç ¸Þ½ÃÁö ¹Ú½º¸¦ Ãâ·ÂÇÕ´Ï´Ù. */

ÀڷḦ ¼­¹ö¿Í µ¥ÀÌÅͺ£À̽º¿¡ ÀúÀåÇϱâ

    ÀÚ·á µî·Ï È­¸é¿¡¼­ ÀÚ·á¿¡ ´ëÇÑ Á¤º¸¸¦ ¼­¹ö¿Í µ¥ÀÌÅͺ£À̽º¿¡ ÀúÀåÇÏ´Â Ç׸ñÀ» ¸¸µì´Ï´Ù.


    if($chanl == input_new)
    {
    /* $chanl=input_newÀÏ ¶§ ½ÇÇàÇÕ´Ï´Ù. */


      error_view($title , $name , $passw , $email , $content , $f , $f2);
      /* Àü´Þ µÇ¾î¿Â ÀÚ·á Á¤º¸ÀÇ ÀÔ·Â ¿©ºÎ¸¦ üũÇÕ´Ï´Ù. */


      $max = mysql_query("select max(no) from $f " ,$connect );
      /* ÇØ´ç Å×À̺íÀÇ ÀÚ·á Áß °¡Àå ³ôÀº ¹øÈ£¸¦ °Ë»öÇÕ´Ï´Ù. */


      $new_no = mysql_result($max ,0 ,0);
      /* °¡Àå ³ôÀº ¹øÈ£¸¦ $new_no º¯¼ö¿¡ ÀúÀåÇÕ´Ï´Ù. */
 

      $no = $new_no + "1" ;
      /* »õ·Ó°Ô µî·ÏµÇ´Â ÀÚ·áÀÇ ¹øÈ£¸¦ ºÎ¿©ÇÕ´Ï´Ù. */


      $wdate = date("y-m-d");
      $gg=explode("." ,"$upfile_name");
      /* Àü´Þ µÇ¾î¿Â ÆÄÀÏÀ» explode( ) ÇÔ¼ö¸¦ ÀÌ¿ëÇؼ­ ÆÄÀÏ À̸§°ú È®ÀåÀÚ¸¦ ±¸ºÐÇÕ´Ï´Ù. */


      $tt=$gg[sizeof($gg)-1];
      /* Àü´Þ µÇ¾î¿Â ÆÄÀÏÀÇ È®ÀåÀÚ¸¦ $tt º¯¼ö¿¡ ÀúÀåÇÕ´Ï´Ù. */


      $path= "/home/ftp/pub/$upfile_name";
      /* Àü´Þ µÇ¾î¿Â ÆÄÀÏ À̸§À» path¿Í ÇÔ²² $path¿¡ ÀúÀåÇÕ´Ï´Ù. À§´Â ·¹µåÇÖ ¸®´ª½ºÀÇ °æ¿ì ÀÔ´Ï´Ù.
         ¸ðµç ftp ¼³Á¤ÀÌ µðÆúÆ®ÀÏ °æ¿ìÀ̸ç ÇØ´ç µð·ºÅ丮´Â nobody°¡ Á¢±Ù °¡´ÉÇÑ »óÅ ÀÔ´Ï´Ù. */


      if($tt == "php" || $tt == "php3" || $tt == "php4" || $tt == "html" 
                                || $tt == "htm" || $tt == "inc" || $tt == "txt" )
      {
        echo("
        <script>
        window.alert('ÀÌ ÆÄÀÏÀº µî·ÏÇÒ ¼ö ¾ø½À´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇØ ÁÖ¼¼¿ä')
        history.go(-1)
        </script>
        ");
        exit;
      }
      /* ¾÷·Îµå µÇ´Â ÆÄÀÏÀÇ È®ÀåÀÚ¸¦ ±¸ºÐÇؼ­ µî·ÏÇÒ ¼ö ¾ø´Â ÆÄÀÏÀ» °¡·Á ³À´Ï´Ù.
         ¸¸¾à À§ Á¶°Ç¿¡ ÇØ´çÇÒ °æ¿ì ¿¡·¯ ¹Ú½º È­¸éÀ» Ãâ·ÂÇÕ´Ï´Ù. */


      if(file_exists("$path"))
      {
        echo("
        <script>
        window.alert('°°Àº À̸§ÀÇ È­ÀÏÀÌ Á¸ÀçÇÕ´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇØ ÁÖ¼¼¿ä')
        history.go(-1)
        </script>
        ");
        exit;
      }
      /* µî·Ï µÇ´Â ÆÄÀÏ°ú ¶È °°Àº À̸§ÀÇ ÆÄÀÏÀÌ Á¸ÀçÇÏ´ÂÁö ¾Ë¾Æº¸°í ÀÖÀ» °æ¿ì ¿¡·¯ È­¸éÀ» Ãâ·ÂÇÕ´Ï´Ù. */
      else
      {
        copy("$upfile" ,"$path");
        /* ¾÷·Îµå µÇ´Â ÆÄÀÏÀ» PHP.INIÀÇ ÆÄÀÏ ¼³Á¤¿¡¼­ Á¤ÇÑ µð·ºÅ丮¿¡¼­ $path º¯¼ö°¡ °¡¸®Å°´Â µð·ºÅ丮·Î copyÇÕ´Ï´Ù.
           ¿©±â¼­´Â PHP.INI ¼³Á¤À» µðÆúÆ®·Î ÇßÀ¸¸ç /tmp µð·ºÅ丮·Î óÀ½ ÆÄÀÏÀ» ¾÷·ÎµåÇÕ´Ï´Ù. */


        mysql_query("insert into $f(title ,name ,passw ,path ,email ,content ,wdate ,no)
        values('$title' ,'$name' ,password('$passw') ,'$upfile_name' ,'$email' ,'$content' ,
        '$wdate' ,'$no')" ,$connect);
        /* ÀÚ·á½Ç ¸ÞÀÎ Å×ÀÌºí¿¡ µî·ÏÇÏ´Â ÀÚ·áÀÇ Á¤º¸¸¦ ÀúÀåÇÕ´Ï´Ù. PasswordÀÇ °æ¿ì mysql ¾Ïȣȭ ¹æ½ÄÀ» ÅëÇØ ÀúÀåÇÕ´Ï´Ù. */


        echo("
        <html>
        <body>
        <center>
        <form method=post action=m.php>
        <font style='font-size:13px;font-style:italic;color:#808080'>
        <b>±ÛÀÌ µî·ÏµÇ¾ú½À´Ï´Ù</b></font>
        <input type=hidden name=chanl value=main_view>
        <input type=hidden name=f value=$f>
        <input type=hidden name=f2 value=$f2>
        <input type=submit value=È®ÀÎ>
        </form>
        </center>
        </body>
        </html>
        ");


        unlink($upfile);
        /* ±ÛÀÇ µî·Ï ¿©ºÎ¸¦ Ãâ·ÂÇÏ°í , µðÆúÆ®·Î ¾÷·ÎµåµÈ(/tmp) ÆÄÀÏÀ» »èÁ¦ÇÕ´Ï´Ù. */
        mysql_close($connect);
      }
        }

ÀÀ´ä ±Û ÀÔ·Â È­¸é°ú µ¥ÀÌÅͺ£À̽º ÀúÀå ¸¸µé±â

    ¼±ÅÃÇÑ ÀÚ·áÀÇ ÀÀ´ä ±ÛÀ» ÀÔ·ÂÇÏ´Â ºÎºÐ°ú ÀÔ·ÂµÈ ÀÀ´ä ±ÛÀÇ Ç׸ñµéÀ» µ¥ÀÌÅͺ£À̽º¿¡ ÀúÀåÇÏ´Â ºÎºÐÀ» ¸¸µì´Ï´Ù.


    if($chanl == input_newlibchal)
    {
    /* $chanl=input_newlibchal ÀÏ ¶§ ÀÀ´ä ±ÛÀ» ÀÔ·ÂÇÏ´Â È­¸éÀ» Ãâ·ÂÇÕ´Ï´Ù. */


      if($chanl2 == input_newlibchal2)
      {
      /* $chanl=input_newlibchal , $chanl2 == input_newlibchal2 ÀÏ ¶§ ÀÔ·ÂÇÑ ÀÀ´ä ±ÛÀÇ ³»¿ëÀ» µ¥ÀÌÅͺ£À̽º¿¡ ÀúåÇÕ´Ï´Ù. */

        $wdate = date("y-m-d");
        mysql_query("insert into $f2(name ,email ,tnum ,wdate ,content)
        values('$name' ,'$email' ,'$tnum' ,'$wdate' ,'$content')" ,$connect);
        /* Àü´Þ µÇ¾î¿Â ÀÀ´ä ±ÛÀÇ ³»¿ëÀ» ÀÀ´ä ±Û Å×ÀÌºí¿¡ ÀúÀåÇÕ´Ï´Ù. */


        echo("
        <html>
        <body>
        <center>
        <form method=post action=m.php>
        <font style='font-size:13px;font-style:italic;color:#808080'>
        <b>±ÛÀÌ µî·Ï µÇ¾ú½À´Ï´Ù</b></font>
        <input type=hidden name=chanl value=main_view>
        <input type=hidden name=f value=$f>
        <input type=hidden name=f2 value=$f2>
        <input type=submit value=È®ÀÎ>
        /* ÀÀ´ä ±Û ÀúÀåÀ» ÇÑ ÈÄ È®ÀÎ È­¸éÀ» Ãâ·ÂÇÏ°í , ÀÚ·á½Ç ¸ÞÀÎ È­¸éÀ¸·Î À̵¿ÇÏ´Â ¹öÆ°À» »ý¼ºÇÕ´Ï´Ù. */


        </form>
        </center>
        </body>
        </html>
        ");
      }
      else
      {
        input_newlibchal($tnum ,$f ,$f2) ;
      }
      /* ÀÀ´ä ±Û ÀÔ·Â È­¸éÀ» Ãâ·ÂÇÕ´Ï´Ù. */

      mysql_close($connect);
    }

ƯÁ¤ ÀÚ·á Á¤º¸ º¸¿© ÁÖ±â

    ÀÚ·á½Ç ¸ÞÀÎ È­¸é¿¡¼­ ƯÁ¤ ÀÚ·áÀÇ Á¦¸ñÀ» Ŭ¸¯ÇÒ °æ¿ì Ãâ·ÂÇÏ´Â È­¸éÀÔ´Ï´Ù.


    if($chanl == title)
    {
      mysql_query("update $f set hit = '$putup[hit]'+1 where no = '$no'" ,$connect) ;
      /* $chanl= title ÀÏ ¶§ ÇØ´ç ÀÚ·áÀÇ Á¶È¸¼ö¸¦ 1 ´õÇؼ­ ÀúÀåÇÕ´Ï´Ù. */


      view_title($ally2 ,$ally3 ,$no ,$f ,$f2) ;
      /* $chanl= title ÀÏ ¶§ ƯÁ¤ ÀÚ·áÀÇ ³»¿ëÀ» º¸¿© ÁÝ´Ï´Ù. */
      mysql_close($connect);
    }

ÀÚ·áÀÇ »èÁ¦

    ƯÁ¤ ÀڷḦ »èÁ¦Çϱâ À§ÇÑ µî·ÏÀÚ Æнº¿öµå ÀÔ·Â È­¸é°ú Æнº¿öµå¸¦ ÀÌ¿ëÇÑ ÇØ´ç ÀÚ·áÀÇ »èÁ¦ ·çƾÀ» ¸¸µì´Ï´Ù.


    if($chanl == del)
    {
      del($no ,$f ,$f2 ,$root);
      mysql_close($connect);
    }
    /* $chanl=del ÀÏ ¶§ ÇØ´ç ÀڷḦ »èÁ¦Çϱâ À§ÇÑ µî·ÏÀÚ Æнº¿öµå ÀÔ·Â È­¸éÀ» Ãâ·ÂÇÕ´Ï´Ù. */


    if($chanl == del_no)
    {
      $input=mysql_query("select password('$passw') " ,$connect );
      $inputpassw = mysql_result($input ,0 ,0);
      /* $chanl == del_noÀÏ ¶§ Àü´Þ µÇ¾î¿Â Æнº¿öµå¸¦ password( )ÇÔ¼ö¸¦ ÀÌ¿ëÇؼ­ ¾ÏȣȭÇÕ´Ï´Ù. */


      if($putup[passw] == $inputpassw || $root )
      {
        unlink("/home/ftp/pub/$putup[path]");
        /* Àü´Þ µÇ¾î¿Â Æнº¿öµå¿Í µ¥ÀÌÅͺ£À̽ºÀÇ Æнº¿öµå°¡ ÀÏÄ¡ÇÒ °æ¿ì ÇØ´ç ÆÄÀÏÀ» »èÁ¦ÇÕ´Ï´Ù. */
        $mldel = "delete from $f where no=$no";
        $rsult = mysql_query($mldel ,$connect);
        /* ÀÚ·á½Ç ¸ÞÀÎ Å×ÀÌºí¿¡¼­ ÇØ´ç ÀÚ·áÀÇ Á¤º¸¸¦ ¸ðµÎ »èÁ¦ÇÕ´Ï´Ù. */


        $ml2del = "delete from $f2 where tnum=$tnum ";
        $rsult2 = mysql_query($ml2del ,$connect);
        /* ÀÚ·á½Ç ÀÀ´ä ±Û Å×ÀÌºí¿¡¼­ ÇØ´ç ÀÚ·áÀÇ ÀÀ´ä ±ÛÀÇ Á¤º¸¸¦ ¸ðµÎ »èÁ¦ÇÕ´Ï´Ù. */
      }
      else
      {
        echo("
        <script>
        window.alert('passw°¡ Ʋ·È½À´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇØ ÁÖ¼¼¿ä')
        history.go(-1)
        </script>
        ");
        exit;
      }


      echo("
      <html>
      <body>
      <center>
      <form method=post action=m.php>
      <font style='font-size:13px;font-style:italic;color:#808080'>
      <b>±ÛÀÌ »èÁ¦ µÇ¾ú½À´Ï´Ù</b></font>
      <input type=hidden name=no value=$no>
      <input type=hidden name=chanl value=main_view>
      <input type=hidden name=f value=$f>
      <input type=hidden name=f2 value=$f2>
      <input type=submit value=È®ÀÎ>
      </form>
      </center>
      </body>
      </html>
      ");
      /* ÇØ´ç ÀÚ·áÀÇ ¸ðµç Á¤º¸¸¦ »èÁ¦ÇÑ ÈÄ È®ÀÎ ¹öÆ°À» »ý¼ºÇÏ°í ÀÚ·á½Ç ¸ÞÀÎ È­¸éÀ¸·Î À̵¿ÇÏ°Ô ÇÕ´Ï´Ù. */

      mysql_close($connect);
    }



    ´ÙÀ½ Àå¿¡¼­´Â °æ¸Å °Ô½ÃÆÇÀ» ¼³¸íÇÏ°Ú½À´Ï´Ù.

  
    Âü°í. À§ ÀÚ·á½ÇÀº Áö±Ý ¾²´Â ¹æ½ÄÀÌ ¾Æ´Õ´Ï´Ù¡¦ Áß¿äÇÑ°Ç À§ ¹æ¹ýÀ» ÀÌ¿ëÇؼ­ ¿©·¯ °Ô½ÃÆÇÀ» µ¶Ã¢ÀûÀ¸·Î
          ¸¸µé¾î º¼ ¼ö ÀÖ½À´Ï´Ù.   ÀÀ´äÇüµµ ¸»ÀÌÁ®¡¦ ¿äÁòÀÇ ftp ÀÚ·á½ÇÀº ±Û°Ô½ÃÆÇ°ú ¿¬µ¿Çؼ­ ¸¹ÀÌµé ¸¸µé¸ç
          ¹æ¹ýÀº Çì´õ¸¦ ÀÌ¿ëÇؼ­ ÆÄÀÏÀ» Àü¼Û ÇÕ´Ï´Ù.   ÀÚ¼¼ÇÑ »çÇ×Àº ¸îÁÙ ¾ÊµË´Ï´Ù. 
          ÇÏÁö¸¸ Àú°¡ Áö±Ý »ý°¢ÀÌ ³ªÁú ¾Ê´Â±º¿ä.   ÇãÁ¢ ÇÏÁö¸¸ ¸¸µé¾îµÐ°Ô ÀÖ¾î µÚÁö¸é ³ª¿Ã µí Çѵ¥ ±Ã±ÝÇϽÅ
          ºÐÀº ¸ÞÀÏ ÁÖ¼¼¿ä¡¦   ±×¸®°í °æ¸ÅÀÇ °æ¿ì ½Ç½Ã°£ÀÌ ¾Æ´Õ´Ï´Ù. 
          ´ÜÁö 󸮵Ǵ ºÎºÐ¸¸À» ±¸Çö Çß½À´Ï´Ù. ½Ç½Ã°£À¸·Î ±¸ÇöÇÏ´Â ¹æ¹ýÀº ¿©·¯ °¡Áö°¡ ÀÖÀ¸¸ç ½±°Ô ¾ò¾îÁú
          °ÍÀÔ´Ï´Ù¡¦

´ÙÀ½ ÀÌÀü Â÷·Ê