Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.98 KB | None | 0 0
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3.  
  4.  class Captcha extends CI_Controller {
  5.  
  6.   function __construct() {
  7.    parent::__construct();
  8.    
  9.    // load library dan helper
  10.    $this->load->library('session');
  11.    $this->load->helper(array('captcha','url','form'));
  12.   }
  13.  
  14.     function cek() {
  15.         $nama = $this->input->post('nama');
  16.         $email = $this->input->post('email');
  17.  
  18.         if (empty($nama)) {
  19.             $this->session->set_flashdata('notif','<p style="color:red;"><b>Mohon isi nama anda</b></p>');
  20.  
  21.             redirect('captcha');
  22.         }
  23.  
  24.         if (empty($email)) {
  25.             $this->session->set_flashdata('notif','<p style="color:red;"><b>Mohon isi email anda</b></p>');
  26.  
  27.             redirect('captcha');
  28.         }
  29.  
  30.         echo "
  31.            <script>
  32.                alert('Terima kasih, data anda telah diterima.');
  33.                window.location='".base_url()."';
  34.            </script>
  35.        ";
  36.     }
  37.  }
  38. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement