phod.php3) This software comes as is, with no warranties specified or implied. USE AT YOUR OWN RISK! (read: if it works, cheers. if it doesn't, don't look at me.) Security issues - All tags (PHP and HTML) are stripped from search input. Validation - only one point here. depending on what version of PHP you are using, it may add slashes to user input automatically. you will have to strip \ not strip these accordingly. Action - parse requesting url send request to dmoz make changes to page format print results with header & footer Requirements - This works with Apache and PHP 3.0.14. It didn't work on a win98/onmiHTTPd/php 3.0.14 box. It didn't work with Apache and 3.0.12. I guarantee it will not work for 3.0.6 or below. (strip_tags() is really buggy - I've had this work on some machines and fail on others. ?) Notes - As I am not a real programmer, I don't know if this is a resource hog or not. If anyone has any tips or suggestions, let me know. I'd be really happy if you sent me streamlined / more robust version of this script. Wishlist - Maxcomm? Logging of searches (not really necessary as they should be in your server logs) The ability to drop the ? from the url (apparently apache should have no problems, but I tried it and no luck) When it's in original search mode, I defaulted the search box back to the new search. It'd be nice if it could stay in original search mode. */ //******************************************************************************// //CONFIGURATION VARIABLES! YOU CAN CHANGE THESE FREELY! $phod_title = "Gomang Open Directory"; //what will you name your PHOD? $phod_header = "head.html"; //this is the relative file path to a header file e.g. "header.html". //control colors, fonts, etc, using this file and css. //HEADER FILE MUST CONTAIN AT LEAST: $phod_footer = "foot.html"; //this is the relative file path to a footer file e.g. "footer.html". //FOOTER FILE MUST CONTAIN AT LEAST: //if you leave the header and footer blank it will default to standard PHOD $phod_table_color = "#669933"; //This replaces DMOZ's green color $phod_table2_color = "#cccccc"; //THis replaces DMOZ's grey color //******************************************************************************// //ADVANCED CONFIGURATION. THINK TWICE BEFORE CHANGING THESE! $phod_url = "http://www.gomangtour.org$PHP_SELF"; //this should be ok. If not, use the URL to your script. $debug = 0; //this is for debugging. 1 = On, 0 = Off. $odp_base = "http://dmoz.org/"; //the base url of the ODP (keep trailing slash) $odp_search = "http://search.dmoz.org/cgi-bin/search"; //The url of ODP's search engine $odp_orig_search = "http://search.dmoz.org/cgi-bin/osearch"; //the url of ODP original search. //NOW we're not playing around. Meddle below only if you know what you're doing //***********************************************************************************// $REQUEST_URI = strip_tags($REQUEST_URI); $res = explode("index.php3?", $REQUEST_URI); $odp_cat = $res[1]; if (substr($odp_cat,0,1) == "/") $odp_cat = substr($odp_cat,1); else if (strstr($odp_cat, "asearch")) { $requesturl = $odp_orig_search; $requesturl .= strstr($REQUEST_URI,"?"); $requesturl = str_replace("?asearch","?a.x=0",$requesturl); $cat = "search"; } else if (strstr($odp_cat, "osearch=")) { $requesturl = $odp_orig_search; $requesturl .= strstr($REQUEST_URI,"?"); $requesturl = str_replace("?osearch=","?search=",$requesturl); $cat = "search"; } else if (strstr($odp_cat, "search=")) { $requesturl = $odp_search; $requesturl .= strstr($REQUEST_URI,"?"); $cat = "search"; } if(!$cat) { if (strstr($odp_cat, "where=")){ $cat = str_replace("where=","",strstr($odp_cat,"where=")); } else { $cat = $odp_cat; } } function top_of_page() { global $HTTP_USER_AGENT; global $cat; global $phod_title; global $phod_header; if ($phod_header) { include($phod_header); } else { ?> <?php echo $phod_title;?> <? if($cat) echo " : ".str_replace("/"," : ",$cat);?> phod Debugging Mode\n"; $phod_ver = "v1.0"; if($debug) echo '$phod_ver: '.$phod_ver."
\n"; global $phod_table_color; if($debug) echo '$phod_table_color: '.$phod_table_color."
\n"; global $phod_table2_color; if($debug) echo '$phod_table2_color: '.$phod_table2_color."
\n"; $phod_copy = 'GomangTour'; if($debug) echo '$phod_copy: '.htmlspecialchars($phod_copy)."
\n"; $phod_fix = ''; global $PHP_SELF; if ($debug) echo '$PHP_SELF: '.$PHP_SELF."
\n"; global $REQUEST_URI; if($debug) echo '$REQUEST_URI: '.$REQUEST_URI."
\n"; $allowed_tags = ",,

,

,

,

,

,
,
,
    ,,,,,
    ,
    ,

    ,

    ,,,
    Help build the largest human-edited directory on the web.
     Submit a Site - Open Directory Project - Become an Editor