Skip to content

Commit

Permalink
Perbaruan Ke hOst
Browse files Browse the repository at this point in the history
  • Loading branch information
onyet committed Jan 22, 2019
1 parent ae82991 commit f377c91
Show file tree
Hide file tree
Showing 335 changed files with 35,541 additions and 155,660 deletions.
Binary file added 1996022518110264/0_24572100_1547438311.txt
Binary file not shown.
Binary file added 1996022518110264/0_26314500_1547442261.txt
Binary file not shown.
Binary file added 1996022518110264/0_33189400_1547438214.txt
Binary file not shown.
308 changes: 308 additions & 0 deletions 1996022518110264/0_62749600_1547455091.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,308 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Members extends CI_Controller {

public function __construct() {

parent::__construct();

if ($this->_cekLogin() === FALSE) {

redirect('../message', 'location');

}

} // end construct

public function index() {

$this->load->library('session');

$lastfile = $this->model->getMyLastFile($this->session->userdata('username'));

$data = array(
'visitor' => $this->model->countAllFileVisitor($this->session->userdata('username')),
'files' => $this->model->countMyFiles($this->session->userdata('username')),
'downloads' => $this->model->countAllFileDownload($this->session->userdata('username')),
'donasi' => $this->model->countAllDonations($this->session->userdata('username')),
'lastfile' => ($lastfile) ? $lastfile : array()
);

$this->load->view('members/partial/header');
$this->load->view('members/partial/navbar');
$this->load->view('members/dashboard', $data);
$this->load->view('modal/contact_us');
$this->load->view('modal/upload_file');
$this->load->view('members/partial/footer');

} // end index

public function proseslogout() {

$this->load->library('session');

$this->session->unset_userdata(array('login_status', 'username', 'user_email', 'user_id', 'user_verify', 'guest_id'));

redirect('../message/logout', 'location');

} // end proseslogout

public function myfiles() {

$this->load->library('session');

$data = array(
'uname' => $this->session->userdata('username'),
'files' => array()
);

$this->db->order_by('file_id', 'DESC');
$this->db->where(array('file_user_uname' => $this->session->userdata('username'), 'file_delete' => '0'));
$q = $this->db->get('tb_file');

if ($q->num_rows() > 0) {

$data['files'] = $q->result();

}

$this->load->view('members/partial/header');
$this->load->view('members/partial/navbar');
$this->load->view('members/myfiles', $data);
$this->load->view('modal/contact_us');
$this->load->view('modal/upload_file');
$this->load->view('members/partial/footer');

} // end myfiles

public function myaccount() {

$this->load->library('session');

$data = array(
'user' => $this->model->getDataUser($this->session->userdata('username')),
);

$this->load->view('members/partial/header');
$this->load->view('members/partial/navbar');
$this->load->view('members/myaccount', $data);
$this->load->view('modal/contact_us');
$this->load->view('modal/upload_file');
$this->load->view('members/partial/footer');

} // end myaccount

public function sendverifikasiemail() {

$this->model->sendVerifikasiEmail();

redirect('../message/members_myaccount', 'location');

} //end sendverifikasiemail

public function update_account() {

$this->load->helper('email');
$userlama = $this->model->getDataUser($this->session->userdata('username'));

$nama = trim(strtolower(htmlentities($this->input->post('txtname'))));
$org = trim(strtolower($this->input->post('txtorganisasi')));
$web = trim(strtolower(htmlentities($this->input->post('txtwebsite'))));
$email= trim(strtolower(htmlentities($this->input->post('txtemail'))));
$pass = hash($this->model->hashalgo, $this->input->post('txtpassword'));
$about= trim(htmlentities($this->input->post('txtabout')));

$data = array(
'user_about' => $about
);

if (strtolower($userlama->user_nama) != $nama) {

$data['user_nama'] = $nama;

}

if (strtolower($userlama->user_organisasi) != $org) {

$data['user_organisasi'] = $org;

}

if (strtolower($userlama->user_website) != $web) {

$data['user_website'] = $web;

}

if (valid_email($email) && $userlama->user_tgl_verify == NULL && strtolower($userlama->user_email) != $email) {

$data['user_email'] = $email;

}

if ($this->input->post('txtpassword') != '' && $userlama->user_pass != $pass) {

$data['user_pass'] = $pass;

}

$ubahdata = $this->model->change_account($data);

redirect('../message/members_myaccount', 'location');

} // end update_account

public function changephoto() {

$this->load->library('session');

$newimage = rand(1, 29) .'.jpg';

$this->db->set('user_avatar', $newimage);
$this->db->where('user_id', $this->session->userdata('user_id'));
$q = $this->db->update('tb_user');

if ($q == 1) {

redirect('../members/myaccount', 'location');

} else {

$this->session->set_flashdata('error', 'Gagal merubah photo profile!');
redirect('../message/members_myaccount', 'location');

}

} // end changephoto

public function uploadmyfile() {

$this->load->library('session');
$allowext = $this->config->item('shareku_ext');

$datauser = $this->model->getDataUser($this->session->userdata('username'));

if ($datauser && $datauser->user_tgl_verify) {

$arramerge= array_merge($allowext['musik'], $allowext['doc'], $allowext['video'], $allowext['lainnya'], $allowext['gambar']);
$allowext2 = implode('|', $arramerge);

if (isset($_POST['submitku'])) {

$config['upload_path'] = './1996022518110264/';
$config['allowed_types'] = $allowext2;
$config['file_name'] = microtime() . '.txt';
$config['max_size'] = 2000;

$hasilupload = $this->model->uploadFile('fileupload', $config);

if ($hasilupload) {

$extfile = explode('.', $hasilupload['client_name']);
$extfile = end($extfile);

$datainsert = array(
'file_nama' => $hasilupload['file_name'],
'file_nama_asli' => strtolower($hasilupload['client_name']),
'file_jenis' => $this->_findTypeFile($extfile),
'file_size' => $hasilupload['file_size'],
'file_type' => $extfile
);

$addtofile = $this->model->add_myfile($datainsert);

if ($addtofile) {

$this->session->set_flashdata('success', 'Berhasil upload file!');

} else {

$this->session->set_flashdata('error', 'Gagal simpan file!');

}

} else {

$this->session->set_flashdata('error', 'Gagal upload file!');

}

} else {

$this->session->set_flashdata('error', 'Anda tidak memiliki akses!');

}

} else {

$this->session->set_flashdata('error', 'Email belum diverfikasi!');

}

redirect('../message/members_myfiles', 'location');

} // end uploadmyfile

public function deletefile($id) {

$this->load->library('session');

$deletefile = $this->model->delete_myfile($id);

if ($deletefile) {

$this->session->set_flashdata('success', 'File berhasil dihapus!');

} else {

$this->session->set_flashdata('error', 'File gagal dihapus!');

}

redirect('../message/members_myfiles', 'location');

} // end deletefile

protected function _findTypeFile($extfile) {

$allext = $this->config->item('shareku_ext');
$newar = explode('.', $extfile);
$extfile= end($newar);

$hasil = 'lainnya';

foreach ($allext as $key => $value) {

$cari = array_search($extfile, $value);

if($cari) {

$hasil = $key;

}

}

return $hasil;

} // end _findTypeFile

protected function _cekLogin() {

$this->load->library('session');

if ($this->session->userdata('login_status') && $this->session->userdata('username')) {

return TRUE;

} else {

return FALSE;

}


} // end _cekLogin

}
Binary file removed 1996022518110264/0_68193600_1545025357.txt
Binary file not shown.
16 changes: 15 additions & 1 deletion application/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = 'https://shareku.onyet/';
// onyet creation index
$onyet_request = (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off') ? 'http://' : 'https://';

$config['base_url'] = $onyet_request . $_SERVER['HTTP_HOST'];
// $config['base_url'] .= preg_replace('@/+$@', '', dirname($_SERVER['SCRIPT_NAME'])).'/';

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -521,3 +525,13 @@
| Array: array('10.0.1.200', '192.168.5.0/24')
*/
$config['proxy_ips'] = '';


// our file config
$config['shareku_ext'] = array(
'musik' => array('aif', 'cda', 'mid', 'midi', 'mp3', 'mpa', 'ogg', 'wav', 'wma', 'wpl'),
'doc' => array('csv', 'db', 'dbf', 'log', 'mdb', 'sav', 'sql', 'xml', 'json', 'fnt', 'fon', 'otf', 'ttf', 'key', 'odp', 'pps', 'ppt', 'pptx', 'c', 'class', 'cpp', 'cs', 'h', 'java', 'sh', 'swift', 'vb', 'html', 'css', 'js', 'cpp', 'ods', 'xlr', 'xls', 'xlsx', 'doc', 'docx', 'odt', 'pdf', 'rtf', 'tex', 'txt', 'wks', 'wps', 'wpd', 'asp', 'aspx', 'cer', 'cfm', 'cgi', 'pl', 'htm', 'jsp', 'part', 'php', 'py', 'rss', 'xhtml', 'sass', 'ts', 'ildoc', 'pdf', 'pub', 'qxd', '0', '1st', '600', '602', 'abw', 'acl', 'afp', 'ami', 'ans', 'asc', 'aww', 'ccf', 'cwk', 'dbk', 'dita', 'docm', 'dot', 'dotx', 'egt', 'epub', 'ezw', 'fdx', 'ftm', 'ftx', 'gdoc', 'hwp', 'hwpml', 'mbp', 'md', 'me', 'mcw', 'mobi', 'nb', 'nbp', 'neis', 'odm', 'odoc', 'osheet', 'ott', 'omm', 'pages', 'pap', 'pdax', 'quox', 'rpt', 'sdw', 'se', 'stw', 'sxw', 'info', 'uof', 'uoml', 'via', 'wpt', 'wrd', 'wrf', 'wri', 'xps'),
'video' => array('3g2', '3gp', 'avi', 'flv', 'h264', 'm4v', 'mkv', 'mov', 'mp4', 'mpg', 'mpeg', 'rm', 'vob', 'wmv', 'wlmp'),
'gambar' => array('gif', 'jpg', 'png', 'bmp', 'ai', 'ico', 'jpeg', 'ps', 'psd', 'svg', 'tif', 'tiff', 'osz', 'nth', 'flipchart', 'cdr', 'cpt', 'dpt', 'indd', 'mcf', 'pmd', 'fm', 'sla', 'scd'),
'lainnya' => array('bak', 'cab', 'cfg', 'cpl', 'cur', 'dll', 'dmp', 'drv', 'icns', 'ini', 'lnk', 'msi', 'sys', 'tmp', 'apk', 'bat', 'bin', 'com', 'exe', 'gadget', 'jar', 'wsf', 'dat', 'tar', 'zip', '7z', 'cab', 'aac', 'ace', 'alz', 'appx', 'at3', 'bke', 'arc', 'arj', 'ass', 'sas', 'b', 'a', 'ba', 'bjsn', 'bzip2', 'bz2', 'deb', 'dmg', 'ddz', 'dn', 'dpe', 'ess', 'skb', 'rpm', 'lzip', 'lzma', 'lzip')
);
6 changes: 5 additions & 1 deletion application/config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@
| my-controller/my-method -> my_controller/my_method
*/
$route['default_controller'] = 'login';
$route['404_override'] = '';
$route['404_override'] = 'login/errorPage';
$route['translate_uri_dashes'] = FALSE;
// my route
$route['logout']= 'members/proseslogout';
$route['unduh/([a-zA-Z\d\-\_]+)'] = 'login/download/$1';
$route['unduh'] = 'login/prosesdownload';
$route['files'] = 'login/files';
$route['message/([a-zA-Z\d\-\_]+)'] = 'login/errorPage/$1';
$route['message'] = 'login/errorPage';
Loading

0 comments on commit f377c91

Please sign in to comment.