dongluni0568 2015-03-07 16:04
浏览 34
已采纳

独特地识别WordPress博客?

I'm working on implementing a WordPress plugin which has a one-click setup procedure that calls my server to set things up by sending a unique key to the server, and then use that code from that time on to configure the system in the future.

Is there a way in WordPress to get a unique blog ID?

At first glance, I looked at get_current_blog_id, but it is a pretty local and non-unique number.

Then, I looked at maybe taking the NONCE_KEY defined in wp-config.php, and hashing that with SHA512. However, I am concerned about the security risk in this (even though I know that an SHA512 is hard to bruteforce).

Is this concern that I have regarding security reasonable? Is there any other way I can identify a WordPress blog uniquely?

  • 写回答

1条回答 默认 最新

  • douwen5741 2015-03-07 16:31
    关注

    You could create a function to create an unique blog ID, but based on what? URL could change, name could change, theme, server ip and so on. There isn't really an unique and static variable.

    Create your own one!

    I use serials and tokens for this. The blog submits a serial to receive a token from my api. You could create the serial on the first request, so the blog owner doesn't have to enter it. Now send the serial and a generated token back to the blog and store this data in the database: update_option('name', 'token') or just add_option('name', 'token'). There is your unique id!

    • on every new blog "registration" (blog has still no serial) generate a unique serial and a token
    • store the serial and the token on your database to verify the blog again
    • the token should change from time to time
    • you could also check against older tokens (let say the last 2 tokens...) to be more flexible
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码