+
+
+ diff --git a/.gitattributes b/.gitattributes index a4296d591b8..eba1110b579 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 269044ea9ea..496ee2ca6a2 100644 --- a/.gitignore +++ b/.gitignore @@ -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 \ No newline at end of file diff --git a/.htaccess b/.htaccess new file mode 100644 index 00000000000..9e25198b5a4 --- /dev/null +++ b/.htaccess @@ -0,0 +1,4 @@ +RewriteEngine On +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule ^(.*)$ index.php/$1 [L] \ No newline at end of file diff --git a/Login.php b/Login.php new file mode 100644 index 00000000000..a49e6ff1bd1 --- /dev/null +++ b/Login.php @@ -0,0 +1,23 @@ + 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"); + } +?> diff --git a/README.md b/README.md new file mode 100644 index 00000000000..01d6d13dce8 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# vietgram + +On this repository I'll clone Instagram front end and back end \ No newline at end of file diff --git a/application/config/autoload.php b/application/config/autoload.php index 7cdc9013c11..e8968fa86db 100644 --- a/application/config/autoload.php +++ b/application/config/autoload.php @@ -1,5 +1,5 @@ 'ua'); */ -$autoload['libraries'] = array(); +$autoload['libraries'] = array('database'); /* | ------------------------------------------------------------------- @@ -89,7 +89,7 @@ | | $autoload['helper'] = array('url', 'file'); */ -$autoload['helper'] = array(); +$autoload['helper'] = array('url'); /* | ------------------------------------------------------------------- diff --git a/application/config/config.php b/application/config/config.php index 10315220e04..0ff5a3ecf5d 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -1,5 +1,5 @@ '', 'hostname' => 'localhost', - 'username' => '', + 'username' => 'root', 'password' => '', - 'database' => '', + 'database' => 'instagram', 'dbdriver' => 'mysqli', 'dbprefix' => '', 'pconnect' => FALSE, diff --git a/application/config/routes.php b/application/config/routes.php index 1b45740d7c7..e43813a147d 100644 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -1,5 +1,5 @@ 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; diff --git a/application/controllers/login.php b/application/controllers/login.php new file mode 100644 index 00000000000..47b17c34dae --- /dev/null +++ b/application/controllers/login.php @@ -0,0 +1,26 @@ + + * @see https://codeigniter.com/user_guide/general/urls.html + */ + public function index() + { + $this->load->view('ViewLogin'); + } +} diff --git a/application/controllers/page.php b/application/controllers/page.php new file mode 100644 index 00000000000..273f777bcfa --- /dev/null +++ b/application/controllers/page.php @@ -0,0 +1,112 @@ +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')); + } +} diff --git a/application/models/IdModel.php b/application/models/IdModel.php new file mode 100644 index 00000000000..55105dd8cf1 --- /dev/null +++ b/application/models/IdModel.php @@ -0,0 +1,26 @@ +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(); + } +} diff --git a/application/models/LoginModel.php b/application/models/LoginModel.php new file mode 100644 index 00000000000..3868f5c0e9b --- /dev/null +++ b/application/models/LoginModel.php @@ -0,0 +1,10 @@ +load->view('view_feed'); + } +} diff --git a/application/models/SearchModel.php b/application/models/SearchModel.php new file mode 100644 index 00000000000..6290e30fab7 --- /dev/null +++ b/application/models/SearchModel.php @@ -0,0 +1,22 @@ +load->view('page/feed'); + } + + public function cariCaption() + { + $keyword = $this->input->post('keyword', true); + //use query builder class to search data mahasiswa based on keyword "nama" or "jurusan" or "nim" or "email" + + $this->db->like('username', $keyword); + $this->db->or_like('desc', $keyword); + $this->db->from('caption'); + $query = $this->db->get(); + return $query->result_array(); + } +} diff --git a/application/models/UpdateModel.php b/application/models/UpdateModel.php new file mode 100644 index 00000000000..4c21d96f49c --- /dev/null +++ b/application/models/UpdateModel.php @@ -0,0 +1,21 @@ +load->view('page/feed'); + } + + function ambil_where($where, $table) + { + return $this->db->get_where($table, $where); + } + + function update($where, $table, $data) + { + $this->db->where($where); + $this->db->update($table, $data); + } +} diff --git a/application/views/ViewLogin.php b/application/views/ViewLogin.php new file mode 100644 index 00000000000..6dd81318acb --- /dev/null +++ b/application/views/ViewLogin.php @@ -0,0 +1,73 @@ + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + = $usr->name ?> + = $usr->bio ?> + = $usr->website ?> +
+
+
+
+
+
+
+
+
+
+ `s get reset. However, we also reset the\n// bottom margin to use `rem` units instead of `em`.\np {\n margin-top: 0;\n margin-bottom: $paragraph-margin-bottom;\n}\n\n// Abbreviations\n//\n// 1. Remove the bottom border in Firefox 39-.\n// 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.\n// 3. Add explicit cursor to indicate changed behavior.\n// 4. Duplicate behavior to the data-* attribute for our tooltip plugin\n\nabbr[title],\nabbr[data-original-title] { // 4\n text-decoration: underline; // 2\n text-decoration: underline dotted; // 2\n cursor: help; // 3\n border-bottom: 0; // 1\n}\n\naddress {\n margin-bottom: 1rem;\n font-style: normal;\n line-height: inherit;\n}\n\nol,\nul,\ndl {\n margin-top: 0;\n margin-bottom: 1rem;\n}\n\nol ol,\nul ul,\nol ul,\nul ol {\n margin-bottom: 0;\n}\n\ndt {\n font-weight: $dt-font-weight;\n}\n\ndd {\n margin-bottom: .5rem;\n margin-left: 0; // Undo browser default\n}\n\nblockquote {\n margin: 0 0 1rem;\n}\n\ndfn {\n font-style: italic; // Add the correct font style in Android 4.3-\n}\n\n// stylelint-disable font-weight-notation\nb,\nstrong {\n font-weight: bolder; // Add the correct font weight in Chrome, Edge, and Safari\n}\n// stylelint-enable font-weight-notation\n\nsmall {\n font-size: 80%; // Add the correct font size in all browsers\n}\n\n//\n// Prevent `sub` and `sup` elements from affecting the line height in\n// all browsers.\n//\n\nsub,\nsup {\n position: relative;\n font-size: 75%;\n line-height: 0;\n vertical-align: baseline;\n}\n\nsub { bottom: -.25em; }\nsup { top: -.5em; }\n\n\n//\n// Links\n//\n\na {\n color: $link-color;\n text-decoration: $link-decoration;\n background-color: transparent; // Remove the gray background on active links in IE 10.\n -webkit-text-decoration-skip: objects; // Remove gaps in links underline in iOS 8+ and Safari 8+.\n\n @include hover {\n color: $link-hover-color;\n text-decoration: $link-hover-decoration;\n }\n}\n\n// And undo these styles for placeholder links/named anchors (without href)\n// which have not been made explicitly keyboard-focusable (without tabindex).\n// It would be more straightforward to just use a[href] in previous block, but that\n// causes specificity issues in many other styles that are too complex to fix.\n// See https://github.com/twbs/bootstrap/issues/19402\n\na:not([href]):not([tabindex]) {\n color: inherit;\n text-decoration: none;\n\n @include hover-focus {\n color: inherit;\n text-decoration: none;\n }\n\n &:focus {\n outline: 0;\n }\n}\n\n\n//\n// Code\n//\n\n// stylelint-disable font-family-no-duplicate-names\npre,\ncode,\nkbd,\nsamp {\n font-family: monospace, monospace; // Correct the inheritance and scaling of font size in all browsers.\n font-size: 1em; // Correct the odd `em` font sizing in all browsers.\n}\n// stylelint-enable font-family-no-duplicate-names\n\npre {\n // Remove browser default top margin\n margin-top: 0;\n // Reset browser default of `1em` to use `rem`s\n margin-bottom: 1rem;\n // Don't allow content to break outside\n overflow: auto;\n // We have @viewport set which causes scrollbars to overlap content in IE11 and Edge, so\n // we force a non-overlapping, non-auto-hiding scrollbar to counteract.\n -ms-overflow-style: scrollbar;\n}\n\n\n//\n// Figures\n//\n\nfigure {\n // Apply a consistent margin strategy (matches our type styles).\n margin: 0 0 1rem;\n}\n\n\n//\n// Images and content\n//\n\nimg {\n vertical-align: middle;\n border-style: none; // Remove the border on images inside links in IE 10-.\n}\n\nsvg:not(:root) {\n overflow: hidden; // Hide the overflow in IE\n}\n\n\n//\n// Tables\n//\n\ntable {\n border-collapse: collapse; // Prevent double borders\n}\n\ncaption {\n padding-top: $table-cell-padding;\n padding-bottom: $table-cell-padding;\n color: $text-muted;\n text-align: left;\n caption-side: bottom;\n}\n\nth {\n // Matches default `
`s get reset. However, we also reset the\n// bottom margin to use `rem` units instead of `em`.\np {\n margin-top: 0;\n margin-bottom: $paragraph-margin-bottom;\n}\n\n// Abbreviations\n//\n// 1. Remove the bottom border in Firefox 39-.\n// 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.\n// 3. Add explicit cursor to indicate changed behavior.\n// 4. Duplicate behavior to the data-* attribute for our tooltip plugin\n\nabbr[title],\nabbr[data-original-title] { // 4\n text-decoration: underline; // 2\n text-decoration: underline dotted; // 2\n cursor: help; // 3\n border-bottom: 0; // 1\n}\n\naddress {\n margin-bottom: 1rem;\n font-style: normal;\n line-height: inherit;\n}\n\nol,\nul,\ndl {\n margin-top: 0;\n margin-bottom: 1rem;\n}\n\nol ol,\nul ul,\nol ul,\nul ol {\n margin-bottom: 0;\n}\n\ndt {\n font-weight: $dt-font-weight;\n}\n\ndd {\n margin-bottom: .5rem;\n margin-left: 0; // Undo browser default\n}\n\nblockquote {\n margin: 0 0 1rem;\n}\n\ndfn {\n font-style: italic; // Add the correct font style in Android 4.3-\n}\n\n// stylelint-disable font-weight-notation\nb,\nstrong {\n font-weight: bolder; // Add the correct font weight in Chrome, Edge, and Safari\n}\n// stylelint-enable font-weight-notation\n\nsmall {\n font-size: 80%; // Add the correct font size in all browsers\n}\n\n//\n// Prevent `sub` and `sup` elements from affecting the line height in\n// all browsers.\n//\n\nsub,\nsup {\n position: relative;\n font-size: 75%;\n line-height: 0;\n vertical-align: baseline;\n}\n\nsub { bottom: -.25em; }\nsup { top: -.5em; }\n\n\n//\n// Links\n//\n\na {\n color: $link-color;\n text-decoration: $link-decoration;\n background-color: transparent; // Remove the gray background on active links in IE 10.\n -webkit-text-decoration-skip: objects; // Remove gaps in links underline in iOS 8+ and Safari 8+.\n\n @include hover {\n color: $link-hover-color;\n text-decoration: $link-hover-decoration;\n }\n}\n\n// And undo these styles for placeholder links/named anchors (without href)\n// which have not been made explicitly keyboard-focusable (without tabindex).\n// It would be more straightforward to just use a[href] in previous block, but that\n// causes specificity issues in many other styles that are too complex to fix.\n// See https://github.com/twbs/bootstrap/issues/19402\n\na:not([href]):not([tabindex]) {\n color: inherit;\n text-decoration: none;\n\n @include hover-focus {\n color: inherit;\n text-decoration: none;\n }\n\n &:focus {\n outline: 0;\n }\n}\n\n\n//\n// Code\n//\n\n// stylelint-disable font-family-no-duplicate-names\npre,\ncode,\nkbd,\nsamp {\n font-family: monospace, monospace; // Correct the inheritance and scaling of font size in all browsers.\n font-size: 1em; // Correct the odd `em` font sizing in all browsers.\n}\n// stylelint-enable font-family-no-duplicate-names\n\npre {\n // Remove browser default top margin\n margin-top: 0;\n // Reset browser default of `1em` to use `rem`s\n margin-bottom: 1rem;\n // Don't allow content to break outside\n overflow: auto;\n // We have @viewport set which causes scrollbars to overlap content in IE11 and Edge, so\n // we force a non-overlapping, non-auto-hiding scrollbar to counteract.\n -ms-overflow-style: scrollbar;\n}\n\n\n//\n// Figures\n//\n\nfigure {\n // Apply a consistent margin strategy (matches our type styles).\n margin: 0 0 1rem;\n}\n\n\n//\n// Images and content\n//\n\nimg {\n vertical-align: middle;\n border-style: none; // Remove the border on images inside links in IE 10-.\n}\n\nsvg:not(:root) {\n overflow: hidden; // Hide the overflow in IE\n}\n\n\n//\n// Tables\n//\n\ntable {\n border-collapse: collapse; // Prevent double borders\n}\n\ncaption {\n padding-top: $table-cell-padding;\n padding-bottom: $table-cell-padding;\n color: $text-muted;\n text-align: left;\n caption-side: bottom;\n}\n\nth {\n // Matches default `
`s get reset. However, we also reset the\n// bottom margin to use `rem` units instead of `em`.\np {\n margin-top: 0;\n margin-bottom: $paragraph-margin-bottom;\n}\n\n// Abbreviations\n//\n// 1. Remove the bottom border in Firefox 39-.\n// 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.\n// 3. Add explicit cursor to indicate changed behavior.\n// 4. Duplicate behavior to the data-* attribute for our tooltip plugin\n\nabbr[title],\nabbr[data-original-title] { // 4\n text-decoration: underline; // 2\n text-decoration: underline dotted; // 2\n cursor: help; // 3\n border-bottom: 0; // 1\n}\n\naddress {\n margin-bottom: 1rem;\n font-style: normal;\n line-height: inherit;\n}\n\nol,\nul,\ndl {\n margin-top: 0;\n margin-bottom: 1rem;\n}\n\nol ol,\nul ul,\nol ul,\nul ol {\n margin-bottom: 0;\n}\n\ndt {\n font-weight: $dt-font-weight;\n}\n\ndd {\n margin-bottom: .5rem;\n margin-left: 0; // Undo browser default\n}\n\nblockquote {\n margin: 0 0 1rem;\n}\n\ndfn {\n font-style: italic; // Add the correct font style in Android 4.3-\n}\n\n// stylelint-disable font-weight-notation\nb,\nstrong {\n font-weight: bolder; // Add the correct font weight in Chrome, Edge, and Safari\n}\n// stylelint-enable font-weight-notation\n\nsmall {\n font-size: 80%; // Add the correct font size in all browsers\n}\n\n//\n// Prevent `sub` and `sup` elements from affecting the line height in\n// all browsers.\n//\n\nsub,\nsup {\n position: relative;\n font-size: 75%;\n line-height: 0;\n vertical-align: baseline;\n}\n\nsub { bottom: -.25em; }\nsup { top: -.5em; }\n\n\n//\n// Links\n//\n\na {\n color: $link-color;\n text-decoration: $link-decoration;\n background-color: transparent; // Remove the gray background on active links in IE 10.\n -webkit-text-decoration-skip: objects; // Remove gaps in links underline in iOS 8+ and Safari 8+.\n\n @include hover {\n color: $link-hover-color;\n text-decoration: $link-hover-decoration;\n }\n}\n\n// And undo these styles for placeholder links/named anchors (without href)\n// which have not been made explicitly keyboard-focusable (without tabindex).\n// It would be more straightforward to just use a[href] in previous block, but that\n// causes specificity issues in many other styles that are too complex to fix.\n// See https://github.com/twbs/bootstrap/issues/19402\n\na:not([href]):not([tabindex]) {\n color: inherit;\n text-decoration: none;\n\n @include hover-focus {\n color: inherit;\n text-decoration: none;\n }\n\n &:focus {\n outline: 0;\n }\n}\n\n\n//\n// Code\n//\n\n// stylelint-disable font-family-no-duplicate-names\npre,\ncode,\nkbd,\nsamp {\n font-family: monospace, monospace; // Correct the inheritance and scaling of font size in all browsers.\n font-size: 1em; // Correct the odd `em` font sizing in all browsers.\n}\n// stylelint-enable font-family-no-duplicate-names\n\npre {\n // Remove browser default top margin\n margin-top: 0;\n // Reset browser default of `1em` to use `rem`s\n margin-bottom: 1rem;\n // Don't allow content to break outside\n overflow: auto;\n // We have @viewport set which causes scrollbars to overlap content in IE11 and Edge, so\n // we force a non-overlapping, non-auto-hiding scrollbar to counteract.\n -ms-overflow-style: scrollbar;\n}\n\n\n//\n// Figures\n//\n\nfigure {\n // Apply a consistent margin strategy (matches our type styles).\n margin: 0 0 1rem;\n}\n\n\n//\n// Images and content\n//\n\nimg {\n vertical-align: middle;\n border-style: none; // Remove the border on images inside links in IE 10-.\n}\n\nsvg:not(:root) {\n overflow: hidden; // Hide the overflow in IE\n}\n\n\n//\n// Tables\n//\n\ntable {\n border-collapse: collapse; // Prevent double borders\n}\n\ncaption {\n padding-top: $table-cell-padding;\n padding-bottom: $table-cell-padding;\n color: $text-muted;\n text-align: left;\n caption-side: bottom;\n}\n\nth {\n // Matches default `