24 lines
745 B
PHP
24 lines
745 B
PHP
|
<?php
|
||
|
class User_model extends CI_Model{
|
||
|
|
||
|
function simpan_user()
|
||
|
{
|
||
|
$simpan_data=array(
|
||
|
'nama_lengkap' => $this->input->post('nama_lengkap'),
|
||
|
'username' => $this->input->post('username'),
|
||
|
'password' => md5($this->input->post('password')),
|
||
|
'email' => $this->input->post('email'),
|
||
|
'alamat' => $this->input->post('alamat')
|
||
|
);
|
||
|
$simpan = $this->db->insert('user', $simpan_data);
|
||
|
return $simpan;
|
||
|
}
|
||
|
function login($user,$pass)
|
||
|
{
|
||
|
$pass = md5($pass);
|
||
|
$sql1 = "SELECT * FROM USER WHERE username = '$user' AND password = '$pass'";
|
||
|
$rs = mysql_query($sql1);
|
||
|
$r = mysql_num_rows($rs);
|
||
|
if ($r=='1'){return true;}
|
||
|
}
|
||
|
}
|