Ruby 求这个功能实现的思路

scuwolf · May 07, 2013 · Last by wushexu replied at May 07, 2013 · 2065 hits

初学 ruby,求下面这个功能实现的思路

每天生成一个连接,比如http://example.com/a_rand_number

这个连接具有 24 小时的有效期,用户点击这个链接之后会验证 a_rand_number 是否有效,有效的话,将用户来源 ip 加入 iptables。

无效的话,就返回 403

用 ruby 生成随机数 加上过期时间 存 redis 里面,设置路由 取到 路由进来的 number 和 redis 里的对比 如果过期 更新随机数和过期时间 (加 24 小时) 。

抛个砖。

这个思路很不自然。默认包应该是过滤掉的吧,走不到 web 服务器,又如何能判断有效呢?

You need to Sign in before reply, if you don't have an account, please Sign up first.