"resty.mysql" 2 local db, err = mysql:new() 3 db:set_timeout(1000) 4 5 local ok, err, errno, sqlstate = db:connect{ 6 host = "127.0.0.1", 7 port = 3306, 8 database = "wunderpay_development", 9 user = "root" 10 } 11 12 res, err, errno, sqlstate = db:query( 13 "SELECT 1 " .. 14 "FROM subscriptions " .. 15 "WHERE user_id = \'"..ngx.var.user_id.. 16 "\'" 17 ) 18 if next(res) == nil then 19 ngx.say("{}") 20 else 21 ngx.redirect("http://wunderpay.de") 22 end Friday, September 6, 13