Skip to content

PATH_INFO problem fixed

Yesterday evening I actually stepped away from gaming for a second to fix a fairly major problem with Project Krystal (which I haven’t talked about for so long, I better tell you it’s a Website Management System and it renders your website from a MySQL database setup).

The problem was in the way that some pages used data after the .php bit of the URL, for example: http://server/products/chainsaws.php/4. In either PHP 5.x (or our remote server setup), the $_SERVER[‘PATH_INFO’] variable wasn’t getting passed to the script, so I devised a slightly messy workaround:

$var = $_SERVER['REQUEST_URI'];
$pro = strstr($var, strrchr($var, ".php/"));
$pro2 = substr($pro, 5);
// echo $pro2;
// die();
$featureidrq = $pro2;
if (empty($featureidrq)) {
 $featureidrq = "";
}

Again, if anyone can do any better I’d love to see you add a comment with your code.

Like this post?

If you would like to support the time and effort I have put into my tutorials and writing, please consider making a donation.

Post a Comment

On some sites, you must be logged in to post a comment. This is not the case on this site.
Your email address is not made public or shared. Required fields are marked with *.
*
*
*

Posting a comment signifies you accept the privacy policy.
Please note — usually your comment will appear straight away but sometimes it will be held for approval (this is due to the spam filter). If your comment is waiting to be approved, please don’t post it again! It will appear eventually.