$g4_path = "../../.."; // common.php ÀÇ »ó´ë °æ·Î
include_once("$g4_path/common.php");
if ($is_admin != "super")
alert("ÃÖ°í°ü¸®ÀÚ·Î ·Î±×ÀÎÇϼ¼¿ä", "$g4[bbs_path]/login.php?url=".urlencode($_SERVER[PHP_SELF]));
@mkdir("$g4[path]/data/item", 0707);
@chmod("$g4[path]/data/item", 0707);
//°æ°íâÈÄ ÀÌÀü ÆäÀÌÁö·Î µ¹¾Æ°¥¶§ ÀÌÀü°ªÀúÀå
set_cookie("wdir", $wdir, time() + 86400*31);
set_cookie("ca_id", $ca_id, time() + 86400*31);
set_cookie("it_id", $it_id, time() + 86400*31);
set_cookie("it_stock_qty", $it_stock_qty, time() + 86400*31);
$dir = dir($wdir);
if($dir) {
function get_dir($dir)
{
$size = 0;
$d = dir($wdir);
while ($entry = $d->read()) {
if ($entry != "." && $entry != "..") {
$size += filesize("$dir/$entry");
}
}
$d->close();
return $size;
}
if(get_dirsize($wdir)<=0){
echo "";
goto_url("file_up.php");
}else{
while (false !== ($entry = $dir->read()))
{
if ($entry != "." && $entry != "..")
{
$filename = explode('.', $entry);
if((preg_match("/($config[cf_image_extension])/", strtolower($filename[1]))))
{
$temp_filename = explode('.', $entry);
if((preg_match("/($config[cf_image_extension])/", strtolower($temp_filename[1]))))
{
$upfile=$entry;
$bf_file = "$it_id";
$sql = " select * from $g4[yc4_item_table] where it_id = '$bf_file' ";
$row = sql_fetch($sql);
if ($row[it_id] == "$bf_file"){
echo "";
goto_url("file_up.php");
}else{
$sql = " insert into $g4[yc4_item_table]
set it_id = '$it_id',
ca_id = '$ca_id',
ca_id2 = '',
ca_id3 = '',
it_name = '$it_id',
it_gallery = '0',
it_maker = '',
it_origin = '',
it_opt1_subject = '',
it_opt2_subject = '',
it_opt3_subject = '',
it_opt4_subject = '',
it_opt5_subject = '',
it_opt6_subject = '',
it_opt1 = '',
it_opt2 = '',
it_opt3 = '',
it_opt4 = '',
it_opt5 = '',
it_opt6 = '',
it_type1 = '0',
it_type2 = '0',
it_type3 = '0',
it_type4 = '0',
it_type5 = '0',
it_basic = '',
it_explan = '',
it_explan_html = '1',
it_cust_amount = '0',
it_amount = '0',
it_amount2 = '0',
it_amount3 = '0',
it_point = '0',
it_sell_email = '',
it_use = '1',
it_stock_qty = '$it_stock_qty',
it_head_html = '',
it_tail_html = '',
it_time = '$g4[time_ymdhis]',
it_ip = '$_SERVER[REMOTE_ADDR]',
it_order = '0',
it_tel_inq = ''
";
sql_query($sql);
}
$bf_file = "$it_id";
$dest_file = "$g4[path]/data/item/" . $bf_file;
$dest_file2 = "$g4[path]/data/item/" . $bf_file . "_l1";
copy("$wdir/$upfile", $dest_file2);
unlink("$wdir/$upfile");
// À̹ÌÁö(´ë)¸¸ ¾÷·ÎµåÇϰí ÀÚµ¿»ý¼º üũÀÏ °æ¿ì À̹ÌÁö(Áß,¼Ò) ÀÚµ¿»ý¼º
$image = "$dest_file2";
$size = getimagesize($image);
$src = @imagecreatefromjpeg($image);
if (!$src)
{
echo "";
}
else
{
// gd ¹öÀü¿¡ µû¶ó
if (imagecopyresampled) {
// À̹ÌÁö(¼Ò) »ý¼º
$dst = imagecreatetruecolor($default[de_simg_width], $default[de_simg_height]);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $default[de_simg_width], $default[de_simg_height], $size[0], $size[1]);
} else {
// À̹ÌÁö(¼Ò) »ý¼º
$dst = imagecreate($default[de_simg_width], $default[de_simg_height]);
imagecopyresized($dst, $src, 0, 0, 0, 0, $default[de_simg_width], $default[de_simg_height], $size[0], $size[1]);
}
imagejpeg($dst, "$g4[path]/data/item/$bf_file"."_s", 90);
if (imagecopyresampled) {
// À̹ÌÁö(Áß) »ý¼º
$dst = imagecreatetruecolor($default[de_mimg_width], $default[de_mimg_height]);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $default[de_mimg_width], $default[de_mimg_height], $size[0], $size[1]);
} else {
// À̹ÌÁö(Áß) »ý¼º
$dst = imagecreate($default[de_mimg_width], $default[de_mimg_height]);
imagecopyresized($dst, $src, 0, 0, 0, 0, $default[de_mimg_width], $default[de_mimg_height], $size[0], $size[1]);
}
@imagejpeg($dst, "$g4[path]/data/item/$bf_file"."_m", 90);
}
$gul =preg_replace('/0*(\d+)/', '', $it_id) ;
$number = preg_replace("/[^\d]/","",$it_id);
$n = strlen($number);
$counts = $number+1;
$it_id= sprintf( "%0".$n."d", $counts );
$it_id = "$gul$it_id";
// ÀÛ¾÷¿Ï·áÈÄ ÀÌÀüÆäÀÌÁö·Î °¬À»¶§ ÃÖÁ¾ ÀúÀåµÈ °ªÀ» º¸¿©ÁÜ
set_cookie("wdir", $wdir, time() + 86400*31);
set_cookie("ca_id", $ca_id, time() + 86400*31);
set_cookie("it_id", $it_id, time() + 86400*31);
set_cookie("it_stock_qty", $it_stock_qty, time() + 86400*31);
}
}else{
echo "";
goto_url("file_up.php");
}
}
}
$dir->close();
echo "";
goto_url("file_up.php");
}
}
else {
echo "";
}
//echo "";
goto_url("file_up.php");
?>