[ Mini Kiebo ]
Server: Windows NT DESKTOP-5B8S0D4 6.2 build 9200 (Windows 8 Professional Edition) i586
Path:
D:
/
Backup
/
05122024
/
htdocs
/
tracer
/
application
/
controllers
/
[
Home
]
File: Web.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Web extends CI_Controller { public function _construct() { session_start(); } public function index() { $cek = $this->session->userdata('logged_in'); if(empty($cek)) { $vals = array( 'img_path' => './captcha/', 'img_url' => base_url().'captcha/', 'font_path' => './assets/captcha/times_new_yorker.ttf', 'img_width' => 130, 'img_height' => 30, 'expiration' => 7200, 'word_length' => 2, 'font_size' => 16, 'img_id' => 'Imageid', 'pool' => '0123456789', 'colors' => array( 'background' => array(255, 255, 255), 'border' => array(255, 255, 255), 'text' => array(0, 0, 0), 'grid' => array(255, 40, 40) ) // White background and border, black text and red grid ); $cap = create_captcha($vals); $data = array( 'captcha_time' => $cap['time'], 'ip_address' => $this->input->ip_address(), 'word' => $cap['word'] ); $sess_data['capth'] = $cap['word']; $this->session->set_userdata($sess_data); $query = $this->db->insert_string('captcha', $data); $this->db->query($query); $data['capcha']=$cap['image']; //$this->load->view('global/bg_top',$d); $this->load->view('web/bg_login',$data); //$this->load->view('global/bg_footer',$d); } else { $st = $this->session->userdata('stts'); if($st=='mahasiswa') { header('location:'.base_url().'user_mhs'); } else if($st=='dosen') { header('location:'.base_url().'dosen'); } else if($st=='admin') { header('location:'.base_url().'admin'); } else if($st=='admin_keuangan') { header('location:'.base_url().'admin_keuangan'); } } } public function login() { $expiration = time() - 7200; // Two hour limit $this->db->where('captcha_time < ', $expiration) ->delete('captcha'); // Then see if a captcha exists: $sql = 'SELECT COUNT(*) AS count FROM captcha WHERE word = ? AND ip_address = ? AND captcha_time > ?'; $binds = array($_POST['captcha'], $this->input->ip_address(), $expiration); $query = $this->db->query($sql, $binds); $row = $query->row(); $hg = $this->session->userdata('capth'); $pg = $_POST['captcha']; if ($row->count == 0) { $this->session->set_flashdata('item', 'captcha diisi..'); redirect('web'); }else{ $u = $this->input->post('username'); $p = $this->input->post('password'); $this->web_app_model->getLoginData($u,$p); } } public function ceck() { $pg = $_GET['nim']; $hg = $this->session->userdata('capth'); echo $pg; if ($pg == $hg) { echo ' <span class="badge badge-success"> <i class="ace-icon glyphicon glyphicon-ok"></i></span>'; }elseif ($pg != $hg) { echo ' <i class="ace-icon glyphicon glyphicon-remove"></i>'; } } public function logout() { $cek = $this->session->userdata('logged_in'); if(empty($cek)) { header('location:'.base_url()); } else { $this->session->sess_destroy(); header('location:'.base_url().'web'); } } } /* End of file web.php */ /* Location: ./application/controllers/web.php */