示例#1
0
			<p class="menu">Menu:</p>
			<ul>
				<li id="1"class="tab1off">本棚</li>
				<li id="2"class="tab2on">登録</li>
				<li id="3"class="tab3off">検索</li>
				<li id="4"class="tab4off">一覧</li>
				<li id="5"class="tab5off">貸出中</li>
				<li id="6"class="tab6off">借入中</li>
				<li id="7"class="tab7off">アプリ</li>
				<li id="8"class="tab8off">色々</li>
			</ul>
		</div>

		<?php 
if (isset($_GET['aname']) == 0 || $_GET['aname'] == null || $_GET['pg'] == 0 || $_GET['pg'] == null) {
    echo "\t<div id=\"box22\"class=\"contents\" style='height:50px'>\n\t\t\t\t\t\t\t\t\t\t<div style='width:32px;height:32px; float:left; margin-left:60px; background-image:url(../../hantei/failed.png);'></div><div style='margin-left:100px; margin-top:8px'>404 not found.</div></div>";
} else {
    require_once '../../amazon/amazon_s.php';
    $api = new MyAmazon(array('access_key_id' => '', 'secret_access_key' => '', 'associate_tag' => 'ryoheipro-22'));
    //$keyword = 'java';
    $author = $_GET['aname'];
    $page = $_GET['pg'];
    $url = $api->ItemSearch(array('ResponseGroup' => 'Medium', 'SearchIndex' => 'Books', 'Author' => $author, 'ItemPage' => $page));
    $result = $api->request($url);
    $json = json_encode($result);
    //		echo $json;
    echo "\t<div id=\"box22\"class=\"contents\">\n\t\t\t<p class=\"each_regi\">著者名から登録</p>\n\t\t\t<script>\n\t\t\t\tvar json = " . $json . ";\n\t\t\t\tvar page = " . $page . ";\n\t\t\t\tvar item = json.Items.Item;\n\t\t\t\tdocument.write (\"<div id='results_num'>\");\n\t\t\t\tdocument.write (\"<p style='font-size:11px'>total page: \"+json.Items.TotalPages+\"</p>\");\n\t\t\t\tdocument.write (\"<p style='font-size:11px'>total results: \"+json.Items.TotalResults+\"</p>\");\n\t\t\t\tdocument.write (\"</div><br>\");\n\n\t\t\t\tif(page == 1){\n\t\t\t\t\tif(json.Items.TotalPages != 1 && json.Items.TotalPages != 0){\n\t\t\t\t\t\tdocument.write (\"<ul class='pageNav'>\");\n\t\t\t\t\t\tdocument.write (\"<li style='margin-left:488px'><a href='./?pg=\"+ (page+1) +\"&aname=" . $author . "'>次の10冊 &raquo;</a></li>\");\n\t\t\t\t\t\tdocument.write (\"</ul>\");\n\t\t\t\t\t}\n\t\t\t\t}else if(page < Math.min(5,json.Items.TotalPages) && page > 1){\n\t\t\t\t\tdocument.write (\"<ul class='pageNav'>\");\n\t\t\t\t\tdocument.write (\"<li><a href='./?pg=\"+ (page-1) +\"&aname=" . $author . "'>&laquo; 前の10冊</a></li>\");\n\t\t\t\t\tdocument.write (\"<li style='margin-left:400px'><a href='./?pg=\"+ (page+1) +\"&aname=" . $author . "'>次の10冊 &raquo;</a></li>\");\n\t\t\t\t\tdocument.write (\"</ul>\");\n\t\t\t\t}else if(page == Math.min(5,json.Items.TotalPages)){\n\t\t\t\t\tdocument.write (\"<ul class='pageNav'>\");\n\t\t\t\t\tdocument.write (\"<li><a href='./?pg=\"+ (page-1) +\"&aname=" . $author . "'>&laquo; 前の10冊</a></li>\");\n\t\t\t\t\tdocument.write (\"</ul>\");\n\t\t\t\t}else{\n\t\t\t\t\tdocument.write(\"<p>不正なアクセスです。</p>\");\n\t\t\t\t}\n\n\t\t\t\tdocument.write (\"<div id='aname_search_results'>\");\t\t\t\t\n\t\t\t\tif(item.length){\n\t\t\t\t\tfor(var i=0;i<item.length;i++){\n\t\t\t\t\t\tif(item[i].ImageSets == null){\n\t\t\t\t\t\t\tvar image_m = '../../material/no_image_m.png';\n\t\t\t\t\t\t\tvar image_s = '../../material/no_image_s.png';\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tvar imageset = item[i].ImageSets.ImageSet;\n\t\t\t\t\t\t\tif (imageset.length) imageset = imageset[0];\n\t\t\t\t\t\t\tvar image_m = imageset.MediumImage.URL;\n\t\t\t\t\t\t\tvar image_s = imageset.SmallImage.URL;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdocument.write (\"<div class='each_b_result'>\");\n\t\t\t\t\t\tdocument.write (\"<div class='b_image'><a href='\"+ item[i].DetailPageURL +\"'><img src='\" + image_m + \"' title='book\"+(i+1)+\"'></a></div>\");\n\t\t\t\t\t\tdocument.write (\"<div class='b_contents'><table><tr><th>ISBN: </th><td>\" + item[i].ItemAttributes.EAN + \"</td></tr>\");\n\t\t\t\t\t\tdocument.write (\"<tr><th>書名: </th><td>\" + item[i].ItemAttributes.Title + \"</td></tr>\");\n\t\t\t\t\t\tdocument.write (\"<tr><th>出版日: </th><td>\" + item[i].ItemAttributes.PublicationDate + \"</td></tr>\");\n\t\t\t\t\t\tdocument.write (\"<tr><th>著者: </th><td>\" + item[i].ItemAttributes.Author + \"</td></tr>\");\n\t\t\t\t\t\tdocument.write (\"<tr><th>出版社: </th><td>\" + item[i].ItemAttributes.Publisher + \"</td></tr>\");\n\t\t\t\t\t\tdocument.write (\"</table><p><a href=' \" + item[i].DetailPageURL + \"'>Amazon URL</a></p></div>\");\n\t\t\t\t\t\tdocument.write (\"<div class='b_register'>\\\n\t\t\t\t\t\t\t<form action='../confirm/'' method='post'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='url' value='\"+ item[i].DetailPageURL +\"'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='image_m' value='\"+ image_m +\"'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='image_s' value='\"+ image_s +\"'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='isbn' value='\"+ item[i].ItemAttributes.EAN +\"'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='bname' value='\"+ item[i].ItemAttributes.Title +\"'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='pdate' value='\"+ item[i].ItemAttributes.PublicationDate +\"'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='author' value='\"+ item[i].ItemAttributes.Author +\"'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='publisher' value='\"+ item[i].ItemAttributes.Publisher +\"'>\\\n\t\t\t\t\t\t\t\t<input type='submit' value='登録する'></form>\\\n\t\t\t\t\t\t\t\t</div>\");\n\t\t\t\t\t\tdocument.write (\"</div><br>\");\n\t\t\t\t\t}\n\t\t\t\t}else {\n\t\t\t\t\t\tif(item.ImageSets == null){\n\t\t\t\t\t\t\tvar image_m = '../../material/no_image_m.png';\n\t\t\t\t\t\t\tvar image_s = '../../material/no_image_s.png';\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tvar imageset = item.ImageSets.ImageSet;\n\t\t\t\t\t\t\tif (imageset.length) imageset = imageset[0];\n\t\t\t\t\t\t\tvar image_m = imageset.MediumImage.URL;\n\t\t\t\t\t\t\tvar image_s = imageset.SmallImage.URL;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdocument.write (\"<div class='b_image'><a href='\"+ item.DetailPageURL +\"'><img src='\" + image_m + \"' title='book1'></a></div>\");\n\t\t\t\t\t\tdocument.write (\"<div class='b_contents'><table><tr><th>ISBN: </th><td>\" + item.ItemAttributes.EAN + \"</td></tr>\");\n\t\t\t\t\t\tdocument.write (\"<tr><th>書名: </th><td>\" + item.ItemAttributes.Title + \"</td></tr>\");\n\t\t\t\t\t\tdocument.write (\"<tr><th>出版日: </th><td>\" + item.ItemAttributes.PublicationDate + \"</td></tr>\");\n\t\t\t\t\t\tdocument.write (\"<tr><th>著者: </th><td>\" + item.ItemAttributes.Author + \"</td></tr>\");\n\t\t\t\t\t\tdocument.write (\"<tr><th>出版社: </th><td>\" + item.ItemAttributes.Publisher + \"</td></tr>\");\n\t\t\t\t\t\tdocument.write (\"</table><p><a href=' \" + item.DetailPageURL + \"'>Amazon URL</a></p></div>\");\n\t\t\t\t\t\tdocument.write (\"<div class='b_register'>\\\n\t\t\t\t\t\t\t<form action='../confirm/'' method='post'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='url' value='\"+ item.DetailPageURL +\"'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='image_m' value='\"+ image_m +\"'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='image_s' value='\"+ image_s +\"'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='isbn' value='\"+ item.ItemAttributes.EAN +\"'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='bname' value='\"+ item.ItemAttributes.Title +\"'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='pdate' value='\"+ item.ItemAttributes.PublicationDate +\"'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='author' value='\"+ item.ItemAttributes.Author +\"'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='publisher' value='\"+ item.ItemAttributes.Publisher +\"'>\\\n\t\t\t\t\t\t\t\t<input type='submit' value='登録する'></form>\\\n\t\t\t\t\t\t\t\t</div>\");\n\t\t\t\t\t\tdocument.write (\"<br>\");\n\t\t\t\t}\n\t\t\t\tdocument.write (\"</div><br>\");\n\n\t\t\t\tif(page == 1){\n\t\t\t\t\tif(json.Items.TotalPages != 1 && json.Items.TotalPages != 0){\n\t\t\t\t\t\tdocument.write (\"<ul class='pageNav'>\");\n\t\t\t\t\t\tdocument.write (\"<li style='margin-left:488px'><a href='./?pg=\"+ (page+1) +\"&aname=" . $author . "'>次の10冊 &raquo;</a></li>\");\n\t\t\t\t\t\tdocument.write (\"</ul>\");\n\t\t\t\t\t}\n\t\t\t\t}else if(page < Math.min(5,json.Items.TotalPages) && page > 1){\n\t\t\t\t\tdocument.write (\"<ul class='pageNav'>\");\n\t\t\t\t\tdocument.write (\"<li><a href='./?pg=\"+ (page-1) +\"&aname=" . $author . "'>&laquo; 前の10冊</a></li>\");\n\t\t\t\t\tdocument.write (\"<li style='margin-left:400px'><a href='./?pg=\"+ (page+1) +\"&aname=" . $author . "'>次の10冊 &raquo;</a></li>\");\n\t\t\t\t\tdocument.write (\"</ul>\");\n\t\t\t\t}else if(page == Math.min(5,json.Items.TotalPages)){\n\t\t\t\t\tdocument.write (\"<ul class='pageNav'>\");\n\t\t\t\t\tdocument.write (\"<li><a href='./?pg=\"+ (page-1) +\"&aname=" . $author . "'>&laquo; 前の10冊</a></li>\");\n\t\t\t\t\tdocument.write (\"</ul>\");\n\t\t\t\t}else{\n\t\t\t\t\tdocument.write(\"<p>不正なアクセスです。</p>\");\n\t\t\t\t}\n\t\t\t</script>\n\t\t</div>";
}
?>
		<p><div class="copy">Copyright (c) 2014 Ryohei Takayama All Rights Reserved.</div></p>
	</body>
示例#2
0
			<p class="menu">Menu:</p>
			<ul>
				<li id="1"class="tab1off">本棚</li>
				<li id="2"class="tab2on">登録</li>
				<li id="3"class="tab3off">検索</li>
				<li id="4"class="tab4off">一覧</li>
				<li id="5"class="tab5off">貸出中</li>
				<li id="6"class="tab6off">借入中</li>
				<li id="7"class="tab7off">アプリ</li>
				<li id="8"class="tab8off">色々</li>
			</ul>
		</div>

		<?php 
if (isset($_GET['ISBN']) == 0 || $_GET['ISBN'] == null) {
    echo "\t<div id=\"box22\"class=\"contents\">\n\t\t\t\t\t<p>404 not found.</p></div>";
} else {
    require_once '../amazon/amazon.php';
    $api = new MyAmazon(array('access_key_id' => 'ここにアクセスキーが入る', 'secret_access_key' => 'ここにシークレットアクセスキーが入る', 'associate_tag' => 'ryoheipro-22'));
    //$keyword = 'java';
    $isbn = $_GET['ISBN'];
    $url = $api->ItemSearch(array('ResponseGroup' => 'Medium', 'SearchIndex' => 'Books', 'IdType' => 'ISBN', 'ItemId' => $isbn, 'ItemPage' => '1'));
    $result = $api->request($url);
    $json = json_encode($result);
    //			echo $json;
    echo "\t<div id=\"box22\"class=\"contents\">\n\t\t\t\t<p class=\"each_regi\">ISBNから登録</p>\n\t\t\t\t<script>\n\t\t\t\t\tvar json = " . $json . ";\n\n\t\t\t\t\tif(json.Items.Item == null){\n\t\t\t\t\t\tdocument.write (\"<div id='bname_search_results' style='margin-left:30px;'>\");\n\t\t\t\t\t\tdocument.write (\"<p>エラーコード: <br>\"+ json.Items.Request.Errors.Error.Code +\"</p>\");\n\t\t\t\t\t\tdocument.write (\"<p>エラーメッセージ: <br>\"+ json.Items.Request.Errors.Error.Message +\"</p></div>\");\n\t\t\t\t\t}else{\n\t\t\t\t\t\tvar item = json.Items.Item;\n\t\t\t\t\t\t//kindle版も存在する可能性があるためitem[0]としておく\n\t\t\t\t\t\tif(item.length) item = item[0];\n\t\t\t\t\t\t//画像が存在しなかった場合のエラー処理\n\t\t\t\t\t\tif(item.ImageSets == null){\n\t\t\t\t\t\t\tvar image_m = '../material/no_image_m.png';\n\t\t\t\t\t\t\tvar image_s = '../material/no_image_s.png';\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tvar imageset = item.ImageSets.ImageSet;\n\t\t\t\t\t\t\tif (imageset.length) imageset = imageset[0];\n\t\t\t\t\t\t\tvar image_m = imageset.MediumImage.URL;\n\t\t\t\t\t\t\tvar image_s = imageset.SmallImage.URL;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//\talert(json.Items.Item.ImageSets.ImageSet.MediumImage.URL);\n\t\t\t\t\t\t//\t\talert(json.Items.Item.ItemAttributes.Title);\n\t\t\t\t\t\tdocument.write (\"<div id='bname_search_results'><div class='each_b_results'>\");\n\t\t\t\t\t\tdocument.write (\"<div class='b_image'><a href='\"+ item.DetailPageURL +\"'><img src='\" + image_m + \"' title='book1'></a></div>\");\n\t\t\t\t\t\tdocument.write (\"<div class='b_contents'><table><tr><th>ISBN : </th><td>\" + item.ItemAttributes.EAN + \"</td></tr>\");\n\t\t\t\t\t\tdocument.write (\"<tr><th>書名 : </th><td>\" + item.ItemAttributes.Title + \"</td></tr>\");\n\t\t\t\t\t\tdocument.write (\"<tr><th>出版日 : </th><td>\" + item.ItemAttributes.PublicationDate + \"</td></tr>\");\n\t\t\t\t\t\tdocument.write (\"<tr><th>著者 : </th><td>\" + item.ItemAttributes.Author + \"</td></tr>\");\n\t\t\t\t\t\tdocument.write (\"<tr><th>出版社 : </th><td>\" + item.ItemAttributes.Publisher + \"</td></tr>\");\n\t\t\t\t\t\tdocument.write (\"</table><p><a href=' \" + item.DetailPageURL + \"'>Amazon URL</a></p></div>\");\n\t\t\t\t\t\tdocument.write (\"<div class='b_register'>\\\n\t\t\t\t\t\t\t<form action='confirm/'' method='post'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='url' value='\"+ item.DetailPageURL +\"'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='image_m' value='\"+ image_m +\"'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='image_s' value='\"+ image_s +\"'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='isbn' value='\"+ item.ItemAttributes.EAN +\"'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='bname' value='\"+ item.ItemAttributes.Title +\"'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='pdate' value='\"+ item.ItemAttributes.PublicationDate +\"'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='author' value='\"+ item.ItemAttributes.Author +\"'>\\\n\t\t\t\t\t\t\t\t<input type='hidden' name='publisher' value='\"+ item.ItemAttributes.Publisher +\"'>\\\n\t\t\t\t\t\t\t\t<input type='submit' value='登録する'></form>\\\n\t\t\t\t\t\t\t\t</div>\");\n\t\t\t\t\t\tdocument.write (\"</div></div>\");\n\t\t\t\t\t}\n\t\t\t\t</script>\n\t\t\t</div>";
}
?>

		<p><div class="copy">Copyright (c) 2014 Ryohei Takayama All Rights Reserved.</div></p>
	</body>