Andy Fang Posted July 25, 2013 Share Posted July 25, 2013 Hello there, Is there any way I can echo a random, 10 digit number that stays the same per IP address? If that can't be done, how about a cookie that lasts forever or 24 hours? Thanks! Link to comment Share on other sites More sharing options...
HartleySan Posted July 25, 2013 Share Posted July 25, 2013 If you're trying to create a unique token for a user, I wouldn't do a ten-digit number. It's too easy to crack. I'd look into using the PHP hash function to create a real hash that's hard to crack. As for cookies, Larry talks about all of that in his PHP & MySQL book. Does he not talk about that in this book? 1 Link to comment Share on other sites More sharing options...
Andy Fang Posted July 25, 2013 Author Share Posted July 25, 2013 I don't think he does for random numbers. I just want to generate a random number that will stay with that person for that IP/ computer for at least 24 hours. Link to comment Share on other sites More sharing options...
Larry Posted July 26, 2013 Share Posted July 26, 2013 Look into the PHP rand() function. Link to comment Share on other sites More sharing options...
Recommended Posts