iTunes Signature Maker, copyright (c) 2005 by Jason Freeman
Launch | Help | Contact | Credits | Gallery | More Info | jasonfreeman.net

0)) { $keyword = quote_smart($_GET['keyword']); $search = sprintf(" WHERE `name` REGEXP %s ", $keyword); } else { $search = ""; } $text = "Click on a name to listen to a signature:"; if ($search != "") { $text = "Search results:"; } echo "
$text


"; // get all results if (isset($_GET["start"])) { $start = $_GET["start"]; } else { $start = 0; } $queryString = 'SELECT * FROM `gallery` ' . $search . ' ORDER BY `fileid` DESC'; $result = mysql_query($queryString); if (!$result) { die('Invalid query: ' . mysql_error()); } $numRecords = mysql_num_rows($result); $queryString = "SELECT * FROM `gallery` " . $search . " ORDER BY `fileid` DESC LIMIT $start, $maxToShow"; $result = mysql_query($queryString); if (!$result) { die('Invalid query: ' . mysql_error()); } if (mysql_num_rows($result) == 0) { echo "
No results found

\n"; } while ($row = mysql_fetch_assoc($result)) { $name = $row["name"]; $data = array('name' => $name, 'file'=>$row['file'], 'popup'=>$popup); $href = "gallery2.php?" . http_build_query($data); echo "
$name
\n"; } mysql_free_result($result); mysql_close($link); $max = $start + $maxToShow - 1; $maxCountFrom1 = $max + 1; if ($maxCountFrom1 > $numRecords) { $maxCountFrom1 = $numRecords; } $startCountFrom1 = $start + 1; echo "


Showing signatures $startCountFrom1 through $maxCountFrom1 of $numRecords


"; echo "
"; if ($start > 0) { $search = $_GET["search"]; $keyword = $_GET["keyword"]; $data = array('start'=>$start-$maxToShow, 'popup'=>$popup, 'search'=>$search, 'keyword'=>$keyword); $href = "gallery.php?" . http_build_query($data); echo "previous "; } if ($numRecords > $maxCountFrom1) { $search = $_GET["search"]; $keyword = $_GET["keyword"]; $data = array('start'=>$start+$maxToShow, 'popup'=>$popup, 'search'=>$search, 'keyword'=>$keyword); $href = "gallery.php?" . http_build_query($data); echo "next"; } echo "
"; /* function http_build_query( $formdata, $numeric_prefix = null, $key = null ) { $res = array(); foreach ((array)$formdata as $k=>$v) { $tmp_key = urlencode(is_int($k) ? $numeric_prefix.$k : $k); if ($key) { $tmp_key = $key.'['.$tmp_key.']'; } if ( is_array($v) || is_object($v) ) { $res[] = http_build_query($v, null, $tmp_key); } else { $res[] = $tmp_key."=".urlencode($v); } } return implode("&", $res); }*/ function quote_smart($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // Quote if not integer if (!is_numeric($value)) { $value = "'" . mysql_real_escape_string($value) . "'"; } return $value; } if ($search != "") { echo "


Go back to the gallery.
"; } ?>