In my form, I would like the visitor to be able to enter in any field any URL that is test.com or test2.com (wildcard), for example test.com/loquesea/39292, like a wildcard.
I have the following in PHP:
$allowedsites = array(
'http://test.com/*',
'http://test2.com/*',
);
if(in_array($longlink, $allowedsites)) {
$error = "The URL is in the array!";
}else{
$error = "The URL doesn't exists in the array.";
include ("crear.php");
exit;
}
I have tried without * and with *, it has not worked for me. It is for a URL shortener restricted to certain pages . Why in bold? Because I'm not looking if the input matches with a single page, but with more than one. Thanks.