问题标签 [unique-id]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1420 浏览

events - Liferay Portlet 中的事件

在任何 portlet 应用程序中,如果包含 portlet 的同一页面在两个浏览器选项卡中打开,那么如何区分第一页中的事件与第二页中的事件?

我想为每个事件分配一个唯一的 ID,将其存储并将其附加到 URL,以便可以共享链接。

有人可以提供他们对此的想法吗?

此外,如果页面 URL 在其他计算机上打开,则页面上显示的数据与在第一台计算机上看到的数据相同。这是在全球范围内设置的。

我怎样才能消除这个?

0 投票
3 回答
159 浏览

php - Prevent spammers by using a hashed user id in web applications

I am building a web application that allows users to send messages to other users. On the send message page I currently have the user id of the receiver in the URL so the application knows where to send the message i.e. example.com/send-message/user-id/1. The user id is the primary key used to identify the receiver in the database

I am concerned that spammers could go to this page and just keep changing the user id in the URL and spam people on the site very quickly.

The solution I have come up with is to make a long unique id (123154123412). This number will be stored in the user database row and would be used instead of the primary key on the send message page so that a spammer could not easily spam lots of people by changing the id.

Are there any potential problems with this approach that I may have over looked?

If I was to use the unique id throughout the site would it slow the site down significantly. In other words is it quicker to search the database using a primary key than a generated unique id.

Thanks

0 投票
2 回答
492 浏览

asp.net - 如何在多线程、多进程、网园、网农场的情况下获取唯一的id?

我正在尝试解决 log4net 不是多进程安全的问题。因为有时日志文件被锁定并且同一应用程序的另一个线程无法写入它。我想要做的是创建日志文件,该文件具有唯一的 id 到其上的线程。目前我正在使用 Thread.CurrentThread.GetHashCode()、Process.GetCurrentProcess() 和 System.Environment.MachineName 作为文件名的一部分。这是否足够或多余,或者是否有更好的方法来获得一个唯一的 ID,它是多线程/进程/网络农场/网络花园安全的日志文件名?或者,有没有更好的方法来编写日志文件?提前致谢。

0 投票
4 回答
1959 浏览

python - python中多维数组元素的唯一ID

我有一个多维数组,其中的元素可以完全随机。例如,

我想为每个唯一元素分配一个 ID(如 [1,2] 中的元素,而不是其中的元素),以便稍后当这个数组更大时我可以识别它,但我似乎无法弄清楚出来。我已经在互联网上搜索了一段时间,但没有运气,所以如果有人可以推动我朝着正确的方向前进,我将非常感激。

0 投票
2 回答
10795 浏览

sql-server - 备用选择.nextval 来自 SQL Server 中的双重 Oracle?

有没有办法在 SQL Server 中创建唯一的序列号

我们有上面的 Oracle 代码,它将创建一个唯一的号码,并且该号码不能被任何其他人使用。

以同样的方式如何在 SQL Server 中创建唯一的序列号????

有人在这方面帮助我

0 投票
3 回答
910 浏览

php - 如何获取网站运行计算机的唯一ID

我尝试使用此代码获取 MAC ID,但我仅获取主机服务器地址,是否有任何方法可以获取用户访问我的网站的计算机的唯一 ID。

实际上,我需要知道是否可以根据除 IP 之外的 PC 中的特定内容来限制对特定网站的访问?

0 投票
1 回答
3850 浏览

java - Saving User ID in Shared Preferences Android

I just asked a question about this but I want to go at it a different way. When a user edits his/her profile and hits the save button, I want to be able to generate a random number using UUID. I want this ID to stay the same if the user goes back and edits their profile a second time (if they press 'save' again I want to retain the ID that was generated the first time they pressed 'save'). I have the following code working to save other data, but I'm not sure how to include a check that can find out if an ID has already been generated. Here is my code:

0 投票
6 回答
10688 浏览

php - 使用 PHP 和 MYSQL 生成唯一 ID

嗨,我正在创建一个处理 ID 和 UID 的系统,我们随机生成的 UID 但我有点卡住了,我需要始终生成数据库中当前不存在的 UID,因为该字段是使用的唯一字段在前端,以免暴露真实ID。

所以回顾一下,我正在尝试生成一个当前在数据库中不存在的唯一 ID,我没有工作的部分是数据库中的交叉检查,所以它有时会给出一个已经存在于数据库中的数字,即使它不应该提前感谢。

到目前为止,这是我的代码:

0 投票
3 回答
3711 浏览

php - 如何为没有用户名的用户创建唯一 ID - PHP

通常,当我开发与客户交互的网站时,我曾经使用他们的用户名或用户 ID 来保存他们的配置等。但是现在我正在开发一个没有登录系统的网站,我需要保存一些东西,比如“喜欢”、“访问的页面”等等。

我已经尝试过 Internet 协议 (IP),但当访问者在 NAT 或代理下时它不会工作。

如何为每个用户创建一个唯一 ID 并将其保存在我的数据库中?

顺便说一句,我正在使用 PHP。

0 投票
0 回答
803 浏览

php - 主键、唯一 ID 和记录(MySQL、PHP、信息系统)

我正在创建一个向公众开放的社交网站,预计将拥有大量用户。每个用户的信息将存储在 MySQL 数据库中,页面将使用 PHP 编写。

我的问题是这样的:Facebook、Yahoo、Stack Overflow 等大型网站使用哪些主键和唯一键来跟踪大量数据?

例如,如下表:

PK、Unique_Id、User_Id、F_Name、L_Name、Date_Created、DEL 等...

我怎样才能给这个表中的每个用户他们自己的 unique_id,他们可以为自己拥有这将是合理的?唯一 ID 应该采用什么格式才能有益?我应该如何管理主键?让pk从1开始,每次递增?