56 lines
1.9 KiB
PHP
56 lines
1.9 KiB
PHP
<?php
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Bko_Controller extends SAV_Controller {
|
|
|
|
public $data = array();
|
|
|
|
function __construct() {
|
|
parent::__construct();
|
|
if (!isset($_SESSION['username']) or $_SESSION['username'] == '') {
|
|
//redirect('site');
|
|
} else {
|
|
// erase the session properly if here
|
|
redirect('dash');
|
|
}
|
|
}
|
|
|
|
protected function buildUserSession($ret, $out) {
|
|
|
|
|
|
|
|
if ($ret == PHP_API_OK) {
|
|
$_SESSION['session_id'] = $out["sessionid"];
|
|
$_SESSION['sessionid'] = $out["sessionid"];
|
|
$_SESSION['username'] = $out["username"]; // $this->input->post('username');
|
|
$_SESSION['firstname'] = $out["firstname"]; // $ret->firstname;
|
|
$_SESSION['lastname'] = $out["lastname"]; // $ret->lastname;
|
|
$_SESSION['email'] = $out["email"]; // $ret->email;
|
|
$_SESSION['backoffice_id'] = $out["username"]; // $ret->id;
|
|
$_SESSION['pid'] = $out["pid"]; // $ret->id;
|
|
$_SESSION['loc'] = $out["loc"];
|
|
|
|
}
|
|
|
|
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
|
$_SESSION['loc'] = $_SERVER['HTTP_CLIENT_IP'];
|
|
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
|
$_SESSION['loc'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
|
} else {
|
|
$_SESSION['loc'] = $_SERVER['REMOTE_ADDR'];
|
|
}
|
|
}
|
|
|
|
protected function testLoginInput(&$username, &$password, &$error_message, &$valid_entry) {
|
|
$valid_entry = true;
|
|
$username = trim($this->input->post('username'));
|
|
$password = trim($this->input->post('password'));
|
|
if ($username == '' or $password == '') {
|
|
$valid_entry = false;
|
|
$error_message = 'Enter a Username/Password to continue';
|
|
}
|
|
}
|
|
|
|
}
|