PageRenderTime 29ms CodeModel.GetById 26ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/application/controllers/md5.php

https://github.com/bolnikh/json_md5_codeigniter
PHP | 38 lines | 28 code | 10 blank | 0 comment | 3 complexity | 0830ff6f01dae5e65ac5b1ceeaf95d38 MD5 | raw file
 1<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 2
 3class Md5 extends CI_Controller {
 4
 5	public function index()
 6	{
 7		$this->encode();
 8	}
 9
10    public function encode() {
11
12        $this->load->library('form_validation');
13
14        $this->form_validation->set_rules('data', 'Данные', 'required|xss_clean');
15
16        $data = array();
17        $data['page_title'] = 'MD5 encode, MD5 хеш';
18        if ($this->form_validation->run() == FALSE)
19        {
20            $data['result'] = '';
21        }
22        else
23        {
24            $data['result'] = md5($this->input->post('data'));
25        }
26        $this->load->view('md5/encode', $data);
27    }
28
29    public function file() {
30
31        $data = array();
32        $data['page_title'] = 'MD5 encode file, MD5 хеш файла';
33        $data['result'] = @$_FILES['data'] ? md5_file($_FILES['data']['tmp_name']) : '';
34
35        $this->load->view('md5/file', $data);
36    }
37}
38