Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
20052d6
Add files via upload
chezapangestu Mar 18, 2020
2252618
Update autoload.php
chezapangestu Mar 18, 2020
10ce466
Add files via upload
chezapangestu Mar 18, 2020
ca4b741
Add files via upload
chezapangestu Mar 18, 2020
997323c
Update routes.php
chezapangestu Mar 18, 2020
6ff3bc9
Update readme.rst
chezapangestu Apr 18, 2020
0064b0a
Add files via upload
chezapangestu Apr 18, 2020
8c6c31c
Delete autoload.php
chezapangestu Apr 18, 2020
0e3a43e
Delete user_agents.php
chezapangestu Apr 18, 2020
ba17351
Delete config.php
chezapangestu Apr 18, 2020
bd79c08
Delete database.php
chezapangestu Apr 18, 2020
4fa063a
Delete doctypes.php
chezapangestu Apr 18, 2020
feb7fdb
Delete constants.php
chezapangestu Apr 18, 2020
8a07f10
Delete foreign_chars.php
chezapangestu Apr 18, 2020
9dd50fa
Delete smileys.php
chezapangestu Apr 18, 2020
2209e4d
Delete routes.php
chezapangestu Apr 18, 2020
2131a2a
Delete profiler.php
chezapangestu Apr 18, 2020
03bace8
Delete mimes.php
chezapangestu Apr 18, 2020
9f5172c
Delete migration.php
chezapangestu Apr 18, 2020
e480e0c
Delete memcached.php
chezapangestu Apr 18, 2020
6cd5817
Delete index.html
chezapangestu Apr 18, 2020
6fdbe9a
Delete hooks.php
chezapangestu Apr 18, 2020
174bce3
Add files via upload
chezapangestu Apr 18, 2020
018bb8d
Add files via upload
chezapangestu Apr 18, 2020
10bd4e1
Add files via upload
chezapangestu Apr 18, 2020
038a5ca
Add files via upload
chezapangestu Apr 18, 2020
56f4cb4
Add files via upload
chezapangestu Apr 18, 2020
38f0336
Add files via upload
chezapangestu Apr 18, 2020
8bc4ed5
Add files via upload
chezapangestu Apr 18, 2020
f39d674
Create .htaccess
chezapangestu Apr 18, 2020
48072dd
Add files via upload
chezapangestu Apr 18, 2020
b86a7e2
Add files via upload
chezapangestu Apr 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
6 changes: 3 additions & 3 deletions application/config/autoload.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
defined('BASEPATH') or exit('No direct script access allowed');

/*
| -------------------------------------------------------------------
Expand Down Expand Up @@ -58,7 +58,7 @@
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array();
$autoload['libraries'] = array('database', 'session', 'upload', 'form_validation');

/*
| -------------------------------------------------------------------
Expand Down Expand Up @@ -89,7 +89,7 @@
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array();
$autoload['helper'] = array('url');

/*
| -------------------------------------------------------------------
Expand Down
20 changes: 10 additions & 10 deletions application/config/config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
defined('BASEPATH') or exit('No direct script access allowed');

/*
|--------------------------------------------------------------------------
Expand All @@ -23,7 +23,7 @@
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = '';
$config['base_url'] = 'http://localhost/vietgram-master/';

/*
|--------------------------------------------------------------------------
Expand All @@ -35,7 +35,7 @@
| variable so that it is blank.
|
*/
$config['index_page'] = 'index.php';
$config['index_page'] = '';

/*
|--------------------------------------------------------------------------
Expand All @@ -52,7 +52,7 @@
|
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
$config['uri_protocol'] = 'REQUEST_URI';
$config['uri_protocol'] = 'REQUEST_URI';

/*
|--------------------------------------------------------------------------
Expand All @@ -76,7 +76,7 @@
| than english.
|
*/
$config['language'] = 'english';
$config['language'] = 'english';

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -400,11 +400,11 @@
| 'cookie_httponly') will also affect sessions.
|
*/
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;

/*
|--------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions application/config/database.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
defined('BASEPATH') or exit('No direct script access allowed');

/*
| -------------------------------------------------------------------
Expand Down Expand Up @@ -76,9 +76,9 @@
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => '',
'username' => 'root',
'password' => '',
'database' => '',
'database' => 'databaseviet',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
Expand Down
4 changes: 2 additions & 2 deletions application/config/routes.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
defined('BASEPATH') or exit('No direct script access allowed');

/*
| -------------------------------------------------------------------------
Expand Down Expand Up @@ -49,6 +49,6 @@
| Examples: my-controller/index -> my_controller/index
| my-controller/my-method -> my_controller/my_method
*/
$route['default_controller'] = 'welcome';
$route['default_controller'] = 'home';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
22 changes: 22 additions & 0 deletions application/controllers/explore.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');

class Explore extends CI_Controller
{

function __construct()
{
parent::__construct();
$this->load->model('m_profile');
}

public function index()
{
$data['title'] = 'Feed';
$user = $this->session->userdata('user');
$data['friends'] = $this->m_profile->getExplore($user['username']);
$this->load->view('templates/header', $data);
$this->load->view('view_explore', $data);
$this->load->view('templates/footer');
}
}
22 changes: 22 additions & 0 deletions application/controllers/feed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');

class Feed extends CI_Controller
{

function __construct()
{
parent::__construct();
$this->load->model('m_feed');
}

public function index()
{
$data['title'] = 'Feed';
$data['feed'] = $this->m_feed->getAllFeed();

$this->load->view('templates/header', $data);
$this->load->view('view_feed', $data);
$this->load->view('templates/footer');
}
}
44 changes: 44 additions & 0 deletions application/controllers/home.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');

class Home extends CI_Controller
{

function __construct()
{
parent::__construct();
$this->load->model('m_user');
}

public function index()
{
$data['title'] = 'Login';
$this->load->view('view_index', $data);
}

public function login()
{
$this->form_validation->set_rules('username', 'username', 'required');
$this->form_validation->set_rules('password', 'password', 'required');

if ($this->form_validation->run() == false) {
redirect('home');
} else {
$uname = $this->input->post('username', true);
$pass = $this->input->post('password', true);
$data = $this->m_user->login($uname, $pass);
if (count($data) == 1) {
$this->session->set_userdata('user', $data[0]);
redirect('feed');
} else {
redirect('home');
}
}
}

public function logout()
{
$this->session->sess_destroy();
redirect('home');
}
}
26 changes: 26 additions & 0 deletions application/controllers/login.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');

class login extends CI_Controller
{

/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see https://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
$this->load->view('view_login');
}
}
156 changes: 156 additions & 0 deletions application/controllers/page.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');

class page extends CI_Controller
{

/**
* @see https://codeigniter.com/user_guide/general/urls.html
*/

public function __construct()
{
parent::__construct();
$this->load->library('form_validation');
$this->load->model('m_id');
$this->load->model('m_update');
$this->load->model('m_search');
$this->load->model('m_upload');
}
public function index()
{
$data['title'] = 'Login';
$this->load->view('template/header', $data);
$this->load->view('view_login');
$this->load->model('m_id');

$username = $this->input->post('username');
$password = $this->input->post('password');

$result = array(
'username' => $username,
'password' => $password
);
$cek = $this->m_id->cek_login("user", $result)->num_rows();
if ($cek > 0) {
$data_session = array(
'nama' => $username,
'status' => "login",
);
$this->session->set_userdata($data_session);
redirect("page/feed");
} else {
//Nothing
}
}
public function feed()
{
$data['title'] = 'Feed';
$this->load->view('template/header', $data);
$this->load->view('view_feed');
$this->load->view('template/footer', $data);
}
public function profile()
{
$data['title'] = 'Profile';
$this->load->view('template/header', $data);
$data['profile'] = $this->m_id->getUser()->result();
$data['photo'] = $this->m_id->getPhoto()->result();
$this->load->view('view_profile', $data);
$this->load->view('template/footer', $data);
}

function edit($username)
{
$head['title'] = 'Update Profile';
$this->load->view('template/header', $head);
$where = array('username' => $username);
$data['profile'] = $this->m_update->ambil_where($where, 'profile')->result();
$this->load->view('view_update', $data);
}

function proses_edit()
{
$name = $this->input->post('name');
$username = $this->input->post('username');
$website = $this->input->post('website');
$bio = $this->input->post('bio');
$email = $this->input->post('email');
$phonenumber = $this->input->post('phonenumber');
$gender = $this->input->post('gender');

$data = array(
'name' => $name,
'username' => $username,
'website' => $website,
'bio' => $bio,
'email' => $email,
'phonenumber' => $phonenumber,
'gender' => $gender
);
$where = array('username' => $username);
$this->m_update->update($where, 'profile', $data);
redirect('page/profile');
}

function search()
{
$data['title'] = 'Feed';
$this->load->view('template/header', $data);
$daata[''] = $this->m_id->getCap()->result();
$this->load->view('view_search', $daata);
$this->load->view('template/footer', $data);

if ($this->input->post('keyword')) {
//Nothing
}
}

function explore()
{
$data['title'] = 'Explore';
$this->load->view('template/header', $data);
$this->load->view('view_explore', $data);
$this->load->view('template/footer', $data);
}

function logout()
{
redirect(base_url('page'));
}

function test()
{
$this->load->view('template/header');
$this->load->view('test');
}

function upload()
{
$data['title'] = "Upload Photo";
$data['photo'] = $this->m_upload->view();
$this->load->view('template/header', $data);
$this->load->view('view_home', $data);
$this->load->view('template/footer', $data);
}

public function tambah()
{
$data['photo'] = $this->m_upload->view();
$this->load->view('template/header', $data);
$data = array();
if ($this->input->post('submit')) {
$upload = $this->m_upload->upload();

if ($upload['result'] == "success") {
$this->m_upload->save($upload);

redirect('page/upload');
} else {
$data['message'] = $upload['error'];
}
}

$this->load->view('view_upload', $data);
}
}
Loading