Need php help  | |
April 9th, 2003, 07:32 AM
|
#1 (permalink)
| | Banned
Join Date: Nov 2002 Location: Seattle, WA
Posts: 3,312
|
I bought www.miraserver.com (The software, not the domain)
And he has a URL rewrite hack here: http://miraserver.com/article.php?cat=support&id=1
Now the article works fine ( http://www.nerdnations.com/article/17 )
But not the topic's
At the header i have this Quote:
<?php
// All this is optional URL re-writing code. Takes a certain type of Apache configuration to make use of it.
$url_array=explode("/",$REQUEST_URI); //BREAK UP THE URL PATH USING '/' as delimiter
$topic=$url_array[2]; //Category
include ('config.php');
?>
| But it is not working 
How can i fix this? |
| |
April 9th, 2003, 01:04 PM
|
#2 (permalink)
| | Member
Join Date: Oct 2001 Location: Palatine, IL
Posts: 375
|
Depending on your PHP config, you may need to change the line to say:
$url_array=explode("/", $_SERVER[REQUEST_URI]); |
| |
April 9th, 2003, 01:05 PM
|
#3 (permalink)
| | Member
Join Date: Mar 2003 Location: 35.92 N 84 W
Posts: 158
|
was gonna say ythe smae thing but with pretty colors, and then i accidentally hit submit.
__________________
d[o.o]b
|
| |
April 9th, 2003, 01:10 PM
|
#4 (permalink)
| | Banned
Join Date: Nov 2002 Location: Seattle, WA
Posts: 3,312
|
This is my header for article PHP Code: // All this is optional URL re-writing code. Takes a certain type of Apache configuration to make use of it.
$url_array=explode("/",$REQUEST_URI); //BREAK UP THE URL PATH USING '/' as delimiter
$id=$url_array[2]; //Article ID #
$p=$url_array[3]; //Page #
|
| |
April 10th, 2003, 07:16 AM
|
#5 (permalink)
| | Member
Join Date: Mar 2003 Location: 35.92 N 84 W
Posts: 158
|
Im not the greatest with PHP so correct me if I am wrong but is it supposed to be URI or URL? |
| |
April 10th, 2003, 01:12 PM
|
#6 (permalink)
| | Member
Join Date: Oct 2001 Location: Palatine, IL
Posts: 375
|
It's URI... No worries.. =]
The reason $REQUEST_URI might not be working is in newer versions of PHP, they turn off 'register_globals' which means you now have to call the variables from the proper namespaces. Eg: $_GET, $_POST, $_COOKIE, $_SERVER, etc..
$REQUEST_URI is a $_SERVER variable, so you word it like so:
$_SERVER[REQUEST_URI] |
| |
April 10th, 2003, 02:02 PM
|
#7 (permalink)
| | Banned
Join Date: Nov 2002 Location: Seattle, WA
Posts: 3,312
|
But one works for articles, but not for the topic? |
| |
April 10th, 2003, 11:05 PM
|
#8 (permalink)
| | Member
Join Date: Oct 2001 Location: Palatine, IL
Posts: 375
| Quote: Originally posted by iNeb But one works for articles, but not for the topic? |
Oh, my bad. I'm an idiot, and didn't see you mention that it works for the articles..
Well, if that's the case, I'd echo $REQUEST_URI and see what's in it.. Make sure there is even enough "/"'s to explode and create 3 array elements. |
| |
April 10th, 2003, 11:20 PM
|
#9 (permalink)
| | Banned
Join Date: Nov 2002 Location: Seattle, WA
Posts: 3,312
|
Huh? I only understand echo.. |
| |
April 11th, 2003, 12:38 AM
|
#10 (permalink)
| | Member
Join Date: Oct 2001 Location: Palatine, IL
Posts: 375
| Quote: Originally posted by iNeb Huh? I only understand echo.. |
In the part of the script that's not working just tag this on:
echo "\nRequest URI: $REQUEST_URI\n";
Put that right after the:
$topic=$url_array[2]; //Category
That should do it. See if anything shows up after 'Request URI'...
If so, just copy/paste it into a reply, and we'll have a look at it. |
| | | Thread Tools | Search this Thread | | | | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |