/** * create - create new user account with given email and password * * @param object $template * */ public function create($email, $pass) { $last_insert_id = null; if (LhpMail::validate($email) && strlen($pass) >= 6 && strlen($pass) <= 32) { $this->mysql->insert('users', array('create_date' => 'NOW()'), array('status' => 1, 'role' => 2, 'email' => $email, 'password' => $this->generate_password_hash($pass), 'api_id' => $this->generate_password_hash($email . time()), 'create_ip' => LhpBrowser::getIp()), true); /* get new user id if successfull */ if ($this->mysql->affected_rows === 1) { $last_insert_id = $this->mysql->getLastId(); } } return $last_insert_id; }