<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: PHP port of ISBN-10/13 tool</title>
	<atom:link href="http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/</link>
	<description>A library-geek blog</description>
	<lastBuildDate>Tue, 16 Mar 2010 15:34:50 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Vladimir2</title>
		<link>http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/comment-page-1/#comment-563054</link>
		<dc:creator>Vladimir2</dc:creator>
		<pubDate>Thu, 04 Feb 2010 03:08:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/#comment-563054</guid>
		<description>&lt;a href=&quot;http://www.proakvariumy.ru&quot; rel=&quot;nofollow&quot;&gt;&lt;a href=&quot;http://www.proakvariumy.ru&quot; rel=&quot;nofollow&quot;&gt;аквариум&lt;/a&gt;&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p><a href="http://www.proakvariumy.ru" rel="nofollow">аквариум</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vladimir</title>
		<link>http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/comment-page-1/#comment-563049</link>
		<dc:creator>Vladimir</dc:creator>
		<pubDate>Tue, 02 Feb 2010 01:23:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/#comment-563049</guid>
		<description>&lt;a href=&quot;http://ray-fm.ru/&quot; rel=&quot;nofollow&quot;&gt;&lt;a href=&quot;http://ray-fm.ru/&quot; rel=&quot;nofollow&quot;&gt;голд&lt;/a&gt;&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p><a href="http://ray-fm.ru/" rel="nofollow">голд</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vladimir</title>
		<link>http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/comment-page-1/#comment-563048</link>
		<dc:creator>Vladimir</dc:creator>
		<pubDate>Mon, 01 Feb 2010 23:47:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/#comment-563048</guid>
		<description>&lt;a href=&quot;http://mirtv.biz/&quot; rel=&quot;nofollow&quot;&gt;&lt;a href=&quot;http://mirtv.biz/&quot; rel=&quot;nofollow&quot;&gt;постеры к сериалам&lt;/a&gt;&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p><a href="http://mirtv.biz/" rel="nofollow">постеры к сериалам</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith Nunn</title>
		<link>http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/comment-page-1/#comment-291763</link>
		<dc:creator>Keith Nunn</dc:creator>
		<pubDate>Thu, 21 Feb 2008 15:01:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/#comment-291763</guid>
		<description>I have quite a complete ISBN test tool that does all of the above and also does GTIN-14.  It&#039;s for php5, but could likely be backported to php4 fairly easily.

If anyone is interested you&#039;ll find it at http://www.phpclasses.org/browse/package/1707.html

It&#039;s just called ISBNcheck (not a clever name, but it works)

kapn</description>
		<content:encoded><![CDATA[<p>I have quite a complete ISBN test tool that does all of the above and also does GTIN-14.  It&#8217;s for php5, but could likely be backported to php4 fairly easily.</p>
<p>If anyone is interested you&#8217;ll find it at <a href="http://www.phpclasses.org/browse/package/1707.html" rel="nofollow">http://www.phpclasses.org/browse/package/1707.html</a></p>
<p>It&#8217;s just called ISBNcheck (not a clever name, but it works)</p>
<p>kapn</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam</title>
		<link>http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/comment-page-1/#comment-119657</link>
		<dc:creator>Adam</dc:creator>
		<pubDate>Fri, 04 May 2007 22:26:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/#comment-119657</guid>
		<description>Here is a txt version

http://tinyurl.com/28ncrk</description>
		<content:encoded><![CDATA[<p>Here is a txt version</p>
<p><a href="http://tinyurl.com/28ncrk" rel="nofollow">http://tinyurl.com/28ncrk</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nicholas</title>
		<link>http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/comment-page-1/#comment-109848</link>
		<dc:creator>Nicholas</dc:creator>
		<pubDate>Mon, 16 Apr 2007 21:26:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/#comment-109848</guid>
		<description>Am I crazy or is none of the code on this page complete?

Lines like this: for($i = 1; $i genchksum10($isbn2);

and blocks of code that end like this:

function isbn_genchksum13($isbn) {
        $isbn = trim($isbn);
        for ($i = 0; $i

Surely can&#039;t be correct. What is going on here? Is everyone just not good at copy and pasteing? Am I the idiot? I&#039;m baffled.</description>
		<content:encoded><![CDATA[<p>Am I crazy or is none of the code on this page complete?</p>
<p>Lines like this: for($i = 1; $i genchksum10($isbn2);</p>
<p>and blocks of code that end like this:</p>
<p>function isbn_genchksum13($isbn) {<br />
        $isbn = trim($isbn);<br />
        for ($i = 0; $i</p>
<p>Surely can&#8217;t be correct. What is going on here? Is everyone just not good at copy and pasteing? Am I the idiot? I&#8217;m baffled.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam</title>
		<link>http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/comment-page-1/#comment-100907</link>
		<dc:creator>Adam</dc:creator>
		<pubDate>Tue, 27 Mar 2007 21:44:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/#comment-100907</guid>
		<description>Thijs, thanks for the pointer.  I&#039;m in the US, dealing with American books.  It never occurred to me that there would be a standard for hyphenating or that international books would be hyphenated differently.

I poked around the site and didn&#039;t see  a guide for the 13 digit numbers.  I assume its the same as 10, except with the dash added after the opening 978.

I will update my function when I have some free time, and I&#039;ll post the code here.</description>
		<content:encoded><![CDATA[<p>Thijs, thanks for the pointer.  I&#8217;m in the US, dealing with American books.  It never occurred to me that there would be a standard for hyphenating or that international books would be hyphenated differently.</p>
<p>I poked around the site and didn&#8217;t see  a guide for the 13 digit numbers.  I assume its the same as 10, except with the dash added after the opening 978.</p>
<p>I will update my function when I have some free time, and I&#8217;ll post the code here.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thijs</title>
		<link>http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/comment-page-1/#comment-94353</link>
		<dc:creator>Thijs</dc:creator>
		<pubDate>Sun, 18 Mar 2007 17:03:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/#comment-94353</guid>
		<description>Hi Adam, your function &lt;code&gt;isbn_dashes();&lt;/code&gt; does not place the hyphens on the right place most of the times. It may be correct with some US-ISBN numbers, I doubt you&#039;ve read the official guidelines:

&lt;a href=&quot;http://www.isbn.org/standards/home/isbn/international/hyphenation-instructions.asp&quot; title=&quot;Hyphenation Instructions&quot; rel=&quot;nofollow&quot;&gt;Hyphenation Instructions&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Hi Adam, your function <code>isbn_dashes();</code> does not place the hyphens on the right place most of the times. It may be correct with some US-ISBN numbers, I doubt you&#8217;ve read the official guidelines:</p>
<p><a href="http://www.isbn.org/standards/home/isbn/international/hyphenation-instructions.asp" title="Hyphenation Instructions" rel="nofollow">Hyphenation Instructions</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam</title>
		<link>http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/comment-page-1/#comment-73589</link>
		<dc:creator>Adam</dc:creator>
		<pubDate>Thu, 22 Feb 2007 19:34:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/#comment-73589</guid>
		<description>This is the collection of ISBN code I&#039;m actively using, compiled from the original code and the comments.

I added the isnb_dashes($isbn) function, which accepts a 10 or 13 digit ISBN number and adds the dashes. This does not check the validity of the string, it just returns it.  If it isn&#039;t 10 or 13 characters long, the function returns false.

&lt;code&gt;
function isbn_convert($isbn) {
        $isbn2 = substr(&quot;978&quot; . trim($isbn), 0, -1);
        $sum13 = isbn_genchksum13($isbn2);
        $isbn13 = &quot;$isbn2-$sum13&quot;;
        return ($isbn13);
    }
 
function isbn_gettype($isbn) {
        $isbn = trim($isbn);
        if (preg_match(&#039;%[0-9]{12}?[0-9Xx]%s&#039;, $isbn)) {
            if (isbn_validatettn($isbn)==1){
                    return 13;
                       } else {return(-1);}
 
                } else if (preg_match(&#039;%[0-9]{9}?[0-9Xx]%s&#039;, $isbn)) {
              if (isbn_validateten($isbn)==1){
                    return 10;
                       } else {return -1;}
        } else {
            return -1;
        }
    }
 
function isbn_validateten($isbn) {
        $isbn = trim($isbn);
        $chksum = substr($isbn, -1, 1);
        $isbn = substr($isbn, 0, -1);
        if (preg_match(&#039;/X/i&#039;, $chksum)) { $chksum=&quot;10&quot;; }
        $sum = isbn_genchksum10($isbn);
        if ($chksum == $sum){
            return 1;
        }else{
            return 0;
        }
    }
 
function isbn_validatettn($isbn) {
        $isbn = trim($isbn);
        $chksum = substr($isbn, -1, 1);
        $isbn = substr($isbn, 0, -1);
        if (preg_match(&#039;/X/i&#039;, $chksum)) { $chksum=&quot;10&quot;; }
        $sum = isbn_genchksum13($isbn);
        if ($chksum == $sum){
            return 1;
        }else{
            return 0;
        }
    }
 
function isbn_genchksum13($isbn) {
        $t = 2;
        $isbn = trim($isbn);
                $b=0;
                for($i = 1; $i genchksum10($isbn2);
        if ($sum10==10) {$sum10=&#039;X&#039;;}
        $isbn10 = $isbn2.$sum10;
        return ($isbn10);
    }
		
## ISBN Add Dashes
function isbn_dashes($isbn) {
        switch(strlen($isbn)):
				    case 13:
						    return
								    substr($isbn,0,3).&quot;-&quot;
								    .substr($isbn,3,1).&quot;-&quot;
								    .substr($isbn,4,3).&quot;-&quot;
								    .substr($isbn,7,5).&quot;-&quot;
								    .substr($isbn,12,1);
								break;
				    case 10:
						    return
								    substr($isbn,0,1).&quot;-&quot;
								    .substr($isbn,1,3).&quot;-&quot;
								    .substr($isbn,4,5).&quot;-&quot;
								    .substr($isbn,9,1);
								break;
						default: return false; break;
					endswitch;
					}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>This is the collection of ISBN code I&#8217;m actively using, compiled from the original code and the comments.</p>
<p>I added the isnb_dashes($isbn) function, which accepts a 10 or 13 digit ISBN number and adds the dashes. This does not check the validity of the string, it just returns it.  If it isn&#8217;t 10 or 13 characters long, the function returns false.</p>
<p><code><br />
function isbn_convert($isbn) {<br />
        $isbn2 = substr("978" . trim($isbn), 0, -1);<br />
        $sum13 = isbn_genchksum13($isbn2);<br />
        $isbn13 = "$isbn2-$sum13";<br />
        return ($isbn13);<br />
    }</p>
<p>function isbn_gettype($isbn) {<br />
        $isbn = trim($isbn);<br />
        if (preg_match('%[0-9]{12}?[0-9Xx]%s', $isbn)) {<br />
            if (isbn_validatettn($isbn)==1){<br />
                    return 13;<br />
                       } else {return(-1);}</p>
<p>                } else if (preg_match('%[0-9]{9}?[0-9Xx]%s', $isbn)) {<br />
              if (isbn_validateten($isbn)==1){<br />
                    return 10;<br />
                       } else {return -1;}<br />
        } else {<br />
            return -1;<br />
        }<br />
    }</p>
<p>function isbn_validateten($isbn) {<br />
        $isbn = trim($isbn);<br />
        $chksum = substr($isbn, -1, 1);<br />
        $isbn = substr($isbn, 0, -1);<br />
        if (preg_match('/X/i', $chksum)) { $chksum="10"; }<br />
        $sum = isbn_genchksum10($isbn);<br />
        if ($chksum == $sum){<br />
            return 1;<br />
        }else{<br />
            return 0;<br />
        }<br />
    }</p>
<p>function isbn_validatettn($isbn) {<br />
        $isbn = trim($isbn);<br />
        $chksum = substr($isbn, -1, 1);<br />
        $isbn = substr($isbn, 0, -1);<br />
        if (preg_match('/X/i', $chksum)) { $chksum="10"; }<br />
        $sum = isbn_genchksum13($isbn);<br />
        if ($chksum == $sum){<br />
            return 1;<br />
        }else{<br />
            return 0;<br />
        }<br />
    }</p>
<p>function isbn_genchksum13($isbn) {<br />
        $t = 2;<br />
        $isbn = trim($isbn);<br />
                $b=0;<br />
                for($i = 1; $i genchksum10($isbn2);<br />
        if ($sum10==10) {$sum10='X';}<br />
        $isbn10 = $isbn2.$sum10;<br />
        return ($isbn10);<br />
    }</p>
<p>## ISBN Add Dashes<br />
function isbn_dashes($isbn) {<br />
        switch(strlen($isbn)):<br />
				    case 13:<br />
						    return<br />
								    substr($isbn,0,3)."-"<br />
								    .substr($isbn,3,1)."-"<br />
								    .substr($isbn,4,3)."-"<br />
								    .substr($isbn,7,5)."-"<br />
								    .substr($isbn,12,1);<br />
								break;<br />
				    case 10:<br />
						    return<br />
								    substr($isbn,0,1)."-"<br />
								    .substr($isbn,1,3)."-"<br />
								    .substr($isbn,4,5)."-"<br />
								    .substr($isbn,9,1);<br />
								break;<br />
						default: return false; break;<br />
					endswitch;<br />
					}<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: huh</title>
		<link>http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/comment-page-1/#comment-67520</link>
		<dc:creator>huh</dc:creator>
		<pubDate>Tue, 13 Feb 2007 06:04:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/#comment-67520</guid>
		<description>cannot get this working.
just including it throws:

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or &#039;}&#039; in /usr/home/www/htdocs/test/ISBN_script.php on line 11

so I changed public function to function and (not surprisingly)

Fatal error: Undefined class name &#039;self&#039; in /usr/home/www/htdocs/test/ISBN_script.php on line 13</description>
		<content:encoded><![CDATA[<p>cannot get this working.<br />
just including it throws:</p>
<p>Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or &#8216;}&#8217; in /usr/home/www/htdocs/test/ISBN_script.php on line 11</p>
<p>so I changed public function to function and (not surprisingly)</p>
<p>Fatal error: Undefined class name &#8217;self&#8217; in /usr/home/www/htdocs/test/ISBN_script.php on line 13</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: OracleHome</title>
		<link>http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/comment-page-1/#comment-61204</link>
		<dc:creator>OracleHome</dc:creator>
		<pubDate>Wed, 31 Jan 2007 17:54:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/#comment-61204</guid>
		<description>Hi,

Thanks for producing this, I found a javascript version, but wanted a PHP version for my site.

This code has saved me a lot of time.

Thanks again!</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Thanks for producing this, I found a javascript version, but wanted a PHP version for my site.</p>
<p>This code has saved me a lot of time.</p>
<p>Thanks again!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: andras</title>
		<link>http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/comment-page-1/#comment-43172</link>
		<dc:creator>andras</dc:creator>
		<pubDate>Sun, 14 Jan 2007 23:26:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.blyberg.net/2006/04/05/php-port-of-isbn-1013-tool/#comment-43172</guid>
		<description>One more time, sorry. I think the test should be :
if (preg_match(’%^[0-9]{13}$%s’, $isbn))</description>
		<content:encoded><![CDATA[<p>One more time, sorry. I think the test should be :<br />
if (preg_match(’%^[0-9]{13}$%s’, $isbn))</p>
]]></content:encoded>
	</item>
</channel>
</rss>
