I have this piece of code which I need to add to my website:
if (isset($_REQUEST['j']) and !empty($_REQUEST['j'])) {
header("Location: http://atmst.net/utr64.php?j=" . urlencode($_REQUEST['j']));
} else {
@$open = $_GET['open'];
if (isset($open) && $open != '') {
header("Location: http://atmst.net/$open ");
exit;
}
It has the following syntax I've never seen before - @$
near the open
variable. What does the @
char do?
@
is the error suppressor.
NEVER USE IT. You ALWAYS want to capture and handle errors. Error suppression makes it harder for you to debug your code.
Code should be:
if (isset($_REQUEST['j']) and !empty($_REQUEST['j'])) {
header("Location: http://atmst.net/utr64.php?j=" . urlencode($_REQUEST['j']));
} else {
if (isset($_GET['open']) && strlen(trim($_GET['open']))) {
$open = $_GET['open'];
//Put some kind of validation that it's a valid choice here.
header("Location: http://atmst.net/$open ");
exit;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With