function generateDo($view = FALSE) { $datajson = optionGet('captcha_data'); $savepath = jsonDataDecode($datajson, 'folderci', 'captchafolder'); $length = jsonDataDecode($datajson, 'lengthci', '5'); $path = locationUpload('path') . $savepath; fileDirCreate($path); $this->CI->load->helper('captcha'); $vals = array('img_path' => $path . '/', 'img_width' => 200, 'img_height' => 60, 'img_url' => locationUpload('url') . $savepath . '/', 'word_length' => $length, 'font_path' => './system/fonts/texb.ttf', 'pool' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'img_id' => 'cicaptcha', 'font_size' => 16, 'colors' => array('background' => array(255, 255, 255), 'border' => array(135, 5, 0), 'text' => array(0, 0, 0), 'grid' => array(255, 255, 255))); $cap = create_captcha($vals); $data = array('captcha_time' => $cap['time'], 'ip_address' => $this->CI->input->ip_address(), 'word' => $cap['word']); $query = $this->CI->db->insert_string($this->tbl, $data); $this->CI->db->query($query); $urlCaptcha = locationUpload('path') . $savepath; return $urlCaptcha . '/' . $cap['time'] . '.jpg'; }
function addGallery($judul, $keterangan) { $d = array('gallery_title' => $judul, 'gallery_description' => $keterangan, 'gallery_date' => dateNow(TRUE), 'gallery_user' => userInfo('user_id')); $output = array(); $slug = stringCreateSlug($judul); if ($this->m_database->addRow('gallery', $d) == TRUE) { $galeriid = $this->m_database->lastInsertID(); fileDirCreate(locationUpload('path') . 'gallery/' . $judul); $output['galleryid'] = $galeriid; $output['status'] = true; } else { $output['galleryid'] = ''; $output['status'] = false; } return $output; }