xssbook2/web/routes/error/model.php

32 lines
616 B
PHP
Raw Normal View History

<?php /* Copyright (c) 2024 Freya Murphy */
class ErrorModel extends Model {
private function get_msg(&$data) {
if (!array_key_exists('code', $_GET)) {
$data['msg'] = lang('error');
$data['title'] = '500';
} else {
$code = $_GET['code'];
$data['title'] = $code;
switch ($code) {
case '404':
$data['msg'] = lang('error_404');
break;
case '500':
$data['msg'] = lang('error_500');
break;
default:
$data['msg'] = lang('error');
break;
}
}
}
public function get_data() {
$data = parent::get_data();
$this->get_msg($data);
return $data;
}
}
?>