Post by ivan111 » Sat May 26, 2018 2:37 pm

Is this a good PHP code for 1.5.6. I'm constantly getting a mistake. I get a white screen.

<?php
class ControllerAccountDelete extends Controller {
private $error = array();

public function index() {
if (!$this->customer->isLogged()) {
$this->session->data['redirect'] = HTTPS_SERVER . 'index.php?route=account/delete';

$this->redirect(HTTPS_SERVER . 'index.php?route=account/login');
}

$this->language->load('account/delete');

$this->document->title = $this->language->get('heading_title');

if (isset($this->request->post['password']) && $this->validate()) {
$this->load->model('account/customer');

$this->model_account_customer->deleteCustomer($this->customer->getId());

$this->redirect(HTTPS_SERVER);
}

$this->document->breadcrumbs = array();

$this->document->breadcrumbs[] = array(
'href' => HTTP_SERVER . 'index.php?route=common/home',
'text' => $this->language->get('text_home'),
'separator' => FALSE
);

$this->document->breadcrumbs[] = array(
'href' => HTTPS_SERVER . 'index.php?route=account/account',
'text' => $this->language->get('text_account'),
'separator' => $this->language->get('text_separator')
);

$this->document->breadcrumbs[] = array(
'href' => HTTPS_SERVER . 'index.php?route=account/delete',
'text' => $this->language->get('heading_title'),
'separator' => $this->language->get('text_separator')
);

$this->data['heading_title'] = $this->language->get('heading_title');

$this->data['text_password'] = $this->language->get('text_password');

$this->data['entry_password'] = $this->language->get('entry_password');

$this->data['button_continue'] = $this->language->get('button_continue');
$this->data['button_back'] = $this->language->get('button_back');

if (isset($this->error['confirm'])) {
$this->data['error_confirm'] = $this->error['confirm'];
} else {
$this->data['error_confirm'] = '';
}

$this->data['action'] = HTTPS_SERVER . 'index.php?route=account/delete';

if (isset($this->request->post['password'])) {
$this->data['password'] = $this->request->post['password'];
} else {
$this->data['password'] = '';
}

$this->data['back'] = HTTPS_SERVER . 'index.php?route=account/account';

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/delete.tpl')) {
$this->template = $this->config->get('config_template') . '/template/account/delete.tpl';
} else {
$this->template = 'default/template/account/delete.tpl';
}

$this->children = array(
'common/column_right',
'common/footer',
'common/column_left',
'common/header'
);

$this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
}

private function validate() {
if (!$this->customer->login($this->customer->getEmail(), $this->request->post['password'])) {
$this->error['confirm'] = $this->language->get('error_confirm');
}

if (!$this->error) {
return TRUE;
} else {
return FALSE;
}
}
}
?>

Newbie

Posts

Joined
Sat May 26, 2018 2:12 am

Post by IP_CAM » Sun May 27, 2018 1:21 am


My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 126 guests