PHP 注意:未定义索引:选择消息
PHP Notice: Undefined index: selecting-message
我总是遇到这个错误:
PHP Notice: Undefined index: selecting-message in /content-protection.php on line 390" and I have tried for many hours to solve this.
希望有人能帮助我。
第 390 行代码:
$message = $_POST['selecting-message'];
$update = mysqli_query($connect, "UPDATE `$table` SET enabled='$enabled', alert='$alert', message='$message' WHERE id=14");
echo '<meta http-equiv="refresh" content="0;url=content-protection">';
}
通知告诉您 POST 数组不包含具有键 selecting-message
的元素。这可能是上一页表单中的空白字段、拼写错误或任何其他原因导致它不存在。
只需检查一个值而不是假定它存在:
if ( isset ( $_POST['selecting-message'] ) ) {
$message = $_POST['selecting-message'];
$update = mysqli_query($connect, "UPDATE `$table` SET enabled='$enabled', alert='$alert', message='$message' WHERE id=14");
echo '<meta http-equiv="refresh" content="0;url=content-protection">';
}
我发现 'unexpected end of file' 错误通常是由代码中某处的大括号“{}”不平衡引起的。检查一下,看看是否有'{'某处没有对应的'}'
kev.
您也许应该阅读有关 SQL 注射的内容。将 POST 值直接传递到查询中而不进行清理将导致网站被黑。
这是一个简单的 PHP 网络 shell,如上所述,允许在您的网络服务器上执行代码。最好摆脱它并强化您的应用程序
我总是遇到这个错误:
PHP Notice: Undefined index: selecting-message in /content-protection.php on line 390" and I have tried for many hours to solve this.
希望有人能帮助我。
第 390 行代码:
$message = $_POST['selecting-message'];
$update = mysqli_query($connect, "UPDATE `$table` SET enabled='$enabled', alert='$alert', message='$message' WHERE id=14");
echo '<meta http-equiv="refresh" content="0;url=content-protection">';
}
通知告诉您 POST 数组不包含具有键 selecting-message
的元素。这可能是上一页表单中的空白字段、拼写错误或任何其他原因导致它不存在。
只需检查一个值而不是假定它存在:
if ( isset ( $_POST['selecting-message'] ) ) {
$message = $_POST['selecting-message'];
$update = mysqli_query($connect, "UPDATE `$table` SET enabled='$enabled', alert='$alert', message='$message' WHERE id=14");
echo '<meta http-equiv="refresh" content="0;url=content-protection">';
}
我发现 'unexpected end of file' 错误通常是由代码中某处的大括号“{}”不平衡引起的。检查一下,看看是否有'{'某处没有对应的'}'
kev.
您也许应该阅读有关 SQL 注射的内容。将 POST 值直接传递到查询中而不进行清理将导致网站被黑。
这是一个简单的 PHP 网络 shell,如上所述,允许在您的网络服务器上执行代码。最好摆脱它并强化您的应用程序