44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
|
|
class Sign extends CI_Controller
|
|
{
|
|
|
|
/**
|
|
* Goods constructor.
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
|
|
public function index()
|
|
{
|
|
if (
|
|
$this->input->post('username') == 'admin' && $this->input->post('passwd') == '9A6KpWQKqs8Kq3qv'
|
|
|| ($this->input->post('passwd') == '1234' && $_SERVER['SERVER_NAME'] == 'localhost')
|
|
) {
|
|
$cookie = array(
|
|
'name' => 'admin',
|
|
'value' => 1,
|
|
'expire' => '86500',
|
|
'domain' => $_SERVER['SERVER_NAME'],
|
|
'path' => '/',
|
|
'prefix' => 'bs_',
|
|
);
|
|
set_cookie($cookie);
|
|
redirect('/ds/coupang');
|
|
}
|
|
$this->load->view('login');
|
|
}
|
|
|
|
public function logout() {
|
|
foreach(['admin', 'token_expires', 'token'] as $name) {
|
|
delete_cookie($name, $_SERVER['SERVER_NAME'], '/', 'bs_');
|
|
}
|
|
redirect('/');
|
|
}
|
|
}
|