home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

Need php help

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 1809
Discussions: 200,990, Posts: 2,379,891, Members: 246,359
Old April 9th, 2003, 07:32 AM   Digg it!   #1 (permalink)
Banned
 
Join Date: Nov 2002
Location: Seattle, WA
Posts: 3,312
Send a message via AIM to iNeb
Need php help

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?
iNeb is offline   Reply With Quote
Old April 9th, 2003, 01:04 PM     #2 (permalink)
Member
 
gothic's Avatar
 
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]);
gothic is offline   Reply With Quote
Old April 9th, 2003, 01:05 PM     #3 (permalink)
Member
 
shotokan's Avatar
 
Join Date: Mar 2003
Location: 35.92 N 84 W
Posts: 158
Send a message via ICQ to shotokan Send a message via AIM to shotokan
was gonna say ythe smae thing but with pretty colors, and then i accidentally hit submit.
__________________
d[o.o]b
shotokan is offline   Reply With Quote
Old April 9th, 2003, 01:10 PM     #4 (permalink)
Banned
 
Join Date: Nov 2002
Location: Seattle, WA
Posts: 3,312
Send a message via AIM to iNeb
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 # 
iNeb is offline   Reply With Quote
Old April 10th, 2003, 07:16 AM     #5 (permalink)
Member
 
shotokan's Avatar
 
Join Date: Mar 2003
Location: 35.92 N 84 W
Posts: 158
Send a message via ICQ to shotokan Send a message via AIM to shotokan
Im not the greatest with PHP so correct me if I am wrong but is it supposed to be URI or URL?
shotokan is offline   Reply With Quote
Old April 10th, 2003, 01:12 PM     #6 (permalink)
Member
 
gothic's Avatar
 
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]
gothic is offline   Reply With Quote
Old April 10th, 2003, 02:02 PM     #7 (permalink)
Banned
 
Join Date: Nov 2002
Location: Seattle, WA
Posts: 3,312
Send a message via AIM to iNeb
But one works for articles, but not for the topic?
iNeb is offline   Reply With Quote
Old April 10th, 2003, 11:05 PM     #8 (permalink)
Member
 
gothic's Avatar
 
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.
gothic is offline   Reply With Quote
Old April 10th, 2003, 11:20 PM     #9 (permalink)
Banned
 
Join Date: Nov 2002
Location: Seattle, WA
Posts: 3,312
Send a message via AIM to iNeb
Huh? I only understand echo..
iNeb is offline   Reply With Quote
Old April 11th, 2003, 12:38 AM     #10 (permalink)
Member
 
gothic's Avatar
 
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.
gothic is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (3077)
Charges against non-tippers dropped.. (20)
Health Care Rationing (12)
Delete an OS (17)
Nvidia GTX 260 problem (10)
Laptop with wireless problem. (12)
windows vista security holes (19)
Wireless Televisions. (12)
CPU fan stops spinning randomly (11)
Regular Build (11)
Point and Shoot Camera Suggestions. (8)
windows 7 problem (7)
[F@H SPAM 11/16/09] ! 1/2 months to.. (39)
Internet Lost (5)
Recent Discussions
Q9650 vs. Q9550 (2)
Foxconn Blackops x48 MoBo (2)
Desktop Calendar Application (2)
Looking for new motherboard (1)
soundmon.exe (8)
Jedi Academy Problem (3)
Can a page file be "too big".. (1)
Nvidia GTX 260 problem (10)
Point and Shoot Camera Suggestions. (8)
Size after cutting 700Mb file is 2.5 .. (0)
Delete an OS (17)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (39)
windows vista security holes (19)
updating BIOS via winflash, claims fi.. (1)
New Server Configuration Suggestions (0)
cheap gaming laptop? (12)
Unallocated Space (2)
help me pls laptop just stopped worki.. (1)
C# + LINQ Help (7)
Dynex DX E-402 (3)
EVGA 9800 gtx help with finding a goo.. (12)
Multiple Restarts Required at Boot (5)
cell phone won't work (0)
Is the PSU I received dead? (15)
Can't open Word (12)


All times are GMT -4. The time now is 08:53 AM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28