Scroll to top

Haloo! Selamat Datang di Komunitas Private Training Web Development (33215 Members, 287 Projects, 2917 Topic, 8079 Comments)

Butuh karyawan baru? atau seorang Web Developer (Part-time/Freelance/Full-time) untuk mengerjakan project/aplikasi anda?, cari disini : Members Area Jobs!
Mengganti url halaman Administrator di swarakalibata Ci 2018
EL noer mustoffa Mengatakan : Members -
  1. Assalamualaikum Warahmatullahi Wabarakatuh...
  2.  
  3. mohon bantuannya saya mengunakan swarakalibata_ci_2018_versi_v_1_3_31 ingin merubah halaman administrator menjadi namaapasaja sudah mengikuti turorial https://members.phpmu.com/forum/read/swarakalibata-ci--mengganti-akses--url-halaman-administrator akan tetapi belum berhasil, ketika diakses menu admin yg dirubah akan kembali ke home
Bukhari al Muslim Mengatakan :
Admin -
  1. Assalam,.. coba share/lampirkan file "application/controller/Administrator.php"
  2. kita coba cek disini mas,..

EL noer mustoffa Mengatakan :
Members -
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3. class Administrator extends CI_Controller {
  4. function index(){
  5. if (isset($_POST['submit'])){
  6. if ($this->input->post() && (strtolower($this->input->post('security_code')) == strtolower($this->session->userdata('mycaptcha')))) {
  7. $username = $this->input->post('a');
  8. $password = hash("sha512", md5($this->input->post('b')));
  9. $cek = $this->model_app->cek_login($username,$password,'users');
  10. $row = $cek->row_array();
  11. $total = $cek->num_rows();
  12. if ($total > 0){
  13. $this->session->set_userdata('upload_image_file_manager',true);
  14. $this->session->set_userdata(array('username'=>$row['username'],
  15. 'level'=>$row['level'],
  16. 'id_session'=>$row['id_session']));
  17. redirect($this->uri->segment(1).'/home');
  18. }else{
  19. echo $this->session->set_flashdata('message', '<div class="alert alert-danger"><center>Username dan Password Salah!!</center></div>');
  20. redirect($this->uri->segment(1).'/index');
  21. }
  22. }else{
  23. echo $this->session->set_flashdata('message', '<div class="alert alert-danger"><center>Security Code salah!</center></div>');
  24. redirect($this->uri->segment(1).'/index');
  25. }
  26. }else{
  27. if ($this->session->level!=''){
  28. redirect($this->uri->segment(1).'/home');
  29. }else{
  30. $this->load->helper('captcha');
  31. $vals = array(
  32. 'img_path' => './captcha/',
  33. 'img_url' => base_url().'captcha/',
  34. 'font_path' => './asset/Tahoma.ttf',
  35. 'font_size' => 17,
  36. 'img_width' => '320',
  37. 'img_height' => 33,
  38. 'border' => 0,
  39. 'word_length' => 5,
  40. 'expiration' => 7200
  41. );
  42.  
  43. $cap = create_captcha($vals);
  44. $data['image'] = $cap['image'];
  45. $this->session->set_userdata('mycaptcha', $cap['word']);
  46. $data['title'] = 'Administrator › Log In';
  47. $this->load->view('administrator/view_login',$data);
  48. }
  49. }
  50. }
  51.  
  52. function reset_password(){
  53. if (isset($_POST['submit'])){
  54. $usr = $this->model_app->edit('users', array('id_session' => $this->input->post('id_session')));
  55. if ($usr->num_rows()>=1){
  56. if ($this->input->post('a')==$this->input->post('b')){
  57. $data = array('password'=>hash("sha512", md5($this->input->post('a'))));
  58. $where = array('id_session' => $this->input->post('id_session'));
  59. $this->model_app->update('users', $data, $where);
  60.  
  61. $row = $usr->row_array();
  62. $this->session->set_userdata('upload_image_file_manager',true);
  63. $this->session->set_userdata(array('username'=>$row['username'],
  64. 'level'=>$row['level'],
  65. 'id_session'=>$row['id_session']));
  66. redirect($this->uri->segment(1).'/home');
  67. }else{
  68. $data['title'] = 'Password Tidak sama!';
  69. $this->load->view('administrator/view_reset',$data);
  70. }
  71. }else{
  72. $data['title'] = 'Terjadi Kesalahan!';
  73. $this->load->view('administrator/view_reset',$data);
  74. }
  75. }else{
  76. $this->session->set_userdata(array('id_session'=>$this->uri->segment(3)));
  77. $data['title'] = 'Reset Password';
  78. $this->load->view('administrator/view_reset',$data);
  79. }
  80. }
  81.  
  82. function lupapassword(){
  83. if (isset($_POST['lupa'])){
  84. $email = strip_tags($this->input->post('email'));
  85. $cekemail = $this->model_app->edit('users', array('email' => $email))->num_rows();
  86. if ($cekemail <= 0){
  87. $data['title'] = 'Alamat email tidak ditemukan';
  88. $this->load->view('administrator/view_login',$data);
  89. }else{
  90. $iden = $this->model_app->edit('identitas', array('id_identitas' => 1))->row_array();
  91. $usr = $this->model_app->edit('users', array('email' => $email))->row_array();
  92. $this->load->library('email');
  93.  
  94. $tgl = date("d-m-Y H:i:s");
  95. $subject = 'Lupa Password ...';
  96. $message = "<html><body>
  97. <table style='margin-left:25px'>
  98. <tr><td>Halo $usr[nama_lengkap],<br>
  99. Seseorang baru saja meminta untuk mengatur ulang kata sandi Anda di <span style='color:red'>$iden[url]</span>.<br>
  100. Klik di sini untuk mengganti kata sandi Anda.<br>
  101. Atau Anda dapat copas (Copy Paste) url dibawah ini ke address Bar Browser anda :<br>
  102. <a href='".base_url().$this->uri->segment(1)."/reset_password/$usr[id_session]'>".base_url().$this->uri->segment(1)."/reset_password/$usr[id_session]</a><br><br>
  103.  
  104. Tidak meminta penggantian ini?<br>
  105. Jika Anda tidak meminta kata sandi baru, segera beri tahu kami.<br>
  106. Email. $iden[email], No Telp. $iden[no_telp]</td></tr>
  107. </table>
  108. </body></html> \n";
  109.  
  110. $this->email->from($iden['email'], $iden['nama_website']);
  111. $this->email->to($usr['email']);
  112. $this->email->cc('');
  113. $this->email->bcc('');
  114.  
  115. $this->email->subject($subject);
  116. $this->email->message($message);
  117. $this->email->set_mailtype("html");
  118. $this->email->send();
  119.  
  120. $config['protocol'] = 'sendmail';
  121. $config['mailpath'] = '/usr/sbin/sendmail';
  122. $config['charset'] = 'utf-8';
  123. $config['wordwrap'] = TRUE;
  124. $config['mailtype'] = 'html';
  125. $this->email->initialize($config);
  126.  
  127. $data['title'] = 'Password terkirim ke '.$usr['email'];
  128. $this->load->view('administrator/view_login',$data);
  129. }
  130. }else{
  131. redirect($this->uri->segment(1));
  132. }
  133. }
  134.  
  135. function home(){
  136. if ($this->session->level=='admin'){
  137. $this->template->load('administrator/template','administrator/view_home_admin');
  138. }else{
  139. $data['users'] = $this->model_app->view_where('users',array('username'=>$this->session->username))->row_array();
  140. $data['modul'] = $this->model_app->view_join_one('users','users_modul','id_session','id_umod','DESC');
  141. $this->template->load('administrator/template','administrator/view_home_users',$data);
  142. }
  143. }
  144.  
  145. function identitaswebsite(){
  146. cek_session_akses('identitaswebsite',$this->session->id_session);
  147. if (isset($_POST['submit'])){
  148. $config['upload_path'] = 'asset/images/';
  149. $config['allowed_types'] = 'gif|jpg|png|ico';
  150. $config['max_size'] = '500'; // kb
  151. $this->load->library('upload', $config);
  152. $this->upload->do_upload('j');
  153. $hasil=$this->upload->data();
  154.  
  155. if ($hasil['file_name']==''){
  156. $data = array('nama_website'=>$this->db->escape_str($this->input->post('a')),
  157. 'email'=>$this->db->escape_str($this->input->post('b')),
  158. 'url'=>$this->db->escape_str($this->input->post('c')),
  159. 'facebook'=>$this->input->post('d'),
  160. 'rekening'=>$this->db->escape_str($this->input->post('e')),
  161. 'no_telp'=>$this->db->escape_str($this->input->post('f')),
  162. 'meta_deskripsi'=>$this->input->post('g'),
  163. 'meta_keyword'=>$this->db->escape_str($this->input->post('h')),
  164. 'maps'=>$this->input->post('i'));
  165. }else{
  166. $data = array('nama_website'=>$this->db->escape_str($this->input->post('a')),
  167. 'email'=>$this->db->escape_str($this->input->post('b')),
  168. 'url'=>$this->db->escape_str($this->input->post('c')),
  169. 'facebook'=>$this->input->post('d'),
  170. 'rekening'=>$this->db->escape_str($this->input->post('e')),
  171. 'no_telp'=>$this->db->escape_str($this->input->post('f')),
  172. 'meta_deskripsi'=>$this->input->post('g'),
  173. 'meta_keyword'=>$this->db->escape_str($this->input->post('h')),
  174. 'favicon'=>$hasil['file_name'],
  175. 'maps'=>$this->input->post('i'));
  176. }
  177. $where = array('id_identitas' => $this->input->post('id'));
  178. $this->model_app->update('identitas', $data, $where);
  179.  
  180. redirect($this->uri->segment(1).'/identitaswebsite');
  181. }else{
  182. $proses = $this->model_app->edit('identitas', array('id_identitas' => 1))->row_array();
  183. $data = array('record' => $proses);
  184. $this->template->load('administrator/template','administrator/mod_identitas/view_identitas',$data);
  185. }
  186. }
  187.  
  188. // Controller Modul Menu Website
  189.  
  190. function menuwebsite(){
  191. cek_session_akses('menuwebsite',$this->session->id_session);
  192. $data['record'] = $this->db->query("SELECT * FROM menu order by position, urutan");
  193. $data['halaman'] = $this->model_app->view_ordering('halamanstatis','id_halaman','DESC');
  194. $data['kategori'] = $this->model_app->view_ordering('kategori','id_kategori','DESC');
  195. $this->template->load('administrator/template','administrator/mod_menu/view_menu',$data);
  196. }
  197.  
  198. function save_menuwebsite(){
  199. cek_session_akses('menuwebsite',$this->session->id_session);
  200. $link = $_POST['link'].$_POST['page'].$_POST['kategori'];
  201. if($_POST['id'] != ''){
  202. $this->db->query("UPDATE menu SET nama_menu = '".$_POST['label']."', link = '".$link."' where id_menu = '".$_POST['id']."' ");
  203. $arr['type'] = 'edit';
  204. $arr['label'] = $_POST['label'];
  205. $arr['link'] = $_POST['link'];
  206. $arr['page'] = $_POST['page'];
  207. $arr['kategori'] = $_POST['kategori'];
  208. $arr['id'] = $_POST['id'];
  209. }else{
  210. $row = $this->db->query("SELECT max(urutan)+1 as urutan FROM menu")->row_array();
  211. $this->db->query("INSERT into menu VALUES('','0','".$_POST['label']."', '".$link."','Ya','Bottom','".$row['urutan']."')");
  212. $id = $this->db->insert_id();
  213. $arr['menu'] = '<li class="dd-item dd3-item" data-id="'.$id.'" >
  214. <div class="dd-handle dd3-handle Bottom">Drag</div>
  215. <div class="dd3-content"><span id="label_show'.$id.'">'.$_POST['label'].'</span>
  216. <span class="span-right">/<span id="link_show'.$id.'">'.$link.'</span>   
  217. <a href="'.base_url().'/'.$this->uri->segment(1).'/posisi_menuwebsite/'.$id.'" style="cursor:pointer"><i class="fa fa-chevron-circle-up text-success"></i></a>  
  218. <a class="edit-button" id="'.$id.'" label="'.$_POST['label'].'" link="'.$_POST['link'].'" ><i class="fa fa-pencil"></i></a>  
  219. <a class="del-button" id="'.$id.'"><i class="fa fa-trash"></i></a>
  220. </span>
  221. </div>';
  222. $arr['type'] = 'add';
  223. }
  224. print json_encode($arr);
  225. }
  226.  
  227. function save(){
  228. $data = json_decode($_POST['data']);
  229. function parseJsonArray($jsonArray, $parentID = 0) {
  230. $return = array();
  231. foreach ($jsonArray as $subArray) {
  232. $returnSubSubArray = array();
  233. if (isset($subArray->children)) {
  234. $returnSubSubArray = parseJsonArray($subArray->children, $subArray->id);
  235. }
  236.  
  237. $return[] = array('id' => $subArray->id, 'parentID' => $parentID);
  238. $return = array_merge($return, $returnSubSubArray);
  239. }
  240. return $return;
  241. }
  242. $readbleArray = parseJsonArray($data);
  243.  
  244. $i=0;
  245. foreach($readbleArray as $row){
  246. $i++;
  247. $this->db->query("UPDATE menu SET id_parent = '".$row['parentID']."', urutan = '".$i."' where id_menu = '".$row['id']."' ");
  248. }
  249. }
  250.  
  251. function posisi_menuwebsite(){
  252. cek_session_akses('menuwebsite',$this->session->id_session);
  253. $cek = $this->model_app->view_where('menu',array('id_menu'=>$this->uri->segment(3)))->row_array();
  254. $posisi = ($cek['position'] == 'Top' ? 'Bottom' : 'Top');
  255. $data = array('position'=>$posisi);
  256. $where = array('id_menu' => $this->uri->segment(3));
  257. $this->model_app->update('menu', $data, $where);
  258. redirect($this->uri->segment(1).'/menuwebsite');
  259. }
  260.  
  261. function delete_menuwebsite(){
  262. cek_session_akses('menuwebsite',$this->session->id_session);
  263. $idm = array('id_menu' => $this->input->post('id'));
  264. $this->model_app->delete('menu',$idm);
  265. $idm = array('id_parent' => $this->input->post('id'));
  266. $this->model_app->delete('menu',$idm);
  267. }
  268.  
  269.  
  270. // Controller Modul Halaman Baru
  271.  
  272. function halamanbaru(){
  273. cek_session_akses('halamanbaru',$this->session->id_session);
  274. if ($this->session->level=='admin'){
  275. $data['record'] = $this->model_app->view_ordering('halamanstatis','id_halaman','DESC');
  276. }else{
  277. $data['record'] = $this->model_app->view_where_ordering('halamanstatis',array('username'=>$this->session->username),'id_halaman','DESC');
  278. }
  279. $this->template->load('administrator/template','administrator/mod_halaman/view_halaman',$data);
  280. }
  281.  
  282. function tambah_halamanbaru(){
  283. cek_session_akses('halamanbaru',$this->session->id_session);
  284. if (isset($_POST['submit'])){
  285. $config['upload_path'] = 'asset/foto_statis/';
  286. $config['allowed_types'] = 'gif|jpg|png|JPG|JPEG';
  287. $config['max_size'] = '3000'; // kb
  288. $this->load->library('upload', $config);
  289. $this->upload->do_upload('c');
  290. $hasil=$this->upload->data();
  291. if ($hasil['file_name']==''){
  292. $data = array('judul'=>$this->db->escape_str($this->input->post('a')),
  293. 'judul_seo'=>seo_title($this->input->post('a')),
  294. 'isi_halaman'=>$this->input->post('b'),
  295. 'tgl_posting'=>date('Y-m-d'),
  296. 'username'=>$this->session->username,
  297. 'dibaca'=>'0',
  298. 'jam'=>date('H:i:s'),
  299. 'hari'=>hari_ini(date('w')));
  300. }else{
  301. $data = array('judul'=>$this->db->escape_str($this->input->post('a')),
  302. 'judul_seo'=>seo_title($this->input->post('a')),
  303. 'isi_halaman'=>$this->input->post('b'),
  304. 'tgl_posting'=>date('Y-m-d'),
  305. 'gambar'=>$hasil['file_name'],
  306. 'username'=>$this->session->username,
  307. 'dibaca'=>'0',
  308. 'jam'=>date('H:i:s'),
  309. 'hari'=>hari_ini(date('w')));
  310. }
  311. $this->model_app->insert('halamanstatis',$data);
  312. redirect($this->uri->segment(1).'/halamanbaru');
  313. }else{
  314. $this->template->load('administrator/template','administrator/mod_halaman/view_halaman_tambah');
  315. }
  316. }
  317.  
  318. function edit_halamanbaru(){
  319. cek_session_akses('halamanbaru',$this->session->id_session);
  320. $id = $this->uri->segment(3);
  321. if (isset($_POST['submit'])){
  322. $config['upload_path'] = 'asset/foto_statis/';
  323. $config['allowed_types'] = 'gif|jpg|png|JPG|JPEG';
  324. $config['max_size'] = '3000'; // kb
  325. $this->load->library('upload', $config);
  326. $this->upload->do_upload('c');
  327. $hasil=$this->upload->data();
  328. if ($hasil['file_name']==''){
  329. $data = array('judul'=>$this->db->escape_str($this->input->post('a')),
  330. 'judul_seo'=>seo_title($this->input->post('a')),
  331. 'isi_halaman'=>$this->input->post('b'));
  332. }else{
  333. $data = array('judul'=>$this->db->escape_str($this->input->post('a')),
  334. 'judul_seo'=>seo_title($this->input->post('a')),
  335. 'isi_halaman'=>$this->input->post('b'),
  336. 'gambar'=>$hasil['file_name']);
  337. }
  338. $where = array('id_halaman' => $this->input->post('id'));
  339. $this->model_app->update('halamanstatis', $data, $where);
  340. redirect($this->uri->segment(1).'/halamanbaru');
  341. }else{
  342. if ($this->session->level=='admin'){
  343. $proses = $this->model_app->edit('halamanstatis', array('id_halaman' => $id))->row_array();
  344. }else{
  345. $proses = $this->model_app->edit('halamanstatis', array('id_halaman' => $id, 'username' => $this->session->username))->row_array();
  346. }
  347. $data = array('rows' => $proses);
  348. $this->template->load('administrator/template','administrator/mod_halaman/view_halaman_edit',$data);
  349. }
  350. }
  351.  
  352. function delete_halamanbaru(){
  353. cek_session_akses('halamanbaru',$this->session->id_session);
  354. if ($this->session->level=='admin'){
  355. $id = array('id_halaman' => $this->uri->segment(3));
  356. }else{
  357. $id = array('id_halaman' => $this->uri->segment(3), 'username'=>$this->session->username);
  358. }
  359. $this->model_app->delete('halamanstatis',$id);
  360. redirect($this->uri->segment(1).'/halamanbaru');
  361. }
  362.  
  363. // Controller Modul List Berita
  364.  
  365. function listberita(){
  366. cek_session_akses('listberita',$this->session->id_session);
  367. if ($this->session->level=='admin'){
  368. $data['record'] = $this->model_app->view_ordering('berita','id_berita','DESC');
  369. }else{
  370. $data['record'] = $this->model_app->view_where_ordering('berita',array('username'=>$this->session->username),'id_berita','DESC');
  371. }
  372. $data['rss'] = $this->model_utama->view_joinn('berita','users','kategori','username','id_kategori','id_berita','DESC',0,10);
  373. $data['iden'] = $this->model_utama->view_where('identitas',array('id_identitas' => 1))->row_array();
  374. $this->load->view('administrator/rss',$data);
  375. $this->template->load('administrator/template','administrator/mod_berita/view_berita',$data);
  376. }
  377.  
  378. function tambah_listberita(){
  379. cek_session_akses('listberita',$this->session->id_session);
  380. if (isset($_POST['submit'])){
  381. $config['upload_path'] = 'asset/foto_berita/';
  382. $config['allowed_types'] = 'gif|jpg|png|JPG|JPEG';
  383. $config['max_size'] = '3000'; // kb
  384. $this->load->library('upload', $config);
  385. $this->upload->do_upload('k');
  386. $hasil=$this->upload->data();
  387.  
  388. $config['source_image'] = 'asset/foto_berita/'.$hasil['file_name'];
  389. $config['wm_text'] = 'phpmu.com';
  390. $config['wm_type'] = 'text';
  391. $config['wm_font_path'] = './system/fonts/texb.ttf';
  392. $config['wm_font_size'] = '26';
  393. $config['wm_font_color'] = 'ffffff';
  394. $config['wm_vrt_alignment'] = 'middle';
  395. $config['wm_hor_alignment'] = 'center';
  396. $config['wm_padding'] = '20';
  397. $this->load->library('image_lib',$config);
  398. $this->image_lib->watermark();
  399.  
  400. if ($this->session->level == 'kontributor'){ $status = 'N'; }else{ $status = 'Y'; }
  401. if ($this->input->post('j')!=''){
  402. $tag_seo = $this->input->post('j');
  403. $tag=implode(',',$tag_seo);
  404. }else{
  405. $tag = '';
  406. }
  407. if ($hasil['file_name']==''){
  408. $data = array('id_kategori'=>$this->db->escape_str($this->input->post('a')),
  409. 'username'=>$this->session->username,
  410. 'judul'=>$this->db->escape_str($this->input->post('b')),
  411. 'sub_judul'=>$this->db->escape_str($this->input->post('c')),
  412. 'youtube'=>$this->db->escape_str($this->input->post('d')),
  413. 'judul_seo'=>seo_title($this->input->post('b')),
  414. 'headline'=>$this->db->escape_str($this->input->post('e')),
  415. 'aktif'=>$this->db->escape_str($this->input->post('f')),
  416. 'utama'=>$this->db->escape_str($this->input->post('g')),
  417. 'isi_berita'=>$this->input->post('h'),
  418. 'keterangan_gambar'=>$this->input->post('i'),
  419. 'hari'=>hari_ini(date('w')),
  420. 'tanggal'=>date('Y-m-d'),
  421. 'jam'=>date('H:i:s'),
  422. 'dibaca'=>'0',
  423. 'tag'=>$tag,
  424. 'status'=>$status);
  425. }else{
  426. $data = array('id_kategori'=>$this->db->escape_str($this->input->post('a')),
  427. 'username'=>$this->session->username,
  428. 'judul'=>$this->db->escape_str($this->input->post('b')),
  429. 'sub_judul'=>$this->db->escape_str($this->input->post('c')),
  430. 'youtube'=>$this->db->escape_str($this->input->post('d')),
  431. 'judul_seo'=>seo_title($this->input->post('b')),
  432. 'headline'=>$this->db->escape_str($this->input->post('e')),
  433. 'aktif'=>$this->db->escape_str($this->input->post('f')),
  434. 'utama'=>$this->db->escape_str($this->input->post('g')),
  435. 'isi_berita'=>$this->input->post('h'),
  436. 'keterangan_gambar'=>$this->input->post('i'),
  437. 'hari'=>hari_ini(date('w')),
  438. 'tanggal'=>date('Y-m-d'),
  439. 'jam'=>date('H:i:s'),
  440. 'gambar'=>$hasil['file_name'],
  441. 'dibaca'=>'0',
  442. 'tag'=>$tag,
  443. 'status'=>$status);
  444. }
  445. $this->model_app->insert('berita',$data);
  446. redirect($this->uri->segment(1).'/listberita');
  447. }else{
  448. $data['tag'] = $this->model_app->view_ordering('tag','id_tag','DESC');
  449. $data['record'] = $this->model_app->view_ordering('kategori','id_kategori','DESC');
  450. $this->template->load('administrator/template','administrator/mod_berita/view_berita_tambah',$data);
  451. }
  452. }
  453.  
  454. function edit_listberita(){
  455. cek_session_akses('listberita',$this->session->id_session);
  456. $id = $this->uri->segment(3);
  457. if (isset($_POST['submit'])){
  458. $config['upload_path'] = 'asset/foto_berita/';
  459. $config['allowed_types'] = 'gif|jpg|png|JPG|JPEG';
  460. $config['max_size'] = '3000'; // kb
  461. $this->load->library('upload', $config);
  462. $this->upload->do_upload('k');
  463. $hasil=$this->upload->data();
  464.  
  465. $config['source_image'] = 'asset/foto_berita/'.$hasil['file_name'];
  466. $config['wm_text'] = '';
  467. $config['wm_type'] = 'text';
  468. $config['wm_font_path'] = './system/fonts/texb.ttf';
  469. $config['wm_font_size'] = '26';
  470. $config['wm_font_color'] = 'ffffff';
  471. $config['wm_vrt_alignment'] = 'middle';
  472. $config['wm_hor_alignment'] = 'center';
  473. $config['wm_padding'] = '20';
  474. $this->load->library('image_lib',$config);
  475. $this->image_lib->watermark();
  476.  
  477. if ($this->session->level == 'kontributor'){ $status = 'N'; }else{ $status = 'Y'; }
  478. if ($this->input->post('j')!=''){
  479. $tag_seo = $this->input->post('j');
  480. $tag=implode(',',$tag_seo);
  481. }else{
  482. $tag = '';
  483. }
  484. if ($hasil['file_name']==''){
  485. $data = array('id_kategori'=>$this->db->escape_str($this->input->post('a')),
  486. 'username'=>$this->session->username,
  487. 'judul'=>$this->db->escape_str($this->input->post('b')),
  488. 'sub_judul'=>$this->db->escape_str($this->input->post('c')),
  489. 'youtube'=>$this->db->escape_str($this->input->post('d')),
  490. 'judul_seo'=>seo_title($this->input->post('b')),
  491. 'headline'=>$this->db->escape_str($this->input->post('e')),
  492. 'aktif'=>$this->db->escape_str($this->input->post('f')),
  493. 'utama'=>$this->db->escape_str($this->input->post('g')),
  494. 'isi_berita'=>$this->input->post('h'),
  495. 'keterangan_gambar'=>$this->input->post('i'),
  496. 'hari'=>hari_ini(date('w')),
  497. 'tanggal'=>date('Y-m-d'),
  498. 'jam'=>date('H:i:s'),
  499. 'dibaca'=>'0',
  500. 'tag'=>$tag,
  501. 'status'=>$status);
  502. }else{
  503. $data = array('id_kategori'=>$this->db->escape_str($this->input->post('a')),
  504. 'username'=>$this->session->username,
  505. 'judul'=>$this->db->escape_str($this->input->post('b')),
  506. 'sub_judul'=>$this->db->escape_str($this->input->post('c')),
  507. 'youtube'=>$this->db->escape_str($this->input->post('d')),
  508. 'judul_seo'=>seo_title($this->input->post('b')),
  509. 'headline'=>$this->db->escape_str($this->input->post('e')),
  510. 'aktif'=>$this->db->escape_str($this->input->post('f')),
  511. 'utama'=>$this->db->escape_str($this->input->post('g')),
  512. 'isi_berita'=>$this->input->post('h'),
  513. 'keterangan_gambar'=>$this->input->post('i'),
  514. 'hari'=>hari_ini(date('w')),
  515. 'tanggal'=>date('Y-m-d'),
  516. 'jam'=>date('H:i:s'),
  517. 'gambar'=>$hasil['file_name'],
  518. 'dibaca'=>'0',
  519. 'tag'=>$tag,
  520. 'status'=>$status);
  521. }
  522. $where = array('id_berita' => $this->input->post('id'));
  523. $this->model_app->update('berita', $data, $where);
  524. redirect($this->uri->segment(1).'/listberita');
  525. }else{
  526. $tag = $this->model_app->view_ordering('tag','id_tag','DESC');
  527. $record = $this->model_app->view_ordering('kategori','id_kategori','DESC');
  528. if ($this->session->level=='admin'){
  529. $proses = $this->model_app->edit('berita', array('id_berita' => $id))->row_array();
  530. }else{
  531. $proses = $this->model_app->edit('berita', array('id_berita' => $id, 'username' => $this->session->username))->row_array();
  532. }
  533. $data = array('rows' => $proses,'tag' => $tag,'record' => $record);
  534. $this->template->load('administrator/template','administrator/mod_berita/view_berita_edit',$data);
  535. }
  536. }
  537.  
  538. function publish_listberita(){
  539. cek_session_admin();
  540. if ($this->uri->segment(4)=='Y'){
  541. $data = array('status'=>'N');
  542. }else{
  543. $data = array('status'=>'Y');
  544. }
  545. $where = array('id_berita' => $this->uri->segment(3));
  546. $this->model_app->update('berita', $data, $where);
  547. redirect($this->uri->segment(1).'/listberita');
  548. }
  549.  
  550. function delete_listberita(){
  551. cek_session_akses('listberita',$this->session->id_session);
  552. if ($this->session->level=='admin'){
  553. $id = array('id_berita' => $this->uri->segment(3));
  554. }else{
  555. $id = array('id_berita' => $this->uri->segment(3), 'username'=>$this->session->username);
  556. }
  557. $this->model_app->delete('berita',$id);
  558. redirect($this->uri->segment(1).'/listberita');
  559. }
  560.  
  561.  
  562. // Controller Modul Kategori Berita
  563.  
  564. function kategoriberita(){
  565. cek_session_akses('kategoriberita',$this->session->id_session);
  566. if ($this->session->level=='admin'){
  567. $data['record'] = $this->model_app->view_ordering('kategori','id_kategori','DESC');
  568. }else{
  569. $data['record'] = $this->model_app->view_where_ordering('kategori',array('username'=>$this->session->username),'id_kategori','DESC');
  570. }
  571. $this->template->load('administrator/template','administrator/mod_kategori/view_kategori',$data);
  572. }
  573.  
  574. function tambah_kategoriberita(){
  575. cek_session_akses('kategoriberita',$this->session->id_session);
  576. if (isset($_POST['submit'])){
  577. $data = array('nama_kategori'=>$this->db->escape_str($this->input->post('a')),
  578. 'username'=>$this->session->username,
  579. 'kategori_seo'=>seo_title($this->input->post('a')),
  580. 'aktif'=>$this->db->escape_str($this->input->post('b')),
  581. 'sidebar'=>$this->db->escape_str($this->input->post('c')));
  582. $this->model_app->insert('kategori',$data);
  583. redirect($this->uri->segment(1).'/kategoriberita');
  584. }else{
  585. $this->template->load('administrator/template','administrator/mod_kategori/view_kategori_tambah');
  586. }
  587. }
  588.  
  589. function edit_kategoriberita(){
  590. cek_session_akses('kategoriberita',$this->session->id_session);
  591. $id = $this->uri->segment(3);
  592. if (isset($_POST['submit'])){
  593. $data = array('nama_kategori'=>$this->db->escape_str($this->input->post('a')),
  594. 'username'=>$this->session->username,
  595. 'kategori_seo'=>seo_title($this->input->post('a')),
  596. 'aktif'=>$this->db->escape_str($this->input->post('b')),
  597. 'sidebar'=>$this->db->escape_str($this->input->post('c')));
  598. $where = array('id_kategori' => $this->input->post('id'));
  599. $this->model_app->update('kategori', $data, $where);
  600. redirect($this->uri->segment(1).'/kategoriberita');
  601. }else{
  602. if ($this->session->level=='admin'){
  603. $proses = $this->model_app->edit('kategori', array('id_kategori' => $id))->row_array();
  604. }else{
  605. $proses = $this->model_app->edit('kategori', array('id_kategori' => $id, 'username' => $this->session->username))->row_array();
  606. }
  607. $data = array('rows' => $proses);
  608. $this->template->load('administrator/template','administrator/mod_kategori/view_kategori_edit',$data);
  609. }
  610. }
  611.  
  612. function delete_kategoriberita(){
  613. cek_session_akses('kategoriberita',$this->session->id_session);
  614. if ($this->session->level=='admin'){
  615. $id = array('id_kategori' => $this->uri->segment(3));
  616. }else{
  617. $id = array('id_kategori' => $this->uri->segment(3), 'username'=>$this->session->username);
  618. }
  619. $this->model_app->delete('kategori',$id);
  620. redirect($this->uri->segment(1).'/kategoriberita');
  621. }
  622.  
  623.  
  624. // Controller Modul Tag Berita
  625.  
  626. function tagberita(){
  627. cek_session_akses('tagberita',$this->session->id_session);
  628. if ($this->session->level=='admin'){
  629. $data['record'] = $this->model_app->view_ordering('tag','id_tag','DESC');
  630. }else{
  631. $data['record'] = $this->model_app->view_where_ordering('tag',array('username'=>$this->session->username),'id_tag','DESC');
  632. }
  633. $this->template->load('administrator/template','administrator/mod_tag/view_tag',$data);
  634. }
  635.  
  636. function tambah_tagberita(){
  637. cek_session_akses('tagberita',$this->session->id_session);
  638. if (isset($_POST['submit'])){
  639. $data = array('nama_tag'=>$this->db->escape_str($this->input->post('a')),
  640. 'username'=>$this->session->username,
  641. 'tag_seo'=>seo_title($this->input->post('a')),
  642. 'count'=>'0');
  643. $this->model_app->insert('tag',$data);
  644. redirect($this->uri->segment(1).'/tagberita');
  645. }else{
  646. $this->template->load('administrator/template','administrator/mod_tag/view_tag_tambah');
  647. }
  648. }
  649.  
  650. function edit_tagberita(){
  651. cek_session_akses('tagberita',$this->session->id_session);
  652. $id = $this->uri->segment(3);
  653. if (isset($_POST['submit'])){
  654. $data = array('nama_tag'=>$this->db->escape_str($this->input->post('a')),
  655. 'username'=>$this->session->username,
  656. 'tag_seo'=>seo_title($this->input->post('a')));
  657. $where = array('id_tag' => $this->input->post('id'));
  658. $this->model_app->update('tag', $data, $where);
  659. redirect($this->uri->segment(1).'/tagberita');
  660. }else{
  661. if ($this->session->level=='admin'){
  662. $proses = $this->model_app->edit('tag', array('id_tag' => $id))->row_array();
  663. }else{
  664. $proses = $this->model_app->edit('tag', array('id_tag' => $id, 'username' => $this->session->username))->row_array();
  665. }
  666. $data = array('rows' => $proses);
  667. $this->template->load('administrator/template','administrator/mod_tag/view_tag_edit',$data);
  668. }
  669. }
  670.  
  671. function delete_tagberita(){
  672. cek_session_akses('tagberita',$this->session->id_session);
  673. if ($this->session->level=='admin'){
  674. $id = array('id_tag' => $this->uri->segment(3));
  675. }else{
  676. $id = array('id_tag' => $this->uri->segment(3), 'username'=>$this->session->username);
  677. }
  678. $this->model_app->delete('tag',$id);
  679. redirect($this->uri->segment(1).'/tagberita');
  680. }
  681.  
  682.  
  683. // Controller Modul Komentar Berita
  684.  
  685. function komentarberita(){
  686. cek_session_akses('komentarberita',$this->session->id_session);
  687. $data['record'] = $this->model_app->view_ordering('komentar','id_komentar','DESC');
  688. $this->template->load('administrator/template','administrator/mod_komentar/view_komentar',$data);
  689. }
  690.  
  691. function edit_komentarberita(){
  692. cek_session_akses('komentarberita',$this->session->id_session);
  693. $id = $this->uri->segment(3);
  694. if (isset($_POST['submit'])){
  695. $data = array('nama_komentar'=>$this->input->post('a'),
  696. 'url'=>$this->input->post('b'),
  697. 'isi_komentar'=>$this->input->post('c'),
  698. 'aktif'=>$this->input->post('d'),
  699. 'email'=>$this->input->post('e'));
  700. $where = array('id_komentar' => $this->input->post('id'));
  701. $this->model_app->update('komentar', $data, $where);
  702. redirect($this->uri->segment(1).'/komentarberita');
  703. }else{
  704. $proses = $this->model_app->edit('komentar', array('id_komentar' => $id))->row_array();
  705. $data = array('rows' => $proses);
  706. $this->template->load('administrator/template','administrator/mod_komentar/view_komentar_edit',$data);
  707. }
  708. }
  709.  
  710. function delete_komentarberita(){
  711. cek_session_akses('komentarberita',$this->session->id_session);
  712. $id = array('id_komentar' => $this->uri->segment(3));
  713. $this->model_app->delete('komentar',$id);
  714. redirect($this->uri->segment(1).'/komentarberita');
  715. }
  716.  
  717.  
  718. // Controller Modul Sensor Komentar Berita
  719.  
  720. function sensorkomentar(){
  721. cek_session_akses('sensorkomentar',$this->session->id_session);
  722. if ($this->session->level=='admin'){
  723. $data['record'] = $this->model_app->view_ordering('katajelek','id_jelek','DESC');
  724. }else{
  725. $data['record'] = $this->model_app->view_where_ordering('katajelek',array('username'=>$this->session->username),'id_jelek','DESC');
  726. }
  727. $this->template->load('administrator/template','administrator/mod_sensorkomentar/view_sensorkomentar',$data);
  728. }
  729.  
  730. function tambah_sensorkomentar(){
  731. cek_session_akses('sensorkomentar',$this->session->id_session);
  732. if (isset($_POST['submit'])){
  733. $data = array('kata'=>$this->input->post('a'),
  734. 'username'=>$this->session->username,
  735. 'ganti'=>$this->input->post('b'));
  736. $this->model_app->insert('katajelek',$data);
  737. redirect($this->uri->segment(1).'/sensorkomentar');
  738. }else{
  739. $this->template->load('administrator/template','administrator/mod_sensorkomentar/view_sensorkomentar_tambah');
  740. }
  741. }
  742.  
  743. function edit_sensorkomentar(){
  744. cek_session_akses('sensorkomentar',$this->session->id_session);
  745. $id = $this->uri->segment(3);
  746. if (isset($_POST['submit'])){
  747. $this->model_berita->tag_berita_update();
  748. $data = array('kata'=>$this->input->post('a'),
  749. 'username'=>$this->session->username,
  750. 'ganti'=>$this->input->post('b'));
  751. $where = array('id_jelek' => $this->input->post('id'));
  752. $this->model_app->update('katajelek', $data, $where);
  753. redirect($this->uri->segment(1).'/sensorkomentar');
  754. }else{
  755. if ($this->session->level=='admin'){
  756. $proses = $this->model_app->edit('katajelek', array('id_jelek' => $id))->row_array();
  757. }else{
  758. $proses = $this->model_app->edit('katajelek', array('id_jelek' => $id, 'username' => $this->session->username))->row_array();
  759. }
  760. $data = array('rows' => $proses);
  761. $this->template->load('administrator/template','administrator/mod_sensorkomentar/view_sensorkomentar_edit',$data);
  762. }
  763. }
  764.  
  765. function delete_sensorkomentar(){
  766. cek_session_akses('sensorkomentar',$this->session->id_session);
  767. if ($this->session->level=='admin'){
  768. $id = array('id_jelek' => $this->uri->segment(3));
  769. }else{
  770. $id = array('id_jelek' => $this->uri->segment(3), 'username'=>$this->session->username);
  771. }
  772. $this->model_app->delete('katajelek',$id);
  773. redirect($this->uri->segment(1).'/sensorkomentar');
  774. }
  775.  
  776.  
  777. // Controller Modul Album
  778.  
  779. function album(){
  780. cek_session_akses('album',$this->session->id_session);
  781. if ($this->session->level=='admin'){
  782. $data['record'] = $this->model_app->view_ordering('album','id_album','DESC');
  783. }else{
  784. $data['record'] = $this->model_app->view_where_ordering('album',array('username'=>$this->session->username),'id_album','DESC');
  785. }
  786. $this->template->load('administrator/template','administrator/mod_album/view_album',$data);
  787. }
  788.  
  789. function tambah_album(){
  790. cek_session_akses('album',$this->session->id_session);
  791. if (isset($_POST['submit'])){
  792. $config['upload_path'] = 'asset/img_album/';
  793. $config['allowed_types'] = 'gif|jpg|png|JPG|JPEG';
  794. $config['max_size'] = '3000'; // kb
  795. $this->load->library('upload', $config);
  796. $this->upload->do_upload('c');
  797. $hasil=$this->upload->data();
  798. if ($hasil['file_name']==''){
  799. $data = array('jdl_album'=>$this->input->post('a'),
  800. 'album_seo'=>seo_title($this->input->post('a')),
  801. 'keterangan'=>$this->input->post('b'),
  802. 'aktif'=>'Y',
  803. 'hits_album'=>'0',
  804. 'tgl_posting'=>date('Y-m-d'),
  805. 'jam'=>date('H:i:s'),
  806. 'hari'=>hari_ini(date('w')),
  807. 'username'=>$this->session->username);
  808. }else{
  809. $data = array('jdl_album'=>$this->input->post('a'),
  810. 'album_seo'=>seo_title($this->input->post('a')),
  811. 'keterangan'=>$this->input->post('b'),
  812. 'gbr_album'=>$hasil['file_name'],
  813. 'aktif'=>'Y',
  814. 'hits_album'=>'0',
  815. 'tgl_posting'=>date('Y-m-d'),
  816. 'jam'=>date('H:i:s'),
  817. 'hari'=>hari_ini(date('w')),
  818. 'username'=>$this->session->username);
  819. }
  820.  
  821. $this->model_app->insert('album',$data);
  822. redirect($this->uri->segment(1).'/album');
  823. }else{
  824. $this->template->load('administrator/template','administrator/mod_album/view_album_tambah');
  825. }
  826. }
  827.  
  828. function edit_album(){
  829. cek_session_akses('album',$this->session->id_session);
  830. $id = $this->uri->segment(3);
  831. if (isset($_POST['submit'])){
  832. $config['upload_path'] = 'asset/img_album/';
  833. $config['allowed_types'] = 'gif|jpg|png|JPG|JPEG';
  834. $config['max_size'] = '3000'; // kb
  835. $this->load->library('upload', $config);
  836. $this->upload->do_upload('c');
  837. $hasil=$this->upload->data();
  838. if ($hasil['file_name']==''){
  839. $data = array('jdl_album'=>$this->input->post('a'),
  840. 'album_seo'=>seo_title($this->input->post('a')),
  841. 'keterangan'=>$this->input->post('b'),
  842. 'aktif'=>$this->input->post('d'));
  843. }else{
  844. $data = array('jdl_album'=>$this->input->post('a'),
  845. 'album_seo'=>seo_title($this->input->post('a')),
  846. 'keterangan'=>$this->input->post('b'),
  847. 'gbr_album'=>$hasil['file_name'],
  848. 'aktif'=>$this->input->post('d'));
  849. }
  850. $where = array('id_album' => $this->input->post('id'));
  851. $this->model_app->update('album', $data, $where);
  852. redirect($this->uri->segment(1).'/album');
  853. }else{
  854. if ($this->session->level=='admin'){
  855. $proses = $this->model_app->edit('album', array('id_album' => $id))->row_array();
  856. }else{
  857. $proses = $this->model_app->edit('album', array('id_album' => $id, 'username' => $this->session->username))->row_array();
  858. }
  859. $data = array('rows' => $proses);
  860. $this->template->load('administrator/template','administrator/mod_album/view_album_edit',$data);
  861. }
  862. }
  863.  
  864. function delete_album(){
  865. cek_session_akses('album',$this->session->id_session);
  866. if ($this->session->level=='admin'){
  867. $id = array('id_album' => $this->uri->segment(3));
  868. }else{
  869. $id = array('id_album' => $this->uri->segment(3), 'username'=>$this->session->username);
  870. }
  871. $this->model_app->delete('album',$id);
  872. redirect($this->uri->segment(1).'/album');
  873. }
  874.  
  875.  
  876. // Controller Modul Gallery
  877.  
  878. function gallery(){
  879. cek_session_akses('gallery',$this->session->id_session);
  880. if ($this->session->level=='admin'){
  881. $data['record'] = $this->model_app->view_join_one('gallery','album','id_album','id_gallery','DESC');
  882. }else{
  883. $data['record'] = $this->model_app->view_join_where('gallery','album','id_album',array('gallery.username'=>$this->session->username),'id_gallery','DESC');
  884. }
  885. $this->template->load('administrator/template','administrator/mod_gallery/view_gallery',$data);
  886. }
  887.  
  888. function tambah_gallery(){
  889. cek_session_akses('gallery',$this->session->id_session);
  890. if (isset($_POST['submit'])){
  891. $config['upload_path'] = 'asset/img_galeri/';
  892. $config['allowed_types'] = 'gif|jpg|png|JPG|JPEG';
  893. $config['max_size'] = '3000'; // kb
  894. $this->load->library('upload', $config);
  895. $this->upload->do_upload('d');
  896. $hasil=$this->upload->data();
  897. if ($hasil['file_name']==''){
  898. $data = array('id_album'=>$this->input->post('a'),
  899. 'username'=>$this->session->username,
  900. 'jdl_gallery'=>$this->input->post('b'),
  901. 'gallery_seo'=>seo_title($this->input->post('b')),
  902. 'keterangan'=>$this->input->post('c'));
  903. }else{
  904. $data = array('id_album'=>$this->input->post('a'),
  905. 'username'=>$this->session->username,
  906. 'jdl_gallery'=>$this->input->post('b'),
  907. 'gallery_seo'=>seo_title($this->input->post('b')),
  908. 'keterangan'=>$this->input->post('c'),
  909. 'gbr_gallery'=>$hasil['file_name']);
  910. }
  911. $this->model_app->insert('gallery',$data);
  912. redirect($this->uri->segment(1).'/gallery');
  913. }else{
  914. $data['record'] = $this->model_app->view_ordering('album','id_album','DESC');
  915. $this->template->load('administrator/template','administrator/mod_gallery/view_gallery_tambah',$data);
  916. }
  917. }
  918.  
  919. function edit_gallery(){
  920. cek_session_akses('gallery',$this->session->id_session);
  921. $id = $this->uri->segment(3);
  922. if (isset($_POST['submit'])){
  923. $config['upload_path'] = 'asset/img_galeri/';
  924. $config['allowed_types'] = 'gif|jpg|png|JPG|JPEG';
  925. $config['max_size'] = '3000'; // kb
  926. $this->load->library('upload', $config);
  927. $this->upload->do_upload('d');
  928. $hasil=$this->upload->data();
  929. if ($hasil['file_name']==''){
  930. $data = array('id_album'=>$this->input->post('a'),
  931. 'username'=>$this->session->username,
  932. 'jdl_gallery'=>$this->input->post('b'),
  933. 'gallery_seo'=>seo_title($this->input->post('b')),
  934. 'keterangan'=>$this->input->post('c'));
  935. }else{
  936. $data = array('id_album'=>$this->input->post('a'),
  937. 'username'=>$this->session->username,
  938. 'jdl_gallery'=>$this->input->post('b'),
  939. 'gallery_seo'=>seo_title($this->input->post('b')),
  940. 'keterangan'=>$this->input->post('c'),
  941. 'gbr_gallery'=>$hasil['file_name']);
  942. }
  943. $where = array('id_gallery' => $this->input->post('id'));
  944. $this->model_app->update('gallery', $data, $where);
  945. redirect($this->uri->segment(1).'/gallery');
  946. }else{
  947. $record = $this->model_app->view_ordering('album','id_album','DESC');
  948. if ($this->session->level=='admin'){
  949. $proses = $this->model_app->edit('gallery', array('id_gallery' => $id))->row_array();
  950. }else{
  951. $proses = $this->model_app->edit('gallery', array('id_gallery' => $id, 'username' => $this->session->username))->row_array();
  952. }
  953. $data = array('rows' => $proses,'record' => $record);
  954. $this->template->load('administrator/template','administrator/mod_gallery/view_gallery_edit',$data);
  955. }
  956. }
  957.  
  958. function delete_gallery(){
  959. cek_session_akses('gallery',$this->session->id_session);
  960. if ($this->session->level=='admin'){
  961. $id = array('id_gallery' => $this->uri->segment(3));
  962. }else{
  963. $id = array('id_gallery' => $this->uri->segment(3), 'username'=>$this->session->username);
  964. }
  965. $this->model_app->delete('gallery',$id);
  966. redirect($this->uri->segment(1).'/gallery');
  967. }
  968.  
  969.  
  970. // Controller Modul Video
  971.  
  972. function video(){
  973. cek_session_akses('video',$this->session->id_session);
  974. if ($this->session->level=='admin'){
  975. $data['record'] = $this->model_app->view_join_one('video','playlist','id_playlist','id_video','DESC');
  976. }else{
  977. $data['record'] = $this->model_app->view_join_where('video','playlist','id_playlist',array('video.username'=>$this->session->username),'id_video','DESC');
  978. }
  979. $this->template->load('administrator/template','administrator/mod_video/view_video',$data);
  980. }
  981.  
  982. function tambah_video(){
  983. cek_session_akses('video',$this->session->id_session);
  984. if (isset($_POST['submit'])){
  985. $config['upload_path'] = 'asset/img_video/';
  986. $config['allowed_types'] = 'gif|jpg|png|JPG|JPEG';
  987. $config['max_size'] = '3000'; // kb
  988. $this->load->library('upload', $config);
  989. $this->upload->do_upload('d');
  990. $hasil=$this->upload->data();
  991.  
  992. if ($this->input->post('f')!=''){
  993. $tag_seo = $this->input->post('f');
  994. $tag=implode(',',$tag_seo);
  995. }else{
  996. $tag = '';
  997. }
  998.  
  999. if ($hasil['file_name']==''){
  1000. $data = array('id_playlist'=>$this->input->post('a'),
  1001. 'username'=>$this->session->username,
  1002. 'jdl_video'=>$this->input->post('b'),
  1003. 'video_seo'=>seo_title($this->input->post('b')),
  1004. 'keterangan'=>$this->input->post('c'),
  1005. 'video'=>'',
  1006. 'youtube'=>$this->input->post('e'),
  1007. 'dilihat'=>'0',
  1008. 'hari'=>hari_ini(date('w')),
  1009. 'tanggal'=>date('Y-m-d'),
  1010. 'jam'=>date('H:i:s'),
  1011. 'tagvid'=>$tag);
  1012. }else{
  1013. $data = array('id_playlist'=>$this->input->post('a'),
  1014. 'username'=>$this->session->username,
  1015. 'jdl_video'=>$this->input->post('b'),
  1016. 'video_seo'=>seo_title($this->input->post('b')),
  1017. 'keterangan'=>$this->input->post('c'),
  1018. 'gbr_video'=>$hasil['file_name'],
  1019. 'video'=>'',
  1020. 'youtube'=>$this->input->post('e'),
  1021. 'dilihat'=>'0',
  1022. 'hari'=>hari_ini(date('w')),
  1023. 'tanggal'=>date('Y-m-d'),
  1024. 'jam'=>date('H:i:s'),
  1025. 'tagvid'=>$tag);
  1026. }
  1027. $this->model_app->insert('video',$data);
  1028. redirect($this->uri->segment(1).'/video');
  1029. }else{
  1030. $data['record'] = $this->model_app->view_ordering('playlist','id_playlist','DESC');
  1031. $data['tag'] = $this->model_app->view_ordering('tagvid','id_tag','DESC');
  1032. $this->template->load('administrator/template','administrator/mod_video/view_video_tambah',$data);
  1033. }
  1034. }
  1035.  
  1036. function edit_video(){
  1037. cek_session_akses('video',$this->session->id_session);
  1038. $id = $this->uri->segment(3);
  1039. if (isset($_POST['submit'])){
  1040. $config['upload_path'] = 'asset/img_video/';
  1041. $config['allowed_types'] = 'gif|jpg|png|JPG|JPEG';
  1042. $config['max_size'] = '3000'; // kb
  1043. $this->load->library('upload', $config);
  1044. $this->upload->do_upload('d');
  1045. $hasil=$this->upload->data();
  1046.  
  1047. if ($this->input->post('f')!=''){
  1048. $tag_seo = $this->input->post('f');
  1049. $tag=implode(',',$tag_seo);
  1050. }else{
  1051. $tag = '';
  1052. }
  1053.  
  1054. if ($hasil['file_name']==''){
  1055. $data = array('id_playlist'=>$this->input->post('a'),
  1056. 'username'=>$this->session->username,
  1057. 'jdl_video'=>$this->input->post('b'),
  1058. 'video_seo'=>seo_title($this->input->post('b')),
  1059. 'keterangan'=>$this->input->post('c'),
  1060. 'video'=>'',
  1061. 'youtube'=>$this->input->post('e'),
  1062. 'tagvid'=>$tag);
  1063. }else{
  1064. $data = array('id_playlist'=>$this->input->post('a'),
  1065. 'username'=>$this->session->username,
  1066. 'jdl_video'=>$this->input->post('b'),
  1067. 'video_seo'=>seo_title($this->input->post('b')),
  1068. 'keterangan'=>$this->input->post('c'),
  1069. 'gbr_video'=>$hasil['file_name'],
  1070. 'video'=>'',
  1071. 'youtube'=>$this->input->post('e'),
  1072. 'tagvid'=>$tag);
  1073. }
  1074.  
  1075. $where = array('id_video' => $this->input->post('id'));
  1076. $this->model_app->update('video', $data, $where);
  1077. redirect($this->uri->segment(1).'/video');
  1078. }else{
  1079. $record = $this->model_app->view_ordering('playlist','id_playlist','DESC');
  1080. $tag = $this->model_app->view_ordering('tagvid','id_tag','DESC');
  1081. if ($this->session->level=='admin'){
  1082. $proses = $this->model_app->edit('video', array('id_video' => $id))->row_array();
  1083. }else{
  1084. $proses = $this->model_app->edit('video', array('id_video' => $id, 'username' => $this->session->username))->row_array();
  1085. }
  1086.  
  1087. $data = array('rows' => $proses,'record' => $record, 'tag' => $tag);
  1088. $this->template->load('administrator/template','administrator/mod_video/view_video_edit',$data);
  1089. }
  1090. }
  1091.  
  1092. function delete_video(){
  1093. cek_session_akses('video',$this->session->id_session);
  1094. if ($this->session->level=='admin'){
  1095. $id = array('id_video' => $this->uri->segment(3));
  1096. }else{
  1097. $id = array('id_video' => $this->uri->segment(3), 'username'=>$this->session->username);
  1098. }
  1099. $this->model_app->delete('video',$id);
  1100. redirect($this->uri->segment(1).'/video');
  1101. }
  1102.  
  1103.  
  1104. // Controller Modul Playlist
  1105.  
  1106. function playlist(){
  1107. cek_session_akses('playlist',$this->session->id_session);
  1108. $data['record'] = $this->model_app->view_ordering('playlist','id_playlist','DESC');
  1109. $this->template->load('administrator/template','administrator/mod_playlist/view_playlist',$data);
  1110. }
  1111.  
  1112. function tambah_playlist(){
  1113. cek_session_akses('playlist',$this->session->id_session);
  1114. if (isset($_POST['submit'])){
  1115. $config['upload_path'] = 'asset/img_playlist/';
  1116. $config['allowed_types'] = 'gif|jpg|png|JPG|JPEG';
  1117. $config['max_size'] = '3000'; // kb
  1118. $this->load->library('upload', $config);
  1119. $this->upload->do_upload('b');
  1120. $hasil=$this->upload->data();
  1121. if ($hasil['file_name']==''){
  1122. $data = array('jdl_playlist'=>$this->input->post('a'),
  1123. 'username'=>$this->session->username,
  1124. 'playlist_seo'=>seo_title($this->input->post('a')),
  1125. 'aktif'=>'Y');
  1126. }else{
  1127. $data = array('jdl_playlist'=>$this->input->post('a'),
  1128. 'username'=>$this->session->username,
  1129. 'playlist_seo'=>seo_title($this->input->post('a')),
  1130. 'gbr_playlist'=>$hasil['file_name'],
  1131. 'aktif'=>'Y');
  1132. }
  1133. $this->model_app->insert('playlist',$data);
  1134. redirect($this->uri->segment(1).'/playlist');
  1135. }else{
  1136. $this->template->load('administrator/template','administrator/mod_playlist/view_playlist_tambah');
  1137. }
  1138. }
  1139.  
  1140. function edit_playlist(){
  1141. cek_session_akses('playlist',$this->session->id_session);
  1142. $id = $this->uri->segment(3);
  1143. if (isset($_POST['submit'])){
  1144. $config['upload_path'] = 'asset/img_playlist/';
  1145. $config['allowed_types'] = 'gif|jpg|png|JPG|JPEG';
  1146. $config['max_size'] = '3000'; // kb
  1147. $this->load->library('upload', $config);
  1148. $this->upload->do_upload('b');
  1149. $hasil=$this->upload->data();
  1150. if ($hasil['file_name']==''){
  1151. $data = array('jdl_playlist'=>$this->input->post('a'),
  1152. 'username'=>$this->session->username,
  1153. 'playlist_seo'=>seo_title($this->input->post('a')),
  1154. 'aktif'=>$this->input->post('c'));
  1155. }else{
  1156. $data = array('jdl_playlist'=>$this->input->post('a'),
  1157. 'username'=>$this->session->username,
  1158. 'playlist_seo'=>seo_title($this->input->post('a')),
  1159. 'gbr_playlist'=>$hasil['file_name'],
  1160. 'aktif'=>$this->input->post('c'));
  1161. }
  1162. $where = array('id_playlist' => $this->input->post('id'));
  1163. $this->model_app->update('playlist', $data, $where);
  1164. redirect($this->uri->segment(1).'/playlist');
  1165. }else{
  1166. $proses = $this->model_app->edit('playlist', array('id_playlist' => $id))->row_array();
  1167. $data = array('rows' => $proses);
  1168. $this->template->load('administrator/template','administrator/mod_playlist/view_playlist_edit',$data);
  1169. }
  1170. }
  1171.  
  1172. function delete_playlist(){
  1173. cek_session_akses('playlist',$this->session->id_session);
  1174. $id = array('id_playlist' => $this->uri->segment(3));
  1175. $this->model_app->delete('playlist',$id);
  1176. redirect($this->uri->segment(1).'/playlist');
  1177. }
  1178.  
  1179.  
  1180. // Controller Modul Tag Video
  1181.  
  1182. function tagvideo(){
  1183. cek_session_akses('tagvideo',$this->session->id_session);
  1184. if ($this->session->level=='admin'){
  1185. $data['record'] = $this->model_app->view_ordering('tagvid','id_tag','DESC');
  1186. }else{
  1187. $data['record'] = $this->model_app->view_where_ordering('tagvid',array('username'=>$this->session->username),'id_tag','DESC');
  1188. }
  1189. $this->template->load('administrator/template','administrator/mod_tagvideo/view_tag',$data);
  1190. }
  1191.  
  1192. function tambah_tagvideo(){
  1193. cek_session_akses('tagvideo',$this->session->id_session);
  1194. if (isset($_POST['submit'])){
  1195. $data = array('nama_tag'=>$this->db->escape_str($this->input->post('a')),
  1196. 'username'=>$this->session->username,
  1197. 'tag_seo'=>seo_title($this->input->post('a')),
  1198. 'count'=>'0');
  1199. $this->model_app->insert('tagvid',$data);
  1200. redirect($this->uri->segment(1).'/tagvideo');
  1201. }else{
  1202. $this->template->load('administrator/template','administrator/mod_tagvideo/view_tag_tambah');
  1203. }
  1204. }
  1205.  
  1206. function edit_tagvideo(){
  1207. cek_session_akses('tagvideo',$this->session->id_session);
  1208. $id = $this->uri->segment(3);
  1209. if (isset($_POST['submit'])){
  1210. $data = array('nama_tag'=>$this->db->escape_str($this->input->post('a')),
  1211. 'username'=>$this->session->username,
  1212. 'tag_seo'=>seo_title($this->input->post('a')));
  1213. $where = array('id_tag' => $this->input->post('id'));
  1214. $this->model_app->update('tagvid', $data, $where);
  1215. redirect($this->uri->segment(1).'/tagvideo');
  1216. }else{
  1217. if ($this->session->level=='admin'){
  1218. $proses = $this->model_app->edit('tagvid', array('id_tag' => $id))->row_array();
  1219. }else{
  1220. $proses = $this->model_app->edit('tagvid', array('id_tag' => $id, 'username' => $this->session->username))->row_array();
  1221. }
  1222.  
  1223. $data = array('rows' => $proses);
  1224. $this->template->load('administrator/template','administrator/mod_tagvideo/view_tag_edit',$data);
  1225. }
  1226. }
  1227.  
  1228. function delete_tagvideo(){
  1229. cek_session_akses('tagvideo',$this->session->id_session);
  1230. if ($this->session->level=='admin'){
  1231. $id = array('id_tag' => $this->uri->segment(3));
  1232. }else{
  1233. $id = array('id_tag' => $this->uri->segment(3), 'username'=>$this->session->username);
  1234. }
  1235. $this->model_app->delete('tagvid',$id);
  1236. redirect($this->uri->segment(1).'/tagvideo');
  1237. }
  1238.  
  1239.  
  1240. // Controller Modul Komentar Video
  1241.  
  1242. function komentarvideo(){
  1243. cek_session_akses('komentarvideo',$this->session->id_session);
  1244. $data['record'] = $this->model_app->view_join_one('komentarvid','video','id_video','id_komentar','DESC');
  1245. $this->template->load('administrator/template','administrator/mod_komentarvideo/view_komentar',$data);
  1246. }
  1247.  
  1248. function edit_komentarvideo(){
  1249. cek_session_akses('komentarvideo',$this->session->id_session);
  1250. $id = $this->uri->segment(3);
  1251. if (isset($_POST['submit'])){
  1252. $data = array('nama_komentar'=>$this->input->post('a'),
  1253. 'url'=>$this->input->post('b'),
  1254. 'isi_komentar'=>$this->input->post('c'),
  1255. 'aktif'=>$this->input->post('d'));
  1256. $where = array('id_komentar' => $this->input->post('id'));
  1257. $this->model_app->update('komentarvid', $data, $where);
  1258. redirect($this->uri->segment(1).'/komentarvideo');
  1259. }else{
  1260. $proses = $this->model_app->edit('komentarvid', array('id_komentar' => $id))->row_array();
  1261. $data = array('rows' => $proses);
  1262. $this->template->load('administrator/template','administrator/mod_komentarvideo/view_komentar_edit',$data);
  1263. }
  1264. }
  1265.  
  1266. function delete_komentarvideo(){
  1267. cek_session_akses('komentarvideo',$this->session->id_session);
  1268. $id = array('id_komentar' => $this->uri->segment(3));
  1269. $this->model_app->delete('komentarvid',$id);
  1270. redirect($this->uri->segment(1).'/komentarvideo');
  1271. }
  1272.  
  1273. // Controller Modul Iklan Atas
  1274.  
  1275. function iklanatas(){
  1276. cek_session_akses('iklanatas',$this->session->id_session);
  1277. if ($this->session->level=='admin'){
  1278. $data['record'] = $this->model_app->view_ordering('iklanatas','id_iklanatas','DESC');
  1279. }else{
  1280. $data['record'] = $this->model_app->view_where_ordering('iklanatas',array('username'=>$this->session->username),'id_iklanatas','DESC');
  1281. }
  1282. $this->template->load('administrator/template','administrator/mod_iklanatas/view_iklanatas',$data);
  1283. }
  1284.  
  1285. function tambah_iklanatas(){
  1286. cek_session_akses('iklanatas',$this->session->id_session);
  1287. if (isset($_POST['submit'])){
  1288. $config['upload_path'] = 'asset/foto_iklanatas/';
  1289. $config['allowed_types'] = 'gif|jpg|png|JPG|JPEG|swf';
  1290. $config['max_size'] = '3000'; // kb
  1291. $this->load->library('upload', $config);
  1292. $this->upload->do_upload('c');
  1293. $hasil=$this->upload->data();
  1294. if ($hasil['file_name']==''){
  1295. $data = array('judul'=>$this->db->escape_str($this->input->post('a')),
  1296. 'username'=>$this->session->username,
  1297. 'url'=>$this->input->post('b'),
  1298. 'tgl_posting'=>date('Y-m-d'));
  1299. }else{
  1300. $data = array('judul'=>$this->db->escape_str($this->input->post('a')),
  1301. 'username'=>$this->session->username,
  1302.  

EL noer mustoffa Mengatakan :
Members -
  1. Assalam,..

Ada 1 File Kiriman :
1. Maaf File 'Administrator.txt (0)' Gagal Terkirim!
Bukhari al Muslim Mengatakan :
Admin -
  1. Assalam,.. saya lihat dari kode/script Administrator.php
  2. yang di share di atas berarti masnya belum mengikuti tutorial yang disampaikan disini :
  3. https://members.phpmu.com/forum/read/swarakalibata-ci--mengganti-akses--url-halaman-administrator
  4.  
  5. Coba buka lagi topicnya dan perhatikan khususnya pada point 3. ^_^

Bukhari al Muslim Mengatakan :
Admin -
  1. Assalam,.. nama file yang diubah dari Administrator.php menjadi Xxx.php
  2. maka pada "class Administrator extends CI_Controller" di dalam file tersebut juga harus diubah sesuai dengan nama filenya
  3. jadinya "class Xxx extends CI_Controller"

Maaf, Untuk Memberikan Komentar Anda Harus Login !!!