summaryrefslogtreecommitdiffstats
path: root/application/controllers/user.php
diff options
context:
space:
mode:
authorRafael Bodill <rafi@sortex.co.il>2014-09-18 21:05:08 +0200
committerRafael Bodill <rafi@sortex.co.il>2014-09-18 21:05:08 +0200
commit91bd244393ae40e302e3c1e0f7fedb01ddeee957 (patch)
tree623763097ed2a7bb41f2ed53250d8cab22edeafa /application/controllers/user.php
parentd2c309aee8189a5d6c2a3fcb0a05ea694d7b646e (diff)
Query builder in user login and controller
Diffstat (limited to 'application/controllers/user.php')
-rw-r--r--application/controllers/user.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/application/controllers/user.php b/application/controllers/user.php
index 079f1665c..45bd93816 100644
--- a/application/controllers/user.php
+++ b/application/controllers/user.php
@@ -102,11 +102,13 @@ class User extends MY_Controller {
$key = random_alphanum(32);
- $this->db->query("
- INSERT INTO `apikeys`
- (`key`, `user`, `comment`, `access_level`)
- VALUES (?, ?, ?, ?)
- ", array($key, $userid, $comment, $access_level));
+ $this->db->set([
+ 'key' => $key,
+ 'user' => $userid,
+ 'comment' => $comment,
+ 'access_level' => $access_level
+ ])
+ ->insert('apikeys');
if (static_storage("response_type") == "json") {
return send_json_reply(array("new_key" => $key));