I have a Opencart 3.0.3.8 php 8.0. How can I fix this error?
PHP Warning: Undefined array key "admin-key" in /home/websitename/storage/modification/admin/controller/common/login.php on line 92
this is a line 92.
if ($this->request->post['admin-key'] != $this->config->get('config_adminkey')) {
see below complete code.
<file path="admin/controller/common/login.php">
<operation>
<search ><![CDATA[
public function index() {
]]></search>
<add position="after"><![CDATA[
$data['config_adminkey'] = $this->config->get('config_adminkey');
]]></add>
</operation>
<operation>
<search ><![CDATA[
protected function validate() {
]]></search>
<add position="after"><![CDATA[
if ($this->request->post['admin-key'] != $this->config->get('config_adminkey')) {
header("Status: 404 Not Found");
require 'view/template/extension/module/404.html';
exit;