Search code examples
phpmysqlsocial-networking

What kind of ID is more safer


I'm developing a small social network and my Database "USERS" has 2 id's
the first one is ID_USER = is primary key and autonumerica like 1,2,3,4,5.
the another one is ID_UNIQ = it's generate with php uniqid()
What do you recommend to use?, is that I saw that for example facebook use long id's like profile.php?id=100003565125387.., althought is not the same because uniqid() generate id's with letters and numbers, so in this case what kind of id would be safer?._


Solution

  • I have also developed a similar kind of project. And for that I used the something like ID_USER. And it worked fine. But the problem is that the user can easily find out someone else's id. But to make sure that other people can't log into to someone else's account I have used session. But if you feel that it is not safe enough then you can use uniqid. It depends on you and how you handle it. This is just my opinion.