| Uutiset | Koodikirjasto | Wiki | Keskustelut | FAQ | Info |
pouët search v0.2Entropia 10.10.03 13:09 Hakee pouet.net:sta demoscenetuotoksia
Kommentoimaton. Toimii tälläisenään, läiskäise vain uuteen .php tiedostoon. <?php # pouët search v0.2 # kirjoittanut by entropia @ 09.10.2003 - 10.10.2003 function pouet($prod) { $result = array(); $finalurl = "http://www.pouet.net/search.php?what=".urlencode($prod)."&type=prod"; $fp = file($finalurl); $pois = array("\"", ">", " ", "="); $pouet = "http://www.pouet.net/prod.php?which="; $demo = substr(strip_tags(trim($fp[123])), 6, strlen(strip_tags(trim($fp[123])))); $group = strip_tags(trim($fp[124])); $type = strip_tags(trim($fp[133])); $platform = strip_tags(trim($fp[139])); $pouetid = str_replace($pois, "", substr(trim($fp[123]), 56, 5)); $result["query"] = $prod; if (empty($demo) || empty($group)) { $result["error"] = "No matches."; } else { $result["prod"] = $demo; $result["group"] = $group; $result["type"] = $type; $result["platform"] = $platform; $result["id"] = $pouetid; if (!strip_tags(trim($fp[145])) == "1 results found") { $result["more"] = true; } } return $result; } if ($_GET["tcl"]) { if ($_GET["search"]) { $pouet = pouet($_GET["search"]); if (!$pouet["error"]) { echo $pouet["prod"] . "\n"; echo $pouet["group"] . "\n"; echo $pouet["type"] . "\n"; echo $pouet["platform"] . "\n"; echo $pouet["id"] . "\n"; } else { echo $pouet["error"]; } } else { echo "No search string given."; } } else { echo "<form action=\"pouet2.php\">\n"; echo "<b>pouët prod search:</b><br>\n"; echo "<input type=\"checkbox\" name=\"tcl\" value=\"1\">TCL-mode<br>\n"; echo "<input name=\"search\" value=\"" . $_GET["search"] . "\">\n"; echo "<input type=\"submit\" value=\"go\"><br>\n"; echo "<hr noshade><br>\n"; if ($_GET["search"]) { $pouet = pouet($_GET["search"]); if (!$pouet["error"]) { echo "<b>prod:</b> " . $pouet["prod"] . "<br>\n"; echo "<b>group:</b> " . $pouet["group"] . "<br>\n"; echo "<b>type:</b> " . $pouet["type"] . "<br>\n"; echo "<b>platform:</b> " . $pouet["platform"] . "<br>\n"; echo "<b>pouët id:</b> " . $pouet["id"] . "<br>\n"; if ($pouet["more"]) { echo "This is the first result, there were more than one."; } } else { echo $pouet["error"]; } } } # jos haluat vilauttaa lähdekoodia if ($_GET["ss"]) { show_source(__FILE__); } ?> Entropia 13:11 10.10.03 Regexpit olis kiva opetella ;) empty 13:28 26.11.03 oikein kiva.. Ei pahemmin kommentteja, mutta koodi on selkeää.. |
![]() Haku
|