OpenCart 3.0.4.0 - PHP Notice: Undefined index: in catalog/controller/account/register.php
Posted: Wed Oct 16, 2024 8:40 am
Hello!
I found some error messages in my error log, Can someone tell me how to fix this error?
Thank you for your help!
error log
The following are listed as lines from the original file:
catalog/controller/account/register.php
I found some error messages in my error log, Can someone tell me how to fix this error?
Thank you for your help!
error log
Code: Select all
2024-10-16 7:16:09 - PHP Notice: Undefined index: firstname in /home/***/storage/modification/catalog/controller/account/register.php on line 245
2024-10-16 7:16:09 - PHP Notice: Undefined index: lastname in /home/***/storage/modification/catalog/controller/account/register.php on line 249
2024-10-16 7:16:09 - PHP Notice: Undefined index: telephone in /home/***/storage/modification/catalog/controller/account/register.php on line 261
2024-10-16 7:16:09 - PHP Notice: Undefined index: confirm in /home/***/storage/modification/catalog/controller/account/register.php on line 291
2024-10-16 7:16:47 - PHP Notice: Undefined index: name in /home/***/public_html/catalog/controller/information/contact.php on line 145
2024-10-16 7:16:47 - PHP Notice: Undefined index: enquiry in /home/***/public_html/catalog/controller/information/contact.php on line 153
catalog/controller/account/register.php
catalog/controller/information/contact.phpprivate function validate() {
if ((utf8_strlen(trim($this->request->post['firstname'])) < 1) || (utf8_strlen(trim($this->request->post['firstname'])) > 32)) { on line 221
$this->error['firstname'] = $this->language->get('error_firstname');
}
if ((utf8_strlen(trim($this->request->post['lastname'])) < 1) || (utf8_strlen(trim($this->request->post['lastname'])) > 32)) { on line 225
$this->error['lastname'] = $this->language->get('error_lastname');
}
if ((utf8_strlen($this->request->post['email']) > 96) || !filter_var($this->request->post['email'], FILTER_VALIDATE_EMAIL)) {
$this->error['email'] = $this->language->get('error_email');
}
if ($this->model_account_customer->getTotalCustomersByEmail($this->request->post['email'])) {
$this->error['warning'] = $this->language->get('error_exists');
}
if ((utf8_strlen($this->request->post['telephone']) < 3) || (utf8_strlen($this->request->post['telephone']) > 32)) { on line 237
$this->error['telephone'] = $this->language->get('error_telephone');
}
// Customer Group
if (isset($this->request->post['customer_group_id']) && is_array($this->config->get('config_customer_group_display')) && in_array($this->request->post['customer_group_id'], $this->config->get('config_customer_group_display'))) {
$customer_group_id = $this->request->post['customer_group_id'];
} else {
$customer_group_id = $this->config->get('config_customer_group_id');
}
// Custom field validation
$this->load->model('account/custom_field');
$custom_fields = $this->model_account_custom_field->getCustomFields($customer_group_id);
foreach ($custom_fields as $custom_field) {
if ($custom_field['location'] == 'account') {
if ($custom_field['required'] && empty($this->request->post['custom_field'][$custom_field['location']][$custom_field['custom_field_id']])) {
$this->error['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
} elseif (($custom_field['type'] == 'text') && !empty($custom_field['validation']) && !filter_var($this->request->post['custom_field'][$custom_field['location']][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) {
$this->error['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
}
}
}
if ((utf8_strlen(html_entity_decode($this->request->post['password'], ENT_QUOTES, 'UTF-8')) < 4) || (utf8_strlen(html_entity_decode($this->request->post['password'], ENT_QUOTES, 'UTF-8')) > 40)) {
$this->error['password'] = $this->language->get('error_password');
}
if ($this->request->post['confirm'] != $this->request->post['password']) { on line 267
$this->error['confirm'] = $this->language->get('error_confirm');
}
protected function validate() {
if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 32)) { on line 145
$this->error['name'] = $this->language->get('error_name');
}
if (!filter_var($this->request->post['email'], FILTER_VALIDATE_EMAIL)) {
$this->error['email'] = $this->language->get('error_email');
}
if ((utf8_strlen($this->request->post['enquiry']) < 10) || (utf8_strlen($this->request->post['enquiry']) > 3000)) { on line 153
$this->error['enquiry'] = $this->language->get('error_enquiry');
}