jeddi
01-27-2012, 01:26 PM
Hi
I have used the this code to ensure that I get a vaild
url ( or I use "none" value )
if(!filter_var($Db_return, FILTER_VALIDATE_URL)) {
$Db_return = "none";
} // end if
Now I just want to make sure that there is an http://
in place so that the re-direct will work.
if( $return == "none"){
$return_path="thankyou.php";
} // endif
else {
if( substr($return, 0, 7) != "http://" || substr($return, 0, 8) != "https://") {
$return = "http://".$return;
} // endif
else {
$return_path = $return;
} // end else
} // end else
header("Location: $return_path");
Is this a good way to deal with checking for the re-direct ?
Or is there another built-in function I should use ?
Thanks
.
I have used the this code to ensure that I get a vaild
url ( or I use "none" value )
if(!filter_var($Db_return, FILTER_VALIDATE_URL)) {
$Db_return = "none";
} // end if
Now I just want to make sure that there is an http://
in place so that the re-direct will work.
if( $return == "none"){
$return_path="thankyou.php";
} // endif
else {
if( substr($return, 0, 7) != "http://" || substr($return, 0, 8) != "https://") {
$return = "http://".$return;
} // endif
else {
$return_path = $return;
} // end else
} // end else
header("Location: $return_path");
Is this a good way to deal with checking for the re-direct ?
Or is there another built-in function I should use ?
Thanks
.