/ Published in: PHP
URL: http://mark.haktstudios.com/
URI Parser 3.1
New and improved URI parser for URI renaming. Converts URI segments into usable PHP variables. Read comments for usage instructions. ( corrected small error in script )
Expand |
Embed | Plain Text
// place the following code into your index.php function seg($n) { if( $n < 1 ) return false; // prevent starting from 0 // prep working vars $req_uri = $_SERVER['REQUEST_URI']; // $n = $n--; // doesn't perform correctly $n--; // clean up request uri // create a clean array to work from // determine if seg is set or not // filter bad seg if( $seg === false || // $seg not set $seg[0] == "?" || // $seg is a query string $seg[0] == "#" || // $seg is an html anchor $seg[0] == "." // $seg starts with a '.' ) return false; // clean out unwanted crap trailing on the end of the string // return a safe string for processing }
You need to login to post a comment.
