开发者

What form of "log" saving does this site use?

My question is about this site, http://psncardgenerator.com/ . As you can see every user has their own link on the site. If you refresh t开发者_StackOverflow中文版he page, the link remains the same. I have checked that http://psncardgenerator.com/ doesnt use cookies or sessions to save the link for the visitor. Does anyone know how they do it?


Since you already listed ip in your question, yes, that is how they most likely do it.

It's as simple as keeping the last accessed REMOTE_ADDR in a database table, and associating the random ?i=123456 id with it. It's no different than your typical user counter.


$ip = $_SERVER["REMOTE_ADDR"];
$userid = db("SELECT userid FROM userids WHERE ip=?", $ip)->userid;

if (!$userid) {
   db("INSERT INTO userids (ip, userid) VALUES (?,?)", $ip, 0);
   # and then select it again...
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜