//*** 定義
$file_name = "../system/data/mook.dat";
$image_dir = "./image/";
$thumb_dir = "./thumb/";
// 出力する本
$mid = $_REQUEST['mid'];
//*** ファイル読み込み
if (! $file = fopen($file_name, "r")) {
echo "
該当するMookがありません。
";
}
flock($file, LOCK_SH);
$now = time();
$id = 0;
while (!feof($file)) {
$line = fgets($file);
$line = ereg_replace("\r|\n","",$line);
$line = mb_convert_encoding($line,"sjis","ASCII,JIS,UTF-8,EUC-JP,SJIS");
$data[$id] = split('<>', $line);
// タグ成形
if ($data[$id][0] == $mid) {
$data_time = explode (",", $data[$id][1]);
if ($data[$id][2] == 'on' || $now < $data_time[0]) {
echo "
該当するMookがありません。
";
break;
}
$mook_title = $data[$id][3];
$copy = $data[$id][5];
$summary = $data[$id][6];
$detail = $data[$id][7];
if ($detail != '') {
$detail_tag = "
■Index
$detail";
}
$price = $data[$id][8];
if ($price != '') {
$price_tag = "
■価格
$price";
}
$coverimg_thumb = $thumb_dir . 'coverimg_' . $data[$id][0] . '_thumb.jpg';
$coverimg = $image_dir . 'coverimg_' . $data[$id][0] . '.jpg';
if (file_exists($coverimg_thumb)) {
$coverimg_tag = '

';
}
else if (file_exists($coverimg)) {
$coverimg_tag = '

';
}
$img1_file = $image_dir . 'img1_' . $data[$id][0] . '.jpg';
$img1_thumb_file = $thumb_dir . 'img1_' . $data[$id][0] . '_thumb.jpg';
if (file_exists($img1_file) && file_exists($img1_thumb_file)) {
$img1_tag = '

【拡大画像】';
}
else if (file_exists($img1_file)) {
$img1_tag = '

';
}
else {
$img1_tag = '';
}
$img2_file = $image_dir . 'img2_' . $data[$id][0] . '.jpg';
$img2_thumb_file = $thumb_dir . 'img2_' . $data[$id][0] . '_thumb.jpg';
if (file_exists($img2_file) && file_exists($img2_thumb_file)) {
$img2_tag = '

【拡大画像】';
}
else if (file_exists($img2_file)) {
$img2_tag = '

';
}
else {
$img2_tag = '';
}
$img_tag = '';
if ($img1_tag != '' || $img2_tag != '') {
$img_tag .= '
';
if ($img1_tag != '') {
$img_tag .= '- ' . $img1_tag . '
';
}
if ($img2_tag != '') {
$img_tag .= '- ' . $img2_tag . '
';
}
$img_tag .= '
';
}?>
break;
}
$id++;
}
flock($file, LOCK_UN);
fclose($file);
if ($id >= count($data)) {
echo "
該当するMookがありません。
";
}
?>