Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- class Admin extends CI_Controller {
- /**
- * Index Page for this controller.
- *
- * Maps to the following URL
- * http://example.com/index.php/welcome
- * - or -
- * http://example.com/index.php/welcome/index
- * - or -
- * Since this controller is set as the default controller in
- * config/routes.php, it's displayed at http://example.com/
- *
- * So any other public methods not prefixed with an underscore will
- * map to /index.php/welcome/<method_name>
- * @see https://codeigniter.com/user_guide/general/urls.html
- */
- public function __construct(){
- parent::__construct();
- $this->load->model('Security_model');
- }
- public function index()
- {
- $this->load->view('welcome_message');
- }
- public function adminindex()
- {
- $this->load->view('admin/index');
- //echo "string";
- }
- public function adminlogin()
- {
- //$this->load->view('welcome_message');
- $this->load->view('admin/adminlogin');
- //$this->load->function('verifylogin');
- }
- public function verifylogin()
- {
- $email = $this->input->post('email');
- $pass = $this->input->post('pass');
- $query = $this->db->get('Admin');
- foreach ($query->result() as $row)
- {
- if(password_verify($pass,$row->password)&&$email==$row->password){
- echo "TRUE";
- }
- else{
- echo "FALSE";
- }
- }
- echo "Email is $email <br> Password is $pass";
- }
- public function sampleSecurity()
- {
- $x = $this->Security_model->encrypt_string('admin');
- echo "<br>Hashed String:";
- echo $this->Security_model->hash_pass('admin');
- echo "<br>encrypted String:";
- echo $x;
- echo "<br>Decrypted String:";
- echo $this->Security_model->decrypt_string($x);
- echo "<br/><br/>";
- if(password_verify("admin",$this->Security_model->hash_pass('admin'))){
- echo "TRUE";
- }
- else{
- echo "FALSE";
- }
- }
- public function database()
- {
- $query = $this->db->get('Admin');
- foreach ($query->result() as $row)
- {
- echo $row->password;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement