|
-
Dec 16th, 2005, 07:55 AM
#1
Thread Starter
Hyperactive Member
Costum Errors
hi, i am making an error handler using IIS 6 and PHP (obviously). when i triger an error iis is ment to return /errors/error.php?404 but it does not and returns /errors/error.php?404?404;http://domain:80/rnddir/
how can i get it to not send that extra data?
thanks, dandono
If there is only one perfect person in the universe, does that make them imperfect?
-
Dec 20th, 2005, 12:11 PM
#2
Re: Costum Errors
Would you care to elaborate?
-
Dec 20th, 2005, 01:23 PM
#3
Thread Starter
Hyperactive Member
Re: Costum Errors
ok. i have made an error handler for my website running iis. how it works it that iis goes to the same page on every error like for http 404 it would give the user /errors/error.php?404 but insted of doing that it gives the user /errors/error.php?404?404;http://path.com/pathwotiswrong/
If there is only one perfect person in the universe, does that make them imperfect?
-
Dec 20th, 2005, 06:03 PM
#4
PowerPoster
Re: Costum Errors
Then the link your using is wrong perhaps? :s
-
Dec 20th, 2005, 06:21 PM
#5
Thread Starter
Hyperactive Member
Re: Costum Errors
ok? i am using this code as my error handler:
PHP Code:
if ($err == "404")
{
$h1 = 'Header/Title';
$body = 'Body Line one. Describes the Error encountered.
<br>Body Line two. Tells the user what they can do.';
}
what it is ment to send for that to work is ?err=404 but insted it is getting ?err=404?404;blah.thing
how can i get it to not either send the ?404;blah.thing or get my code to be able to read that. can any one help?
If there is only one perfect person in the universe, does that make them imperfect?
-
Dec 20th, 2005, 06:42 PM
#6
PowerPoster
Re: Costum Errors
?err=404?404;blah.thing
Would indicate that thers an error in your code. Check whichever file it is that sends you to the page ?err=404. Sounds like your missing a "
I think. :\
-
Dec 21st, 2005, 05:59 AM
#7
Re: Costum Errors
The variable $_GET['err'] will contain "404?404;blah.thing" so all you need to do is extract the protion of the stirng which contains the error code, anything before the ?:
Code:
$code = substr($_GET['err'], 0, strpos($_GET['err'], '?'));
-
Dec 21st, 2005, 07:21 AM
#8
Re: Costum Errors
 Originally Posted by dandono
ok? i am using this code as my error handler:
PHP Code:
if ($err == "404")
{
$h1 = 'Header/Title';
$body = 'Body Line one. Describes the Error encountered.
<br>Body Line two. Tells the user what they can do.';
}
what it is ment to send for that to work is ?err=404 but insted it is getting ?err=404?404;blah.thing
how can i get it to not either send the ?404;blah.thing or get my code to be able to read that. can any one help?
In that case you are sending it wrongly, what are you using to direct to the error page?
I use the .htaccess page to set my error URL, as follows
Code:
ErrorDocument 404 http://mydomain.com/error.php?id=404
Then in error.php just check the value of $_GET['id']. If you it that way nothing extra should get sent.
-
Dec 21st, 2005, 08:09 AM
#9
Re: Costum Errors
This is IIS though, it addsthe info automagically. - so don't put anything in yourself, just the name of the error document.
-
Dec 21st, 2005, 08:11 AM
#10
Re: Costum Errors
Oh IIS. Missed that
-
Dec 21st, 2005, 09:59 AM
#11
Thread Starter
Hyperactive Member
Re: Costum Errors
thanks for the replys and thanks visualad. if i changed iis so insted of the error doc being /errors/error.php?err=404 to /errors/error.php and insted of using $code = substr($_GET['err'], 0, strpos($_GET['err'], '?')); i used $code = substr($_GET['err'], 0, strpos($_GET['err'], ';')); would that work?
If there is only one perfect person in the universe, does that make them imperfect?
-
Dec 21st, 2005, 11:20 AM
#12
Re: Costum Errors
Apparently IIS automatically appends ?<code>;<document> to whatever error document you set. Therefore you can do this:
Code:
list($code, $url) = explode(';', $_SERVER['argv'][1]);
It might be [0], I'm not sure.
You need to change your IIS config so that it only points to /errors/error.php, though, not /errors/error.php?err=404.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|