Thread: urldecode
View Single Post

  #2 (permalink)  
Old 07-10-2003
Andrew G
 
Posts: n/a
Default Re: urldecode


"Martin Cunningham" <muttly@iol.ie> wrote in message
news:beidkq$36e$1@kermit.esat.net...

> $Error_Number = '403';//urldecode($err);


This may not be the problem but when you initialise a variable using quotes
as you have here, you are defining your error "number" as a string. I think
it's bad programming style to have a variable called $Error_Number that is
in fact a string.

> if('$Error_Number' == 403){
> $Error_Message = "You are not authorized to view this page.<br>You might
> not have permission to view this directory or page using the credentials

you
> supplied.";
> }


Same story here, You don't need the quotes around the variable name but you
do need the quotes around 403 because you have previously defined it as a
string.

So to sum up try either:

$Error_Number = 403;
if($Error_Number == 403){
$Error_Message = "You are not authorized to view this page.<br>You might
not have permission to view this directory or page using the credentials
you
supplied.";
}



Or this:



$Error_Number = '403';
if($Error_Number == '403'){
$Error_Message = "You are not authorized to view this page.<br>You might
not have permission to view this directory or page using the credentials
you
supplied.";
}


The first stores $Error_Number as an integer value as far as PHP is
concerned and the second stores $Error_Number as a string.

I think the first is preferable.

HTH
Andrew


Reply With Quote