-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMy_admin_model.php
44 lines (35 loc) · 1.04 KB
/
My_admin_model.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class My_admin_model extends CI_Model{
// table cloumns
public $user_login;
public $user_pass;
public $pass_salt;
public $user_email;
public $user_registered;
public $user_nicename;
public function __construct()
{
}
public function create_user( $user_data = array() )
{
// get posted value and insert into users table
$data = array(
'user_pass' => password_hash($user_data['password'], PASSWORD_BCRYPT),
'pass_salt' => password_hash($this->user_pass, PASSWORD_BCRYPT),
'user_email' => $user_data['emailaddress'],
'user_nicename' => $user_data['firstname'],
'user_registered' => date("Y-m-d h:i:s")
);
/*
** set values for inserts - set() will also accept an optional third parameter ($escape),
** that will prevent data from being escaped if set to FALSE.
*/
$this->db->set($data);
/*
** Insert data into users table.
*/
$user = $this->db->insert('users');
return $user;
}
}