½ÃÀÛÆäÀÌÁö·Î Áñ°Üã±âÃß°¡
·Î±×ÀÎ
ȸ¿ø°¡ÀÔ l Ã⼮üũ l ¸¶ÀÌÆäÀÌÁö l CGIMALL
ÀÚ·á½Ç »çÀÌÆ®µî·Ï ·©Å·100 ÇÁ·Î±×·¥¸®ºä °ü¸®ÀÚÃßõÀÚ·á Ãʺ¸°¡À̵å
Ä¿¹Â´ÏƼ
Àüü ÆîÃ帱â
Äü¸Þ´º¸µÅ© jquery , CSS , PHP , Javascript , ¹«·áÆùÆ® , ASP
»ó¼¼°Ë»ö
Ȩ > Ä¿¹Â´ÏƼ > Áú¹®°ú´äº¯ »ó¼¼º¸±â
Ä¿¹Â´ÏƼ ±¸Àα¸Á÷
»çÀÌÆ®µî·Ï
Ŭ¶ó¿ìµåű×
Javascript
PHP
asp
CSS
html
mysql
jquery
image
Mobile
API
slide
°Ô½ÃÆÇ
¸Þ´º
ÇöÀçÁ¢¼ÓÀÚ ¸í »õ·Î°íħ
°Ô½ÃÆÇŸÀÌƲ Áú¹®°ú´äº¯ / »ó¼¼º¸±â
Æ®À§ÅÍ·Î º¸³»±â
Ãßõ¼ö 152 | Á¶È¸¼ö 5,295 | µî·ÏÀÏ 2003-07-11 19:57:04

´Ð³×ÀÓ

sebal90

À̸ÞÀÏ

sebal90@yahoo.co.kr

Á¦¸ñ

¹Î´Þ Å´½º¹öÁ¯ ÅõÇ¥ÇÔ¿ä...óÀ½ °ªÀ» 100À¸·Î ÇÒ·Á¸é ¾î¶»°Ô Çϳª¿ä?
³»¿ë

Á¦ »ý°¢À¸·Î´Â vote.php3À» ¼öÁ¤ÇØ¾ß ÇÒ°Í °°Àºµ¥...

 

<?
//##############################################################################[¾Ë·¯Æ®]
function ERROR($msg)
{
 echo ( "<script language=javascript>
   window.alert('$msg');
   history.go(-1);
   </script>" );
 exit;
}
function ALERT($msg)
{
 echo ( "<script language=javascript>
   window.alert('$msg');
   self.close();
   </script>" );
 exit;
}
//############################################################################[LOCK]
function LOCK($db)
{
 if(file_exists("./db/$db/lock")) {
  sleep(1);
 }
 
 $fp = fopen("./db/$db/lock", "w"); 
 fwrite($fp, "");
 fclose($fp);
}
function UNLOCK($db)
{
 if(file_exists("./db/$db/lock")) {
  unlink ("./db/$db/lock");
 }
}
//##########################################################################[ÅõÇ¥µ¥ÀÌÅÍ ÀúÀå]
function WRITE_DATA()
{
global $db, $no, $HTTP_COOKIE_VARS,$REMOTE_ADDR,$PHP_SELF;
global $TARGET_OP, $TARGET_NAME, $VOTE_END_OP, $MEMBER_ONLY ;

 $TOTAL_Q_NUM = file("./db/$db/db_que_num");
 $db_que_num = $TOTAL_Q_NUM[0];

 $TOTAL = file("./db/$db/total");
 $TOTAL_NUM = $TOTAL[0] + 1;

 LOCK($db);

 $fp = fopen("./db/$db/total", "w"); 
 fwrite($fp, "$TOTAL_NUM");
 fclose($fp);

 UNLOCK($db);

 for ( $j=0 ; $j < $db_que_num ; $j++) {

  $RECORD = file("./db/$db/record$j");
  $V_NUM = split("\|", $RECORD[0]);

  LOCK($db);
  
  $V_NUM[$no[$j]-1] += 1;

  $fp = fopen("./db/$db/record$j", "w"); 
  fwrite($fp, "$V_NUM[0]|$V_NUM[1]|$V_NUM[2]|$V_NUM[3]|$V_NUM[4]|$V_NUM[5]|$V_NUM[6]|$V_NUM[7]|$V_NUM[8]|$V_NUM[9]|$V_NUM[10]|$V_NUM[11]|$V_NUM[12]|$V_NUM[13]|$V_NUM[14]|");
  fclose($fp);

  UNLOCK($db);
 }
}

//##############################################################################[ÅõÇ¥ ÇÊÅ͸µ°ú ÅõÇ¥ÀÚÁ¤º¸ ÀúÀå]
function VOTE_DATA()
{
global $db, $no, $HTTP_COOKIE_VARS,$REMOTE_ADDR,$PHP_SELF;
global $TARGET_OP, $TARGET_NAME, $VOTE_END_OP ;
global $MEMBER_ONLY, $NO_VIEW_OP, $END_DATE, $GRADE_CUT ;

 $END_DATE_V = split("-", $END_DATE);
 $END_YEAR = $END_DATE_V[0];
 $END_MONTH = $END_DATE_V[1];
 $END_DAY = $END_DATE_V[2];
 $END_HOUR = $END_DATE_V[3];
 $END_MIN = $END_DATE_V[4];

 $END_DATE_UNIX = mktime( $END_HOUR, $END_MIN, 0, $END_MONTH, $END_DAY, $END_YEAR);
 $NOW_TIME_UNIX = time();

 $TOTAL_Q_NUM = file("./db/$db/db_que_num");
 $db_que_num = $TOTAL_Q_NUM[0];

 $QUE_MSG = file("./db/$db/que_msg");
 $Q_MSG = split("\|", $QUE_MSG[0]);

 if ( !$END_DATE ) { $END_DATE_UNIX = $NOW_TIME_UNIX + 1; }

 if ( ($VOTE_END_OP == "checked") || ($NOW_TIME_UNIX > $END_DATE_UNIX)) {
  $msg =  " ¼³¹®Á¶»ç°¡ Á¾·áµÇ¾ú½À´Ï´Ù.";
  if ( ($TARGET_OP == "target") && ( $TARGET_NAME != "_blank" ) ) { ERROR($msg);}
  else       { ALERT($msg);}
 }

 //*************************************************** ȸ¿øÀü¿ë 1ÀÎ 1ÅõÇ¥ÀÎ °æ¿ì
 if ($MEMBER_ONLY == "checked") {

  if ( !is_file("../../member/login_user/$HTTP_COOKIE_VARS[MEMBER_ID].cgi") ) {
   $msg = " ¸ÕÀú ·Î±×ÀÎ ÇØ ÁÖ¼¼¿ä. ";
   if ( ($TARGET_OP == "target") && ( $TARGET_NAME != "_blank" ) ) { ERROR($msg);}
   else       { ALERT($msg);}
  }

  // ·Î±×ÀεǾî ÀÖÀ¸¸é
  else { 

   $MEMBER_DATA = file("../../member/regis_members/$HTTP_COOKIE_VARS[MEMBER_ID].cgi");
   $VALUE = split("\|", $MEMBER_DATA[0]);
   $MEMBER_GRADE = $VALUE[27];

   if ( $VALUE[25] != "checked" ) {
    $msg = "  \\n\\nÁ˼ÛÇÕ´Ï´Ù. $VALUE[2]´Ô²²¼­´Â º¸·ù»óÅÂÀÔ´Ï´Ù.\\n\\n  ";
    if ( ($TARGET_OP == "target") && ( $TARGET_NAME != "_blank" ) ) { ERROR($msg);}
    else       { ALERT($msg);}
   }
   if ( $MEMBER_GRADE > $GRADE_CUT ) {
    $msg = "  \\n\\nÁ˼ÛÇÕ´Ï´Ù. $GRADE_CUT µî±ÞÀÌ»óÀΠȸ¿ø¸¸ Âü¿©ÇÒ ¼ö ÀÖ½À´Ï´Ù. \\n\\n  ";
    if ( ($TARGET_OP == "target") && ( $TARGET_NAME != "_blank" ) ) { ERROR($msg);}
    else       { ALERT($msg);}
   }

   if ( !is_dir("./db/$db/vote_member") ) {
    mkdir("./db/$db/vote_member", 0777);
   }
   if( !is_file("./db/$db/vote_list.cgi")) {
    $fp = fopen("./db/$db/vote_list.cgi", "w");
    fclose($fp);
   }
   
   // ÀÌ¹Ì ÅõÇ¥Çß´ÂÁö ¾ÆÀ̵ð üũ
   if(file_exists("./db/$db/vote_member/$HTTP_COOKIE_VARS[MEMBER_ID].cgi")) {
    $msg = "  \\n\\n $VALUE[2]´Ô²²¼­´Â ÀÌ¹Ì ÅõÇ¥Çϼ̽À´Ï´Ù. \\n\\n  ";
    if ( ($TARGET_OP == "target") && ( $TARGET_NAME != "_blank" ) ) { ERROR($msg);}
    else               { ALERT($msg);}
   }

   for ( $j=0, $x=0 ; $j < $db_que_num ; $j++) {
    if ($Q_MSG[$j]) {
     $x++;
     if( !$no[$j] ) {
      if ( $db_que_num == "1" ) { $msg = " ´äº¯Ç׸ñÀ» ¼±ÅÃÇØÁÖ¼¼¿ä. "; }
      else      { $msg =  " $x ¹ø Ç׸ñÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä. "; }
      if ( ($TARGET_OP == "target") && ( $TARGET_NAME != "_blank" ) ) { ERROR($msg); }
      else               { ALERT($msg);}
     }
    }
   }
   if(!file_exists("./db/$db/total")) {
    $V_MSG = "¼±ÅÃÇÑ µð·ºÅ丮¿¡ ¼³¹®µ¥ÀÌÅÍ°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.";
    if ( ($TARGET_OP == "target") && ( $TARGET_NAME != "_blank" ) ) { ERROR($msg);}
    else               { ALERT($msg);}
   }

   WRITE_DATA();  // ÅõÇ¥ µ¥ÀÌÅÍ ÀúÀå
  
   $MEMBER_LIST = file("./db/$db/vote_list.cgi");
   LOCK($db);
   $fp = fopen("./db/$db/vote_list.cgi", "w");
   fwrite($fp, "$HTTP_COOKIE_VARS[MEMBER_ID]\n");
   $i=0;
   while( $MEMBER_LIST[$i] ) {
    fwrite($fp, "$MEMBER_LIST[$i]");
   $i++;
   }
   fclose($fp);

   $VOTE_TIME = date("Y-m-d[H:i:s]");
   $fp = fopen("./db/$db/vote_member/$HTTP_COOKIE_VARS[MEMBER_ID].cgi", "w"); 
   fwrite($fp, "$HTTP_COOKIE_VARS[MEMBER_ID]|$MEMBER_GRADE|$VOTE_TIME|$REMOTE_ADDR|");
   fclose($fp);

   UNLOCK($db);
  
  // ¿©±â±îÁö ·Î±×ÀεǾî ÀÖ´Â °æ¿ì ÅõÇ¥µ¥ÀÌÅÍ¿Í È¸¿ø ID ÀúÀå
  }
 }

 //*********************************************** ȸ¿øÀü¿ëÅõÇ¥°¡ ¾Æ´Ñ °æ¿ì
 else {
  if ($HTTP_COOKIE_VARS[kimsvote] != $db) {

   for ( $j=0, $x=0 ; ($j < $db_que_num) && ( $Q_MSG[$j]) ; $j++) {
    if ($Q_MSG[$j]) {
     $x++ ;
     if( !$no[$j] ) {
      if ( $db_que_num == "1" ) { $msg = " ´äº¯Ç׸ñÀ» ¼±ÅÃÇØÁÖ¼¼¿ä. "; }
      else      { $msg =  " $x ¹ø Ç׸ñÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä. "; }
      if ( ($TARGET_OP == "target") && ( $TARGET_NAME != "_blank" ) ) {
       ERROR($msg);
      }
      else { ALERT($msg);}
     }
    }
   }

   if(!file_exists("./db/$db/total")) {
    $V_MSG = "¼±ÅÃÇÑ µð·ºÅ丮¿¡ ¼³¹®µ¥ÀÌÅÍ°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.";
    if ( ($TARGET_OP == "target") && ( $TARGET_NAME != "_blank" ) ) { ERROR($msg);}
    else               { ALERT($msg);}
   }

   WRITE_DATA();  // ÅõÇ¥ µ¥ÀÌÅÍ ÀúÀå

   setcookie("kimsvote", "$db", "" , "/");

  }
  else {
   $msg = " ÀÌ¹Ì ÅõÇ¥Çϼ̽À´Ï´Ù. ";
   if ( ($TARGET_OP == "target") && ( $TARGET_NAME != "_blank" ) ) { ERROR($msg);}
   else       { ALERT($msg);}
  }
 }

 if ( ($MEMBER_ONLY == "checked") && ($NO_VIEW_OP) ) {
  $msg = " ÅõÇ¥¿¡ Âü¿©ÇØ Áּż­ °¨»çÇÕ´Ï´Ù. ";
  if ( ($TARGET_OP == "target") && ( $TARGET_NAME != "_blank" ) ) { ERROR($msg);}
  else               { ALERT($msg);}
 }
 else {
  echo "<html>
  <META http-equiv=\"refresh\" content =\"0;url=./mindalboard.php3?query=view&db=$db\">
  </html>";
 }
exit;
}
//##############################################################################[¼³¹®Á¶»çÆû]
function VOTE_FORM()
{
global $PHP_SELF,$ImgUrl,$db;
global $TARGET_OP, $TARGET_NAME, $SUBJECT_OP, $VOTE_END_OP, $COLUMN_V, $ROW_OP ;
global $MEMBER_ONLY, $NO_VIEW_OP, $END_DATE, $WIN_WIDTH, $WIN_HEIGHT ;

 if( file_exists("./mindal_dir")) {

  $VOTE_DIR = file("./mindal_dir");
  $MINDAL_DIR = $VOTE_DIR[0];
 }

 echo "<HTML>
 <HEAD>
 <TITLE>¼³¹®Á¶»ç </TITLE>
 <STYLE>
 A:LINK {text-decoration:none;}
 A:VISITED {text-decoration:none;}
 V:HOVER {text-decoration:none; hover:red;}
 body,p,br,table,tr,td,form,input {font-size:9pt; font-family:±¼¸²;}
 </STYLE>\n\r";

 // MINDALVOTE1, MINDALVOTE2 - ÅõÇ¥ ¹öÆ° ´­·¶À» ¶§,  VOTE1, VOTE2 - °á°úº¸±â ¹öÆ° ´­·¶À» ¶§

 echo"<SCRIPT LANGUAGE=javascript>
  function VOTE(URL) {
   window.open(URL,'VOTE','resizable=yes,scrollbars=yes,status=0,width=500,height=450');
  }
  function VOTE2(URL) {
   window.open(URL,'VOTE2','resizable=yes,scrollbars=yes,status=0,width=750,height=450');
  }
  function MINDALVOTE(){
   window.open('','MINDALVOTE','width=500,height=450,status=0,resizable=yes,scrollbars=yes');
  }
  function MINDALVOTE2(){
   window.open('','MINDALVOTE2','width=750,height=450,status=0,resizable=yes,scrollbars=yes');
  }
 </SCRIPT>\n\r";

 echo"</HEAD>
 <BODY>\n\n\n";

 if ( $TARGET_OP == "target" ) {
  echo"<FORM METHOD=POST ACTION='$MINDAL_DIR/vote.php3' target='$TARGET_NAME'>";
 }
 else {
  if( $COLUMN_V == "2" ) {
  echo"<FORM METHOD=POST ACTION='$MINDAL_DIR/vote.php3' target='MINDALVOTE2'>";
  }
  else {
  echo"<FORM METHOD=POST ACTION='$MINDAL_DIR/vote.php3' target='MINDALVOTE'>";
  }
 }

 echo"<INPUT type=hidden name=action value=vote>
 <INPUT type=hidden name=db value='$db'>";

 $TOTAL_Q_NUM = file("./db/$db/db_que_num");
 $db_que_num = $TOTAL_Q_NUM[0];
 
 $QUE_MSG = file("./db/$db/que_msg");
 $Q_MSG = split("\|", $QUE_MSG[0]);

 for ( $j = 0; $j < $db_que_num  ; $j++) {
  if ( $Q_MSG[$j] ) {
  $Q_MSG[$j] = stripslashes($Q_MSG[$j]); // Áú¹®
   echo "<br>";
   echo " <font face=±¼¸²> $Q_MSG[$j] </font>\n<br>\n";

   $V_MSG_RECORD = file("./db/$db/msg$j");
   $V_MSG = split("\|", $V_MSG_RECORD[0]);
   
   for( $i = 0;  $i <15  ; $i++) {
    $num = $i + 1;
    if ($V_MSG[$i]) {
    $V_MSG[$i] = stripslashes($V_MSG[$i]);
     echo "<INPUT type=radio name='no[$j]' value='$num'> <FONT face=±¼¸²>$V_MSG[$i]</FONT><BR>\n";
    }
   }
  }
 }
 echo"<br>";
 if ( $TARGET_OP == "target" ) {
  echo "<INPUT type=image src='$MINDAL_DIR/image/button_vote.gif' border=0 target='$TARGET_NAME'>&nbsp;\n";
  echo"<A href='./mindalboard.php3?query=view&db=$db' target='$TARGET_NAME'><IMG src='$MINDAL_DIR/image/button_result.gif' border=0></A>\n";
 }
 else {
  if( $COLUMN_V == "2" ) {
   echo "<INPUT type=image src='$MINDAL_DIR/image/button_vote.gif' border=0 onClick='MINDALVOTE2()' target='MINDALVOTE2'>&nbsp;\n";
   echo"<A href=javascript:VOTE2('./mindalboard.php3?query=view&db=$db')><IMG src='$MINDAL_DIR/image/button_result.gif' border=0></A>\n";
  }
  else {
   echo "<INPUT type=image src='$MINDAL_DIR/image/button_vote.gif' border=0 onClick='MINDALVOTE()' target='MINDALVOTE'>&nbsp;\n";
   echo"<A href=javascript:VOTE('./mindalboard.php3?query=view&db=$db')><IMG src='$MINDAL_DIR/image/button_result.gif' border=0></A>\n";
  }
 }

 echo"</FORM>\n\r
 </BODY></HTML>";

exit;
}
//##############################################################################[Äõ¸®]
global $p, $db, $PHP_SELF, $VOTE_END_OP, $MEMBER_ONLY, $NO_VIEW_OP, $OPI_LISTNUM, $OPI_RECTNUM, $GRADE_CUT ;

 $ImgUrl = "./image";

 if ( $db && is_dir("./db/$db")) {

  $LAYOUT = file("./db/$db/layout");
  $LAY = split("\|", $LAYOUT[0]);

  $TARGET_OP = $LAY[0];  // Ÿ°Ù¼³Á¤, »õâ : win,  Ÿ°ÙÁöÁ¤ : target
  $TARGET_NAME = $LAY[1];  // Ÿ°ÙÀ̸§

  $SUBJECT_OP = $LAY[2];  // ¼³¹®ÁÖÁ¦ Ãâ·Â¿É¼Ç
  $COLUMN_V = $LAY[3];  // Ãâ·Â´Ü¼ö,  1´Ü : 1,  2´Ü : 2
  $ROW_OP = $LAY[4]; // Ç೪´©±â
  $OPI_OP = $LAY[5];  // °£´ÜÀÇ°ß
  $OPI_WRITE_OP = $LAY[6]; // µµ¹è±ÝÁö
  $OPI_RECNUM = $LAY[7];  // ÀÇ°ß±Û ¼ö/ 1ÆäÀÌÁö
  $OPI_LISTNUM = $LAY[8]; // ÀÇ°ß±Û ÆäÀÌÁö¹øÈ£ Ç¥½Ã ¼ö
  $VOTE_END_OP = $LAY[9];  // ¼³¹®¸¶°¨(ÀÓÀǸ¶°¨)
  $END_DATE = $LAY[10];  // ¸¶°¨ÀÏ

  $BGCOLOR = $LAY[11];  // Àüü¹è°æ»ö
  $SUBJECT_COLOR = $LAY[12]; // ¼³¹®ÁÖÁ¦ ±ÛÀÚ»ö
  $SUBJECT_BGCOLOR = $LAY[13]; // ¼³¹®ÁÖÁ¦ ¼¿¹è°æ
  $QUE_COLOR = $LAY[14];  // Áú¹® ±ÛÀÚ»ö
  $QUE_BGCOLOR = $LAY[15]; // Áú¹® ¼¿ ¹è°æ»ö
  $MSG_COLOR = $LAY[16];  // ´äº¯ Ç׸ñ ±ÛÀÚ»ö
  $MSG_BGCOLOR = $LAY[17]; // ´äº¯Ç׸ñ ¼¿ ¹è°æ»ö
  $BAR_BGCOLOR = $LAY[18]; // ¸·´ë±×·¡ÇÁ ¼¿¹è°æ»ö
  $ETC_COLOR1 = $LAY[19];  // ±âŸ±ÛÀÚ»ö, ÅõÇ¥¼ö, ÆÛ¼¾Æ®,
  $ETC_COLOR2 = $LAY[20];  // ±âŸ±ÛÀÚ»ö, ¼³¹®Á¶»ç±â°£, ÃÑÅõÇ¥¼ö
  $OPI_COLOR = $LAY[21];  // ÀÇ°ß±Û ±ÛÀÚ»ö
  $OPI_BGCOLOR = $LAY[22]; // ÀÇ°ß±Û ¼¿¹è°æ»ö
  $OPI_BORDER_COLOR = $LAY[23]; // ÀÇ°ß±Û Å×À̺í Å׵θ®»ö

  $MEMBER_ONLY = $LAY[24]; // ȸ¿øÀü¿ë¿É¼Ç
  $NO_VIEW_OP = $LAY[25]; // °á°úÈ­¸é ºñ°ø°³
 
  $START_DATE = $LAY[26];  // ¼³¹®Á¶»ç »ý¼ºÀÏ
  $GRADE_CUT = $LAY[27];  // ȸ¿øµî±Þ Á¦ÇÑ
  $VOTE_B_OP = $LAY[28]; // ÅõÇ¥ ¹öÆ° Ãâ·Â¿©ºÎ
  $LIST_B_OP = $LAY[29]; // ¸ñ·Ï ¹öÆ°

  if ( $action == "vote" ) { VOTE_DATA(); }
  else   { VOTE_FORM(); }

 }
 else {
  $V_MSG = "Á¸ÀçÇÏÁö ¾Ê´Â DBÀ̰ųª DB¸¦ ¼±ÅÃÇÏÁö ¾ÊÀ¸¼Ì½À´Ï´Ù."; ERROR($V_MSG);
 }

?>
<p>&nbsp;</p>

 

¾îµð¸¦ °íÃÄ¾ß Ã³À½ ÅõÇ¥Çظé 101 ÀÌ µÉ±î¿ä??

 

Ãßõ½ºÅ©·¦¼Ò½ºº¸±â ¸ñ·Ï
ÀÌÀü°Ô½Ã±Û µµ¿ÍÁÖ¼¼¿ä~~ 2003-07-11 15:16:45
´ÙÀ½°Ô½Ã±Û [¿ÏÀü Ãʺ¸] CGI ¼³Á¤ È®ÀÎ 2003-07-16 16:48:03