amazon.com pages."); define('TEXT_CONFIDENCE', "Your book has been determined %.2f%%. You may stop at any time and get your result by clicking Show Result.
"); define('SKIP_PROB', 2); define('DONE_FUNC', 'ServeBook'); echo HandleSubmit('books', $_POST); function ServeBook($file, $scores) { $page = file_get_contents($file); $name = GetBookName($file); if (!preg_match('/\ 'left')); $min = $scores[array_mini($scores)]; $max = $scores[$file] - $min; unset($scores[$file]); for ($ii = 0; $ii < 5; $ii++) { $maxi = array_maxi($scores); $others .= li() . l(GetBookURL($maxi), GetBookName($maxi)) . sprintf(" (%.0f%%)", 100 * ($scores[$maxi] - $min) / ($max - $min)); unset($scores[$maxi]); } $others .= ul(false); return $image . br() . "You're $name!" . br() . ServeLink(GetBookURL($file), $name) . br() . br() . $others; } function ServeLink($url, $name) { return "See Amazon's " . l($url, $name) . " page!"; } function GetBookName($file) { $page = file_get_contents($file); // Get name $name0 = strpos($page, ""); if ($name0 === false) return basename($file, '.html'); $name0 += 7 + 12; $full = substr($page, $name0, strpos($page, "\n", $name0) - $name0); $full = str_replace(": Books:", " by", $full); return trim(StripHTML($full)); } function GetBookURL($file) { return "http://www.existencia.org/memer/" . $file; } ?>