codeigniter_test2/application/models/user_model.php

24 lines
745 B
PHP
Raw Normal View History

2020-01-02 23:07:40 +07:00
<?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;}
}
}