2015-05-19 11:03:53 +02:00
|
|
|
var pg = require('pg');
|
|
|
|
var secret = require('../../private');
|
|
|
|
|
|
|
|
module.exports.index = function(req, res) {
|
|
|
|
|
|
|
|
var user_id = req.session.user_id;
|
|
|
|
var arrow_id = req.body.arrow_id;
|
|
|
|
|
|
|
|
pg.connect(secret.url, function(err, client, release) {
|
|
|
|
client.query(
|
2015-05-20 10:23:19 +02:00
|
|
|
"INSERT INTO arrowclicked(user_id, arrow_id, time) VALUES($1,$2, to_timestamp($3));",
|
|
|
|
[user_id, arrow_id, req.body.time],
|
2015-05-19 11:03:53 +02:00
|
|
|
function(err, result) {
|
|
|
|
release();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
res.setHeader('Content-Type', 'text/html');
|
|
|
|
res.send("user_id = " + user_id);
|
|
|
|
|
|
|
|
}
|