/*************************************************************
** ¾Æ·¡´Â Ư¼öÇÑ °æ¿ì¶óµçÁö, ¼±°áÇØ¼ ó¸®ÇؾßÇÒ ºÎºÐÀÇ ¼Ò½º **
**************************************************************/
//ÀÔ·ÂÆûÀÇ °¢ÆäÀÌÁö¿¡¼ ¾ÏÈ£ÈÇØ¼ º¸³½ °ÍÀ» ¿©±â¼ ´Ù½Ã ǰ
if($temp_pass) $passwd=base64_decode($temp_pass);
if($temp_resno) $sub6=base64_decode($temp_resno);
//°Ô½Ã¹°À» boardÅ×ÀÌºí¿¡¼ ºÎ¸¦ °ÍÀΰ¡ cafeboard¿¡¼ ºÎ¸¦ °ÍÀΰ¡ °áÁ¤
if($cafe_url) $board=cafeboard; else $board=board;
//ÀÏ´Ü ¾÷·ÎµåµÈ ÆÄÀϸíÀ» ¿£ÄÚµùÇÔ
$file1_name = urlencode($file1_name);
$file2_name = urlencode($file2_name);
// °¢Á¾ ÇÔ¼ö ¼±¾ð ==========================================================
/*************************************************************
** ³»¿ë »èÁ¦½Ã ¿ä°ÇÀÌ ¸ÂÁö ¾ÊÀ¸¸é ƯÁ¤ page·Î À̵¿¸µÅ© ÇÔ¼ö **
**************************************************************/
function error($sub_title,$sub_action,$sub_comment)
{
global $code,$main_no,$dep_no,$link_url,$page,$login_key,$mode,$keyword,$add_no,$no,$opp,$cafe_url,$thumb_nail,$jump_id,$jump_name,$year,$mm;
if($opp) $opp_url='view.html'; else $opp_url='page.html';
echo "
";
// ÇÁ·Î±×·¥ Á¾·á
exit();
}
/*************************
** ÆÄÀÏÀÇ È®ÀåÀÚ ±¸Çϱâ **
*************************/
function getExt($file_name) {
// boardÇÁ·Î±×·¥°ú ´Þ¶óÁø °÷ÀÔ´Ï´Ù.
$lower = strtolower($file_name);
$pos = strrpos($lower,".");
$ext = substr($lower,$pos); //ÆÄÀÏÀÇ È®ÀåÀÚ
$name = substr($lower,0,$pos); //È®ÀåÀÚ¸¦ Á¦¿ÜÇÑ ÆÄÀÏÀ̸§
switch ($ext) {
case ".html":
$ext = ".html";
break;
case ".php":
$ext = ".php";
break;
case ".cgi":
$ext = ".cgi";
break;
}
return array($name,$ext);
}
/******************************
**ÆÄÀÏ »èÁ¦ÇÔ¼ö**
//******************************/
function file_del($row,$code,$main_no,$dep_no){
//÷ºÎÆÄÀÏ Á¦°Å(À§´Â 1¹ø, 2´Â 2¹ø)
if($row[file1]){
list($filename,$ext) = getExt($row[file1]);
$file1_action = "./upfile/$code/fd_1/$main_no$dep_no"."$ext";
if(!unlink($file1_action)) {
echo "ÆÄÀÏÀ» Áö¿î´Âµ¥ ½ÇÆÐÇß½À´Ï´Ù.
";
echo $row[file1];
exit();
}
}
if($row[file2]){
list($filename,$ext) = getExt($row[file2]);
$file2_action = "./upfile/$code/fd_2/$main_no$dep_no"."$ext";
if(!unlink($file2_action)) {
echo "ÆÄÀÏÀ» Áö¿î´Âµ¥ ½ÇÆÐÇß½À´Ï´Ù.";
echo $row[file2];
exit();
}
}
}
/******************************
**½æ³×ÀÏ ÇÔ¼ö**
//******************************/
function thumbnail($file, $save_filename, $ext, $max_width, $max_height)
{
$src_img = ImageCreateFromJPEG($file); //JPGÆÄÀϷκÎÅÍ À̹ÌÁö¸¦ Àоî¿É´Ï´Ù
$img_info = getImageSize($file);//¿øº»À̹ÌÁöÀÇ Á¤º¸¸¦ ¾ò¾î¿É´Ï´Ù
$img_width = $img_info[0];
$img_height = $img_info[1];
if(($img_width/$max_width) == ($img_height/$max_height))
{//¿øº»°ú ½æ³×ÀÏÀÇ °¡·Î¼¼·ÎºñÀ²ÀÌ °°Àº°æ¿ì
$dst_width=$max_width;
$dst_height=$max_height;
}
elseif(($img_width/$max_width) < ($img_height/$max_height))
{//¼¼·Î¿¡ ±âÁØÀ» µÐ°æ¿ì
$dst_width=$max_height*($img_width/$img_height);
$dst_height=$max_height;
}
else{//°¡·Î¿¡ ±âÁØÀ» µÐ°æ¿ì
$dst_width=$max_width;
$dst_height=$max_width*($img_height/$img_width);
}//±×¸²»çÀÌÁ ºñ±³ÇØ ¿øÇÏ´Â ½æ³×ÀÏ Å©±âÀÌÇÏ·Î °¡·Î¼¼·Î Å©±â¸¦ ¼³Á¤ÇÕ´Ï´Ù.
$dst_img = imagecreatetruecolor($dst_width, $dst_height); //Ÿ°ÙÀ̹ÌÁö¸¦ »ý¼ºÇÕ´Ï´Ù
Imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dst_width, $dst_height, $img_width, $img_height); //Ÿ°ÙÀ̹ÌÁö¿¡ ¿øÇÏ´Â »çÀÌÁîÀÇ À̹ÌÁö¸¦ ÀúÀåÇÕ´Ï´Ù
ImageInterlace($dst_img);
if($ext==".jpg" or $ext==".jpeg")ImageJPEG($dst_img, $save_filename); //JPEG½ÇÁ¦·Î À̹ÌÁöÆÄÀÏÀ» »ý¼ºÇÕ´Ï´Ù
if($ext==".gif") ImageGIF($dst_img, $save_filename); //GIF½ÇÁ¦·Î À̹ÌÁöÆÄÀÏÀ» »ý¼ºÇÕ´Ï´Ù
if($ext==".png") ImagePNG($dst_img, $save_filename); //PNG½ÇÁ¦·Î À̹ÌÁöÆÄÀÏÀ» »ý¼ºÇÕ´Ï´Ù
ImageDestroy($dst_img);
ImageDestroy($src_img);
}
/*****************************
** MySQL ÀÛ¾÷ÀÌ ½ÇÆÐÇÒ °æ¿ì **
*****************************/
function dbError($message) {
global $code, $page, $keyword, $url, $link_url,$cafe_url;
die ("SQL ¼¹ö¿¡ ¹®Á¦°¡ ¹ß»ýÇÏ¿© ó¸®ÇÏÁö ¸øÇß½À´Ï´Ù. ($message)
È®ÀÎ\n");
}
//¹®ÀÚ ÀԷ¹æ½Ä ¼±ÅÃ(¿Ï¼ºµÈ Ãâ·Â¹æ½Ä)
if($char_form==text_char)
$content = str_replace("<", "<", $content);
elseif($char_form==html_char)
$content = str_replace("\n","",$content); //¿ª½½·¹½Ã¸¦ °ø¶õÀ¸·Î º¯È¯
elseif($char_form==space_char and $mode=="new") { // °ø¶õ±ÛÀÎÁ¤+»õ±Û
$content = str_replace("<", "<", $content);
$content = ereg_replace(" "," ","$content");
}
elseif($char_form==space_char and $mode=="modify") { //°ø¶õ±ÛÀÎÁ¤+¼öÁ¤
$content = ereg_replace(" "," ","$content");
$content = str_replace("<", "<", $content);
$content = ereg_replace(" "," ","$content");
}
elseif($mode=="opp") { // °ø¶õ±ÛÀÎÁ¤+Àǰߴޱâ
$content = str_replace("<", "<", $content);
$content = ereg_replace(" "," ","$content");
}
/**************
** »õ±Û ÀÔ·Â **
**************/
function input_new() {
//±Û·Î¹ú º¯¼ö ÁöÁ¤
global $code, $file1, $file1_size, $file1_name, $file2, $file2_size, $file2_name, $content, $sub1, $sub2, $sub3,
$sub4, $sub5, $sub6, $sub7, $sub8, $sub9, $sub10, $int_1, $int_2, $int_3, $int_4, $int_5, $int_6, $int_7, $int_8, $int_9, $int_10,
$title, $name, $passwd, $email,$homeurl,$read_only,$reply_sel,$board,$cafe_url,$id, $url, $link1, $link2, $link3, $char_form, $thumb_nail,$thumb_size;
// ÇÏÀ§ ¹øÈ£°¡ AAAAAAAÀÌ¸é ¸ÞÀÎ ±Û
$dep_no = "AAAAAAA";
// °°Àº °Ô½ÃÆÇ Äڵ带 °¡Áö°í ÀÖ´Â ±Û ¹øÈ£ Áß¿¡¼ Á¦ÀÏ ³ôÀº ¹øÈ£¸¦ ±¸ÇÑ´Ù.
$query = " select main_no from $board
where code='$code'
order by main_no desc limit 1";
$result = mysql_query($query);
//ù °Ô½Ã¹°ÀÌ ¾Æ´Ï¸é ÇöÀç±îÁö °Ô½Ã¹°ÀÇ ÃÖ°í ³ôÀº ¹øÈ£º¸´Ù Çϳª Áõ°¡.
if ($row = mysql_fetch_array($result))
if($row[main_no]<0) //°øÁö±ÛÀÇ main_no´Â ¸¶À̳ʽºÀ̹ǷΠ°øÁö±ÛÀÌ Ã³À½¿¡ ¿Ã¶ó°¥À» ¶§ ¹®Á¦¸¦ ÇØ°áÇϱâ À§ÇØ
$main_no = 1;
else
$main_no = $row[main_no]+1;
//ù °Ô½Ã¹°À̸é
else
$main_no = 1;
//¾÷·ÎµåµÈ ÆÄÀÏ Ã³¸®Çϱâ(1¹øÆÄÀÏ)
if($file1_size >0) {
list($filename,$ext) = getExt($file1_name);
$file1_name = "{$filename}$ext";
if(!is_dir("./upfile/$code")) {
exec("mkdir ./upfile/$code");
exec("chmod 777 ./upfile/$code");
}
if(!is_dir("./upfile/$code/fd_1")) {
exec("mkdir ./upfile/$code/fd_1");
exec("chmod 777 ./upfile/$code/fd_1");
}
// ÇÑ±ÛÆÄÀÏÀÇ ±úÁüÇö»óÀ» ¸·±âÀ§ÇØ À§¿¡¼ urlencodeÇÑ °ÍÀ» ´Ù½Ã urldecodeÇß´Ù.
$file1_rename = urldecode($file1_name);
// ¶ç¾î¾²±â¸¦ ÇÑ ÆÄÀÏÀº ÇÑ.¿µ ¸ðµÎ ¿Ã·ÁÁöÁö ¾ÊÀ¸¹Ç·Î °ø¹éÀ» -À¸·Î ´ëÄ¡
$file1_rename = str_replace(" ", "_", $file1_rename);
// ¸ÞÀγѹö¿Í µö³Ñ¹ö¿¡ È®ÀåÀÚ¸¦ ´õÇÏ¿© ÆÄÀϸíÀ¸·Î ÀúÀåÇÑ´Ù.
$fn = $main_no.$dep_no.$ext;
// ÆÄÀÏ º¹»ç ¹× ±ÇÇÑ ¼³Á¤
exec("cp $file1 ./upfile/$code/fd_1/$fn");
exec("chmod 666 ./upfile/$code/fd_1/$fn");
//-----------½æ³×ÀÏ Ã³¸®½ÃÀÛ--------------
//½æ³×ÀÏÀ» ó¸®ÇϱâÀ§ÇÑ ¼Ò½º
if(file2_size<=0 and $thumb_nail==y and
($ext==".jpg" or $ext==".jpeg" or $ext==".gif" or $ext==".png")){
// ¿øº» À̹ÌÁö ÆÄÀÏ
$srcFile = "./upfile/$code/fd_1/$fn";
// Ÿ°Ù À̹ÌÁö ÆÄÀÏ
$sumFile = "./upfile/$code/fd_2/$fn";
//½æ³×ÀÏ ÆÄÀÏÀ» fd_2¿¡ ÀúÀåÇϱâÀ§ÇØ Æú´õ¸¦ ¸¸µé°í ÆÄÀÏ1ÀÇ À̸§À» ÆÄÀÏ2ÇÒ´çÇÑ´Ù.
if(!is_dir("./upfile/$code/fd_2")) {
exec("mkdir ./upfile/$code/fd_2");
exec("chmod 777 ./upfile/$code/fd_2");
}
$file2_rename = $file1_rename;
//½æ³×ÀÏ ÇÔ¼ö ºÒ·¯¿À±â(¾Æ·¡ÀÇ ¼ýÀÚ¸¦ º¯°æÇؼ Ãà¼ÒµÈ À̹ÌÁö Å©±â¸¦ ±¸ÇÑ´Ù.)
thumbnail($srcFile,$sumFile,$ext,"$thumb_size","$thumb_size");
exec("chmod 666 ./upfile/$code/fd_2/$fn");
}
//-----------½æ³×ÀÏ Ã³¸®¿Ï·á----------------
}else
$file1_name = "";
//¾÷·ÎµåµÈ ÆÄÀÏ Ã³¸®Çϱâ(2¹øÆÄÀÏ)
if($file2_size >0) {
list($filename,$ext) = getExt($file2_name);
$file2_name = "{$filename}$ext";
if(!is_dir("./upfile/$code")) {
exec("mkdir ./upfile/$code");
exec("chmod 777 ./upfile/$code");
}
if(!is_dir("./upfile/$code/fd_2")) {
exec("mkdir ./upfile/$code/fd_2");
exec("chmod 777 ./upfile/$code/fd_2");
}
// ÇÑ±ÛÆÄÀÏÀÇ ±úÁüÇö»óÀ» ¸·±âÀ§ÇØ À§¿¡¼ urlencodeÇÑ °ÍÀ» ´Ù½Ã urldecodeÇß´Ù.
$file2_rename = urldecode($file2_name);
// ¶ç¾î¾²±â¸¦ ÇÑ ÆÄÀÏÀº ÇÑ.¿µ ¸ðµÎ ¿Ã·ÁÁöÁö ¾ÊÀ¸¹Ç·Î °ø¹éÀ» -À¸·Î ´ëÄ¡
$file2_rename = str_replace(" ", "_", $file2_rename);
// ¸ÞÀγѹö¿Í µö³Ñ¹ö¿¡ È®ÀåÀÚ¸¦ ´õÇÏ¿© ÆÄÀϸíÀ¸·Î ÀúÀåÇÑ´Ù.
$fn = $main_no.$dep_no.$ext;
// ÆÄÀÏ º¹»ç ¹× ±ÇÇÑ ¼³Á¤
exec("cp $file2 ./upfile/$code/fd_2/$fn");
exec("chmod 666 ./upfile/$code/fd_2/$fn");
}else
$file2_name = "";
//ÇöÀç ³¯Â¥ ¹× ½Ã°£ ±¸Çϱâ
$date_write = date("Y/m/d H:m:s");
// Á¢¼Ó Ŭ¶óÀ̾ðÆ®ÀÇ IP
$ip = getenv("REMOTE_ADDR");
//°Ô½Ã¹° ÀÔ·Â
$sql = " insert into $board
( code, main_no, dep_no, title, sub1, sub2, sub3,
sub4, sub5, sub6, sub7, sub8, sub9, sub10, int_1, int_2, int_3, int_4, int_5, int_6, int_7, int_8, int_9, int_10,
name, date, view, content, passwd, email, link1, link2, link3,
file1, file2, ip, homeurl, read_only, reply_sel, cafe_url, id, char_form)
values ( '$code', $main_no, '$dep_no', '$title', '$sub1', '$sub2', '$sub3',
'$sub4', '$sub5', '$sub6', '$sub7', '$sub8', '$sub9', '$sub10', '$int_1', '$int_2', '$int_3', '$int_4', '$int_5', '$int_6', '$int_7', '$int_8', '$int_9', '$int_10',
'$name', '$date_write',0, '$content', '$passwd', '$email', '$link1', '$link2', '$link3',
'$file1_rename', '$file2_rename', '$ip', '$homeurl', '$read_only', '$reply_sel', '$cafe_url', '$id', '$char_form')";
mysql_query($sql) or dbError(mysql_error());
}
/****************
** °øÁö±Û ÀÔ·Â **
*****************/
function input_notice() {
//±Û·Î¹ú º¯¼ö ÁöÁ¤
global $code, $file1, $file1_size, $file1_name, $file2, $file2_size, $file2_name, $content, $sub1, $sub2, $sub3,
$sub4, $sub5, $sub6, $sub7, $sub8, $sub9, $sub10, $int_1, $int_2, $int_3, $int_4, $int_5, $int_6, $int_7, $int_8, $int_9, $int_10,
$title, $name, $passwd, $email,$homeurl,$read_only,$reply_sel,$board,$cafe_url,$id, $url, $link1, $link2, $link3, $char_form;
// ÇÏÀ§ ¹øÈ£°¡ AAAAAAAÀÌ¸é ¸ÞÀÎ ±Û
$dep_no = "AAAAAAA";
// °°Àº °Ô½ÃÆÇ Äڵ带 °¡Áö°í ÀÖ´Â ±Û ¹øÈ£ Áß¿¡¼ Á¦ÀÏ ³ôÀº ¹øÈ£¸¦ ±¸ÇÑ´Ù.
$query = " select main_no from $board
where code='$code'
order by main_no limit 1";
$result = mysql_query($query);
//ù °Ô½Ã¹°ÀÌ ¾Æ´Ï¸é ÇöÀç±îÁö °Ô½Ã¹°ÀÇ ÃÖ°í ³ôÀº ¹øÈ£º¸´Ù Çϳª Áõ°¡.
if ($row = mysql_fetch_array($result))
if($row[main_no]<0) //°øÁö±ÛÀÇ main_no´Â ¸¶À̳ʽºÀ̹ǷΠóÀ½¿¡ ¿Ã¶ó°£ ±ÛÀÌ °øÁö±ÛÀÌ ¾Æ´Ñ °æ¿ì¿¡ -1¸¦ ÇÏ´Â ¹®Á¦¸¦ ¸·±âÀ§ÇØ
$main_no = $row[main_no]-1;
else
$main_no = -1;
//ù °Ô½Ã¹°À̸é
else
$main_no = -1;
//¾÷·ÎµåµÈ ÆÄÀÏ Ã³¸®Çϱâ(1¹øÆÄÀÏ)
if($file1_size >0) {
list($filename,$ext) = getExt($file1_name);
$file1_name = "{$filename}$ext";
if(!is_dir("./upfile/$code")) {
exec("mkdir ./upfile/$code");
exec("chmod 777 ./upfile/$code");
}
if(!is_dir("./upfile/$code/fd_1")) {
exec("mkdir ./upfile/$code/fd_1");
exec("chmod 777 ./upfile/$code/fd_1");
}
// ÇÑ±ÛÆÄÀÏÀÇ ±úÁüÇö»óÀ» ¸·±âÀ§ÇØ À§¿¡¼ urlencodeÇÑ °ÍÀ» ´Ù½Ã urldecodeÇß´Ù.
$file1_rename = urldecode($file1_name);
// ¶ç¾î¾²±â¸¦ ÇÑ ÆÄÀÏÀº ÇÑ.¿µ ¸ðµÎ ¿Ã·ÁÁöÁö ¾ÊÀ¸¹Ç·Î °ø¹éÀ» -À¸·Î ´ëÄ¡
$file1_rename = str_replace(" ", "_", $file1_rename);
// ¸ÞÀγѹö¿Í µö³Ñ¹ö¿¡ È®ÀåÀÚ¸¦ ´õÇÏ¿© ÆÄÀϸíÀ¸·Î ÀúÀåÇÑ´Ù.
$fn = $main_no.$dep_no.$ext;
// ÆÄÀÏ º¹»ç ¹× ±ÇÇÑ ¼³Á¤
exec("cp $file1 ./upfile/$code/fd_1/$fn");
exec("chmod 666 ./upfile/$code/fd_1/$fn");
}else
$file1_name = "";
//¾÷·ÎµåµÈ ÆÄÀÏ Ã³¸®Çϱâ(2¹øÆÄÀÏ)
if($file2_size >0) {
list($filename,$ext) = getExt($file2_name);
$file2_name = "{$filename}$ext";
if(!is_dir("./upfile/$code")) {
exec("mkdir ./upfile/$code");
exec("chmod 777 ./upfile/$code");
}
if(!is_dir("./upfile/$code/fd_2")) {
exec("mkdir ./upfile/$code/fd_2");
exec("chmod 777 ./upfile/$code/fd_2");
}
// ÇÑ±ÛÆÄÀÏÀÇ ±úÁüÇö»óÀ» ¸·±âÀ§ÇØ À§¿¡¼ urlencodeÇÑ °ÍÀ» ´Ù½Ã urldecodeÇß´Ù.
$file2_rename = urldecode($file2_name);
// ¶ç¾î¾²±â¸¦ ÇÑ ÆÄÀÏÀº ÇÑ.¿µ ¸ðµÎ ¿Ã·ÁÁöÁö ¾ÊÀ¸¹Ç·Î °ø¹éÀ» -À¸·Î ´ëÄ¡
$file2_rename = str_replace(" ", "_", $file2_rename);
// ¸ÞÀγѹö¿Í µö³Ñ¹ö¿¡ È®ÀåÀÚ¸¦ ´õÇÏ¿© ÆÄÀϸíÀ¸·Î ÀúÀåÇÑ´Ù.
$fn = $main_no.$dep_no.$ext;
// ÆÄÀÏ º¹»ç ¹× ±ÇÇÑ ¼³Á¤
exec("cp $file2 ./upfile/$code/fd_2/$fn");
exec("chmod 666 ./upfile/$code/fd_2/$fn");
}else
$file2_name = "";
//ÇöÀç ³¯Â¥ ¹× ½Ã°£ ±¸Çϱâ
$date_write = date("Y/m/d H:m:s");
// Á¢¼Ó Ŭ¶óÀ̾ðÆ®ÀÇ IP
$ip = getenv("REMOTE_ADDR");
//°Ô½Ã¹° ÀÔ·Â
$sql = " insert into $board
( code, main_no, dep_no, title, sub1, sub2, sub3,
sub4, sub5, sub6, sub7, sub8, sub9, sub10, int_1, int_2, int_3, int_4, int_5, int_6, int_7, int_8, int_9, int_10,
name, date, view, content, passwd, email, link1, link2, link3,
file1, file2, ip, homeurl, read_only, reply_sel, cafe_url, id, char_form)
values ( '$code', $main_no, '$dep_no', '$title', '$sub1', '$sub2', '$sub3',
'$sub4', '$sub5', '$sub6', '$sub7', '$sub8', '$sub9', '$sub10', '$int_1', '$int_2', '$int_3', '$int_4', '$int_5', '$int_6', '$int_7', '$int_8', '$int_9', '$int_10',
'$name', '$date_write',0, '$content', '$passwd', '$email', '$link1','$link','$link3',
'$file1_rename', '$file2_rename', '$ip', '$homeurl', '$read_only', '$reply_sel', '$cafe_url', '$id', '$char_form')";
mysql_query($sql) or dbError(mysql_error());
}
/****************
** ´äº¯±Û ÀÔ·Â **
****************/
function input_reply() {
//±Û·Î¹ú º¯¼ö ÁöÁ¤
global $code, $main_no, $dep_no, $file1, $file1_size, $file1_name, $file2, $file2_size, $file2_name, $content, $url, $link1, $link2, $link3,
$title, $name, $passwd, $email, $board_title, $homeurl, $read_only, $reply_sel, $sub1, $sub2, $sub3,
$sub4, $sub5, $sub6, $sub7, $sub8, $sub9, $sub10, $int_1, $int_2, $int_3, $int_4, $int_5, $int_6, $int_7, $int_8, $int_9, $int_10,
$board,$cafe_url,$id, $char_form, $thumb_nail,$thumb_size;
//¸î¹øÂ° ´Ü°èÀÇ ´äº¯ÀÎÁö ±¸ÇÑ´Ù.
$a_size = strpos($dep_no, "A");
//¾Æ·¡ ºÎºÐ if($a_size<0)°¡ ¹®Á¦°¡ ÀÖ¾î¼ ¼öÁ¤ ÇßÀ½
// $a_size°¡ falseÀ̸é 7´Ü°è¸¦ ÃʰúÇÏ´Â ´äº¯À̹ǷΠ´õÀÌ»ó µî·ÏÀ» ÇÏÁö ¾Ê´Â´Ù
if($a_size>=6) {
echo "ÇÑ °Ô½Ã¹°¿¡ ´ëÇÑ Ãß°¡ÀûÀÎ ´äº¯Àº 6´Ü°è±îÁö¸¸ °¡´ÉÇÕ´Ï´Ù.
È®ÀÎ\n";
exit();
}
// ºÎ¸ð±Û·ÎºÎÅÍ °íÁ¤µÈ dep_no(¼ýÀںκÐ)À» ±¸ÇÑ´Ù.
$reply_dep_no = substr($dep_no,0,$a_size);
//»óÀ§ ±ÛÀÇ °ü·Ã ±ÛÁß¿¡¼ ÇÏÀ§ ¹øÈ£°¡ °¡Àå Å« °ÍÀ» ±¸ÇÑ´Ù.
$sql = " select dep_no from $board
where code='$code' and main_no = $main_no and
dep_no like '$reply_dep_no%' and dep_no <> '$dep_no'
order by dep_no limit 1";
$result = mysql_query($sql);
// ÀÌ¹Ì ´äº¯±ÛÀÌ ÀÖÀ¸¸é
if($row = mysql_fetch_array($result)) {
//ÀԷ±ÛÀÇ ÇÏÀ§ ¹øÈ£¸¦ ±¸ÇÑ´Ù.
$fixed_dep_no = substr($row[dep_no],0,$a_size+1);
if($fixed_dep_no%10==0) {
echo ("ÇÑ °Ô½Ã¹°¿¡ ´ëÇÑ ´Ü°èº° ´äº¯Àº 10°³±îÁö¸¸ °¡´ÉÇÕ´Ï´Ù.
¸ñ·ÏÀ¸·Î\n");
exit();
}else
$reply_dep_no=$fixed_dep_no-1;
// ù ´äº¯±ÛÀ̸é..
}else {
$reply_dep_no .= "9" ;
}
// »õ·Î Ãß°¡µÇ´Â ´äº¯±ÛÀÇ dep_no
$reply_dep_no = $reply_dep_no."AAAAAA";
$dep_no = substr($reply_dep_no,0,7);
//¾÷·ÎµåµÈ ÆÄÀÏ Ã³¸®Çϱâ(1¹øÆÄÀÏ)
if($file1_size >0) {
list($filename,$ext) = getExt($file1_name);
$file1_name = "{$filename}$ext";
if(!is_dir("./upfile/$code")) {
exec("mkdir ./upfile/$code");
exec("chmod 777 ./upfile/$code");
}
if(!is_dir("./upfile/$code/fd_1")) {
exec("mkdir ./upfile/$code/fd_1");
exec("chmod 777 ./upfile/$code/fd_1");
}
// ÇÑ±ÛÆÄÀÏÀÇ ±úÁüÇö»óÀ» ¸·±âÀ§ÇØ À§¿¡¼ urlencodeÇÑ °ÍÀ» ´Ù½Ã urldecodeÇß´Ù.
$file1_rename = urldecode($file1_name);
// ¶ç¾î¾²±â¸¦ ÇÑ ÆÄÀÏÀº ÇÑ.¿µ ¸ðµÎ ¿Ã·ÁÁöÁö ¾ÊÀ¸¹Ç·Î °ø¹éÀ» -À¸·Î ´ëÄ¡
$file1_rename = str_replace(" ", "_", $file1_rename);
// ¸ÞÀγѹö¿Í µö³Ñ¹ö¿¡ È®ÀåÀÚ¸¦ ´õÇÏ¿© ÆÄÀϸíÀ¸·Î ÀúÀåÇÑ´Ù.
$fn = $main_no.$dep_no.$ext;
// ÆÄÀÏ º¹»ç ¹× ±ÇÇÑ ¼³Á¤
exec("cp $file1 ./upfile/$code/fd_1/$fn");
exec("chmod 666 ./upfile/$code/fd_1/$fn");
//-----------½æ³×ÀÏ Ã³¸®½ÃÀÛ--------------
//½æ³×ÀÏÀ» ó¸®ÇϱâÀ§ÇÑ ¼Ò½º
if(file2_size<=0 and $thumb_nail==y and
($ext==".jpg" or $ext==".jpeg" or $ext==".gif" or $ext==".png")){
// ¿øº» À̹ÌÁö ÆÄÀÏ
$srcFile = "./upfile/$code/fd_1/$fn";
// Ÿ°Ù À̹ÌÁö ÆÄÀÏ
$sumFile = "./upfile/$code/fd_2/$fn";
//½æ³×ÀÏ ÆÄÀÏÀ» fd_2¿¡ ÀúÀåÇϱâÀ§ÇØ Æú´õ¸¦ ¸¸µé°í ÆÄÀÏ1ÀÇ À̸§À» ÆÄÀÏ2ÇÒ´çÇÑ´Ù.
if(!is_dir("./upfile/$code/fd_2")) {
exec("mkdir ./upfile/$code/fd_2");
exec("chmod 777 ./upfile/$code/fd_2");
}
$file2_rename = $file1_rename;
//½æ³×ÀÏ ÇÔ¼ö ºÒ·¯¿À±â
thumbnail($srcFile,$sumFile,$ext,"$thumb_size","$thumb_size");
exec("chmod 666 ./upfile/$code/fd_2/$fn");
}
//-----------½æ³×ÀÏ Ã³¸®¿Ï·á----------------
}else
$file1_name = "";
//¾÷·ÎµåµÈ ÆÄÀÏ Ã³¸®Çϱâ(2¹øÆÄÀÏ)
if($file2_size >0) {
list($filename,$ext) = getExt($file2_name);
$file2_name = "{$filename}$ext";
if(!is_dir("./upfile/$code")) {
exec("mkdir ./upfile/$code");
exec("chmod 777 ./upfile/$code");
}
if(!is_dir("./upfile/$code/fd_2")) {
exec("mkdir ./upfile/$code/fd_2");
exec("chmod 777 ./upfile/$code/fd_2");
}
// ÇÑ±ÛÆÄÀÏÀÇ ±úÁüÇö»óÀ» ¸·±âÀ§ÇØ À§¿¡¼ urlencodeÇÑ °ÍÀ» ´Ù½Ã urldecodeÇß´Ù.
$file2_rename = urldecode($file2_name);
// ¶ç¾î¾²±â¸¦ ÇÑ ÆÄÀÏÀº ÇÑ.¿µ ¸ðµÎ ¿Ã·ÁÁöÁö ¾ÊÀ¸¹Ç·Î °ø¹éÀ» -À¸·Î ´ëÄ¡
$file2_rename = str_replace(" ", "_", $file2_rename);
// ¸ÞÀγѹö¿Í µö³Ñ¹ö¿¡ È®ÀåÀÚ¸¦ ´õÇÏ¿© ÆÄÀϸíÀ¸·Î ÀúÀåÇÑ´Ù.
$fn = $main_no.$dep_no.$ext;
// ÆÄÀÏ º¹»ç ¹× ±ÇÇÑ ¼³Á¤
exec("cp $file2 ./upfile/$code/fd_2/$fn");
exec("chmod 666 ./upfile/$code/fd_2/$fn");
}else
$file2_name = "";
//³¯Â¥ ¹× ½Ã°£ ±¸Çϱâ
$date_write = date("Y/m/d H:m:s");
// Á¢¼Ó Ŭ¶óÀ̾ðÆ®ÀÇ IP
$ip = getenv("REMOTE_ADDR");
//°Ô½Ã¹° ÀÔ·Â
$sql = " insert into $board
( code, main_no, dep_no, title, sub1, sub2, sub3,
sub4, sub5, sub6, sub7, sub8, sub9, sub10, int_1, int_2, int_3, int_4, int_5, int_6, int_7, int_8, int_9, int_10,
name, date, view, content, passwd, email, link1, link2, link3,
file1, file2, ip, homeurl, read_only, reply_sel, cafe_url, id, char_form)
values ( '$code', $main_no, '$dep_no', '$title', '$sub1', '$sub2', '$sub3',
'$sub4', '$sub5', '$sub6', '$sub7', '$sub8', '$sub9', '$sub10', '$int_1', '$int_2', '$int_3', '$int_4', '$int_5', '$int_6', '$int_7', '$int_8', '$int_9', '$int_10',
'$name', '$date_write', 0, '$content','$passwd','$email', '$link1','$link2','$link3',
'$file1_rename', '$file2_rename', '$ip', '$homeurl', '$read_only', '$reply_sel', '$cafe_url', '$id', '$char_form')";
mysql_query($sql) or dbError(mysql_error());
}
/*********************
** ÀÇ°ß´Þ±â ±Û ÀÔ·Â **
**********************/
function opinion() {
global $code, $main_no, $dep_no, $file1, $file2, $content, $url, $link1, $link2, $link3,
$title, $name, $passwd, $email, $board_title, $homeurl, $sub1, $sub2, $sub3,
$sub4, $sub5, $sub6, $sub7, $sub8, $sub9, $sub10, $int_1, $int_2, $int_3, $int_4, $int_5, $int_6, $int_7, $int_8, $int_9, $int_10,
$board,$cafe_url,$id;
$sql = " select add_no from $board
where code='$code' and main_no='$main_no' and dep_no='$dep_no'
order by add_no desc limit 1";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
//add_noÀÇ °¡Àå ³ôÀº ¹øÈ£¿¡ »õ±ÛÀ» À§ÇØ 1À» ´õÇÏ¿© ´Ù½Ã ÀúÀåÇÑ´Ù.
$add_no = $row[add_no]+1;
//ÇöÀç ³¯Â¥ ¹× ½Ã°£ ±¸Çϱâ
$date_write = date("Y/m/d H:m:s");
// Á¢¼Ó Ŭ¶óÀ̾ðÆ®ÀÇ IP
$ip = getenv("REMOTE_ADDR");
//°Ô½Ã¹° ÀÔ·Â
$sql = " insert into $board
( code, main_no, dep_no, add_no, title, sub1, sub2, sub3,
sub4, sub5, sub6, sub7, sub8, sub9, sub10, int_1, int_2, int_3, int_4, int_5, int_6, int_7, int_8, int_9, int_10,
name, date, view, content, passwd, email, link1, link2, link3,
file1, file2, ip, homeurl, cafe_url, id)
values ( '$code', $main_no, '$dep_no', $add_no, '$title', '$sub1', '$sub2', '$sub3',
'$sub4', '$sub5', '$sub6', '$sub7', '$sub8', '$sub9', '$sub10', '$int_1', '$int_2', '$int_3', '$int_4', '$int_5', '$int_6', '$int_7', '$int_8', '$int_9', '$int_10',
'$name', '$date_write',0, '$content', '$passwd', '$email', '$link1','$link2','$link3',
'$file1_name', '$file2_name', '$ip', '$homeurl', '$cafe_url', '$id')";
mysql_query($sql) or dbError(mysql_error());
}
/************
** ±Û ¼öÁ¤ **
************/
function modify() {
//±Û·Î¹ú º¯¼ö ÁöÁ¤
global $code, $main_no, $dep_no, $file1, $file1_size, $file1_name, $file2, $file2_size, $file2_name, $content, $url,
$link1, $link2, $link3, $title, $name, $passwd, $email, $board_title, $homeurl, $read_only, $reply_sel, $sub1, $sub2, $sub3,
$sub4, $sub5, $sub6, $sub7, $sub8, $sub9, $sub10, $int_1, $int_2, $int_3, $int_4, $int_5, $int_6, $int_7, $int_8, $int_9, $int_10,
$board,$cafe_url, $char_form, $thumb_nail,$thumb_size;
//º¸µå Å×À̺í·Î ºÎÅÍ ÆÐ½º¿öµå,ÆÄÀϵéÀ» ºÒ·¯¿Â´Ù.
$sql = " select passwd,file1,file2 from $board ".
" where code='$code' and main_no = $main_no and dep_no ='$dep_no' and add_no=0";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
// ÆÐ½º¿öµå º¯°æ
if(strlen($passwd)>0)
$sql_passwd = ", passwd='$passwd' "; //µÚ¿¡ ÀÖ´Â ºÎºÐÀº ¾÷µ¥ÀÌÆ® ½Ã ÅëÀ¸·Î µÈ ºÎºÐÀÌ´Ù.
//¾÷·ÎµåµÈ ÆÄÀÏ Ã³¸®Çϱâ(1¹øÆÄÀÏ)
if($file1_size >0) {
list($filename,$ext) = getExt($file1_name);
$file_name = "{$filename}$ext";
//±âÁ¸ÆÄÀÏ »èÁ¦ ÇÔ¼ö
if($row[file1]){
list($filenam,$ext) = getExt($row[file1]);
$file1_action = "./upfile/$code/fd_1/$main_no$dep_no"."$ext";
if(!unlink($file1_action)) {
echo "ÆÄÀÏÀ» Áö¿î´Âµ¥ ½ÇÆÐÇß½À´Ï´Ù.
";
echo $row[file1];
exit;
}
}
// ÇÑ±ÛÆÄÀÏÀÇ ±úÁüÇö»óÀ» ¸·±âÀ§ÇØ À§¿¡¼ urlencodeÇÑ °ÍÀ» ´Ù½Ã urldecodeÇß´Ù.
$file1_rename = urldecode($file1_name);
// ¶ç¾î¾²±â¸¦ ÇÑ ÆÄÀÏÀº ÇÑ.¿µ ¸ðµÎ ¿Ã·ÁÁöÁö ¾ÊÀ¸¹Ç·Î °ø¹éÀ» -À¸·Î ´ëÄ¡
$file1_rename = str_replace(" ", "_", $file1_rename);
// ¸ÞÀγѹö¿Í µö³Ñ¹ö¿¡ È®ÀåÀÚ¸¦ ´õÇÏ¿© ÆÄÀϸíÀ¸·Î ÀúÀåÇÑ´Ù.
$fn = $main_no.$dep_no.$ext;
// ÆÄÀÏ º¹»ç ¹× ±ÇÇÑ ¼³Á¤
exec("cp $file1 ./upfile/$code/fd_1/$fn");
exec("chmod 666 ./upfile/$code/fd_1/$fn");
//-----------½æ³×ÀÏ Ã³¸®½ÃÀÛ--------------
//½æ³×ÀÏÀ» ó¸®ÇϱâÀ§ÇÑ ¼Ò½º
if(file2_size<=0 and $thumb_nail==y and
($ext==".jpg" or $ext==".jpeg" or $ext==".gif" or $ext==".png")){
//±âÁ¸ÆÄÀÏ »èÁ¦ ÇÔ¼ö
if($row[file2]){
list($filenam,$ext) = getExt($row[file2]);
$file2_action = "./upfile/$code/fd_2/$main_no$dep_no"."$ext";
if(!unlink($file2_action)) {
echo "ÆÄÀÏÀ» Áö¿î´Âµ¥ ½ÇÆÐÇß½À´Ï´Ù.
";
echo $row[file2];
exit;
}
}
$srcFile = "./upfile/$code/fd_1/$fn"; //¿øº» À̹ÌÁö ÆÄÀÏ
$sumFile = "./upfile/$code/fd_2/$fn"; //Ÿ°Ù À̹ÌÁö ÆÄÀÏ
//½æ³×ÀÏ ÆÄÀÏÀ» fd_2¿¡ ÀúÀåÇϱâÀ§ÇØ Æú´õ¸¦ ¸¸µé°í ÆÄÀÏ1ÀÇ À̸§À» ÆÄÀÏ2ÇÒ´çÇÑ´Ù.
if(!is_dir("./upfile/$code/fd_2")) {
exec("mkdir ./upfile/$code/fd_2");
exec("chmod 777 ./upfile/$code/fd_2");
}
$sql_file2 = ", file2='$file1_rename' ";//ÆÄÀÏ1ÀÇ À̸§À» ÆÄÀÏ2¿¡ ´ëÀÔÇÑ´Ù.
thumbnail($srcFile,$sumFile,$ext,"$thumb_size","$thumb_size");//½æ³×ÀÏ ÇÔ¼ö ºÒ·¯¿À±â
exec("chmod 666 ./upfile/$code/fd_2/$fn");//½æ³×ÀÏµÈ 2¹ø ÆÄÀÏÀÇ ±ÇÇÑÀ» º¯°æ
}
//-----------½æ³×ÀÏ Ã³¸®¿Ï·á----------------
}
//¾÷·ÎµåµÈ ÆÄÀÏ Ã³¸®Çϱâ(2¹øÆÄÀÏ)
if($file2_size >0) {
list($filename,$ext) = getExt($file2_name);
$file2_name = "{$filename}$ext";
//±âÁ¸ÆÄÀÏ »èÁ¦ ÇÔ¼ö
if($row[file2]){
list($filename,$ext) = getExt($row[file2]);
$file2_action = "./upfile/$code/fd_2/$main_no$dep_no"."$ext";
if(!unlink($file2_action)) {
echo "ÆÄÀÏÀ» Áö¿î´Âµ¥ ½ÇÆÐÇß½À´Ï´Ù.";
echo $row[file2];
exit;
}
}
$file2_rename = urldecode($file2_name);// ÇÑ±ÛÆÄÀÏÀÇ ±úÁüÇö»óÀ» ¸·±âÀ§ÇØ À§¿¡¼ urldecodeÇÑ °ÍÀ» ´Ù½Ã urlencodeÇß´Ù.
$file2_rename = str_replace(" ", "_", $file2_rename); // ¶ç¾î¾²±â¸¦ ÇÑ ÆÄÀÏÀº ÇÑ.¿µ ¸ðµÎ ¿Ã·ÁÁöÁö ¾ÊÀ¸¹Ç·Î °ø¹éÀ» -À¸·Î ´ëÄ¡
$fn = $main_no.$dep_no.$ext;// ¸ÞÀγѹö¿Í µö³Ñ¹ö¿¡ È®ÀåÀÚ¸¦ ´õÇÏ¿© ÆÄÀϸíÀ¸·Î ÀúÀåÇÑ´Ù.
exec("cp $file2 ./upfile/$code/fd_2/$fn");//ÆÄÀϺ¹»ç
exec("chmod 666 ./upfile/$code/fd_2/$fn");//±ÇÇѼ³Á¤
$sql_file2 = ", file2='$file2_rename' ";
}
$sql = "update $board set
name='$name', title = '$title', sub1 = '$sub1', sub2 = '$sub2', sub3 = '$sub3',
sub4='$sub4', sub5='$sub5', sub6='$sub6', sub7='$sub7', sub8='$sub8', sub9='$sub9', sub10='$sub10',
int_1='$int_1', int_2='$int_2', int_3='$int_3', int_4='$int_4', int_5='$int_5', int_6='$int_6', int_7='$int_7', int_8='$int_8', int_9='$int_9', int_10='$int_10',
content = '$content', email= '$email', homeurl= '$homeurl' $sql_passwd $sql_file1 $sql_file2, read_only='$read_only',
reply_sel='$reply_sel', link1 = '$link1', link2 = '$link2', link3 = '$link3', char_form='$char_form'
where code = '$code' and
main_no = $main_no and
dep_no = '$dep_no' and
add_no = 0";
mysql_query($sql) or dbError(mysql_error());
}
/*********************
** ÀÇ°ß´Þ±â ±Û ¼öÁ¤ **
**********************/
function opp_modify() {
//±Û·Î¹ú º¯¼ö ÁöÁ¤
global $code, $main_no, $dep_no, $add_no, $content, $url,
$link1, $link2, $link3, $title, $name, $passwd, $email, $board_title, $homeurl, $read_only, $reply_sel, $sub1, $sub2, $sub3,
$sub4, $sub5, $sub6, $sub7, $sub8, $sub9, $sub10, $int_1, $int_2, $int_3, $int_4, $int_5, $int_6, $int_7, $int_8, $int_9, $int_10,
$board,$cafe_url, $char_form, $thumb_nail,$thumb_size;
$sql = "update $board set
name='$name', title = '$title', sub1 = '$sub1', sub2 = '$sub2', sub3 = '$sub3',
sub4='$sub4', sub5='$sub5', sub6='$sub6', sub7='$sub7', sub8='$sub8', sub9='$sub9', sub10='$sub10',
int_1='$int_1', int_2='$int_2', int_3='$int_3', int_4='$int_4', int_5='$int_5', int_6='$int_6', int_7='$int_7', int_8='$int_8', int_9='$int_9', int_10='$int_10',
content = '$content', email= '$email', homeurl= '$homeurl' $sql_passwd $sql_file1 $sql_file2, read_only='$read_only',
reply_sel='$reply_sel', link1 = '$link1', link2 = '$link2', link3 = '$link3', char_form='$char_form'
where code = '$code' and
main_no = $main_no and
dep_no = '$dep_no' and
add_no = $add_no";
mysql_query($sql) or dbError(mysql_error());
}
/***********
** ±Û»èÁ¦ **
***********/
function del() {
//±Û·Î¹ú º¯¼ö ÁöÁ¤
global $link_url, $code, $main_no, $dep_no, $passwd, $email,
$keyword, $board_title, $admin_pwd, $mode, $homeurl, $read_only,$board,$cafe_url;
if (!($passwd) ) {
$sub_title = "±Û»èÁ¦ ";
$sub_action = "../../system/save.html";
$sub_comment ="";
error($sub_title,$sub_action,$sub_comment);
exit();
} else {
//º¸µå Å×À̺í·Î ºÎÅÍ ÆÐ½º¿öµå,ÆÄÀϵéÀ» ºÒ·¯¿Â´Ù.
$sql = " select passwd,file1,file2 from $board ".
" where code='$code' and main_no = $main_no and dep_no ='$dep_no' and add_no=0";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
if($admin_pwd==$passwd) $check = true;
else {
if($passwd==$row[passwd])
$check = true;
}
// ÆÐ½º¿öµå°¡ ¸ÂÀ¸¸é
if($check) {
//Å×ÀÌºí¿¡¼ ÀÚ·á »èÁ¦
$sql = "delete from $board
where code='$code' and
main_no=$main_no and
dep_no='$dep_no'";
$result = mysql_query($sql) or dbError(mysql_error());
//ÆÄÀÏ »èÁ¦ ÇÔ¼ö
file_del($row,$code,$main_no,$dep_no);
//÷ºÎÆÄÀÏ Á¦°Å(¼¹ö¿¡¼ ¹®Á¦¸¦ ¹æÁöÇϱâÀ§ÇØ ÆÄÀÏ ¸®´ª½º »èÁ¦ ¸í·É¾î¸¦ ¸·À¸¸é À§¿¡ °ÍÀ¸·Î »ç¿ë)
//exec("rm -rf ./upfile/$code/fd_1/$main_no$dep_no"."*");
//exec("rm -rf ./upfile/$code/fd_2/$main_no$dep_no"."*");
}else {
$sub_title = "±Û»èÁ¦ ";
$sub_action = "../../system/save.html";
$sub_comment = "ÆÐ½º¿öµå°¡ Ʋ¸³´Ï´Ù.";
error($sub_title,$sub_action,$sub_comment);
exit();
}
}
}
/*********************
** ´ÙÁß¼±Åà ±Û»èÁ¦ **
*********************/
function del_all() {
//±Û·Î¹ú º¯¼ö ÁöÁ¤
global $link_url, $code, $main_no, $dep_no, $passwd, $email, $keyword, $board_title, $admin_pwd, $mode, $homeurl, $checkup,$board,$cafe_url;
if($admin_pwd==$passwd) $check = true;
// ÆÐ½º¿öµå°¡ ¸ÂÀ¸¸é
if($check) {
for($i = 0; $i < sizeof($checkup); $i++) {
$length = strlen($checkup[$i]);
$main_no = substr($checkup[$i], 0, $length-7);
$dep_no = substr($checkup[$i], $length-7);
//º¸µå Å×À̺í·Î ºÎÅÍ ÆÐ½º¿öµå,ÆÄÀϵéÀ» ºÒ·¯¿Â´Ù.
$sql = " select passwd,file1,file2 from $board ".
" where code='$code' and main_no = $main_no and dep_no ='$dep_no' and add_no=0";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$sql = "delete from $board
where code='$code' and
main_no=$main_no and
dep_no='$dep_no'";
$result = mysql_query($sql) or dbError(mysql_error());
//ÆÄÀÏ »èÁ¦ ÇÔ¼ö
file_del($row,$code,$main_no,$dep_no);
//÷ºÎÆÄÀÏ Á¦°Å(¼¹ö°¡ ¸·Áö ¾ÊÀ¸¸é À °Æº¸´Ù È¿À²ÀûÀÌ´Ù)
//exec("rm -rf ./upfile/$code/fd_1/$main_no$dep_no"."*");
//exec("rm -rf ./upfile/$code/fd_2/$main_no$dep_no"."*");
}
}else {
echo "ÆÐ½º¿öµå°¡ Ʋ·È¾î¿À[È®ÀÎ]";
exit();
}
}
/********************
** Àǰߴޱ⠱ۻèÁ¦ **
*********************/
function add_del() {
//±Û·Î¹ú º¯¼ö ÁöÁ¤
global $link_url, $code, $main_no, $dep_no, $add_no, $admin_pwd, $passwd,$board,$cafe_url,$jump_id,$jump_name;
if (!($passwd) ) {
$sub_title = "Àǰ߱ۻèÁ¦ ";
$sub_action = "../../system/save.html";
$sub_comment ="";
error($sub_title,$sub_action,$sub_comment);
exit();
} else {
if($admin_pwd==$passwd) $check = true;
else {
$sql = " select passwd from $board ".
" where code='$code' and main_no = $main_no and dep_no ='$dep_no' and add_no =$add_no";
$result = mysql_query($sql);
if($row = mysql_fetch_array($result))
if($passwd==$row[passwd])
$check = true;
}
// ÆÐ½º¿öµå°¡ ¸ÂÀ¸¸é
if($check) {
$sql = "delete from $board
where code='$code' and
main_no=$main_no and
dep_no='$dep_no' and
add_no=$add_no";
$result = mysql_query($sql) or dbError(mysql_error());
}else {
$sub_title = "Àǰ߱ۻèÁ¦ ";
$sub_action = "../../system/save.html";
$sub_comment = "ÆÐ½º¿öµå°¡ Ʋ¸³´Ï´Ù.";
error($sub_title,$sub_action,$sub_comment);
exit();
}
}
}
/******************
** ÅõÇ¥ ¾÷µ¥ÀÌÆ® **
*******************/
function vote() {
//±Û·Î¹ú º¯¼ö ÁöÁ¤
global $code, $main_no, $dep_no, $passwd, $vote,$board,$cafe_url;
$sql = "update $board set vote = vote+1
where code='$code' and main_no=$main_no and dep_no='$dep_no' and add_no=0";
mysql_query($sql);
echo mysql_error();
}
// ========================================================= °¢Á¾ ÇÔ¼ö ¼±¾ð
//°Ô½ÃÆÇ DB¿¬°á
include('../manager/inc_db.html');
include('./inc_board.html');
//°Ë»ö¾î¸¦ urlencodingÇÑ´Ù.
$keyword = urlencode($keyword);
$id=$HTTP_COOKIE_VARS["doori_id"];
//mode¿¡ µû¶ó Á¤ÇØÁø ÇÔ¼ö¸¦ È£ÃâÇÏ°í »óȲ¿¡ µû¶ó ÀÛ¾÷ÈÄ À̵¿ÇÒ º¯¼öµéÀ» ´Þ¸®ÇØ ³Ö¾ú´Ù.
Switch ($mode) {
//»õ ±ÛÀÎ ÀÔ·Â ...
case "new":
//½ºÆè±Û Â÷´ÜÀ» À§ÇØ ·Î±×ÀÎ ÈÄ¿¡ »ý±â´Â ÄíŰº¯¼ö¸¦ äũÇßÀ½
if(strlen($HTTP_COOKIE_VARS["spam"]) >0) input_new();
//»õ±ÛÀ» ¾²°í ±Û¾´ÀÌÀÇ À̸§À» 6°³¿ù°£ Ŭ¶óÀÌ¾ðÆ®¿¡ ÀúÀåÇØ¼ ´ÙÀ½ ±ÛÀ» ¾µ¶§ Write.html¿¡¼ ºÒ·¯¾¸
header('P3P: CP="NOI CURa ADMa DEVa TAIa OUR DELa BUS IND PHY ONL UNI COM NAV INT DEM PRE"');
SetCookie("write_name",$name,time()+15552000,"/");
//ÀÛ¾÷ ÈÄ À̵¿ÇÒ ÆäÀÌÁö
$url = "../pages/$link_url/page.html?code=$code&link_url=$link_url&ftype=$ftype&keyword=$keyword&cafe_url=$cafe_url&mm=$mm&year=$year";
break;
//°øÁö ±ÛÀÎ ÀÔ·Â ...
case "notice":
//½ºÆè±Û Â÷´ÜÀ» À§ÇØ ·Î±×ÀÎ ÈÄ¿¡ »ý±â´Â ÄíŰº¯¼ö¸¦ äũÇßÀ½
if(strlen($HTTP_COOKIE_VARS["spam"]) >0) input_notice();
//»õ±ÛÀ» ¾²°í ±Û¾´ÀÌÀÇ À̸§À» 1ÁÖÀϰ£ Ŭ¶óÀÌ¾ðÆ®¿¡ ÀúÀåÇØ¼ ´ÙÀ½ ±ÛÀ» ¾µ¶§ Write.html¿¡¼ ºÒ·¯¾¸
header('P3P: CP="NOI CURa ADMa DEVa TAIa OUR DELa BUS IND PHY ONL UNI COM NAV INT DEM PRE"');
SetCookie("write_name",$name,time()+15552000,"/");
//ÀÛ¾÷ ÈÄ À̵¿ÇÒ ÆäÀÌÁö
$url = "../pages/$link_url/page.html?code=$code&link_url=$link_url&ftype=$ftype&keyword=$keyword&cafe_url=$cafe_url";
break;
//´äº¯±Û ÀÔ·Â ...
case "reply":
input_reply();
//ºÎ¸ð±Û¿¡ ´ëÇØ ¸ÞÀÏ º¸³»±â
if($rep_sel=="y")
include("./reply_mail.php");
//´äº¯±ÛÀ» ¾²°í ±Û¾´ÀÌÀÇ À̸§À» 6°³¿ù°£ Ŭ¶óÀÌ¾ðÆ®¿¡ ÀúÀåÇØ¼ ´ÙÀ½ ±ÛÀ» ¾µ¶§ Write.html¿¡¼ ºÒ·¯¾¸
header('P3P: CP="NOI CURa ADMa DEVa TAIa OUR DELa BUS IND PHY ONL UNI COM NAV INT DEM PRE"');
SetCookie("write_name",$name,time()+15552000,"/");
//ÀÛ¾÷ ÈÄ À̵¿ÇÒ ÆäÀÌÁö
$url = "../pages/$link_url/page.html?code=$code&page=$page&link_url=$link_url&ftype=$ftype&keyword=$keyword&main_no=$main_no&dep_no=$dep_no&no=$no&cafe_url=$cafe_url&read_pass=a";
break;
//Àǰߴޱâ ÀÔ·Â
case "opp":
opinion();
//Àǰߴޱ⸦ ¾²°í ±Û¾´ÀÌÀÇ À̸§À» 6°³¿ù°£ Ŭ¶óÀÌ¾ðÆ®¿¡ ÀúÀåÇØ¼ ´ÙÀ½ ±ÛÀ» ¾µ¶§ Write.html¿¡¼ ºÒ·¯¾¸
header('P3P: CP="NOI CURa ADMa DEVa TAIa OUR DELa BUS IND PHY ONL UNI COM NAV INT DEM PRE"');
SetCookie("write_name",$name,time()+15552000,"/");
//ÀÛ¾÷ ÈÄ À̵¿ÇÒ ÆäÀÌÁö
if($opp==opp)
$url = "../pages/$link_url/view.html?code=$code&page=$page&link_url=$link_url&ftype=$ftype&keyword=$keyword&main_no=$main_no&dep_no=$dep_no&read_pass=a&no=$no&cafe_url=$cafe_url&jump_id=$jump_id&jump_name=$jump_name&mm=$mm&year=$year";
else
$url = "../pages/$link_url/page.html?code=$code&page=$page&link_url=$link_url&ftype=$ftype&keyword=$keyword&main_no=$main_no&dep_no=$dep_no&read_pass=a&no=$no&cafe_url=$cafe_url&jump_id=$jump_id&jump_name=$jump_name&mm=$mm&year=$year";
break;
//±Û »èÁ¦ ±ÛÀÎ °æ¿ì ...
case "del":
del();
//ÀÛ¾÷ ÈÄ À̵¿ÇÒ ÆäÀÌÁö
$url = "../pages/$link_url/page.html?code=$code&page=$page&link_url=$link_url&ftype=$ftype&keyword=$keyword&cafe_url=$cafe_url&mm=$mm&year=$year";
break;
//´ÙÁß¼±Åà ±Û »èÁ¦ ±ÛÀÎ °æ¿ì ...
case "del_all":
del_all();
//ÀÛ¾÷ ÈÄ À̵¿ÇÒ ÆäÀÌÁö
$url = "../pages/$link_url/page.html?code=$code&page=$page&link_url=$link_url&ftype=$ftype&keyword=$keyword&cafe_url=$cafe_url";
break;
//Àǰߴޱ⠻èÁ¦ÀÎ °æ¿ì ...
case "add_del":
add_del();
//ÀÛ¾÷ ÈÄ À̵¿ÇÒ ÆäÀÌÁö
if($opp==opp)
$url = "../pages/$link_url/view.html?code=$code&page=$page&link_url=$link_url&ftype=$ftype&keyword=$keyword&main_no=$main_no&dep_no=$dep_no&no=$no&cafe_url=$cafe_url&jump_id=$jump_id&jump_name=$jump_name&mm=$mm&year=$year";
else
$url = "../pages/$link_url/page.html?code=$code&page=$page&link_url=$link_url&ftype=$ftype&keyword=$keyword&main_no=$main_no&dep_no=$dep_no&no=$no&cafe_url=$cafe_url&jump_id=$jump_id&jump_name=$jump_name&mm=$mm&year=$year";
break;
//±Û ¼öÁ¤ÀÎ °æ¿ì ...
case "modify":
modify();
//±Û¼öÁ¤ ÈÄ ±Û¾´ÀÌÀÇ À̸§À» 6°³¿ù°£ Ŭ¶óÀÌ¾ðÆ®¿¡ ÀúÀåÇØ¼ ´ÙÀ½ ±ÛÀ» ¾µ¶§ Write.html¿¡¼ ºÒ·¯¾¸
header('P3P: CP="NOI CURa ADMa DEVa TAIa OUR DELa BUS IND PHY ONL UNI COM NAV INT DEM PRE"');
SetCookie("write_name",$name,time()+15552000,"/");
//ÀÛ¾÷ ÈÄ À̵¿ÇÒ ÆäÀÌÁö
$url = "../pages/$link_url/page.html?code=$code&page=$page&link_url=$link_url&ftype=$ftype&keyword=$keyword&main_no=$main_no&dep_no=$dep_no&no=$no&cafe_url=$cafe_url&read_pass=a&mm=$mm&year=$year";
break;
//ÀÇ°ß´Þ±â ±Û ¼öÁ¤ÀÎ °æ¿ì ...
case "opp_modify":
opp_modify();
//±Û¼öÁ¤ ÈÄ ±Û¾´ÀÌÀÇ À̸§À» 6°³¿ù°£ Ŭ¶óÀÌ¾ðÆ®¿¡ ÀúÀåÇØ¼ ´ÙÀ½ ±ÛÀ» ¾µ¶§ Write.html¿¡¼ ºÒ·¯¾¸
header('P3P: CP="NOI CURa ADMa DEVa TAIa OUR DELa BUS IND PHY ONL UNI COM NAV INT DEM PRE"');
SetCookie("write_name",$name,time()+15552000,"/");
//ÀÛ¾÷ ÈÄ À̵¿ÇÒ ÆäÀÌÁö
$url = "../pages/$link_url/page.html?code=$code&page=$page&link_url=$link_url&ftype=$ftype&keyword=$keyword&main_no=$main_no&dep_no=$dep_no&no=$no&cafe_url=$cafe_url&read_pass=a&mm=$mm&year=$year";
break;
//ÅõÇ¥(Ãßõ)ÀÎ °æ¿ì...
case "vote":
vote();
//ÅõÇ¥ÈÄ¿¡ 6°³¿ù°£ Ŭ¶óÀÌ¾ðÆ®¿¡ ÀúÀåÇØ¼ Áߺ¹ÅõÇ¥¸¦ ¸·±âÀ§ÇØ Äí۸¦ ¹ß¼ÛÇÑ´Ù.
header('P3P: CP="NOI CURa ADMa DEVa TAIa OUR DELa BUS IND PHY ONL UNI COM NAV INT DEM PRE"');
$vote_cook = $code.$main_no.$dep_no;
SetCookie("$vote_cook",vote,0,"/");
//ÀÛ¾÷ ÈÄ À̵¿ÇÒ ÆäÀÌÁö
$url = "../pages/$link_url/page.html?code=$code&page=$page&link_url=$link_url&ftype=$ftype&keyword=$keyword&main_no=$main_no&dep_no=$dep_no&no=$no&cafe_url=$cafe_url";
break;
}
?>
ÀÔ·Â Áß