- in_array: documentation ( source)
<?php
$_GET = [
'param1' => 3000,
'param2' => 'campaign2'
];
$allowed_param = array (
'3000',
'4000',
'5000',
);
if (isset($_GET['param1']) && $_GET['param2'] == 'campaign1') {
if (!in_array($_GET["param1"], $allowed_param)) {
//Header('Referer: https://google.com');
//Header('Location: https://camp1.contoso.com/');
die(1);
} else {
//Header('Referer: https://google.com');
//Header('Location: https://camp1.contoso.com/');
die(2);
}
}
if (isset($_GET['param1']) && $_GET['param2'] == 'campaign2') {
if (!in_array($_GET["param1"], $allowed_param)) {
//Header('Referer: https://google.com');
//Header('Location: https://camp2.contoso.com/');
die(3);
} else {
//Header('Referer: https://google.com');
//Header('Location: https://camp2.contoso.com');
die(4);
}
}
die(5);