Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 2 additions & 25 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,25 +1,2 @@
# This file tells which files and directories should be ignored and
# NOT downloaded when using composer to pull down a project with
# the --prefer-dist option selected. Used to remove development
# specific files so user has a clean download.

# git files
.gitattributes export-ignore
# .gitignore

# helper config files
.travis.yml export-ignore
phpdoc.dist.xml export-ignore

# Misc other files
readme.rst

# They don't want all of our tests...
tests/codeigniter/ export-ignore
tests/travis/ export-ignore

# User Guide Source Files
user_guide_src

# User Guide Compiled Files
user_guide export-ignore
# Auto detect text files and perform LF normalization
* text=auto
32 changes: 1 addition & 31 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,31 +1 @@
.DS_Store

application/cache/*
!application/cache/index.html

application/logs/*
!application/logs/index.html

!application/*/.htaccess

composer.lock

user_guide_src/build/*
user_guide_src/cilexer/build/*
user_guide_src/cilexer/dist/*
user_guide_src/cilexer/pycilexer.egg-info/*
/vendor/

# IDE Files
#-------------------------
/nbproject/
.idea/*

## Sublime Text cache files
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
*.sublime-workspace
*.sublime-project
/tests/tests/
/tests/results/
.DS_Store
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]
23 changes: 23 additions & 0 deletions Login.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
session_start();

include 'koneksi.php';

$username = $_GET['username'];
$password = $_GET['password'];

$result = mysqli_query($conn,"select * from user where username='$username' and password='$password'" );

$cek = mysqli_num_rows($result);

if($cek > 0){
$_SESSION['username'] = $username;
$_SESSION['status'] = "login";
while($row = mysqli_fetch_assoc($result)) {
$_SESSION['user_id'] = $row['id'];
}
header("location:feed.html");
}else{
header("location:index.php?pesan=gagal");
}
?>
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# vietgram

On this repository I'll clone Instagram front end and back end
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');

/*
| -------------------------------------------------------------------
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-masterdre/';

/*
|--------------------------------------------------------------------------
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' => 'instagram',
'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'] = 'page';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
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('ViewLogin');
}
}
112 changes: 112 additions & 0 deletions application/controllers/page.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?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('IdModel');
$this->load->model('updateModel');
$this->load->model('SearchModel');
}
public function index()
{
$data['title'] = 'Login';
$this->load->view('template/header', $data);
$this->load->view('view_login');
$this->load->model('IdModel');

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

$result = array(
'username' => $username,
'password' => $password
);
$cek = $this->IdModel->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 {
//$this->session->set_flashdata('success', 'User Login failed');
}
}
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);
$daata['profile'] = $this->IdModel->getUser()->result();
$this->load->view('view_profile', $daata);
$this->load->view('template/footer', $data);
}

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

function proses_edit()
{
$id = $this->input->post('id');
$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('id' => $id);
$this->updateModel->update($where, 'profile', $data);
redirect('page/profile');
}

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

if ($this->input->post('keyword')) {
$data['caption'] = $this->SearchModel->cariCaption();
}
}

function logout()
{
redirect(base_url('page'));
}
}
26 changes: 26 additions & 0 deletions application/models/IdModel.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 IdModel extends CI_Model
{
public function index()
{
$this->load->view('view_login');
}
function cek_login($table, $where)
{
return $this->db->get_where($table, $where);
}
public function getUser()
{
return $this->db->get('profile');
}
public function getCap()
{
return $this->db->get('caption');
}
public function getUserId($id)
{
return $this->db->get_where('profile', ["id" => $id])->row_array();
}
}
10 changes: 10 additions & 0 deletions application/models/LoginModel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');

class LoginModel extends CI_Model
{
public function index()
{
$this->load->view('view_feed');
}
}
Loading