Moved to PHP folder
This commit is contained in:
44
php/application/libraries/Password.php
Normal file
44
php/application/libraries/Password.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
|
||||
|
||||
class Password
|
||||
|
||||
{
|
||||
|
||||
|
||||
|
||||
public function __construct()
|
||||
|
||||
{
|
||||
|
||||
$this->CI =& get_instance();
|
||||
|
||||
//$this->CI->load->library('encrypt');
|
||||
|
||||
}
|
||||
|
||||
public function encrypt_password($password){
|
||||
|
||||
|
||||
|
||||
$key = 'swebin';
|
||||
|
||||
$key2 = 'sosp@$%Ck';
|
||||
|
||||
$string = $password;
|
||||
|
||||
|
||||
|
||||
$output = false;
|
||||
|
||||
$encrypt_method = "AES-256-CBC";
|
||||
|
||||
$key = hash( 'sha256', $key );
|
||||
|
||||
$iv = substr( hash( 'sha256', $key2 ), 0, 16 );
|
||||
|
||||
$output = base64_encode( openssl_encrypt( $string, $encrypt_method, $key, 0, $iv ) );
|
||||
|
29
php/application/libraries/Userauth.php
Normal file
29
php/application/libraries/Userauth.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Userauth
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->CI =& get_instance();
|
||||
$this->CI->load->library('session');
|
||||
}
|
||||
public function logged_in(){
|
||||
|
||||
if ( ! $this->CI->session->userdata('user_id'))
|
||||
{
|
||||
redirect('admin');
|
||||
}
|
||||
}
|
||||
|
||||
public function logged_admin(){
|
||||
|
||||
if (! $this->CI->session->userdata('user_id') && $this->CI->session->userdata('user_type') != "admin")
|
||||
{
|
||||
redirect('admin');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
11
php/application/libraries/index.html
Normal file
11
php/application/libraries/index.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user