Pertemuan 5 Login Dan session.

Slides:



Advertisements
Similar presentations
LIS651 lecture 3 taming PHP Thomas Krichel
Advertisements

PHP SQL. Connection code:- mysql_connect("server", "username", "password"); Connect to the Database Server with the authorised user and password. Eg $connect.
Widhy Hayuhardhika NP, S.Kom. Overview of database structure Connecting to MySQL database Selecting the database to use Using the require_once statement.
TABLES 6 How to create tables What information suits tables How to represent complex data in tables.
Simple Java Forms Dr. Robert L. Probert S.I.T.E., University of Ottawa.
1 Crystal Report adalah sebuah paket software Report Generator (Pembangkit Laporan). Crystal report dapat dipanggil dari visual basic untuk diminta bantuannya.
1 6.3 & 7.3 NESTED LOOP Linear Doubly Linked List INSERT KIRI.
Algoritma Genetika ( 2 ).
Murach's PHP and MySQL, C4© 2010, Mike Murach & Associates, Inc.Slide 1.
Enkripsi dan Dekripsi Data
1.  Understanding about How to Working with Server Side Scripting using PHP Framework (CodeIgniter) 2.
By Asep Taufik Muharram. Data Definition Language (DDL) Digunakan untuk melakukan pembuatan struktur database, mulai dari mendefinisikan database, tabel-tabel.
Pertemuan : 6 Basis Data Terapan
SQL Pertemuan 26. Range Operator ‘Between dan Not Between’
Pertemuan ke 2 Tipe data & ERD Kurniawan Eka Permana.
SQL Data Manipulation Language (DML)
Multiple Tiers in Action
Learning HTML Week 6. Every Web Page Has the Same Basic Structure The title of your page The guts of the web page, text, graphics, links and so on.
Introduction to HTML II Shih-Heng Chin. Preface Structure of a HTML File Elements used frequently Tables.
15. User Authentication, Form Validation, Paging. M. Udin Harun Al Rasyid, S.Kom, Ph.D
Website Security ISYS 475. Authentication Authentication is the process that determines the identity of a user.
Accessing MySQL with PHP IDIA 618 Fall 2014 Bridget M. Blodgett.
INTERNET APPLICATION DEVELOPMENT Practical on Sessions.
CAKEPHP Blog tutorial. what you’ll need examples/blog/blog.html 2  A running web server  A database server.
Nic Shulver, Introduction to Sessions in PHP Sessions What is a session? Example Software Software Organisation The login HTML.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
1 DIG 3134 – Lecture 14 MySQL and PHP Play Together Michael Moshell University of Central Florida Media Software Design.
Creating A Database Driven Website 1.Setting Up Your Web Server 2.Creating a Database 3.Creating a Webpage to Display Information From a Database 4.Creating.
HTML Help book. HTML HTML is the programming language used to make web pages for the Internet. HTML stands for Hyper Text Markup Language. HTML is made.
Tugas Pertemuan 9 1. Pelajari teknik memahami gambar susun dan beberapa istilah yang ditunjukkan dalam gambar, pelajari tabel rincian komponen dan cara.
Tried my best to simplify it for you!
HTML TABLE Khafiizh Hastuti.
MEMBUAT LAPORAN : 1. Tambahkan File Crystal Report:
J2EE (Enterprise Programing)
pernyataan kontrol pengulangan - lanjutan -
BAB INHERITANCE (Pewarisan)
CodeIgniter Form & Login
Table Pertemuan 10 Matakuliah : L0182 / Web & Animation Design
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
LOOPING DAN FUNCTION Pertemuan 5.
Pertemuan 3 Edit, Delete,Simpan.
Week 6 Creating Tables using HTML.
IS1500: Introduction to Web Development
PERTEMUAN 2.
PHP: Login FdSc Module 109 Server side scripting and Database design
Example of a table. Note that I looked at an example under CIS44.
Pertemuan ke 13 Input dan cari.
Introduction to CodeIgniter (CI)
Web Design and Development
Getting Started – Table 2
Getting web pages First we need to get the webpage by issuing a HTTP request. The best option for this is the requests library that comes with Anaconda:
MEMBUAT LAPORAN : 1. Tambahkan File Crystal Report:
MySQL tutorial.
HTML Tables CS 1150 Fall 2016.
PHP and MySQL.
Matakuliah : Web Design
CIS 388 Internet Programming
Web Design and Development
Using rowspan and colspan attributes
Using rowspan and colspan attributes
HTML Tables.
Hyperlinks 1 2.
CONTOH LATIHAN CI.
Direct Method of Interpolation
CS205 Tables & Forms © 2012 D. J. Foreman.
A Title Link 1 Some text A picture Link 2 Link 3 Link 4   Link 1 | Link 2 | Link 3 | Link 4.
CS205 Tables & Forms © 2008 D. J. Foreman.
CS205 Tables & Forms © 2004 D. J. Foreman.
1. Sapto M. Suwito 2. Yetti M.M., S.Kom 3. Irni Marnida 4. Fadila Lahay 5. Endah Wahyuningsih 6. Nurlaila.
Presentation transcript:

Pertemuan 5 Login Dan session

Buatkan tabel login dengan struktur sebagai berikut : Field Name Data Type Length Keterangan id_user int 5 Primary key,auto increment Nama Varchar 50 - Pass varchar 100 fullname 200

Buat controller baru dengan nama login.php class Login extends CI_Controller { public function __construct() parent ::__construct(); $this->load->model('mdl_login', 'm'); } public function index() redirect('login/form_login');

Lanjutan dari login.php public function form_login() { if(!empty($_POST['submit'])) $r=$this->m>check_user($_POST['username'],$_POST['password']); if($r==1) redirect('coba/index'); } else $this->load->helper('form'); $this->load->view('form_login');

Tambahkan fungsi session pada file autoload Tambahkan fungsi session pada file autoload.php pada baris ke 55 menjadi : Tambahkan nilai secara bebas pada fungsi config[encryption_key] pada baris 227 menjadi : $autoload['libraries'] = array('database','session'); $config['encryption_key'] = 'x';

Membuat view dengan nama form_login.php <html> <head> <title> Login form </title> <body> <?php echo form_open('login/form_login'); ?> <table> <tr> <td colspan="2"> <h2> Form login </h2> </td> </tr> <td> username : </td> <td> <?php echo form_input('username'); ?> </td>

Lanjutan dari view.php <tr> <td> password : </td> <td> <?php echo form_input('password'); ?> </td> </tr> <td> <?php echo form_submit('submit','login'); ?> </td> </table> <?php echo form_close(); ?> </body> </html>

Membuat model dengan nama mdl_login.php class Mdl_login extends CI_Model { function __construct() { //cell the model constructor parent::__construct(); } function check_user($u,$p) $this->db->select('id_user,nama,fullname') ->from('users') ->where('nama',$u) ->where('pass',$p) ->limit(1); $q=$this->db->get();

Lanjutan dari mdl_login if($q->num_rows()==1) { $d=$q->row(); $data=array( 'id_user' => $d, 'nama' =>$d, 'fullname'=>$d, 'status' =>1, ); $this ->session->set_userdata($data); return 1; } else return 0;

public function logout() { $data = array('id_user' =>'' , Tambahkan function logout pada controller login.php tambahkan kode pada file view(news.php) setelah kode paging. public function logout() { $data = array('id_user' =>'' , 'nama' =>'', 'pass' =>'', 'fullname'=>''); $this->session->unset_userdata($data); redirect('login/form_login'); } <?php echo anchor('login/logout','logout'); ?>